/* ==========================================================================
   Components. Colours, fonts and timings come from theme.css; sizes, columns
   and desktop/mobile choices come from layout.css. You shouldn't need to
   edit this file to restyle the site.

   Keyword settings in layout.css (e.g. --nav-mode: menu) are copied onto
   <html data-nav="menu"> by js/site.js; the rules below key off those.
   ========================================================================== */

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-height) + 16px); font-size: var(--text-base); }
body {
  margin: 0; overflow-x: hidden;
  background: var(--color-bg); color: var(--color-text);
  font-family: var(--font-body); font-weight: var(--body-weight); line-height: var(--line-height);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--color-accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; transition: color var(--speed-fast); }
a:hover { color: var(--color-accent-hover); }
h1, h2, h3 {
  font-family: var(--font-display); font-weight: var(--heading-weight);
  letter-spacing: var(--heading-letter-spacing); text-transform: var(--heading-transform);
  line-height: 1.12; margin: 0 0 0.5em;
}
p { margin: 0 0 1em; }
:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--color-accent); color: var(--color-accent-text); }

/* The same padding on BOTH sides keeps content clear of the pinned icons while
   staying centred in the window; it is 0 when the icons sit along the bottom. */
.container {
  width: min(100% - 2 * var(--page-gutter), var(--page-max-width)); margin-inline: auto;
  padding-inline: var(--dock-side-clearance);
}
.muted { color: var(--color-muted); }

/* ---------- Header ---------- */
.site-header { position: sticky; top: 0; z-index: 50; background: var(--color-header-bg); color: var(--color-header-text); box-shadow: 0 2px 16px rgba(20, 10, 50, 0.18); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: var(--header-height); }
.brand { display: flex; align-items: center; gap: 12px; color: var(--color-header-text); text-decoration: none; line-height: 1.05; min-width: 0; }
.brand:hover { color: var(--color-header-text); }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-logo {
  width: var(--logo-size); height: var(--logo-size); flex-shrink: 0; object-fit: contain;
  border-radius: var(--logo-radius); background: transparent; /* transparent logos sit straight on the header */
  transition: transform var(--speed) var(--ease), box-shadow var(--speed) var(--ease);
}
.brand:hover .brand-logo { transform: scale(var(--logo-hover-scale)); }
.brand-name {
  font-family: var(--font-display); font-weight: 700; font-size: var(--brand-size);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-shadow: var(--brand-shadow);
  transition: letter-spacing var(--speed) var(--ease), text-shadow var(--speed) var(--ease);
}
.brand:hover .brand-name { letter-spacing: 0.02em; text-shadow: var(--brand-shadow-hover); }
.brand-subtitle { font-size: 0.95rem; color: var(--color-header-muted); font-weight: 600; margin-top: 2px; }
html[data-subtitle="no"] .brand-subtitle { display: none; }

.nav { display: flex; gap: 4px; }
.nav a {
  position: relative; padding: 8px 12px; border-radius: var(--radius-small);
  color: var(--color-header-muted); text-decoration: none;
  font-family: var(--font-display); font-weight: 500; font-size: 1.05rem; letter-spacing: 0.02em;
  transition: color var(--speed-fast), background var(--speed-fast);
}
.nav a::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: 4px; height: 2px; border-radius: 2px;
  background: var(--color-accent-3); transform: scaleX(0); transform-origin: left; transition: transform var(--speed) var(--ease);
}
.nav a:hover, .nav a.active { color: var(--color-header-text); }
.nav a:hover::after, .nav a.active::after { transform: scaleX(1); }

.menu-toggle {
  display: none; width: 44px; height: 44px; flex-shrink: 0; padding: 0; position: relative;
  border: 0; border-radius: var(--radius-small); background: rgba(255, 255, 255, 0.12); cursor: pointer;
  transition: background var(--speed-fast);
}
.menu-toggle:hover { background: rgba(255, 255, 255, 0.22); }
.menu-toggle span { position: absolute; left: 12px; right: 12px; height: 2px; border-radius: 2px; background: var(--color-header-text); transition: transform var(--speed) var(--ease), opacity var(--speed-fast); }
.menu-toggle span:nth-child(1) { top: 15px; }
.menu-toggle span:nth-child(2) { top: 21px; }
.menu-toggle span:nth-child(3) { top: 27px; }
.menu-open .menu-toggle span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.menu-open .menu-toggle span:nth-child(2) { opacity: 0; }
.menu-open .menu-toggle span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

