/* ===========================================================
   Knot Alone — design system
   Concept: a knot loosening. Warm, calm, dark-first, tactile.
   =========================================================== */

:root {
  /* brand */
  --ink: #120f1a;
  --ink-2: #1b1726;
  --ink-3: #251f33;
  --paper: #fbf7f2;
  --paper-2: #f2ece3;
  --rope: #e8b87d;      /* the thread */
  --rope-deep: #c98f4b;
  --calm: #8fd4c7;      /* resolution */
  --ache: #f08f8f;      /* feeling */
  --violet: #b9a6ff;

  /* semantic (dark is the default) */
  --bg: var(--ink);
  --bg-soft: var(--ink-2);
  --bg-card: #1e1929;
  --bg-elev: #262036;
  --fg: #f4f0ea;
  --fg-muted: #b6adc2;
  --fg-dim: #8b8299;
  --line: #342c45;
  --accent: var(--rope);
  --accent-fg: #2a1c08;
  --focus: var(--calm);

  /* type */
  --display: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --arabic: 'IBM Plex Sans Arabic', 'Noto Kufi Arabic', var(--sans);

  /* space + shape */
  --r-sm: 10px;
  --r: 18px;
  --r-lg: 28px;
  --r-pill: 999px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 40px -12px rgba(0, 0, 0, .55);
  --shadow-lift: 0 2px 4px rgba(0, 0, 0, .3), 0 28px 60px -20px rgba(0, 0, 0, .6);
  --gutter: clamp(1rem, 5vw, 2.5rem);
  --maxw: 1180px;
  --measure: 68ch;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
}

:root[data-theme='light'] {
  --bg: var(--paper);
  --bg-soft: var(--paper-2);
  --bg-card: #ffffff;
  --bg-elev: #ffffff;
  --fg: #1a1524;
  --fg-muted: #574e66;
  --fg-dim: #7b7289;
  --line: #e3d9cc;
  --accent: var(--rope-deep);
  --accent-fg: #fff8ee;
  --focus: #1f8f7c;
  --shadow: 0 1px 2px rgba(60, 40, 20, .06), 0 14px 34px -16px rgba(60, 40, 20, .18);
  --shadow-lift: 0 2px 6px rgba(60, 40, 20, .08), 0 28px 56px -22px rgba(60, 40, 20, .26);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme='dark']) {
    --bg: var(--paper);
    --bg-soft: var(--paper-2);
    --bg-card: #ffffff;
    --bg-elev: #ffffff;
    --fg: #1a1524;
    --fg-muted: #574e66;
    --fg-dim: #7b7289;
    --line: #e3d9cc;
    --accent: var(--rope-deep);
    --accent-fg: #fff8ee;
    --focus: #1f8f7c;
    --shadow: 0 1px 2px rgba(60, 40, 20, .06), 0 14px 34px -16px rgba(60, 40, 20, .18);
    --shadow-lift: 0 2px 6px rgba(60, 40, 20, .08), 0 28px 56px -22px rgba(60, 40, 20, .26);
  }
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: clamp(1rem, .96rem + .2vw, 1.075rem);
  line-height: 1.65;
  letter-spacing: -.005em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img, svg, video { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 2.5px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--accent); color: var(--accent-fg); }

/* ---------- type scale ---------- */
h1, h2, h3, h4, .display {
  font-family: var(--display);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -.025em;
  font-variation-settings: 'SOFT' 40, 'WONK' 1;
  text-wrap: balance;
}
h1 { font-size: clamp(2.3rem, 1.5rem + 4.2vw, 4.4rem); }
h2 { font-size: clamp(1.75rem, 1.3rem + 2.2vw, 2.8rem); }
h3 { font-size: clamp(1.25rem, 1.1rem + .8vw, 1.6rem); }
h4 { font-size: 1.1rem; letter-spacing: -.01em; }
p { text-wrap: pretty; }

.eyebrow {
  font-family: var(--sans);
  font-size: .76rem;
  font-weight: 650;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
}
.lede { font-size: clamp(1.1rem, 1rem + .5vw, 1.35rem); color: var(--fg-muted); line-height: 1.55; }
.muted { color: var(--fg-muted); }
.dim { color: var(--fg-dim); font-size: .9rem; }

