/* ==========================================================================
   flexx — base: tokens, themes, reset, type, buttons, forms, utilities
   Two sides, one system. Every themed element reads CSS variables, so a
   section can flip to the other side with data-theme="core|cult".
   ========================================================================== */

:root {
  /* type */
  --f-core: 'Anybody', 'Arial Black', Impact, sans-serif;
  --f-cult: 'Pirata One', 'UnifrakturCook', Georgia, serif;
  --f-serif: 'IM Fell English', Georgia, 'Times New Roman', serif;
  --f-body: 'Archivo', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --f-mono: 'Martian Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;

  /* raw palette */
  --paper: #F1EFEA;
  --paper-2: #E8E5DE;
  --ink: #0E0E0E;
  --acid: #C9F23E;
  --void: #0B0A0A;
  --bone: #E8E2D6;
  --blood: #B0101C;
  --blood-hot: #E0192A;

  /* motion */
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-io: cubic-bezier(.76, 0, .24, 1);
  --ease-back: cubic-bezier(.34, 1.56, .64, 1);
  --ease-snap: cubic-bezier(.2, .9, .1, 1);

  /* layout */
  --gutter: clamp(16px, 2.2vw, 32px);
  --bar-h: 34px;
  --header-h: 64px;
  --radius: 2px;
  --z-header: 50;
  --z-drawer: 80;
  --z-modal: 90;
  --z-toast: 95;
  --z-cursor: 120;
  --z-transition: 200;
  --z-preloader: 300;
}

/* ---------------------------------------------------------------- themes */
:root,
[data-theme="core"] {
  --bg: var(--paper);
  --bg-2: #E8E5DE;
  --bg-3: #DCD8D0;
  --fg: var(--ink);
  --fg-2: #3A3835;
  --muted: #76726B;
  --line: rgba(14, 14, 14, .12);
  --line-2: rgba(14, 14, 14, .26);
  --accent: var(--acid);
  --accent-fg: var(--ink);
  --accent-text: #5E7A00;
  --card-core: #E3E0D9;
  --card-cult: #151414;
  --danger: #C21B1B;
  --ok: #2F7D32;
  --sel-bg: var(--acid);
  --sel-fg: var(--ink);
  /* display type recipe */
  --d-family: var(--f-core);
  --d-weight: 900;
  --d-style: italic;
  --d-case: uppercase;
  --d-track: -.015em;
  --d-lh: .84;
  --btn-clip: none;
  color-scheme: light;
}

[data-theme="cult"] {
  --bg: var(--void);
  --bg-2: #141313;
  --bg-3: #1E1C1C;
  --fg: var(--bone);
  --fg-2: #C4BDB0;
  --muted: #8E877C;
  --line: rgba(232, 226, 214, .12);
  --line-2: rgba(232, 226, 214, .26);
  --accent: var(--blood);
  --accent-fg: #F6F0E6;
  --accent-text: #E0474F;
  --card-core: #D8D4CC;
  --card-cult: #151414;
  --danger: #F0525C;
  --ok: #7FC77F;
  --sel-bg: var(--blood);
  --sel-fg: var(--bone);
  --d-family: var(--f-cult);
  --d-weight: 400;
  --d-style: normal;
  --d-case: none;
  --d-track: 0em;
  --d-lh: .9;
  --btn-clip: polygon(9px 0, 100% 0, 100% calc(100% - 9px), calc(100% - 9px) 100%, 0 100%, 0 9px);
  color-scheme: dark;
}

[data-theme] { color: var(--fg); }

/* ---------------------------------------------------------------- reset */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scrollbar-gutter: stable; }
body {
  min-height: 100svh;
  background: var(--bg);
  color: var(--fg);
  font: 400 16px/1.55 var(--f-body);
  font-variation-settings: 'wdth' 100;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
  transition: background-color .6s var(--ease-out), color .6s var(--ease-out);
}
img, svg, video, canvas, picture { display: block; max-width: 100%; }
img { height: auto; }
input, button, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }
h1, h2, h3, h4, h5, h6 { font-weight: inherit; font-size: inherit; line-height: inherit; }
p, h1, h2, h3, h4, h5, h6 { overflow-wrap: break-word; }
table { border-collapse: collapse; }
::selection { background: var(--sel-bg); color: var(--sel-fg); }
:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; }
[data-theme="core"] :focus-visible { outline-color: var(--ink); box-shadow: 0 0 0 5px var(--acid); }
[data-theme="cult"] :focus-visible { outline-color: var(--bone); box-shadow: 0 0 0 5px var(--blood); }
[hidden] { display: none !important; }