html[data-nav="menu"] .menu-toggle { display: block; }
html[data-nav="menu"] .nav {
  position: absolute; left: 0; right: 0; top: 100%;
  flex-direction: column; gap: 0; padding: 8px var(--page-gutter) 16px;
  background: var(--color-header-bg); box-shadow: 0 12px 24px rgba(20, 10, 50, 0.25);
  visibility: hidden; opacity: 0; transform: translateY(-8px);
  transition: opacity var(--speed) var(--ease), transform var(--speed) var(--ease), visibility var(--speed);
}
html[data-nav="menu"] .menu-open .nav { visibility: visible; opacity: 1; transform: none; }
html[data-nav="menu"] .nav a { padding: 12px 4px; font-size: 1.15rem; border-bottom: 1px solid rgba(255, 255, 255, 0.12); }
html[data-nav="menu"] .nav a:last-child { border-bottom: 0; }
html[data-nav="menu"] .nav a::after { left: 4px; right: auto; width: 32px; bottom: 6px; }

/* ---------- Buttons, chips, tags ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 20px; border-radius: var(--radius-button);
  font-family: var(--font-display); font-weight: 500; font-size: 1.02rem; letter-spacing: 0.02em; line-height: 1.2;
  color: var(--color-text); background: var(--color-surface); border: 1.5px solid var(--color-border-strong);
  text-decoration: none; cursor: pointer;
  transition: transform var(--speed-fast) var(--ease), box-shadow var(--speed-fast) var(--ease), background var(--speed-fast), border-color var(--speed-fast), color var(--speed-fast);
}
.btn:hover { color: var(--color-accent); border-color: var(--color-accent); transform: translateY(calc(-1 * var(--hover-lift-small))); box-shadow: var(--hover-glow); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--color-accent); border-color: var(--color-accent); color: var(--color-accent-text); }
.btn-primary:hover { background: var(--color-accent-hover); border-color: var(--color-accent-hover); color: var(--color-accent-text); }
.btn .arrow { transition: transform var(--speed-fast) var(--ease); }
.btn:hover .arrow { transform: translateX(4px); }
.btn:hover .arrow-down { transform: translateY(4px); } /* buttons that scroll down the page */
.button-row { display: flex; gap: 12px; flex-wrap: wrap; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: var(--grid-gap); }
.filters-label { font-family: var(--font-display); color: var(--color-muted); margin-right: 4px; }
html[data-filters="no"] .filters { display: none; }
.chip {
  padding: 6px 14px; border-radius: 999px; cursor: pointer;
  border: 1.5px solid var(--color-border); background: var(--color-surface); color: var(--color-muted);
  font: 600 0.85rem var(--font-body);
  transition: color var(--speed-fast), border-color var(--speed-fast), background var(--speed-fast), transform var(--speed-fast) var(--ease);
}
.chip:hover { color: var(--color-accent); border-color: var(--color-accent); transform: translateY(calc(-1 * var(--hover-lift-small))); }
.chip.active { background: var(--color-accent); border-color: var(--color-accent); color: var(--color-accent-text); }

.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0; }
.tag { font-size: 0.78rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--color-surface-2); color: var(--color-accent); }

/* ---------- Sections ---------- */
.section { padding: var(--section-space) 0; --section-bg: var(--color-bg); background: var(--section-bg); }
.section-alt { --section-bg: var(--color-bg-alt); }
.section-head { margin-bottom: 32px; }
.section-title { font-size: var(--title-section); margin: 0; }
.section-title::after { content: ""; display: block; width: 56px; height: 4px; margin-top: 12px; border-radius: 2px; background: var(--highlight); }

/* ---------- Showreel (top of the home page) ---------- */
.showreel { padding: var(--showreel-space) 0 var(--showreel-gap); background: var(--color-bg-alt); }
.showreel + .section { padding-top: var(--showreel-gap); } /* keeps About close to the video */
.showreel .container { max-width: var(--showreel-max-width); }