/* ---------- layout ---------- */
.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }
.narrow { max-width: 760px; }
.section { padding-block: clamp(3.5rem, 8vw, 7rem); }
.section--tight { padding-block: clamp(2.5rem, 5vw, 4rem); }
.stack > * + * { margin-top: 1rem; }
.stack-lg > * + * { margin-top: 2rem; }
.grid { display: grid; gap: clamp(1rem, 2.5vw, 1.6rem); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 290px), 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 225px), 1fr)); }
.row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
.between { display: flex; flex-wrap: wrap; gap: 1rem; align-items: baseline; justify-content: space-between; }
.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--accent); color: var(--accent-fg); padding: .7rem 1.1rem; border-radius: 0 0 var(--r-sm) 0; font-weight: 600;
}
.skip:focus { left: 0; }

/* ---------- texture ---------- */
.grain::before {
  content: ''; position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

/* ---------- header ---------- */
.site-head {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(14px) saturate(1.4);
  background: color-mix(in oklab, var(--bg) 82%, transparent);
  border-bottom: 1px solid transparent;
  transition: border-color .3s, background .3s;
}
.site-head[data-stuck='true'] { border-bottom-color: var(--line); }
.site-head__inner { display: flex; align-items: center; gap: 1rem; min-height: 68px; }
.brand { display: inline-flex; align-items: center; gap: .6rem; font-family: var(--display); font-size: 1.22rem; font-weight: 600; letter-spacing: -.03em; }
.brand__mark { width: 30px; height: 30px; flex: none; color: var(--accent); }
.brand__mark path { transition: stroke-dashoffset .8s var(--ease-out); }
.brand:hover .brand__mark { animation: tug .5s var(--ease-out); }
@keyframes tug { 50% { transform: rotate(-8deg) scale(1.08); } }

.nav { margin-left: auto; display: flex; align-items: center; gap: .15rem; }
.nav a {
  position: relative; padding: .5rem .72rem; border-radius: var(--r-pill);
  font-size: .94rem; font-weight: 500; color: var(--fg-muted);
  transition: color .2s, background .2s;
}
.nav a:hover { color: var(--fg); background: color-mix(in oklab, var(--fg) 7%, transparent); }
.nav a[aria-current='page'] { color: var(--fg); font-weight: 600; }
.nav a[aria-current='page']::after {
  content: ''; position: absolute; left: .72rem; right: .72rem; bottom: .2rem; height: 2px;
  background: var(--accent); border-radius: 2px;
}
.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px; flex: none;
  background: transparent; border: 1px solid var(--line); border-radius: var(--r-pill); cursor: pointer;
  transition: border-color .2s, background .2s, transform .2s;
}
.icon-btn:hover { border-color: var(--accent); transform: translateY(-1px); }
.nav-toggle { display: none; }

@media (max-width: 860px) {
  .nav-toggle { display: inline-grid; margin-left: auto; }
  .nav {
    position: fixed; inset: 68px 0 auto; margin: 0; flex-direction: column; align-items: stretch; gap: .2rem;
    background: var(--bg-soft); border-bottom: 1px solid var(--line);
    padding: 1rem var(--gutter) 1.5rem; box-shadow: var(--shadow);
    transform: translateY(-120%); transition: transform .38s var(--ease-out); max-height: calc(100vh - 68px); overflow-y: auto;
  }
  .nav[data-open='true'] { transform: translateY(0); }
  .nav a { padding: .85rem .5rem; font-size: 1.05rem; }
  .nav a[aria-current='page']::after { left: .5rem; right: auto; width: 18px; bottom: .55rem; }
}