html.is-locked, html.is-locked body { overflow: hidden; }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border: 3px solid var(--bg); border-radius: 10px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------------------------------------------------------------- type */
.t-display {
  font-family: var(--d-family);
  font-weight: var(--d-weight);
  font-style: var(--d-style);
  text-transform: var(--d-case);
  letter-spacing: var(--d-track);
  line-height: var(--d-lh);
  font-variation-settings: 'wdth' var(--wdth, 78);
}
.t-core {
  font-family: var(--f-core); font-weight: 900; font-style: italic; text-transform: uppercase;
  letter-spacing: -.015em; line-height: .84; font-variation-settings: 'wdth' var(--wdth, 78);
}
.t-core-up { font-family: var(--f-core); font-weight: 800; text-transform: uppercase; letter-spacing: -.01em; line-height: .86; font-variation-settings: 'wdth' var(--wdth, 60); }
.t-cult { font-family: var(--f-cult); font-weight: 400; font-style: normal; text-transform: none; letter-spacing: 0; line-height: .9; }
.t-serif { font-family: var(--f-serif); font-style: italic; letter-spacing: -.005em; }
.t-mono, .label { font-family: var(--f-mono); font-variation-settings: 'wdth' 88; }
.label { font-size: 11px; line-height: 1.3; letter-spacing: .04em; text-transform: uppercase; font-weight: 400; }
.label--lg { font-size: 12px; }
.caps { font: 600 12px/1.2 var(--f-body); font-variation-settings: 'wdth' 78; letter-spacing: .09em; text-transform: uppercase; }
.muted { color: var(--muted); }

.t-mega { font-size: clamp(80px, 17vw, 300px); }
.t-xxl { font-size: clamp(64px, 12vw, 210px); }
.t-xl { font-size: clamp(52px, 8.6vw, 150px); }
.t-l { font-size: clamp(40px, 5.8vw, 96px); }
.t-m { font-size: clamp(30px, 3.6vw, 58px); }
.t-s { font-size: clamp(22px, 2.3vw, 34px); }
.t-xs { font-size: clamp(18px, 1.6vw, 22px); }
[data-theme="cult"] .t-display.t-mega, [data-theme="cult"] .t-display.t-xxl { letter-spacing: -.01em; }

.lede { font-size: clamp(17px, 1.35vw, 21px); line-height: 1.5; color: var(--fg-2); max-width: 46ch; }
.prose { max-width: 62ch; color: var(--fg-2); }
.prose p + p { margin-top: 1em; }
.prose h3 { font: 700 18px/1.3 var(--f-body); color: var(--fg); margin: 1.6em 0 .5em; }
.prose ul { padding-left: 1.2em; margin: .6em 0; }
.prose li + li { margin-top: .3em; }

/* ---------------------------------------------------------------- layout helpers */
.wrap { padding-inline: var(--gutter); }
.wrap-narrow { max-width: 1180px; margin-inline: auto; padding-inline: var(--gutter); }
.grid-12 { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gutter); }
.rule { border: 0; border-top: 1px solid var(--line); }
.row { display: flex; align-items: center; gap: 12px; }
.row--between { justify-content: space-between; }
.stack > * + * { margin-top: var(--stack, 16px); }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: fixed; left: 12px; top: -60px; z-index: 999; padding: 10px 16px; background: var(--acid); color: var(--ink); font: 700 13px var(--f-body); transition: top .3s; }
.skip:focus { top: 12px; }

section { position: relative; }
.section { padding-block: clamp(72px, 10vw, 160px); }
.section + .section { padding-top: clamp(8px, 2vw, 32px); }
.section--tight { padding-block: clamp(48px, 6vw, 96px); }

/* section heads: (01) index — title — link */
.shead { display: grid; grid-template-columns: auto 1fr auto; align-items: end; gap: 12px 24px; padding-bottom: 22px; margin-bottom: clamp(24px, 3vw, 44px); border-bottom: 1px solid var(--line); }
.shead__idx { font: 400 11px/1 var(--f-mono); letter-spacing: .04em; color: var(--muted); padding-bottom: .5em; align-self: start; }
.shead__title { margin: 0; }
.shead__aside { display: flex; align-items: center; gap: 18px; padding-bottom: .35em; }
@media (max-width: 720px) {
  .shead { grid-template-columns: 1fr auto; }
  .shead__idx { grid-column: 1 / -1; }
}

/* ---------------------------------------------------------------- links */
.ulink { position: relative; display: inline-flex; align-items: center; gap: .45em; padding-block: 2px; background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat; transition: background-size .5s var(--ease-out); }
.ulink:hover, .ulink:focus-visible { background-size: 100% 1px; }
.ulink--on { background-size: 100% 1px; }
.ulink--on:hover { background-position: 100% 100%; background-size: 0 1px; }
.arrow { display: inline-block; transition: transform .45s var(--ease-out); }
a:hover > .arrow, button:hover > .arrow, .ulink:hover .arrow { transform: translateX(4px); }