/* ---------- Intro / About ---------- */
.intro { position: relative; isolation: isolate; overflow: hidden; }
.intro::before, .intro::after {
  content: ""; position: absolute; z-index: -1; border-radius: 50%; filter: blur(40px);
  opacity: var(--hero-blobs); animation: drift var(--blob-speed) ease-in-out infinite alternate;
}
.intro::before { width: 520px; height: 520px; top: -200px; right: -140px; background: radial-gradient(circle, var(--blob-1), transparent 65%); }
.intro::after { width: 440px; height: 440px; bottom: -240px; left: 10%; background: radial-gradient(circle, var(--blob-2), transparent 65%); animation-delay: calc(var(--blob-speed) / -2); }
@keyframes drift { to { transform: translate(-60px, 40px) scale(1.12); } }

.about { display: grid; grid-template-columns: var(--about-photo-size) 1fr; gap: clamp(24px, 5vw, 64px); align-items: center; }
html[data-about="stacked"] .about { grid-template-columns: 1fr; align-items: start; }
.about-photo {
  width: var(--about-photo-size); aspect-ratio: 1; object-fit: cover; border-radius: var(--about-photo-radius);
  border: 4px solid var(--color-surface); box-shadow: 0 0 0 3px var(--color-accent);
  transition: transform var(--speed-slow) var(--ease), box-shadow var(--speed-slow) var(--ease);
  justify-self: var(--about-photo-align);
}
/* No hover effect: the photo isn't a link. */
.eyebrow { font-family: var(--font-display); font-size: 1rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--color-accent); margin: 0 0 8px; }
.about h2 { font-size: var(--title-hero); margin-bottom: 0.35em; }
.about-text { color: var(--color-text-soft); font-size: 1.08rem; max-width: 64ch; }
.about .button-row { margin-top: 28px; }
/* "Read more" (--about-read-more: on): everything after the first paragraph hides until clicked. */
.about-more-toggle { display: none; }
html[data-about-more="on"] .about-more:not(.open) { display: none; }
html[data-about-more="on"] .about-more-toggle {
  display: inline-block; padding: 0; border: 0; background: none; cursor: pointer;
  font: inherit; font-weight: 700; color: var(--color-accent); text-decoration: underline; text-underline-offset: 3px;
}

/* ---------- Project cards ---------- */
.grid { display: grid; grid-template-columns: repeat(var(--grid-columns), minmax(0, 1fr)); gap: var(--grid-gap); }
.group.is-empty { display: none; }

/* Featured layout: big card on the left, two stacked on the right. */
.hero-grid {
  display: grid; grid-template-columns: var(--hero-split); gap: var(--grid-gap); align-items: stretch;
  max-width: var(--hero-max-width); height: var(--hero-height); margin-inline: auto;
}
.hero-side { display: grid; grid-template-rows: repeat(2, minmax(0, 1fr)); gap: var(--grid-gap); min-width: 0; min-height: 0; }
.hero-grid .card { min-height: 0; overflow: hidden; }
/* While the featured layout is on, the two stacked cards keep a shorter summary
   and a single row of tags so all three stay the same height. */
html[data-featured="hero"] .hero-side .card-summary { -webkit-line-clamp: var(--hero-side-summary-lines); }
html[data-featured="hero"] .hero-side .tags { flex-wrap: nowrap; overflow: hidden; }
.card-hero .card-media { aspect-ratio: var(--hero-image-ratio); flex: 1; } /* fills the height the stacked pair sets */
.card-hero .card-body { padding: 24px 26px 26px; gap: 10px; }
.card-hero h3 { font-size: var(--title-card-hero); }
.card-hero .card-summary { font-size: 1.05rem; }
.hero-side .card { min-height: 0; }
.hero-side .card-media { aspect-ratio: auto; flex: 1; min-height: var(--hero-side-image-min); }
.hero-side .card-body { padding: 12px 18px 12px; }

/* Flattened back to a plain grid on small screens. (While a tag filter is on,
   js/site.js rebuilds the group as a single grid instead.) */