/* ---------- buttons ---------- */
.btn {
  --btn-bg: var(--accent); --btn-fg: var(--accent-fg);
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .85rem 1.35rem; border: 1px solid transparent; border-radius: var(--r-pill);
  background: var(--btn-bg); color: var(--btn-fg);
  font-weight: 620; font-size: .97rem; letter-spacing: -.01em; cursor: pointer;
  transition: transform .18s var(--ease-out), box-shadow .22s, background .2s, border-color .2s;
  box-shadow: 0 1px 0 color-mix(in oklab, #fff 28%, transparent) inset, 0 8px 22px -12px color-mix(in oklab, var(--accent) 80%, #000);
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 1px 0 color-mix(in oklab, #fff 28%, transparent) inset, 0 16px 34px -14px color-mix(in oklab, var(--accent) 85%, #000); }
.btn:active { transform: translateY(0); }
.btn--ghost { --btn-bg: transparent; --btn-fg: var(--fg); border-color: var(--line); box-shadow: none; }
.btn--ghost:hover { border-color: var(--accent); background: color-mix(in oklab, var(--accent) 10%, transparent); box-shadow: none; }
.btn--sm { padding: .55rem .95rem; font-size: .88rem; }
.btn--block { width: 100%; }

/* ---------- chips / tags ---------- */
.chip {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .35rem .75rem; border-radius: var(--r-pill);
  background: color-mix(in oklab, var(--fg) 7%, transparent);
  border: 1px solid var(--line);
  font-size: .8rem; font-weight: 550; color: var(--fg-muted);
  transition: border-color .2s, color .2s, background .2s;
}
a.chip:hover { color: var(--fg); border-color: var(--accent); }
.chip--accent { background: color-mix(in oklab, var(--accent) 16%, transparent); border-color: color-mix(in oklab, var(--accent) 45%, transparent); color: color-mix(in oklab, var(--accent) 72%, var(--fg)); }
.chip--calm { background: color-mix(in oklab, var(--calm) 15%, transparent); border-color: color-mix(in oklab, var(--calm) 40%, transparent); color: color-mix(in oklab, var(--calm) 70%, var(--fg)); }

/* ---------- hero ---------- */
.hero { position: relative; padding-block: clamp(3rem, 9vw, 6.5rem) clamp(2.5rem, 6vw, 4.5rem); overflow: hidden; }
.hero__glow {
  position: absolute; inset: -30% -10% auto; height: 120%; z-index: -1; pointer-events: none;
  background:
    radial-gradient(42% 46% at 18% 28%, color-mix(in oklab, var(--rope) 24%, transparent), transparent 70%),
    radial-gradient(38% 44% at 82% 18%, color-mix(in oklab, var(--violet) 20%, transparent), transparent 72%),
    radial-gradient(44% 40% at 62% 72%, color-mix(in oklab, var(--calm) 15%, transparent), transparent 72%);
  filter: blur(10px);
  animation: drift 24s ease-in-out infinite alternate;
}
@keyframes drift { to { transform: translate3d(2%, 2%, 0) scale(1.06); } }
.hero__grid { display: grid; gap: clamp(2rem, 5vw, 3.5rem); align-items: center; grid-template-columns: 1fr; }
@media (min-width: 940px) { .hero__grid { grid-template-columns: 1.08fr .92fr; } }
.hero h1 em { font-style: normal; color: var(--accent); position: relative; white-space: nowrap; }
.hero h1 em::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: .06em; height: .14em;
  background: currentColor; opacity: .22; border-radius: 99px;
}
.hero__art { position: relative; }
.knot-art { width: 100%; max-width: 440px; margin-inline: auto; overflow: visible; }
.knot-art .thread { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.knot-art .thread--main { stroke: var(--accent); stroke-width: 7; stroke-dasharray: 1400; stroke-dashoffset: 1400; animation: draw 2.6s var(--ease-out) .25s forwards; }
.knot-art .thread--calm { stroke: var(--calm); stroke-width: 4.5; opacity: .75; stroke-dasharray: 900; stroke-dashoffset: 900; animation: draw 2.4s var(--ease-out) .9s forwards; }
.knot-art .thread--ache { stroke: var(--ache); stroke-width: 3.5; opacity: .6; stroke-dasharray: 800; stroke-dashoffset: 800; animation: draw 2.2s var(--ease-out) 1.4s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.knot-art .pulse { animation: breathe 6s ease-in-out infinite; transform-origin: center; }
@keyframes breathe { 50% { transform: scale(1.035); } }

/* ---------- cards ---------- */
.card {
  position: relative; display: flex; flex-direction: column; gap: .7rem;
  padding: clamp(1.15rem, 2.4vw, 1.6rem);
  background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow);
  transition: transform .3s var(--ease-out), box-shadow .3s, border-color .3s;
  isolation: isolate; overflow: hidden;
}
.card::before {
  content: ''; position: absolute; inset: 0 0 auto; height: 3px; z-index: 1;
  background: linear-gradient(90deg, var(--accent), var(--violet) 55%, var(--calm));
  opacity: 0; transition: opacity .3s;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lift); border-color: color-mix(in oklab, var(--accent) 35%, var(--line)); }
.card:hover::before { opacity: 1; }
.card:focus-within { border-color: var(--accent); }
.card h3 a { background-image: linear-gradient(var(--accent), var(--accent)); background-size: 0 1.5px; background-repeat: no-repeat; background-position: 0 100%; transition: background-size .3s var(--ease-out); }
.card:hover h3 a { background-size: 100% 1.5px; }
.card__meta { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; font-size: .82rem; color: var(--fg-dim); margin-top: auto; }
.card__full { position: absolute; inset: 0; z-index: 2; }
.card--feature { gap: 1rem; padding: clamp(1.5rem, 3.5vw, 2.4rem); }

/* topic tiles */
.tile {
  position: relative; display: block; padding: 1.25rem 1.2rem 1.4rem; border-radius: var(--r);
  background: var(--bg-card); border: 1px solid var(--line); overflow: hidden;
  transition: transform .3s var(--ease-out), border-color .3s, box-shadow .3s;
}
.tile::after {
  content: ''; position: absolute; right: -40px; bottom: -40px; width: 130px; height: 130px; border-radius: 50%;
  background: radial-gradient(circle, var(--tile-tint, var(--accent)), transparent 68%); opacity: .22;
  transition: transform .45s var(--ease-out), opacity .3s;
}
.tile:hover { transform: translateY(-4px); border-color: color-mix(in oklab, var(--tile-tint, var(--accent)) 50%, var(--line)); box-shadow: var(--shadow-lift); }
.tile:hover::after { transform: scale(1.25) translate(-6px, -6px); opacity: .34; }
.tile__q { font-family: var(--display); font-size: 1.22rem; letter-spacing: -.02em; line-height: 1.15; margin-bottom: .4rem; }
.tile__a { font-size: .9rem; color: var(--fg-muted); position: relative; z-index: 1; }
.tile__go { margin-top: .9rem; font-size: .82rem; font-weight: 650; color: var(--tile-tint, var(--accent)); display: inline-flex; gap: .35rem; align-items: center; position: relative; z-index: 1; }
.tile:hover .tile__go svg { transform: translateX(3px); }
.tile__go svg { transition: transform .25s var(--ease-out); }

/* ---------- the untangler (interactive) ---------- */
.untangle { background: var(--bg-soft); border-block: 1px solid var(--line); }
.untangle__box {
  background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: clamp(1.4rem, 3.5vw, 2.4rem); box-shadow: var(--shadow); max-width: 740px; margin-inline: auto;
}
.loop-list { list-style: none; padding: 0; display: grid; gap: .55rem; }
.loop-list button {
  width: 100%; text-align: left; padding: .9rem 1.1rem; border-radius: var(--r-sm);
  background: color-mix(in oklab, var(--fg) 4%, transparent); border: 1px solid var(--line); cursor: pointer;
  font-size: .97rem; line-height: 1.4; transition: border-color .2s, background .2s, transform .2s;
  display: flex; gap: .7rem; align-items: center;
}
.loop-list button:hover { border-color: var(--accent); transform: translateX(3px); background: color-mix(in oklab, var(--accent) 8%, transparent); }
.loop-list button[aria-pressed='true'] { border-color: var(--accent); background: color-mix(in oklab, var(--accent) 14%, transparent); }
.loop-list .num { font-family: var(--display); font-size: .9rem; color: var(--accent); flex: none; width: 1.2em; }
.untangle__out { margin-top: 1.4rem; padding-top: 1.4rem; border-top: 1px dashed var(--line); }
.untangle__out[hidden] { display: none; }
.untangle__out h3 { margin-bottom: .5rem; }
.reveal-in { animation: revealIn .5s var(--ease-out) both; }
@keyframes revealIn { from { opacity: 0; transform: translateY(10px); } }

/* ---------- article ---------- */
.prose { max-width: var(--measure); }
.prose > * + * { margin-top: 1.15em; }
.prose h2 { margin-top: 2.4em; font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2rem); scroll-margin-top: 90px; }
.prose h3 { margin-top: 1.8em; scroll-margin-top: 90px; }
.prose h2 + p, .prose h3 + p { margin-top: .6em; }
.prose a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px; text-decoration-color: color-mix(in oklab, var(--accent) 45%, transparent); transition: text-decoration-color .2s; }
.prose a:hover { text-decoration-color: var(--accent); }
.prose ul, .prose ol { padding-left: 1.3em; display: grid; gap: .5em; }
.prose li::marker { color: var(--accent); }
.prose strong { color: var(--fg); font-weight: 650; }
.prose blockquote {
  margin-inline: 0; padding: .3em 0 .3em 1.3em; border-left: 3px solid var(--accent);
  font-family: var(--display); font-size: 1.15em; line-height: 1.4; color: var(--fg);
}
.prose code { font-size: .9em; background: color-mix(in oklab, var(--fg) 8%, transparent); padding: .15em .4em; border-radius: 5px; }
.prose hr { border: 0; height: 1px; background: var(--line); margin-block: 2.5em; }
.prose img { border-radius: var(--r); margin-block: 1.8em; }