/* ---------------------------------------------------------------- buttons */
.btn {
  --h: 52px;
  position: relative;
  isolation: isolate;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: var(--h); padding: 0 26px;
  font: 700 12.5px/1 var(--f-body); font-variation-settings: 'wdth' 82; letter-spacing: .1em; text-transform: uppercase;
  color: var(--bg); background: var(--fg);
  border: 1px solid var(--fg);
  border-radius: var(--radius);
  clip-path: var(--btn-clip);
  overflow: hidden;
  white-space: nowrap;
  transition: color .35s var(--ease-out), border-color .35s, transform .35s var(--ease-out);
  user-select: none;
}
.btn::before {
  content: ''; position: absolute; inset: -1px; z-index: -1;
  background: var(--accent);
  transform: translateY(102%);
  transition: transform .55s var(--ease-out);
}
.btn:hover::before, .btn:focus-visible::before { transform: translateY(0); }
.btn:hover, .btn:focus-visible { color: var(--accent-fg); border-color: var(--accent); }
.btn:active { transform: scale(.975); }
.btn[disabled], .btn.is-disabled { opacity: .45; pointer-events: none; }

/* rolling label: text slides up and a copy slides in */
.roll { position: relative; display: inline-block; overflow: hidden; line-height: 1.2; vertical-align: middle; }
.roll > span { display: block; transition: transform .55s var(--ease-out); }
.roll > span::after { content: attr(data-t); position: absolute; left: 0; top: 100%; }
a:hover .roll > span, button:hover .roll > span, .btn:focus-visible .roll > span { transform: translateY(-100%); }

.btn--ghost { background: transparent; color: var(--fg); border-color: var(--line-2); }
.btn--ghost:hover { border-color: var(--accent); }
.btn--accent { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.btn--accent::before { background: var(--fg); }
.btn--accent:hover { color: var(--bg); border-color: var(--fg); }
.btn--sm { --h: 40px; padding: 0 16px; font-size: 11px; }
.btn--lg { --h: 60px; padding: 0 34px; font-size: 13px; }
.btn--block { width: 100%; }
.btn .ico { width: 18px; height: 18px; }

.iconbtn { position: relative; display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: inherit; transition: background-color .3s, transform .3s var(--ease-out); }
.iconbtn:hover { background: var(--line); }
.iconbtn:active { transform: scale(.92); }
.ico { width: 20px; height: 20px; stroke: currentColor; stroke-width: 1.5; fill: none; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ico--fill { fill: currentColor; stroke: none; }

.count {
  position: absolute; top: 3px; right: 1px; min-width: 17px; height: 17px; padding: 0 4px;
  display: grid; place-items: center; border-radius: 9px;
  background: var(--accent); color: var(--accent-fg);
  font: 600 9.5px/1 var(--f-mono);
  transform: scale(0); transition: transform .45s var(--ease-back);
}
.count.is-on { transform: scale(1); }
.count.is-bump { animation: bump .5s var(--ease-back); }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.5); } 100% { transform: scale(1); } }

/* chips / pills */
.chip {
  display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 14px;
  border: 1px solid var(--line-2); border-radius: 40px;
  font: 600 11.5px/1 var(--f-body); font-variation-settings: 'wdth' 84; letter-spacing: .06em; text-transform: uppercase;
  white-space: nowrap; transition: background-color .3s, color .3s, border-color .3s;
}
.chip:hover { border-color: var(--fg); }
.chip.is-on, .chip[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.chip .x { width: 12px; height: 12px; }

/* badges */
.badge {
  display: inline-flex; align-items: center; height: 22px; padding: 0 8px;
  font: 500 9.5px/1 var(--f-mono); letter-spacing: .05em; text-transform: uppercase;
  background: var(--fg); color: var(--bg);
}
.badge--acid { background: var(--acid); color: var(--ink); }
.badge--blood { background: var(--blood); color: var(--bone); }
.badge--line { background: transparent; color: inherit; border: 1px solid currentColor; }
.tag-line { font: 500 9.5px/1 var(--f-mono); letter-spacing: .08em; }
.tag-line--core { font-family: var(--f-core); font-weight: 900; font-style: italic; font-size: 12px; letter-spacing: 0; font-variation-settings: 'wdth' 90; }
.tag-line--cult { font-family: var(--f-cult); font-size: 15px; letter-spacing: .02em; }

/* ---------------------------------------------------------------- forms */
.field { position: relative; display: block; }
.field__label { display: block; margin-bottom: 8px; font: 500 10.5px/1.2 var(--f-mono); letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; height: 50px; padding: 0 16px;
  background: transparent; color: var(--fg);
  border: 1px solid var(--line-2); border-radius: var(--radius);
  font: 400 15px/1.2 var(--f-body);
  transition: border-color .25s, box-shadow .25s, background-color .25s;
  appearance: none;
}
.textarea { height: auto; min-height: 120px; padding: 14px 16px; resize: vertical; line-height: 1.5; }
.input::placeholder, .textarea::placeholder { color: var(--muted); opacity: .8; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--fg-2); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--fg); box-shadow: 0 0 0 3px var(--line); }
.select { padding-right: 40px; background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; cursor: pointer; }
.select option { background: var(--bg); color: var(--fg); }
.field.is-error .input, .field.is-error .select { border-color: var(--danger); }
.field__err { display: none; margin-top: 6px; font: 400 12px/1.3 var(--f-body); color: var(--danger); }
.field.is-error .field__err { display: block; }