html[data-featured="grid"] .hero-grid { grid-template-columns: repeat(var(--grid-columns), minmax(0, 1fr)); }
html[data-featured="grid"] .hero-side { display: contents; }
html[data-featured="grid"] .card-hero .card-media { aspect-ratio: var(--card-image-ratio); flex: none; }
html[data-featured="grid"] .card-hero h3 { font-size: var(--title-card); }
html[data-featured="grid"] .hero-side .card-media { aspect-ratio: var(--card-image-ratio); flex: none; }

/* "Show more": the rest of the group, with the top of its cards peeking out. */
.more { margin-top: var(--grid-gap); }
.more-inner {
  position: relative; overflow: hidden; max-height: var(--more-peek);
  transition: max-height var(--speed-slow) var(--ease);
}
.more-inner::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: min(var(--more-fade), 100%);
  background: linear-gradient(to bottom, transparent, var(--section-bg));
  pointer-events: none; transition: opacity var(--speed);
}
.more.open .more-inner::after { opacity: 0; }
.more-toggle { display: flex; margin: 18px auto 0; }
.more-toggle .chev { transition: transform var(--speed) var(--ease); }
.more.open .more-toggle .chev { transform: rotate(180deg); }

.card {
  position: relative; display: flex; flex-direction: column;
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius);
  overflow: hidden; color: var(--color-text); text-decoration: none; box-shadow: var(--shadow-rest);
  transition:
    transform var(--speed) var(--ease), box-shadow var(--speed) var(--ease), border-color var(--speed),
    opacity var(--speed-slow) var(--ease) var(--d, 0s), translate var(--speed-slow) var(--ease) var(--d, 0s);
}
.card::before {
  content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none;
  border-radius: inherit; padding: 2px; background: var(--highlight);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: 0; transition: opacity var(--speed);
}
.card:hover {
  color: var(--color-text); transform: translateY(calc(-1 * var(--hover-lift)));
  border-color: var(--card-hover-border);
  box-shadow: 0 0 0 var(--card-hover-ring) var(--card-hover-border), var(--shadow-hover);
}
.card:hover::before, .card:focus-visible::before { opacity: var(--hover-outline); }
.card.is-hidden { display: none; }

.card-media { position: relative; aspect-ratio: var(--card-image-ratio); overflow: hidden; background: var(--color-surface-2); flex-shrink: 0; }
.card-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform var(--speed-slow) var(--ease); }
.card:hover .card-media img { transform: scale(var(--hover-zoom)); }

.badge {
  position: absolute; left: 12px; top: 12px; padding: 4px 10px; border-radius: 999px;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  background: var(--color-accent-3); color: var(--color-badge-text);
}
.badge + .badge { left: auto; right: 12px; }

.card-body { display: flex; flex-direction: column; gap: 8px; flex: 1; padding: 18px 20px 20px; }
.card h3 { font-size: var(--title-card); margin: 0; }
.card h3 .year { color: var(--color-muted); font-weight: 400; font-size: 0.8em; white-space: nowrap; }
.card-meta { font-size: 0.85rem; font-weight: 600; color: var(--color-muted); }
/* Clamped so cards stay the same height whatever the summary's length. */
.card-summary {
  margin: 0; color: var(--color-text-soft); font-size: 0.95rem;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: var(--card-summary-lines); overflow: hidden;
}
html[data-summary="no"] .card-summary { display: none; }
.card .tags { margin-top: 2px; }
.read-more { margin-top: auto; padding-top: 6px; font-family: var(--font-display); color: var(--color-accent); font-weight: 500; letter-spacing: 0.02em; }
.read-more .arrow { display: inline-block; transition: transform var(--speed-fast) var(--ease); }
.card:hover .read-more .arrow { transform: translateX(5px); }

html[data-cards="horizontal"] .card { flex-direction: row; }
html[data-cards="horizontal"] .card-media { width: var(--card-image-width); aspect-ratio: auto; min-height: 150px; }

/* ---------- Contact ---------- */
.contact { text-align: center; }
.contact h2 { font-size: var(--title-section); }
.contact .lead { color: var(--color-muted); max-width: 52ch; margin: 0 auto 28px; }
.contact .button-row { justify-content: center; }