.callout {
  padding: 1.1rem 1.25rem; border-radius: var(--r); border: 1px solid var(--line);
  background: color-mix(in oklab, var(--fg) 4%, transparent); border-left: 3px solid var(--accent);
}
.callout > * + * { margin-top: .6rem; }
.callout__title { font-weight: 650; font-size: .95rem; letter-spacing: -.01em; }
.callout--try { border-left-color: var(--calm); background: color-mix(in oklab, var(--calm) 8%, transparent); }
.callout--science { border-left-color: var(--violet); background: color-mix(in oklab, var(--violet) 8%, transparent); }
.callout--careful { border-left-color: var(--ache); background: color-mix(in oklab, var(--ache) 8%, transparent); }

/* answer-first box (AEO) */
.answer {
  padding: clamp(1.1rem, 2.5vw, 1.5rem); border-radius: var(--r);
  background: linear-gradient(135deg, color-mix(in oklab, var(--accent) 12%, var(--bg-card)), var(--bg-card));
  border: 1px solid color-mix(in oklab, var(--accent) 30%, var(--line));
}
.answer .eyebrow { margin-bottom: .45rem; display: block; }
.answer p { font-size: 1.06rem; line-height: 1.55; }

/* reading progress */
.progress { position: fixed; top: 0; left: 0; height: 3px; width: 100%; z-index: 60; background: transparent; pointer-events: none; }
.progress__bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--calm)); transition: width .1s linear; }

