/* =========================================================
   BoardBuddy Brixalo — Editorial Strategy Laboratory
   Custom design system (vanilla CSS)
   ========================================================= */

:root {
  --terracotta: #C65D3B;
  --terracotta-deep: #A3452A;
  --orange: #E88952;
  --olive: #68734A;
  --olive-deep: #4F5935;
  --ivory: #F7F1E5;
  --ink: #29251F;
  --ink-soft: #4A433A;
  --sand: #D9C8AC;
  --sage: #DCE1CF;
  --cream: rgba(255, 251, 242, 0.74);
  --line: rgba(104, 115, 74, 0.28);
  --line-strong: rgba(104, 115, 74, 0.5);
  --shadow: 0 1px 0 rgba(41, 37, 31, 0.04), 0 12px 30px -14px rgba(84, 52, 28, 0.3);
  --shadow-lg: 0 2px 0 rgba(41, 37, 31, 0.05), 0 34px 60px -26px rgba(84, 52, 28, 0.42);
  --radius: 22px;
  --radius-sm: 12px;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --wrap: 1240px;
  --img-paper-grain-texture: radial-gradient(circle at 20% 10%, rgba(232, 137, 82, 0.08), transparent 40%), radial-gradient(circle at 85% 30%, rgba(104, 115, 74, 0.08), transparent 45%), radial-gradient(circle at 50% 100%, rgba(217, 200, 172, 0.35), transparent 50%);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--ink);
  background-color: var(--ivory);
  background-image: var(--img-paper-grain-texture);
  background-attachment: fixed;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; height: auto; }