/* ---------- Footer ---------- */
/* Pinned email/social links, on screen on every page (replaces the footer). */
.dock {
  position: fixed; z-index: 60; display: flex; gap: var(--dock-gap);
  right: var(--dock-offset); bottom: var(--dock-offset); flex-direction: column;
  padding: var(--dock-padding); border-radius: var(--radius-button);
  background: var(--color-dock-bg); border: 1px solid var(--color-border);
  box-shadow: 0 8px 26px rgba(30, 20, 60, 0.18);
}
.dock-link {
  position: relative; display: grid; place-items: center;
  width: var(--dock-size); height: var(--dock-size); border-radius: 50%;
  text-decoration: none; color: var(--color-text);
  transition: transform var(--speed) var(--ease), background var(--speed-fast), box-shadow var(--speed-fast);
}
.dock-link img { width: 58%; height: 58%; object-fit: contain; }
.dock-initial { font-family: var(--font-display); font-size: 1.1rem; }
/* Same purple highlight as the header and the project cards. */
.dock-link:hover {
  transform: scale(var(--dock-hover-scale)); background: var(--color-surface-2);
  box-shadow: 0 0 0 var(--card-hover-ring) var(--card-hover-border);
}
/* Name slides out beside the icon on hover. */
.dock-label {
  position: absolute; right: calc(100% + 10px); top: 50%; transform: translate(6px, -50%);
  padding: 4px 10px; border-radius: var(--radius-small); white-space: nowrap; pointer-events: none;
  background: var(--color-text); color: var(--color-bg); font-size: 0.8rem; font-weight: 600;
  opacity: 0; transition: opacity var(--speed-fast), transform var(--speed-fast) var(--ease);
}
.dock-link:hover .dock-label, .dock-link:focus-visible .dock-label { opacity: 1; transform: translate(0, -50%); }

/* Phones: a centred row along the bottom edge. */
html[data-dock="row"] .dock { flex-direction: row; left: 50%; right: auto; transform: translateX(-50%); }
html[data-dock="row"] .dock-label { display: none; }

/* Keeps content clear of the dock: space under the page, and a strip down the
   right-hand side. The strip is inset inside .container (see the Base section)
   rather than on <body>, so full-width backgrounds still reach the screen edge. */
body { padding-bottom: var(--dock-clearance); }

/* ---------- Project page ---------- */
.back-link { display: inline-flex; gap: 6px; margin: 24px 0 14px; color: var(--color-muted); font-family: var(--font-display); text-decoration: none; transition: color var(--speed-fast), transform var(--speed-fast) var(--ease); }
.back-link:hover { color: var(--color-accent); transform: translateX(-4px); }

.project-header { margin-bottom: 20px; }
.project-title { font-size: var(--title-project); margin-bottom: 0.1em; }
.project-title::after { content: ""; display: block; width: 56px; height: 4px; margin-top: 12px; border-radius: 2px; background: var(--highlight); }
.project-header .tags { margin-top: 14px; }

/* Title above; below it the video on the left and the download panel on the right.
   The panel's size follows how many buttons it holds:
     1 button  — half width, half the video's height
     2 buttons — fills the space beside the video, half its height
     3-4       — same width, full video height (two rows) */
.project-media { --media-gap: 24px; --video-height: calc(var(--project-video-width) * 9 / 16); }
.project-media { display: flex; gap: var(--media-gap); align-items: flex-start; margin-bottom: var(--project-media-space); }
.project-media .project-hero { flex: 0 0 var(--project-video-width); min-width: 0; }
/* Height follows the buttons — no stretching to match the video. */
.project-facts {
  flex: 1 1 auto; min-width: 0;
  display: flex; flex-direction: column; gap: 10px;
  padding: 14px 16px; border-radius: var(--radius);
  background: var(--color-bg-alt); border: 1px solid var(--color-border);
}
.project-facts[data-count="1"] { flex: 0 0 calc((100% - var(--project-video-width) - var(--media-gap)) / 2); }

html[data-project-media="stacked"] .project-media { flex-direction: column; align-items: stretch; }
html[data-project-media="stacked"] .project-media .project-hero { flex-basis: auto; }
html[data-project-media="stacked"] .project-facts,
html[data-project-media="stacked"] .project-facts[data-count="1"] { flex-basis: auto; height: auto; }