/* TOC */
.article-layout { display: grid; gap: clamp(2rem, 4vw, 3.5rem); }
@media (min-width: 1040px) { .article-layout { grid-template-columns: minmax(0, 1fr) 240px; align-items: start; } }
.toc { position: sticky; top: 92px; font-size: .9rem; display: none; }
@media (min-width: 1040px) { .toc { display: block; } }
.toc p { font-size: .74rem; letter-spacing: .13em; text-transform: uppercase; color: var(--fg-dim); font-weight: 650; margin-bottom: .7rem; }
.toc ol { list-style: none; padding: 0; display: grid; gap: .1rem; border-left: 1px solid var(--line); }
.toc a { display: block; padding: .35rem .8rem; color: var(--fg-dim); border-left: 2px solid transparent; margin-left: -1px; transition: color .2s, border-color .2s; }
.toc a:hover { color: var(--fg); }
.toc a[data-active='true'] { color: var(--accent); border-left-color: var(--accent); font-weight: 600; }

/* FAQ */
.faq { display: grid; gap: .7rem; }
details.qa {
  border: 1px solid var(--line); border-radius: var(--r); background: var(--bg-card); overflow: hidden;
  transition: border-color .25s;
}
details.qa[open] { border-color: color-mix(in oklab, var(--accent) 40%, var(--line)); }
details.qa summary {
  cursor: pointer; padding: 1.05rem 1.2rem; font-weight: 600; font-size: 1.02rem; letter-spacing: -.012em;
  display: flex; gap: .9rem; align-items: flex-start; list-style: none;
}
details.qa summary::-webkit-details-marker { display: none; }
details.qa summary::after {
  content: ''; flex: none; margin-left: auto; width: 11px; height: 11px; margin-top: .4rem;
  border-right: 2px solid var(--accent); border-bottom: 2px solid var(--accent);
  transform: rotate(45deg); transition: transform .3s var(--ease-out);
}
details.qa[open] summary::after { transform: rotate(-135deg); }
details.qa .qa__body { padding: 0 1.2rem 1.2rem; color: var(--fg-muted); }
details.qa .qa__body > * + * { margin-top: .7rem; }