a { color: var(--terracotta-deep); text-underline-offset: 3px; }
a:hover { color: var(--ink); }
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; line-height: 1.08; margin: 0 0 .5em; letter-spacing: -0.015em; }
h1 { font-size: clamp(2.5rem, 6vw, 5.4rem); }
h2 { font-size: clamp(1.9rem, 3.6vw, 3.1rem); }
h3 { font-size: clamp(1.25rem, 2vw, 1.6rem); }
p { margin: 0 0 1em; }
:focus-visible { outline: 3px solid var(--terracotta); outline-offset: 3px; border-radius: 6px; }
.wrap { width: min(100% - 2.5rem, var(--wrap)); margin-inline: auto; }
.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: var(--ivory); padding: .7rem 1rem; z-index: 100; }
.skip:focus { left: 1rem; top: 1rem; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Icons ---------- */
.icon { width: 1.1em; height: 1.1em; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; vertical-align: -0.15em; }

/* ---------- Header (slim, scrolls away with the page — never sticky) ---------- */
.site-header { position: relative; z-index: 30; border-bottom: 1px solid var(--line); background: rgba(247, 241, 229, 0.96); }
.header-inner { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .5rem 0; min-height: 54px; }
.brand { display: inline-flex; align-items: center; gap: .5rem; text-decoration: none; color: var(--ink); }
.brand-mark { display: grid; grid-template-columns: repeat(2, 9px); gap: 2px; transform: rotate(-8deg); }
.brand-mark i { width: 9px; height: 9px; border-radius: 2px; background: var(--terracotta); box-shadow: 1px 1px 0 rgba(41, 37, 31, .25); }
.brand-mark i:nth-child(2) { background: var(--olive); border-radius: 50%; }
.brand-mark i:nth-child(3) { background: var(--sand); }
.brand-mark i:nth-child(4) { background: var(--orange); }
.brand-text { font-family: var(--serif); font-size: 1.08rem; font-weight: 600; letter-spacing: -0.02em; line-height: 1; }
.brand-text em { font-style: italic; color: var(--terracotta-deep); font-weight: 500; }
.site-nav ul { list-style: none; display: flex; gap: .1rem; margin: 0; padding: 0; align-items: center; }
.site-nav a { display: block; padding: .36rem .62rem; font-size: .82rem; font-weight: 500; line-height: 1.3; color: var(--ink); text-decoration: none; border-radius: 999px; transition: background .2s, color .2s; white-space: nowrap; }
.site-nav a:hover { background: var(--sage); }
.site-nav a[aria-current="page"] { background: var(--ink); color: var(--ivory); }
.site-nav a.nav-cta { border: 1px solid var(--terracotta); color: var(--terracotta-deep); margin-left: .25rem; }
.site-nav a.nav-cta[aria-current="page"] { background: var(--terracotta-deep); color: #fff; }

/* Three-dot (kebab) menu button for small screens */
.nav-toggle { display: none; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 0; font-size: 0; line-height: 0; color: var(--ink); background: transparent; border: 1px solid var(--line-strong); border-radius: 50%; cursor: pointer; transition: background .2s, border-color .2s; }
.nav-toggle .icon { display: none; }
.nav-toggle::before { content: ""; width: 4px; height: 4px; border-radius: 50%; background: currentColor; box-shadow: 0 -7px 0 currentColor, 0 7px 0 currentColor; }
.nav-toggle:hover { background: var(--sage); }
.nav-toggle[aria-expanded="true"] { background: var(--ink); color: var(--ivory); border-color: var(--ink); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .55rem; font: 600 .98rem/1.2 var(--sans); padding: .9rem 1.4rem; border-radius: 999px; text-decoration: none; border: 1.5px solid transparent; cursor: pointer; transition: transform .2s ease, background .2s, box-shadow .2s, color .2s; }
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--terracotta-deep); color: #FFF9F0; box-shadow: 0 10px 22px -12px rgba(163, 69, 42, .8); }
.btn-primary:hover { background: var(--ink); color: var(--ivory); }
.btn-ghost { background: var(--cream); color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover { border-color: var(--ink); color: var(--ink); background: #fff; }
.btn-olive { background: var(--olive-deep); color: #FAF6EC; }
.btn-olive:hover { background: var(--ink); color: var(--ivory); }
.btn-sm { padding: .62rem 1rem; font-size: .88rem; }

/* ---------- Typography helpers ---------- */
.eyebrow { font: 600 .78rem/1.3 var(--sans); letter-spacing: .16em; text-transform: uppercase; color: var(--olive-deep); display: inline-flex; align-items: center; gap: .6rem; margin-bottom: 1rem; }
.eyebrow::before { content: ""; width: 28px; height: 1.5px; background: var(--terracotta); }
.lede { font-size: clamp(1.1rem, 1.6vw, 1.3rem); color: var(--ink-soft); max-width: 60ch; }
.num { font-family: var(--serif); font-style: italic; color: var(--terracotta); font-weight: 500; }
.muted { color: var(--ink-soft); }
.small { font-size: .9rem; }

/* ---------- Hero: The Opening Move ---------- */
.hero { position: relative; overflow: hidden; padding: clamp(3rem, 7vw, 6rem) 0 clamp(3.5rem, 7vw, 6rem); background: linear-gradient(180deg, #FAF5EA 0%, var(--ivory) 100%); border-bottom: 1px solid var(--line); --mx: 70%; --my: 40%; --px: 0; --py: 0; }
.hero-motif { position: absolute; inset: -20% -10% auto auto; width: min(900px, 120vw); aspect-ratio: 1; opacity: .5; pointer-events: none; animation: motifSpin 140s linear infinite; }
.hero-motif svg { width: 100%; height: 100%; }
.hero-spot { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(520px circle at var(--mx) var(--my), rgba(232, 137, 82, .2), rgba(247, 241, 229, 0) 65%); transition: background .2s; }
.hero-grid { position: relative; display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr); gap: clamp(2rem, 4vw, 4rem); align-items: center; }
.hero-copy { position: relative; z-index: 2; }
.hero-title { font-size: clamp(2.7rem, 6.6vw, 6rem); line-height: .98; letter-spacing: -0.035em; margin-bottom: 1.4rem; }
.hero-title .mask { display: block; overflow: hidden; padding-bottom: .06em; }
.hero-title .mask > span { display: block; transform: translateY(110%); }
.hero-title em { font-style: italic; color: var(--terracotta-deep); font-weight: 500; }
.hero.is-ready .hero-title .mask > span { animation: maskUp 1s cubic-bezier(.2, .8, .2, 1) forwards; }
.hero.is-ready .hero-title .mask:nth-child(2) > span { animation-delay: .14s; }
.hero.is-ready .hero-title .mask:nth-child(3) > span { animation-delay: .28s; }
.reveal-item { opacity: 0; transform: translateY(18px); }
.hero.is-ready .reveal-item { animation: fadeUp .8s ease forwards; }
.hero.is-ready .reveal-item:nth-of-type(1) { animation-delay: .05s; }
.hero.is-ready .hero-lede { animation-delay: .55s; }
.hero.is-ready .hero-actions { animation-delay: .7s; }
.hero.is-ready .hero-meta { animation-delay: .85s; }
.hero-lede { font-size: clamp(1.08rem, 1.5vw, 1.25rem); color: var(--ink-soft); max-width: 52ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .8rem; margin: 1.8rem 0 2rem; }
.hero-meta { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .6rem 1.4rem; font-size: .9rem; color: var(--ink-soft); }
.hero-meta li { display: inline-flex; gap: .45rem; align-items: center; }
.hero-meta strong { font-family: var(--serif); font-size: 1.3rem; color: var(--ink); }

.hero-stage { position: relative; z-index: 1; min-height: 480px; perspective: 1400px; }
.board-wrap { position: absolute; inset: 6% 4% 10% 8%; transform-style: preserve-3d; transform: translate3d(calc(var(--px) * -14px), calc(var(--py) * -10px), 0); transition: transform .35s ease-out; }
.board { position: absolute; inset: 0; margin: auto; width: min(380px, 78%); aspect-ratio: 1; transform-style: preserve-3d; transform: rotateX(calc(54deg + var(--py) * 5deg)) rotateZ(calc(-36deg + var(--px) * 6deg)); transition: transform .4s ease-out; }
.board-surface { position: absolute; inset: 0; border-radius: 26px; background: linear-gradient(135deg, #E7D6B8, #D2BB94); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .35), 0 0 0 10px #B7946A, 0 0 0 11px rgba(41, 37, 31, .2), 40px 50px 60px -10px rgba(84, 52, 28, .45); display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; padding: 18px; transform-style: preserve-3d; }
.tile { border-radius: 10px; background: var(--ivory); box-shadow: inset 0 2px 0 rgba(255, 255, 255, .7), inset 0 -3px 0 rgba(41, 37, 31, .18), 4px 6px 0 rgba(84, 52, 28, .35); transform: translate3d(0, 0, 4px); position: relative; overflow: hidden; }
.tile::after { content: ""; position: absolute; inset: 22%; border-radius: 4px; border: 1.5px solid rgba(41, 37, 31, .14); }
.tile.t-terra { background: var(--terracotta); }
.tile.t-orange { background: var(--orange); }
.tile.t-olive { background: var(--olive); }
.tile.t-sage { background: var(--sage); }
.tile.t-sand { background: #E9DCC4; }
.tile.t-ink { background: var(--ink); }
.tile.t-ink::after { border-color: rgba(247, 241, 229, .25); border-radius: 50%; }
.tile.t-empty { background: transparent; box-shadow: inset 0 0 0 1.5px rgba(41, 37, 31, .18); transform: none; }
.tile.t-empty::after { display: none; }
.hero.is-ready .tile:not(.t-empty) { animation: tileIn 1.1s cubic-bezier(.2, .9, .25, 1.05) both; animation-delay: calc(var(--i) * 75ms + .2s); }
.move-lines { position: absolute; inset: 0; width: 100%; height: 100%; transform: translateZ(9px); overflow: visible; pointer-events: none; }
.move-lines path { fill: none; stroke: var(--terracotta-deep); stroke-width: 2.4; stroke-linecap: round; stroke-dasharray: 520; stroke-dashoffset: 520; }
.move-lines circle { fill: var(--terracotta-deep); opacity: 0; }
.hero.is-ready .move-lines path { animation: trace 1.8s ease forwards; animation-delay: 1.6s; }
.hero.is-ready .move-lines path:nth-of-type(2) { animation-delay: 2s; }
.hero.is-ready .move-lines path:nth-of-type(3) { animation-delay: 2.4s; }
.hero.is-ready .move-lines circle { animation: fadeIn .4s ease forwards; animation-delay: 3s; }
.token { position: absolute; transform-style: preserve-3d; }
.token .face { position: absolute; inset: 0; }
.tok-disc { width: 46px; height: 46px; left: 63%; top: 12%; --z: 26px; }
.tok-disc .face { border-radius: 50%; background: radial-gradient(circle at 35% 30%, #F2A374, var(--terracotta) 60%, #9B4027); box-shadow: 0 6px 0 #8B3920, 10px 14px 16px rgba(41, 37, 31, .35); }
.tok-hex { width: 52px; height: 52px; left: 14%; top: 58%; --z: 22px; }
.tok-hex .face { clip-path: polygon(25% 4%, 75% 4%, 100% 50%, 75% 96%, 25% 96%, 0 50%); background: linear-gradient(140deg, #8C9868, var(--olive) 55%, #4D5634); }
.tok-cube { width: 34px; height: 34px; left: 40%; top: 40%; --z: 30px; }
.tok-cube .face { border-radius: 6px; background: linear-gradient(140deg, #FFF8EA, #E2D3B7); box-shadow: 0 7px 0 #BFA77F, 8px 12px 14px rgba(41, 37, 31, .3); }
.tok-ring { width: 40px; height: 40px; left: 72%; top: 70%; --z: 18px; }
.tok-ring .face { border-radius: 50%; border: 9px solid var(--ink); box-shadow: 0 5px 0 #0F0D0A; }
.token { transform: translateZ(var(--z)) rotate(0deg); }
.hero.is-ready .token { animation: tokenIn 1.2s cubic-bezier(.2, .9, .3, 1.1) both; }
.hero.is-ready .tok-disc { animation-delay: 1.15s; }
.hero.is-ready .tok-hex { animation-delay: 1.3s; }
.hero.is-ready .tok-cube { animation-delay: 1.45s; }
.hero.is-ready .tok-ring { animation-delay: 1.6s; }
.stage-photo { position: absolute; right: -2%; bottom: -4%; width: 44%; margin: 0; border-radius: 18px; overflow: hidden; box-shadow: var(--shadow-lg); border: 6px solid #FFFBF2; transform: rotate(4deg) translate3d(calc(var(--px) * 10px), calc(var(--py) * 8px), 0); transition: transform .4s ease-out; z-index: 2; }
.stage-photo img { aspect-ratio: 4/5; object-fit: cover; width: 100%; }
.stage-photo figcaption { position: absolute; left: .6rem; bottom: .6rem; background: rgba(41, 37, 31, .82); color: var(--ivory); font-size: .72rem; padding: .25rem .55rem; border-radius: 999px; letter-spacing: .04em; }
.stage-note { position: absolute; left: 0; top: 2%; background: var(--cream); border: 1px solid var(--line); border-radius: 14px; padding: .7rem .9rem; font-size: .8rem; max-width: 190px; box-shadow: var(--shadow); backdrop-filter: blur(6px); transform: translate3d(calc(var(--px) * 18px), calc(var(--py) * 12px), 0); transition: transform .4s ease-out; z-index: 2; }
.stage-note b { display: block; font-family: var(--serif); font-size: 1rem; }

@keyframes maskUp { to { transform: translateY(0); } }
@keyframes fadeUp { to { opacity: 1; transform: none; } }
@keyframes fadeIn { to { opacity: 1; } }
@keyframes tileIn { 0% { opacity: 0; transform: translate3d(var(--fx, 60px), var(--fy, -80px), 90px) rotate(var(--fr, 30deg)); } 70% { opacity: 1; } 100% { opacity: 1; transform: translate3d(0, 0, 4px) rotate(0); } }
@keyframes tokenIn { 0% { opacity: 0; transform: translateZ(140px) rotate(-160deg) scale(.7); } 100% { opacity: 1; transform: translateZ(var(--z)) rotate(0) scale(1); } }
@keyframes trace { to { stroke-dashoffset: 0; } }
@keyframes motifSpin { to { transform: rotate(360deg); } }
@keyframes dropIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ---------- Sections ---------- */
.section { padding: clamp(3.5rem, 7vw, 6.5rem) 0; position: relative; }
.section-head { display: grid; grid-template-columns: auto 1fr; gap: 1rem 2rem; align-items: end; margin-bottom: 2.4rem; }
.section-index { font-family: var(--serif); font-size: clamp(3.4rem, 8vw, 7rem); line-height: .8; color: transparent; -webkit-text-stroke: 1.5px var(--terracotta); font-weight: 500; }
.section-head h2 { margin-bottom: .3rem; }
.section-head p { margin: 0; max-width: 62ch; color: var(--ink-soft); }
.band-sage { background: linear-gradient(180deg, rgba(220, 225, 207, .55), rgba(220, 225, 207, .25)); border-block: 1px solid var(--line); }
.band-ink { background: var(--ink); color: var(--ivory); }
.band-ink .section-head p, .band-ink .muted { color: #D8CDB8; }
.band-ink a { color: #F2B08A; }

/* ---------- Page hero (inner pages) ---------- */
.page-hero { padding: clamp(3rem, 6vw, 5rem) 0 clamp(2.5rem, 5vw, 4rem); border-bottom: 1px solid var(--line); position: relative; overflow: hidden; }
.page-hero::after { content: ""; position: absolute; right: -80px; top: -80px; width: 340px; height: 340px; border: 1.5px solid var(--line-strong); border-radius: 40px; transform: rotate(18deg); pointer-events: none; }
.page-hero::before { content: ""; position: absolute; right: 120px; bottom: -60px; width: 160px; height: 160px; border-radius: 50%; background: rgba(232, 137, 82, .16); pointer-events: none; }
.page-hero-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, .7fr); gap: 2.5rem; align-items: end; position: relative; z-index: 1; }
.page-hero h1 { font-size: clamp(2.4rem, 5.6vw, 4.8rem); letter-spacing: -0.03em; }
.page-hero aside { background: var(--cream); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.3rem 1.4rem; box-shadow: var(--shadow); font-size: .95rem; }
.breadcrumb { font-size: .85rem; margin-bottom: 1.2rem; color: var(--ink-soft); }
.breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem; padding: 0; margin: 0; }
.breadcrumb li + li::before { content: "/"; margin-right: .4rem; color: var(--olive); }

/* ---------- Search & filters ---------- */
.search-panel { background: var(--cream); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(1.1rem, 2.4vw, 1.6rem); box-shadow: var(--shadow); backdrop-filter: blur(6px); display: grid; gap: 1rem; margin-bottom: 2rem; }
.search-field { position: relative; }
.search-field .icon { position: absolute; left: 1.1rem; top: 50%; transform: translateY(-50%); color: var(--olive-deep); width: 1.25rem; height: 1.25rem; }
.search-field input { width: 100%; font: 500 1.05rem var(--sans); color: var(--ink); background: #FFFCF6; border: 1.5px solid var(--line-strong); border-radius: 999px; padding: 1rem 1.2rem 1rem 3.1rem; }
.search-field input:focus { outline: none; border-color: var(--terracotta); box-shadow: 0 0 0 4px rgba(198, 93, 59, .16); }
.filter-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.chip { font: 500 .88rem var(--sans); padding: .5rem .95rem; border-radius: 999px; border: 1px solid var(--line-strong); background: transparent; color: var(--ink); cursor: pointer; transition: all .2s; text-decoration: none; display: inline-flex; align-items: center; gap: .35rem; }
.chip:hover { background: var(--sage); color: var(--ink); }
.chip[aria-pressed="true"], .chip.is-active { background: var(--olive-deep); border-color: var(--olive-deep); color: #FAF6EC; }
.control-row { display: flex; flex-wrap: wrap; gap: .8rem 1.2rem; align-items: center; justify-content: space-between; }
.select-wrap { display: inline-flex; align-items: center; gap: .5rem; font-size: .88rem; font-weight: 500; }
.select-wrap select { font: 500 .92rem var(--sans); color: var(--ink); background: #FFFCF6; border: 1px solid var(--line-strong); border-radius: 10px; padding: .55rem .8rem; }
.result-count { font-size: .9rem; color: var(--ink-soft); margin: 0; }
.empty-state { text-align: center; padding: 3rem 1rem; border: 1.5px dashed var(--line-strong); border-radius: var(--radius); grid-column: 1 / -1; }

/* ---------- Game cards ---------- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 1.6rem; }
.card-grid.asym > :nth-child(5n + 1) { grid-column: span 2; }
.game-card { background: #FFFBF3; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow); transition: transform .3s ease, box-shadow .3s ease; position: relative; }
.game-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); }
.card-media { position: relative; aspect-ratio: 16/10; overflow: hidden; background: var(--sand); }
.asym > :nth-child(5n + 1) .card-media { aspect-ratio: 21/10; }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s ease; }
.game-card:hover .card-media img { transform: scale(1.04); }
.card-badge { position: absolute; left: .9rem; top: .9rem; background: rgba(41, 37, 31, .84); color: var(--ivory); font-size: .74rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; padding: .32rem .7rem; border-radius: 999px; }
.card-award { position: absolute; right: .9rem; top: .9rem; background: var(--ivory); color: var(--olive-deep); font-size: .72rem; font-weight: 600; padding: .32rem .7rem; border-radius: 999px; border: 1px solid var(--line-strong); }
.card-body { padding: 1.3rem 1.35rem 1.4rem; display: flex; flex-direction: column; gap: .7rem; flex: 1; }
.card-cat { font-size: .76rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--olive-deep); margin: 0; }
.card-body h3 { margin: 0; font-size: 1.55rem; }
.card-body h3 a { color: var(--ink); text-decoration: none; }
.card-body h3 a:hover { color: var(--terracotta-deep); }
.card-sum { font-size: .95rem; color: var(--ink-soft); margin: 0; }
.card-specs { list-style: none; margin: .2rem 0 0; padding: .8rem 0 0; border-top: 1px dashed var(--line-strong); display: grid; grid-template-columns: 1fr 1fr; gap: .45rem .8rem; font-size: .86rem; }
.card-specs li { display: flex; align-items: center; gap: .45rem; }
.card-specs .icon { color: var(--terracotta-deep); }
.card-actions { display: flex; flex-wrap: wrap; gap: .55rem; margin-top: auto; padding-top: .5rem; }
.card-actions .btn { flex: 1 1 auto; }

/* ---------- Editorial blocks ---------- */
.edit-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 1.4rem; }
.panel { background: var(--cream); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(1.3rem, 2.5vw, 2rem); box-shadow: var(--shadow); position: relative; }
.panel h3 { margin-top: 0; }
.panel-ink { background: var(--ink); color: var(--ivory); border-color: transparent; }
.panel-ink p { color: #E4D9C5; }
.panel-ink a { color: #F2B08A; }
.panel-terra { background: var(--terracotta-deep); color: #FFF7EC; border-color: transparent; }
.panel-terra p { color: #FBE5D6; }
.panel-terra a { color: #FFF; }
.panel-sage { background: var(--sage); }
.span-7 { grid-column: span 7; } .span-5 { grid-column: span 5; } .span-4 { grid-column: span 4; } .span-8 { grid-column: span 8; } .span-6 { grid-column: span 6; } .span-12 { grid-column: span 12; } .span-3 { grid-column: span 3; }
.panel-num { position: absolute; right: 1.2rem; top: .8rem; font-family: var(--serif); font-size: 3rem; font-style: italic; opacity: .22; line-height: 1; }
.feature-image { border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-lg); position: relative; margin: 0; }
.feature-image img { width: 100%; height: 100%; object-fit: cover; }
.feature-image figcaption { font-size: .82rem; padding: .7rem 1rem; background: #FFFBF3; color: var(--ink-soft); }
.layered { position: relative; }
.layered .feature-image:nth-child(2) { position: absolute; width: 48%; right: -4%; bottom: -12%; border: 6px solid #FFFBF3; transform: rotate(-3deg); }
.tick-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .65rem; }
.tick-list li { padding-left: 1.7rem; position: relative; }
.tick-list li::before { content: ""; position: absolute; left: 0; top: .5em; width: 11px; height: 11px; border-radius: 3px; background: var(--terracotta); transform: rotate(45deg); }
.panel-ink .tick-list li::before { background: var(--orange); }
.step-list { counter-reset: s; list-style: none; padding: 0; margin: 0; display: grid; gap: .9rem; }
.step-list li { counter-increment: s; position: relative; padding-left: 3rem; }
.step-list li::before { content: counter(s, decimal-leading-zero); position: absolute; left: 0; top: -.1rem; font-family: var(--serif); font-style: italic; font-size: 1.4rem; color: var(--terracotta-deep); }
.cat-tile { display: flex; flex-direction: column; gap: .5rem; padding: 1.4rem; border-radius: var(--radius); border: 1px solid var(--line); background: #FFFBF3; text-decoration: none; color: var(--ink); transition: transform .25s, box-shadow .25s, background .25s; min-height: 180px; position: relative; overflow: hidden; }
.cat-tile:hover { transform: translateY(-4px) rotate(-.4deg); box-shadow: var(--shadow-lg); color: var(--ink); background: #fff; }
.cat-tile .shape { width: 38px; height: 38px; margin-bottom: auto; }
.cat-tile h3 { margin: .6rem 0 0; font-size: 1.3rem; }
.cat-tile p { margin: 0; font-size: .9rem; color: var(--ink-soft); }
.shape-sq { background: var(--terracotta); border-radius: 8px; transform: rotate(12deg); }
.shape-ci { background: var(--olive); border-radius: 50%; }
.shape-hex { background: var(--orange); clip-path: polygon(25% 4%, 75% 4%, 100% 50%, 75% 96%, 25% 96%, 0 50%); }
.shape-tri { background: var(--ink); clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.shape-ring { border: 8px solid var(--terracotta); border-radius: 50%; }
.shape-dia { background: var(--olive); transform: rotate(45deg) scale(.8); border-radius: 6px; }
.shape-half { background: linear-gradient(90deg, var(--terracotta) 50%, var(--sand) 50%); border-radius: 50%; }

.quote-block { font-family: var(--serif); font-size: clamp(1.5rem, 3vw, 2.4rem); line-height: 1.2; font-style: italic; margin: 0; letter-spacing: -0.01em; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #FFFBF3; box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-size: .94rem; min-width: 680px; }
caption { text-align: left; padding: 1rem 1.2rem; font-family: var(--serif); font-size: 1.15rem; font-weight: 600; caption-side: top; }
th, td { text-align: left; padding: .85rem 1.1rem; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { background: var(--sage); font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink); }
tbody tr:hover { background: rgba(232, 137, 82, .07); }
tbody th { font-family: var(--serif); font-size: 1.05rem; }
.sort-btn { font: inherit; text-transform: inherit; letter-spacing: inherit; background: none; border: 0; color: inherit; cursor: pointer; padding: 0; display: inline-flex; align-items: center; gap: .3rem; font-weight: 700; }
.sort-btn::after { content: "↕"; opacity: .5; }
.sort-btn[data-dir="asc"]::after { content: "↑"; opacity: 1; }
.sort-btn[data-dir="desc"]::after { content: "↓"; opacity: 1; }

/* ---------- Detail page ---------- */
.detail-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(1.5rem, 4vw, 3.5rem); align-items: center; }
.detail-hero .feature-image img { aspect-ratio: 4/3; }
.spec-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .8rem; margin: 1.4rem 0; }
.spec { background: #FFFBF3; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .8rem 1rem; }
.spec dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--olive-deep); font-weight: 600; }
.spec dd { margin: .2rem 0 0; font-family: var(--serif); font-size: 1.12rem; font-weight: 600; }
.detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 2.5rem; align-items: start; }
.detail-main > section { margin-bottom: 2.8rem; }
.detail-aside { position: sticky; top: 1.5rem; display: grid; gap: 1rem; }
.meter { display: grid; gap: .3rem; margin-bottom: .8rem; }
.meter-label { display: flex; justify-content: space-between; font-size: .88rem; font-weight: 600; }
.meter-bar { height: 8px; border-radius: 99px; background: var(--sand); overflow: hidden; }
.meter-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--olive), var(--terracotta)); border-radius: 99px; }
.gallery { display: grid; grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; gap: .9rem; }
.gallery figure { margin: 0; border-radius: var(--radius-sm); overflow: hidden; box-shadow: var(--shadow); }
.gallery figure:first-child { grid-row: span 2; }
.gallery img { width: 100%; height: 100%; object-fit: cover; min-height: 160px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }

/* ---------- Articles ---------- */
.article-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: clamp(2rem, 4vw, 4rem); align-items: start; }
.toc { position: sticky; top: 1.5rem; background: var(--cream); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.3rem; }
.toc h2 { font-size: 1.1rem; }
.toc ol { margin: 0; padding-left: 1.2rem; display: grid; gap: .5rem; font-size: .92rem; }
.toc a { color: var(--ink); text-decoration: none; }
.toc a:hover, .toc a.is-active { color: var(--terracotta-deep); text-decoration: underline; }
.article { margin-bottom: 4rem; padding-bottom: 3rem; border-bottom: 1px solid var(--line); scroll-margin-top: 1.5rem; }
.article-kicker { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .85rem; color: var(--ink-soft); margin-bottom: .8rem; }
.article h2 { font-size: clamp(2rem, 4vw, 3.2rem); }
.article h3 { margin-top: 1.8rem; }
.article p, .article li { max-width: 70ch; }
.article-nav { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-top: 2rem; }
.article-nav a { font-weight: 600; text-decoration: none; display: inline-flex; gap: .4rem; align-items: center; }
.pull { border-left: 4px solid var(--terracotta); padding: .4rem 0 .4rem 1.3rem; margin: 1.6rem 0; font-family: var(--serif); font-size: 1.35rem; font-style: italic; }
.dropcap::first-letter { font-family: var(--serif); float: left; font-size: 4.2rem; line-height: .82; padding: .35rem .5rem 0 0; color: var(--terracotta-deep); }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-grid .full { grid-column: 1 / -1; }
label { font-weight: 600; font-size: .9rem; display: block; margin-bottom: .35rem; }
input[type="text"], input[type="email"], select, textarea { width: 100%; font: 500 1rem var(--sans); color: var(--ink); background: #FFFCF6; border: 1.5px solid var(--line-strong); border-radius: 12px; padding: .8rem .95rem; }
textarea { min-height: 150px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--terracotta); box-shadow: 0 0 0 4px rgba(198, 93, 59, .15); }
.field-error { color: #8E2F14; font-size: .84rem; margin-top: .3rem; min-height: 1em; }
.form-status { padding: .9rem 1.1rem; border-radius: 12px; background: var(--sage); margin-top: 1rem; display: none; }
.form-status.show { display: block; }
.check { display: flex; gap: .6rem; align-items: flex-start; font-weight: 400; }
.check input { margin-top: .35rem; accent-color: var(--terracotta-deep); }

/* ---------- Legal ---------- */
.legal { max-width: 820px; }
.legal h2 { font-size: 1.6rem; margin-top: 2.4rem; }
.legal h3 { font-size: 1.2rem; margin-top: 1.4rem; }
.legal ul { padding-left: 1.2rem; }
.legal-card { background: var(--cream); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.3rem 1.5rem; margin: 1.5rem 0; }

/* ---------- Footer ---------- */
.site-footer { background: var(--ink); color: #E8DECB; padding: 4rem 0 2rem; margin-top: 2rem; position: relative; overflow: hidden; }
.site-footer::before { content: ""; position: absolute; right: -60px; top: -60px; width: 260px; height: 260px; border: 1.5px solid rgba(232, 137, 82, .3); border-radius: 36px; transform: rotate(22deg); }
.footer-top { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 2rem; position: relative; }
.site-footer .brand { color: var(--ivory); gap: .6rem; }
.site-footer .brand-text { font-size: 1.3rem; }
.site-footer .brand-mark { grid-template-columns: repeat(2, 12px); gap: 3px; }
.site-footer .brand-mark i { width: 12px; height: 12px; border-radius: 3px; }
.site-footer .brand-mark i:nth-child(2) { border-radius: 50%; }
.site-footer .brand-text em { color: #F2B08A; }
.site-footer h2 { font-size: 1rem; font-family: var(--sans); text-transform: uppercase; letter-spacing: .14em; color: #F2B08A; margin-bottom: 1rem; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.site-footer a { color: #EFE6D6; text-decoration: none; }
.site-footer a:hover { color: #fff; text-decoration: underline; }
.site-footer address { font-style: normal; font-size: .9rem; line-height: 1.7; margin-top: 1rem; color: #D8CDB8; }
.footer-brand p { font-size: .95rem; color: #D8CDB8; margin-top: 1rem; max-width: 40ch; }
.footer-notices { margin-top: 2.6rem; padding-top: 1.8rem; border-top: 1px solid rgba(247, 241, 229, .16); display: grid; gap: .9rem; font-size: .86rem; color: #D8CDB8; }
.footer-notices strong { color: #F2B08A; }
.footer-base { margin-top: 1.6rem; display: flex; flex-wrap: wrap; justify-content: space-between; gap: .6rem; font-size: .82rem; color: #BFB39D; }
.footer-base p { margin: 0; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: #EFE6D6; cursor: pointer; text-align: left; }
.link-btn:hover { text-decoration: underline; color: #fff; }

/* ---------- Cookie banner ---------- */
.cookie-banner { position: fixed; left: 1rem; right: 1rem; bottom: 1rem; z-index: 90; max-width: 560px; background: #FFFBF3; border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 1.3rem 1.4rem; display: none; }
.cookie-banner.show { display: block; animation: fadeUp .5s ease both; opacity: 0; transform: translateY(18px); }
.cookie-banner h2 { font-size: 1.25rem; margin-bottom: .4rem; padding-right: 2rem; }
.cookie-banner p { font-size: .9rem; color: var(--ink-soft); }
.cookie-actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.cookie-close { position: absolute; right: .8rem; top: .8rem; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line-strong); background: transparent; cursor: pointer; font-size: 1.2rem; color: var(--ink); }

/* ---------- Scroll reveal ---------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .8s ease, transform .8s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .nav-toggle { display: inline-flex; }
  .site-nav { display: none; position: absolute; top: calc(100% + .35rem); right: 0; width: min(250px, calc(100vw - 2.5rem)); background: #FFFBF3; border: 1px solid var(--line-strong); border-radius: 14px; box-shadow: var(--shadow-lg); padding: .4rem; z-index: 40; }
  .site-nav.open { display: block; animation: dropIn .2s ease both; }
  .site-nav ul { flex-direction: column; align-items: stretch; gap: .1rem; padding: 0; }
  .site-nav a { padding: .6rem .8rem; border-radius: 10px; font-size: .88rem; }
  .site-nav a.nav-cta { margin: .25rem 0 0; text-align: center; }
  .footer-top { grid-template-columns: 1fr 1fr; }
  .detail-layout, .article-layout { grid-template-columns: 1fr; }
  .detail-aside, .toc { position: static; }
}
@media (max-width: 900px) {
  .hero-grid, .page-hero-grid, .detail-hero { grid-template-columns: 1fr; }
  .hero-stage { min-height: 400px; max-width: 520px; width: 100%; margin-inline: auto; }
  .edit-grid > * { grid-column: span 12; }
  .card-grid.asym > :nth-child(5n + 1) { grid-column: auto; }
  .asym > :nth-child(5n + 1) .card-media { aspect-ratio: 16/10; }
  .layered .feature-image:nth-child(2) { position: relative; width: 70%; right: auto; bottom: auto; margin: -3rem 0 0 auto; }
}
@media (max-width: 640px) {
  body { font-size: 1rem; }
  .section-head { grid-template-columns: 1fr; }
  .form-grid, .two-col { grid-template-columns: 1fr; }
  .footer-top { grid-template-columns: 1fr; }
  .gallery { grid-template-columns: 1fr; grid-template-rows: auto; }
  .gallery figure:first-child { grid-row: auto; }
  .hero-stage { min-height: 340px; }
  .stage-note { display: none; }
  .card-specs { grid-template-columns: 1fr; }
  .card-grid { grid-template-columns: 1fr; }
}
@media (max-width: 380px) {
  .wrap { width: min(100% - 1.5rem, var(--wrap)); }
  .brand-text { font-size: 1rem; }
  .btn { width: 100%; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .hero-motif { animation: none; }
  .hero-title .mask > span, .reveal-item, .reveal { transform: none !important; opacity: 1 !important; }
  .move-lines path { stroke-dashoffset: 0 !important; }
  .move-lines circle { opacity: 1 !important; }
}