/* Download buttons: identical black rounded rectangles filling the panel. */
.downloads { display: flex; flex-direction: column; gap: 12px; flex: 1; min-height: 0; }
.download-group { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.download-heading {
  margin: 0 0 7px; font-family: var(--font-body); font-size: 0.7rem; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--color-muted); line-height: 1.3;
}
/* The panel's width follows the button count; the buttons stay one size. */
.store-links {
  display: grid; grid-template-columns: repeat(var(--download-columns), minmax(0, 1fr)); gap: 10px;
  align-content: start; justify-items: center;
}
.project-facts[data-count="1"] .store-links { grid-template-columns: 1fr; }
.store-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; max-width: var(--store-btn-width); height: var(--store-btn-height);
  padding: 0 14px; border-radius: var(--store-btn-radius);
  background: var(--store-btn-bg); color: var(--store-btn-text); text-decoration: none;
  font-family: var(--font-display); font-size: 0.85rem; letter-spacing: 0.02em; line-height: 1;
  transition: transform var(--speed) var(--ease), box-shadow var(--speed) var(--ease), background var(--speed-fast);
}
.store-btn-icon { width: 17px; height: 17px; flex-shrink: 0; }
.store-btn-text { white-space: nowrap; }
.store-btn:hover {
  color: var(--store-btn-text); background: var(--store-btn-bg-hover);
  transform: translateY(calc(-1 * var(--hover-lift-small))) scale(var(--store-hover-scale));
  box-shadow: var(--shadow-hover); /* same drop shadow as a hovered project card, no ring */
}
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.project-hero { max-width: var(--project-video-width); }
.project-hero > img { width: 100%; max-height: 520px; object-fit: cover; border-radius: var(--radius); }

/* Case-study bands: alternating full-width colour sections. */
.band { padding: var(--band-space) 0; background: var(--color-bg); }
.band-alt { background: var(--color-bg-alt); }
.band .content { padding: 0; }

/* ----- Toggled sections (--content-sections: tabs) -------------------------
   A segmented control swapping between Responsibilities and the case study.
   Setting --content-sections: bands in layout.css makes all of this unused. */
.segmented {
  display: inline-flex; gap: 4px; margin: 0 auto var(--band-space); padding: 4px;
  border-radius: var(--radius-button); background: var(--color-surface); border: 1px solid var(--color-border);
}
.content-tabs .container { display: flex; flex-direction: column; align-items: center; }
.content-tabs .content { width: 100%; }
.seg {
  padding: 10px 26px; border: 0; border-radius: var(--radius-button); cursor: pointer;
  background: transparent; color: var(--color-muted);
  font-family: var(--font-display); font-size: 1.05rem; letter-spacing: 0.02em; line-height: 1.2;
  transition: background var(--speed-fast), color var(--speed-fast);
}
.seg:hover { background: var(--color-surface-2); color: var(--color-text); }
.seg[aria-selected="true"] { background: var(--color-accent); color: var(--color-accent-text); }
.tab-panel.just-shown { animation: tab-fade var(--speed) var(--ease); }
@keyframes tab-fade { from { opacity: 0; translate: 0 8px; } to { opacity: 1; translate: none; } }
html[data-segments="full"] .segmented { display: flex; width: 100%; }
html[data-segments="full"] .seg { flex: 1; padding: 10px 12px; font-size: 0.95rem; }

.content { max-width: var(--content-width); margin-inline: auto; padding: 16px 0 64px; }
.content > * + * { margin-top: 28px; }
.content h2 { font-size: calc(var(--title-section) * 0.85); margin-top: 64px; margin-bottom: 0; }
.band .content > div:first-child h2 { margin-top: 0; } /* a band already provides the space */
.content h2::after { content: ""; display: block; width: 44px; height: 3px; margin-top: 10px; border-radius: 2px; background: var(--highlight); transition: width var(--speed) var(--ease); }
.content h2:hover::after { width: 110px; }
.content h3 { font-size: 1.35rem; margin: 0 0 12px; }
.content > div > h3 { margin-top: 20px; }
.prose { color: var(--color-text-soft); font-size: 1.04rem; }
.prose p { margin: 0 0 1em; }
.prose > :last-child { margin-bottom: 0; }
.prose ul { padding-left: 1.3em; margin: 0 0 1em; }
.prose li + li { margin-top: 6px; }
.prose li::marker { color: var(--color-accent); }
figure { margin: 0; }
figcaption { margin-top: 10px; font-size: 0.9rem; color: var(--color-muted); text-align: center; font-style: italic; }