/* ---------- download / resource rows ---------- */
.res {
  display: grid; gap: 1rem; grid-template-columns: auto 1fr auto; align-items: center;
  padding: 1.1rem 1.2rem; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg-card);
  transition: border-color .25s, transform .25s var(--ease-out), box-shadow .25s;
}
.res:hover { border-color: color-mix(in oklab, var(--accent) 40%, var(--line)); transform: translateY(-2px); box-shadow: var(--shadow); }
.res__icon { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; background: color-mix(in oklab, var(--accent) 16%, transparent); color: var(--accent); flex: none; }
.res h3 { font-size: 1.08rem; }
.res p { font-size: .9rem; color: var(--fg-muted); }
@media (max-width: 620px) { .res { grid-template-columns: auto 1fr; } .res > .btn { grid-column: 1 / -1; } }

/* ---------- novels ---------- */
.book { display: grid; gap: clamp(1.2rem, 3vw, 2.2rem); grid-template-columns: 1fr; align-items: start; }
@media (min-width: 720px) { .book { grid-template-columns: 220px 1fr; } }
.book__cover {
  aspect-ratio: 2 / 3; border-radius: 14px; overflow: hidden; position: relative;
  background: linear-gradient(160deg, var(--bg-elev), var(--bg-soft));
  border: 1px solid var(--line); box-shadow: var(--shadow-lift);
  display: grid; place-items: center; text-align: center; padding: 1.2rem;
  transition: transform .4s var(--ease-out);
}
.book__cover:hover { transform: rotate(-1.2deg) scale(1.02); }
.book__cover .t { font-family: var(--display); font-size: 1.25rem; line-height: 1.1; letter-spacing: -.02em; }
.book__cover .by { font-size: .74rem; letter-spacing: .16em; text-transform: uppercase; color: var(--fg-dim); margin-top: .8rem; }
.book__cover::after { content: ''; position: absolute; inset: 0; background: linear-gradient(115deg, transparent 40%, color-mix(in oklab, #fff 14%, transparent) 50%, transparent 60%); }
.trope-row { display: flex; flex-wrap: wrap; gap: .4rem; }

/* ---------- newsletter / readers line ---------- */
.line-card {
  position: relative; overflow: hidden; border-radius: var(--r-lg); padding: clamp(1.6rem, 4vw, 3rem);
  background: linear-gradient(145deg, color-mix(in oklab, var(--violet) 14%, var(--bg-card)), var(--bg-card) 60%);
  border: 1px solid color-mix(in oklab, var(--violet) 28%, var(--line));
}
.line-card::before {
  content: ''; position: absolute; right: -60px; top: -60px; width: 240px; height: 240px; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in oklab, var(--rope) 30%, transparent), transparent 70%);
}
.field { display: grid; gap: .4rem; }
.field label { font-size: .85rem; font-weight: 600; color: var(--fg-muted); }
.field input, .field textarea, .field select {
  padding: .8rem 1rem; border-radius: var(--r-sm); border: 1px solid var(--line);
  background: color-mix(in oklab, var(--bg) 60%, var(--bg-card)); transition: border-color .2s, box-shadow .2s;
}
.field input:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 22%, transparent); }
.form-row { display: flex; gap: .6rem; flex-wrap: wrap; }
.form-row .field { flex: 1 1 220px; }

/* ---------- saved (localStorage) ---------- */
.save-btn {
  display: inline-flex; align-items: center; gap: .4rem; padding: .4rem .8rem; border-radius: var(--r-pill);
  background: transparent; border: 1px solid var(--line); cursor: pointer; font-size: .82rem; font-weight: 600; color: var(--fg-muted);
  transition: border-color .2s, color .2s, background .2s;
}
.save-btn:hover { border-color: var(--accent); color: var(--fg); }
.save-btn[aria-pressed='true'] { border-color: var(--accent); background: color-mix(in oklab, var(--accent) 14%, transparent); color: var(--accent); }
.save-btn svg { width: 14px; height: 14px; }