.check { display: inline-flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 14px; line-height: 1.4; }
.check input { position: absolute; opacity: 0; pointer-events: none; }
.check__box { flex: none; width: 18px; height: 18px; margin-top: 1px; border: 1px solid var(--line-2); display: grid; place-items: center; transition: background-color .2s, border-color .2s; }
.check__box svg { width: 12px; height: 12px; stroke: var(--bg); stroke-width: 2.4; fill: none; opacity: 0; transform: scale(.4); transition: opacity .2s, transform .3s var(--ease-back); }
.check input:checked + .check__box { background: var(--fg); border-color: var(--fg); }
.check input:checked + .check__box svg { opacity: 1; transform: scale(1); }
.check input:focus-visible + .check__box { outline: 2px solid var(--fg); outline-offset: 2px; }
.check--radio .check__box { border-radius: 50%; }

/* inline form (newsletter-style) */
.iform { display: flex; align-items: stretch; border-bottom: 1px solid var(--fg); }
.iform .input { border: 0; height: 56px; padding-left: 0; font-size: 17px; box-shadow: none; }
.iform .input:focus { box-shadow: none; }
.iform__btn { display: inline-flex; align-items: center; gap: 8px; padding: 0 4px 0 16px; font: 700 12px/1 var(--f-body); font-variation-settings: 'wdth' 82; letter-spacing: .1em; text-transform: uppercase; white-space: nowrap; }

/* ---------------------------------------------------------------- grain + textures */
.grain {
  position: fixed; inset: -50%; z-index: 150; pointer-events: none;
  background: url('../img/textures/grain.webp') repeat;
  opacity: .05;
  animation: grain 1.2s steps(6) infinite;
}
[data-theme="cult"] .grain, html[data-theme="cult"] .grain { opacity: .08; }
@keyframes grain {
  0% { transform: translate(0, 0); } 17% { transform: translate(-7%, 5%); } 33% { transform: translate(4%, -9%); }
  50% { transform: translate(-3%, 8%); } 67% { transform: translate(9%, 2%); } 83% { transform: translate(-6%, -4%); } 100% { transform: translate(0, 0); }
}
.scratches::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: url('../img/textures/scratches.webp') center / 900px repeat;
  opacity: .16; mix-blend-mode: screen;
}

/* ---------------------------------------------------------------- reveal primitives (driven by motion.js) */
[data-reveal] { --d: 0ms; }
[data-reveal="up"] { opacity: 0; transform: translateY(40px); transition: opacity 1s var(--ease-out) var(--d), transform 1.2s var(--ease-out) var(--d); }
[data-reveal="fade"] { opacity: 0; transition: opacity 1.2s var(--ease-out) var(--d); }
[data-reveal="clip"] { clip-path: inset(100% 0 0 0); transition: clip-path 1.3s var(--ease-io) var(--d); }
[data-reveal="clip-x"] { clip-path: inset(0 100% 0 0); transition: clip-path 1.2s var(--ease-io) var(--d); }
[data-reveal="scale"] { opacity: 0; transform: scale(.92); transition: opacity 1s var(--ease-out) var(--d), transform 1.4s var(--ease-out) var(--d); }
[data-reveal].is-in { opacity: 1; transform: none; clip-path: inset(0 0 0 0); }
/* split lines */
.line-mask { display: block; overflow: hidden; padding-bottom: .06em; margin-bottom: -.06em; }
.line-mask > .line-in { display: block; transform: translateY(105%); transition: transform 1.15s var(--ease-out); transition-delay: calc(var(--d, 0ms) + var(--i, 0) * 80ms); }
.is-in .line-mask > .line-in, .line-mask.is-in > .line-in { transform: none; }
.char { display: inline-block; }
[data-split="chars"] .char { transform: translateY(110%) rotate(6deg); opacity: 0; transition: transform .9s var(--ease-out), opacity .6s; transition-delay: calc(var(--d, 0ms) + var(--i, 0) * 32ms); }
[data-split="chars"].is-in .char { transform: none; opacity: 1; }

/* ---------------------------------------------------------------- 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; }
  [data-reveal], .line-mask > .line-in, [data-split="chars"] .char { opacity: 1 !important; transform: none !important; clip-path: none !important; }
  .grain { animation: none; }
}