blockquote {
  margin: 0; padding: 6px 0 6px 24px; border-left: 4px solid var(--color-accent);
  font-family: var(--font-display); font-size: 1.45rem; line-height: 1.35;
}
blockquote cite { display: block; margin-top: 10px; font: 600 0.9rem var(--font-body); font-style: normal; color: var(--color-muted); }
blockquote cite::before { content: "— "; }

/* Text beside image(s) */
.split { display: grid; grid-template-columns: 1fr var(--split-image-width); gap: 20px 36px; align-items: start; }
.split.media-left { grid-template-columns: var(--split-image-width) 1fr; }
.split.media-left .split-media { order: -1; }
.split-media { display: grid; gap: 16px; }
html[data-split="stacked"] .split, html[data-split="stacked"] .split.media-left { grid-template-columns: 1fr; }
html[data-split="stacked"] .split.media-left .split-media { order: 0; }

/* Clickable images (open in the lightbox) */
.zoomable {
  display: block; width: 100%; padding: 0; position: relative; overflow: hidden; cursor: zoom-in;
  border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-surface-2);
  transition: box-shadow var(--speed) var(--ease), transform var(--speed) var(--ease);
}
.zoomable img { width: 100%; transition: transform var(--speed-slow) var(--ease); }
.zoomable:hover { box-shadow: var(--shadow-hover); transform: translateY(calc(-1 * var(--hover-lift-small))); }
.zoomable:hover img { transform: scale(calc(1 + (var(--hover-zoom) - 1) / 2)); }

/* Up to --gallery-columns per row; a gallery with fewer images stretches them to fill the row. */
.gallery {
  --gallery-gap: 14px;
  display: grid; gap: var(--gallery-gap); align-items: start;
  grid-template-columns: repeat(auto-fit, minmax(calc((100% - (var(--gallery-columns) - 1) * var(--gallery-gap)) / var(--gallery-columns)), 1fr));
}
.gallery .zoomable { aspect-ratio: 16 / 10; }
.gallery img { height: 100%; object-fit: cover; }

/* Looping silent clips (.mp4/.webm), used where a GIF would have been. */
.clip {
  display: block; width: 100%; height: auto; border-radius: var(--radius);
  border: 1px solid var(--color-border); background: var(--color-surface-2);
}
.gallery .clip { aspect-ratio: 16 / 10; object-fit: cover; }
.gallery.no-crop .zoomable { aspect-ratio: auto; }
.gallery.no-crop img { height: auto; }
.gallery figcaption { text-align: left; margin-top: 6px; }

/* YouTube: a thumbnail that swaps in the real player on click */
.yt {
  position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; padding: 0; overflow: hidden; cursor: pointer;
  border: 0; border-radius: var(--radius); background: #000; color: #fff; font: inherit;
}
/* No thumbnail available (private or deleted video): show a plain panel instead. */
.yt.no-thumb { background: var(--color-surface-2); }
.yt.no-thumb img { display: none; }
.yt.no-thumb .yt-title { color: var(--color-text); text-shadow: none; }