/* ---------- misc ---------- */
.stat { display: grid; gap: .2rem; }
.stat__n { font-family: var(--display); font-size: clamp(1.8rem, 1.4rem + 1.6vw, 2.6rem); color: var(--accent); line-height: 1; }
.stat__l { font-size: .85rem; color: var(--fg-muted); }

.marquee { overflow: hidden; border-block: 1px solid var(--line); padding-block: .85rem; background: var(--bg-soft); mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); }
.marquee__track { display: flex; gap: 2.5rem; width: max-content; animation: slide 38s linear infinite; }
.marquee:hover .marquee__track { animation-play-state: paused; }
.marquee span { font-family: var(--display); font-size: 1rem; color: var(--fg-muted); white-space: nowrap; display: inline-flex; gap: 2.5rem; align-items: center; }
.marquee span::after { content: '◦'; color: var(--accent); }
@keyframes slide { to { transform: translateX(-50%); } }

.reveal { opacity: 0; transform: translateY(18px); }
.reveal[data-shown='true'] { opacity: 1; transform: none; transition: opacity .7s var(--ease-out), transform .7s var(--ease-out); }

/* footer */
.site-foot { border-top: 1px solid var(--line); background: var(--bg-soft); padding-block: clamp(2.5rem, 5vw, 4rem) 2rem; margin-top: clamp(3rem, 7vw, 6rem); }
.foot-grid { display: grid; gap: 2rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); }
.foot-grid h4 { font-family: var(--sans); font-size: .76rem; letter-spacing: .13em; text-transform: uppercase; color: var(--fg-dim); font-weight: 650; margin-bottom: .8rem; }
.foot-grid ul { list-style: none; padding: 0; display: grid; gap: .5rem; font-size: .93rem; }
.foot-grid a { color: var(--fg-muted); }
.foot-grid a:hover { color: var(--accent); }
.foot-bottom { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; font-size: .85rem; color: var(--fg-dim); }

/* breadcrumbs */
.crumbs { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; font-size: .84rem; color: var(--fg-dim); margin-bottom: 1.2rem; }
.crumbs a:hover { color: var(--accent); }
.crumbs svg { opacity: .5; }

/* pills nav for topic filtering */
.filter-bar { display: flex; gap: .5rem; flex-wrap: wrap; }
.filter-bar button { cursor: pointer; }
.filter-bar button[aria-pressed='true'] { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }

[dir='rtl'], .ar { font-family: var(--arabic); }

/* ---------- video (lazy facade: no YouTube code until clicked) ---------- */
.video {
  position: relative; aspect-ratio: 16 / 9; width: 100%; max-width: 100%;
  border-radius: var(--r); overflow: hidden; border: 1px solid var(--line);
  background: var(--bg-elev); box-shadow: var(--shadow); margin-block: 1.6em;
  cursor: pointer; display: block; isolation: isolate;
}
.video img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease-out), filter .4s; }
.video:hover img { transform: scale(1.03); filter: brightness(.82); }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video__play {
  position: absolute; inset: 0; display: grid; place-items: center; z-index: 2;
  background: linear-gradient(to top, rgba(10,8,14,.55), transparent 55%);
}
.video__play span {
  display: grid; place-items: center; width: 68px; height: 68px; border-radius: 50%;
  background: var(--accent); color: var(--accent-fg);
  box-shadow: 0 10px 30px -8px rgba(0,0,0,.6);
  transition: transform .25s var(--ease-out);
}
.video:hover .video__play span { transform: scale(1.09); }
.video__play svg { width: 26px; height: 26px; margin-left: 3px; }
.video__label {
  position: absolute; left: 14px; bottom: 12px; z-index: 3; display: flex; gap: .5rem; align-items: center;
  font-size: .82rem; font-weight: 600; color: #fff; text-shadow: 0 1px 6px rgba(0,0,0,.7);
}
.video__note { font-size: .84rem; color: var(--fg-dim); margin-top: -1em; margin-bottom: 1.8em; }
.ep { display: grid; gap: 1rem; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 680px) { .ep { grid-template-columns: 280px 1fr; } }
.ep .video { margin: 0; }
