/*
Theme Name: Yo Mammoth
Description: A fast, plain theme for trip photo galleries. Pairs with the Mammoth Galleries plugin. Dark by default so photos pop; switch to light under Appearance, Customize, Yo Mammoth.
Version: 1.0.8
Author: Steven Lyew
Requires at least: 6.4
Requires PHP: 7.4
License: GPL-2.0-or-later
Text Domain: yomammoth
*/

/* ---------- Color tokens ---------- */
:root {
	--bg: #101415;
	--surface: #1a2023;
	--fg: #edebe4;
	--muted: #98a2a5;
	--line: rgba(237, 235, 228, .12);
	--accent: #f0a83c;
	--on-accent: #1d1305;
	--field: #151a1c;
	--header-bg: rgba(16, 20, 21, .82);
	--display: "Big Shoulders Display", "Arial Narrow", Impact, sans-serif;
	--body: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
	--wrap: 1360px;
	--gutter: clamp(16px, 3.5vw, 40px);
}
body.scheme-light {
	--bg: #f5f2ea;
	--surface: #e7e2d6;
	--fg: #1a1e1f;
	--muted: #5f6669;
	--line: rgba(26, 30, 31, .14);
	--accent: #b1600f;
	--on-accent: #fff;
	--field: #fff;
	--header-bg: rgba(245, 242, 234, .86);
}
@media (prefers-color-scheme: light) {
	body.scheme-auto {
		--bg: #f5f2ea;
		--surface: #e7e2d6;
		--fg: #1a1e1f;
		--muted: #5f6669;
		--line: rgba(26, 30, 31, .14);
		--accent: #b1600f;
		--on-accent: #fff;
		--field: #fff;
		--header-bg: rgba(245, 242, 234, .86);
	}
}
body {
	/* Hand the palette to the gallery plugin. */
	--ymg-fg: var(--fg);
	--ymg-muted: var(--muted);
	--ymg-surface: var(--surface);
	--ymg-line: var(--line);
	--ymg-accent: var(--accent);
	--ymg-on-accent: var(--on-accent);
	--ymg-bg: var(--bg);
	--ymg-field: var(--field);
	--ymg-display: var(--display);
	--ymg-radius: 6px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body { overflow-x: clip; }
body {
	margin: 0; background: var(--bg); color: var(--fg);
	font-family: var(--body); font-size: 17px; line-height: 1.6;
	-webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: var(--accent); text-underline-offset: .18em; }
img, video, iframe { max-width: 100%; }
img { height: auto; }
h1, h2, h3, h4 { line-height: 1.15; margin: 1.6em 0 .5em; }
h1, h2 { font-family: var(--display); font-weight: 800; text-transform: uppercase; letter-spacing: .005em; }
::selection { background: var(--accent); color: var(--on-accent); }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link:focus { position: fixed !important; top: 8px; left: 8px; width: auto; height: auto; clip: auto; z-index: 1000; padding: 8px 14px; background: var(--accent); color: var(--on-accent); }

/* ---------- Header ---------- */
.site-header {
	position: sticky; top: 0; z-index: 50;
	background: var(--header-bg); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
	border-bottom: 1px solid transparent; transition: border-color .2s;
}
.admin-bar .site-header { top: 32px; }
@media (max-width: 782px) { .admin-bar .site-header { top: 46px; } }
.site-header.is-scrolled { border-bottom-color: var(--line); }
.header-inner { display: flex; align-items: center; gap: 1.5rem; min-height: 68px; }
.wordmark {
	font-family: var(--display); font-weight: 900; font-size: clamp(1.15rem, 2.2vw, 1.55rem);
	letter-spacing: .02em; text-transform: uppercase; line-height: 1;
	color: var(--fg); text-decoration: none; margin-right: auto;
}
.wordmark .plus { color: var(--accent); padding: 0 .12em; }
.custom-logo-link { margin-right: auto; display: block; line-height: 0; }
.custom-logo { max-height: 52px; width: auto; height: auto; }
@media (max-width: 640px) { .custom-logo { max-height: 40px; } }
/* Black-on-white logo on the dark header: flip it to white and let the (now black) box disappear. */
body.logo-light.scheme-dark .custom-logo { filter: invert(1) grayscale(1); mix-blend-mode: screen; }
/* Blending needs a solid backdrop, so the header is solid when the logo is flipped. */
body.logo-light.scheme-dark .site-header { background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; }
@media (prefers-color-scheme: dark) { body.logo-light.scheme-auto .custom-logo { filter: invert(1) grayscale(1); mix-blend-mode: screen; } body.logo-light.scheme-auto .site-header { background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; } }
.site-nav { display: flex; align-items: center; gap: 1.4rem; font-size: .95rem; font-weight: 600; }
.site-nav > a { color: var(--fg); text-decoration: none; }
.site-nav > a:hover { color: var(--accent); }
.trip-jump select {
	font: inherit; font-weight: 500; font-size: .9rem; color: var(--fg); background: var(--field);
	border: 1px solid var(--line); border-radius: 999px; padding: .5em 2.2em .5em 1em; cursor: pointer; max-width: 220px;
	appearance: none; -webkit-appearance: none;
	background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
	background-position: calc(100% - 17px) 55%, calc(100% - 12px) 55%; background-size: 5px 5px; background-repeat: no-repeat;
}
.nav-cta {
	display: inline-flex; align-items: center; gap: .35em;
	background: var(--accent); color: var(--on-accent) !important; padding: .55em 1em .55em .8em; border-radius: 999px;
}
.nav-cta svg { width: 18px; height: 18px; fill: currentColor; }
.nav-cta:hover { filter: brightness(1.08); }
.menu-toggle { display: none; }
.trip-list { display: none; }

@media (max-width: 860px) {
	.menu-toggle { display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 50%; background: transparent; color: var(--fg); cursor: pointer; margin-right: -10px; }
	.menu-toggle svg { width: 26px; height: 26px; fill: currentColor; }
	.site-nav {
		display: none; position: absolute; left: 0; right: 0; top: 100%;
		flex-direction: column; align-items: stretch; gap: 0;
		background: var(--bg); border-bottom: 1px solid var(--line); padding: .5rem var(--gutter) 1.2rem;
	}
	.nav-open .site-nav { display: flex; max-height: calc(100vh - 68px); overflow-y: auto; overscroll-behavior: contain; }
	.admin-bar.nav-open .site-nav { max-height: calc(100vh - 114px); }
	.site-nav > a { padding: .85rem 0; border-bottom: 1px solid var(--line); font-size: 1.05rem; }
	.trip-jump { display: none; }
	.trip-list { display: block; list-style: none; margin: .4rem 0 0; padding: 0; }
	.trip-list::before { content: "Jump to a trip"; display: block; padding: .6rem 0 .3rem; font-size: .72rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
	.trip-list li { margin: 0; }
	.trip-list a { display: block; padding: .62rem 0; color: var(--fg); text-decoration: none; font-weight: 500; border-bottom: 1px solid var(--line); }
	.trip-list li:last-child a { border-bottom: 0; }
	.trip-list a[aria-current="page"] { color: var(--accent); }
	.nav-open { overflow: hidden; }
	.nav-cta { justify-content: center; margin-top: .4rem; padding: .85em 1em; border-bottom: 0 !important; }
}

/* ---------- Page heads ---------- */
.site-main { min-height: 60vh; }
.page-head { padding: clamp(2rem, 6vw, 4.5rem) 0 clamp(1rem, 2.5vw, 1.6rem); }
.page-title { font-size: clamp(2.6rem, 8vw, 6.2rem); line-height: .9; margin: 0; letter-spacing: -.005em; }
.home-title { font-size: clamp(2rem, 4.6vw, 3.6rem); max-width: 22ch; }
.kicker { margin: 0 0 .9rem; font-size: .78rem; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }
.kicker a { color: var(--accent); text-decoration: none; }
.kicker span { opacity: .5; padding: 0 .3em; }

/* ---------- Content ---------- */
.entry-content > * { max-width: 72ch; }
.entry-content > .ymg, .entry-content > .ymg-trips, .entry-content > .ymg-gate,
.entry-content > .wp-block-embed, .entry-content > .alignwide, .entry-content > .alignfull, .entry-content > figure { max-width: none; }
.trip-head + .entry-content > p:first-child { font-size: clamp(1.05rem, 1.6vw, 1.3rem); line-height: 1.5; color: var(--fg); margin-top: 0; }
.entry-content .wp-block-embed { margin: 2.5rem 0; }
/* Videos: WordPress sizes block embeds to their real shape (wide or vertical); only bare iframes get a 16:9 box. */
.entry-content .wp-block-embed iframe { border-radius: 6px; }
/* Each video keeps its own shape and fills the column, without relying on other styles. */
.entry-content .wp-has-aspect-ratio .wp-block-embed__wrapper { position: relative; }
.entry-content .wp-has-aspect-ratio .wp-block-embed__wrapper::before { content: ""; display: block; padding-top: 56.25%; }
.entry-content .wp-embed-aspect-21-9 .wp-block-embed__wrapper::before { padding-top: 42.85%; }
.entry-content .wp-embed-aspect-18-9 .wp-block-embed__wrapper::before { padding-top: 50%; }
.entry-content .wp-embed-aspect-4-3 .wp-block-embed__wrapper::before { padding-top: 75%; }
.entry-content .wp-embed-aspect-1-1 .wp-block-embed__wrapper::before { padding-top: 100%; }
.entry-content .wp-embed-aspect-9-16 .wp-block-embed__wrapper::before { padding-top: 177.77%; }
.entry-content .wp-embed-aspect-1-2 .wp-block-embed__wrapper::before { padding-top: 200%; }
.entry-content .wp-has-aspect-ratio iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
.entry-content > iframe[src*="youtube"], .entry-content p > iframe[src*="youtube"] { width: 100%; height: auto; aspect-ratio: 16 / 9; border-radius: 6px; }
/* Vertical phone videos (YouTube Shorts) stay phone-width instead of filling the column. */
.entry-content .wp-embed-aspect-9-16, .entry-content .wp-embed-aspect-1-2 { max-width: 400px; margin-left: auto; margin-right: auto; }
.entry-content .wp-block-image img, .entry-content figure img { border-radius: 6px; }
.entry-content hr { border: 0; border-top: 1px solid var(--line); margin: 2.5rem 0; }

/* ---------- Previous / next trip ---------- */
.trip-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 3.5rem 0 1rem; padding-top: 2rem; border-top: 1px solid var(--line); }
.trip-nav a { display: flex; align-items: center; gap: 1rem; text-decoration: none; color: var(--fg); padding: .6rem; border-radius: 8px; transition: background .2s; }
.trip-nav a:hover { background: var(--surface); }
.trip-nav-newer { flex-direction: row-reverse; text-align: right; }
.trip-nav img { width: 108px; height: 76px; object-fit: cover; border-radius: 5px; flex: none; }
.trip-nav-text { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.trip-nav .kicker { margin: 0; }
.trip-nav strong { font-family: var(--display); font-weight: 800; text-transform: uppercase; font-size: 1.35rem; line-height: 1; }
@media (max-width: 640px) {
	.trip-nav { grid-template-columns: 1fr; }
	.trip-nav-newer { flex-direction: row; text-align: left; }
	.trip-nav img { width: 84px; height: 60px; }
}

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); margin-top: 3rem; padding: 2.2rem 0 2.6rem; color: var(--muted); font-size: .9rem; }
.footer-inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .6rem 2rem; }
.footer-inner p { margin: 0; }
.footer-line { font-family: var(--display); font-weight: 800; text-transform: uppercase; font-size: 1.15rem; letter-spacing: .03em; color: var(--fg); }
.footer-meta a { color: var(--muted); }
.footer-meta a:hover { color: var(--accent); }

/* ---------- Blog fallback ---------- */
.post-list { display: grid; gap: 2rem; padding-bottom: 2rem; }
.post-item h2 { margin: 0 0 .2rem; font-size: 2rem; }
.post-item h2 a { color: var(--fg); text-decoration: none; }
.post-date { color: var(--muted); font-size: .9rem; margin: 0; }