.yt img { width: 100%; height: 100%; object-fit: cover; filter: brightness(0.78); transition: transform var(--speed-slow) var(--ease), filter var(--speed); }
.yt:hover img { transform: scale(calc(1 + (var(--hover-zoom) - 1) / 2)); filter: brightness(0.95); }
.yt-title { position: absolute; left: 18px; right: 18px; top: 14px; text-align: left; font-family: var(--font-display); font-size: 1.1rem; text-shadow: 0 1px 6px #000; }
.yt-play {
  position: absolute; left: 50%; top: 50%; width: 78px; height: 54px; transform: translate(-50%, -50%); border-radius: 16px;
  background: rgba(15, 15, 22, 0.8); transition: background var(--speed-fast), transform var(--speed-fast) var(--ease), box-shadow var(--speed-fast);
}
.yt-play::before {
  content: ""; position: absolute; left: 50%; top: 50%; transform: translate(-38%, -50%);
  border-style: solid; border-width: 11px 0 11px 19px; border-color: transparent transparent transparent #fff;
}
.yt:hover .yt-play, .yt:focus-visible .yt-play { background: #f00; transform: translate(-50%, -50%) scale(1.12); box-shadow: 0 0 30px rgba(255, 0, 0, 0.45); }
.yt-frame { aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; background: #000; }
.yt-frame iframe { width: 100%; height: 100%; border: 0; display: block; }
.notice { padding: 12px 16px; border-radius: var(--radius-small); background: #fff4d6; color: #6b4b00; }

.project-nav {
  display: grid; grid-template-columns: repeat(var(--project-nav-columns), minmax(0, 1fr)); gap: 16px;
  margin-top: var(--project-media-space); padding-bottom: 72px; /* same gap as below the video */
}
.project-nav a {
  display: block; padding: 18px 22px; border-radius: var(--radius); text-decoration: none;
  background: var(--color-surface); border: 1.5px solid var(--color-border); color: var(--color-text);
  transition: transform var(--speed) var(--ease), border-color var(--speed), box-shadow var(--speed);
}
.project-nav a:hover { color: var(--color-text); transform: translateY(calc(-1 * var(--hover-lift-small))); border-color: var(--color-accent); box-shadow: var(--shadow-hover); }
.project-nav small { display: block; color: var(--color-muted); text-transform: uppercase; letter-spacing: 0.1em; font-size: 0.72rem; font-weight: 700; }
.project-nav strong { font-family: var(--font-display); font-weight: 500; font-size: 1.2rem; }
.project-nav .next { text-align: right; }
.project-nav .next:only-child { grid-column: -2 / -1; }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center;
  padding: 64px 16px 24px; background: rgba(10, 8, 18, 0.94);
  opacity: 0; visibility: hidden; transition: opacity var(--speed), visibility var(--speed);
}
.lightbox.open { opacity: 1; visibility: visible; }
.lightbox figure { display: flex; flex-direction: column; align-items: center; max-width: min(1400px, 100%); }
.lightbox img { max-height: calc(100vh - 150px); width: auto; border-radius: var(--radius-small); transform: scale(0.96); transition: transform var(--speed) var(--ease); }
.lightbox.open img { transform: none; }
.lightbox figcaption { color: #d8d3e6; }
.lb-btn {
  position: absolute; width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center;
  font-size: 1.4rem; line-height: 1; color: #fff; cursor: pointer;
  background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.18);
  transition: background var(--speed-fast), transform var(--speed-fast) var(--ease);
}
.lb-btn:hover { background: var(--color-accent); transform: scale(1.1); }
.lb-close { top: 12px; right: 12px; }
.lb-prev { left: 12px; top: 50%; margin-top: -24px; }
.lb-next { right: 12px; top: 50%; margin-top: -24px; }
.lb-btn[hidden] { display: none; }

/* ---------- Scroll reveal, hover switch, reduced motion ---------- */
.reveal { opacity: 0; translate: 0 var(--reveal-distance); transition: opacity var(--speed-slow) var(--ease) var(--d, 0s), translate var(--speed-slow) var(--ease) var(--d, 0s); }
.reveal.in-view { opacity: 1; translate: none; }
html[data-reveal="off"] .reveal { opacity: 1; translate: none; }

html[data-hover="off"] {
  --hover-lift: 0px;
  --hover-lift-small: 0px;
  --hover-zoom: 1;
  --hover-glow: none;
  --hover-outline: 0;
  --logo-hover-scale: 1;
  --store-hover-scale: 1;
  --dock-hover-scale: 1;
  --card-hover-ring: 0px;
}
html[data-hover="off"] .content h2:hover::after { width: 44px; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition-duration: 0.01ms !important; transition-delay: 0s !important; }
  .reveal { opacity: 1; translate: none; }
}
