/* ==========================================================================
   Zaika — Restaurant Discovery & Analytics
   Spice-market sketchbook: warm paper, hand-drawn ink, turmeric → chilli gradients
   ========================================================================== */

/* ----------------------------------------------------------------- tokens */
:root {
  color-scheme: light;
  --paper: #f6ecd9;
  --paper-2: #efe0c3;
  --card: #fffaf0;
  --card-2: #fbf1dd;
  --ink: #2a1a10;
  --ink-2: #57402f;
  --ink-3: #7a5f4b;
  --rule: rgba(42, 26, 16, 0.12);
  --rule-strong: rgba(42, 26, 16, 0.28);

  --turmeric: #e8a317;
  --saffron: #ef8a1d;
  --chilli: #c8341f;
  --cardamom: #5f8a2e;
  --cinnamon: #8c4a24;
  --kokum: #8a2a4f;

  --accent-text: #9a3a12;      /* readable accent for small text on paper */
  --grad-spice: linear-gradient(115deg, #f7c94a 0%, #f3a227 45%, #ec7f22 100%);
  --grad-chilli: linear-gradient(115deg, #ef8a1d 0%, #d4492a 55%, #a8283f 100%);
  --grad-leaf: linear-gradient(115deg, #a8c25a 0%, #6f9a33 55%, #4b7426 100%);
  --grad-ink: linear-gradient(115deg, #e8a317 0%, #c8341f 60%, #8a2a4f 100%);
  --hl: rgba(239, 138, 29, 0.42);

  --chart: #c8341f;
  --chart-2: #5f8a2e;
  --note: #fde7a6;
  --note-2: #f8d7c4;
  --note-3: #dfeab9;
  --tape: rgba(232, 163, 23, 0.5);
  --shadow: rgba(42, 26, 16, 0.9);
  --shadow-soft: rgba(42, 26, 16, 0.14);

  --band-excellent: #2f6b1f;
  --band-verygood: #4f7d24;
  --band-good: #7f8f1c;
  --band-average: #b46d06;
  --band-poor: #b3301c;
  --band-none: #8a7766;

  --grade-a: #3f7a22;
  --grade-b: #b46d06;
  --grade-c: #b3301c;

  --font-hand: "Kalam", "Comic Neue", "Segoe Print", cursive;
  --font-note: "Caveat", "Kalam", cursive;
  --font-body: "Mukta", ui-sans-serif, system-ui, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Consolas, monospace;

  --wobble-a: 255px 18px 225px 18px / 18px 225px 18px 255px;
  --wobble-b: 18px 225px 18px 255px / 255px 18px 225px 18px;
  --wobble-c: 225px 22px 255px 14px / 14px 255px 22px 225px;
  --wobble-pill: 120px 140px 110px 150px / 40px 34px 44px 30px;
  --wobble-circle: 52% 48% 55% 45% / 47% 55% 45% 53%;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #1b130e;
  --paper-2: #231912;
  --card: #2a1f17;
  --card-2: #322519;
  --ink: #f6e8d2;
  --ink-2: #dcc6a6;
  --ink-3: #b49c80;
  --rule: rgba(246, 232, 210, 0.12);
  --rule-strong: rgba(246, 232, 210, 0.3);

  --turmeric: #f2b21b;
  --saffron: #f59a3a;
  --chilli: #ff6f4f;
  --cardamom: #a3cc5d;
  --cinnamon: #d9925f;
  --kokum: #e0709a;

  --accent-text: #f7b65a;
  --hl: rgba(242, 178, 27, 0.32);

  --chart: #f2b21b;
  --chart-2: #a3cc5d;
  --note: #3d2e12;
  --note-2: #3e2219;
  --note-3: #2c3417;
  --tape: rgba(242, 178, 27, 0.35);
  --shadow: rgba(0, 0, 0, 0.75);
  --shadow-soft: rgba(0, 0, 0, 0.35);

  --band-excellent: #8fd36a;
  --band-verygood: #b6d65e;
  --band-good: #d6d05a;
  --band-average: #f2b21b;
  --band-poor: #ff7a5c;
  --band-none: #a8957f;

  --grade-a: #9bd36b;
  --grade-b: #f2b21b;
  --grade-c: #ff7a5c;
}

/* ------------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: 100px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh;
  background: var(--paper); color: var(--ink);
  font-family: var(--font-body); font-size: 17px; line-height: 1.55;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
  transition: background-color 0.5s var(--ease), color 0.5s var(--ease);
}
img, svg { display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
code, .mono { font-family: var(--font-mono); font-size: 0.82em; }
code { padding: 0.08em 0.4em; border-radius: 6px; background: var(--card-2); border: 1.5px dashed var(--rule-strong); }
strong { font-weight: 700; }
.muted { color: var(--ink-3); }
.small { font-size: 0.85rem; }
::selection { background: var(--hl); color: var(--ink); }

.container { width: min(1200px, 100% - 32px); margin-inline: auto; }
.ico { width: 20px; height: 20px; flex: none; }

.skip-link { position: fixed; left: 16px; top: -60px; z-index: 100; padding: 10px 16px; background: var(--turmeric); color: #2a1a10; font-weight: 700; text-decoration: none; border-radius: var(--wobble-a); transition: top 0.2s; }
.skip-link:focus { top: 16px; }
:focus-visible { outline: 2.5px dashed var(--chilli); outline-offset: 3px; }

/* hand-drawn box: irregular radii + ink border + offset shadow */
.sk {
  position: relative;
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: var(--wobble-a);
  box-shadow: 3px 4px 0 var(--shadow-soft);
}

/* ------------------------------------------------------------------ paper */
.paper { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.wash { position: absolute; border-radius: 50%; filter: blur(70px); opacity: 0.55; will-change: transform; animation: drift 30s ease-in-out infinite alternate; }
.wash-a { width: 52vmax; height: 52vmax; left: -16vmax; top: -18vmax; background: radial-gradient(circle, #f7c94a 0%, transparent 62%); }
.wash-b { width: 46vmax; height: 46vmax; right: -16vmax; top: 22vh; background: radial-gradient(circle, #ef8a3a 0%, transparent 62%); animation-delay: -10s; opacity: 0.4; }
.wash-c { width: 56vmax; height: 56vmax; left: 18vw; bottom: -34vmax; background: radial-gradient(circle, #a8c25a 0%, transparent 62%); animation-delay: -20s; opacity: 0.35; }
:root[data-theme="dark"] .wash { opacity: 0.22; }
@keyframes drift { 0% { translate: 0 0; } 50% { translate: 3vmax -2vmax; } 100% { translate: -2vmax 3vmax; } }
.dots { position: absolute; inset: 0; background-image: radial-gradient(var(--rule-strong) 1.1px, transparent 1.3px); background-size: 26px 26px; opacity: 0.45; }
.grain {
  position: absolute; inset: -50%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
  opacity: 0.09; mix-blend-mode: multiply;
}
:root[data-theme="dark"] .grain { mix-blend-mode: screen; opacity: 0.05; }

.scroll-progress { position: fixed; inset: 0 0 auto 0; height: 4px; z-index: 60; }
.scroll-progress span { display: block; height: 100%; transform-origin: 0 50%; transform: scaleX(0); background: var(--grad-ink); border-radius: 0 4px 4px 0; }

/* ---------------------------------------------------------------- buttons */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 46px; padding: 0 20px;
  border: 2px solid var(--ink); border-radius: var(--wobble-pill);
  background: var(--card); color: var(--ink);
  font-family: var(--font-hand); font-weight: 700; font-size: 1.05rem; letter-spacing: 0.01em; white-space: nowrap;
  box-shadow: 3px 3px 0 var(--shadow);
  cursor: pointer; user-select: none; text-decoration: none;
  transition: transform 0.25s var(--ease-spring), box-shadow 0.25s var(--ease), background-color 0.2s;
}
.btn:hover { transform: translate(-1px, -2px) rotate(-1deg); box-shadow: 5px 6px 0 var(--shadow); }
.btn:active { transform: translate(3px, 3px) rotate(0); box-shadow: 0 0 0 var(--shadow); transition-duration: 0.08s; }
.btn:disabled { opacity: 0.45; pointer-events: none; }
.btn .ico { transition: transform 0.35s var(--ease-spring); }
.btn:hover .ico { animation: wiggle 0.5s ease-in-out; }
.btn:hover .ico:last-child:not(:first-child) { animation: nudge 0.6s ease-in-out infinite; }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-14deg); } 75% { transform: rotate(10deg); } }
@keyframes nudge { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(4px); } }
.btn-primary { background: var(--grad-spice); color: #2a1a10; }
.btn-primary:hover { filter: saturate(1.15) brightness(1.03); }
.btn-danger { background: var(--chilli); color: #fffaf0; }
:root[data-theme="dark"] .btn-danger { color: #1b130e; }
.btn-sm { height: 40px; padding: 0 15px; font-size: 0.98rem; }

.icon-btn {
  display: grid; place-items: center; width: 42px; height: 42px;
  border: 2px solid var(--ink); border-radius: var(--wobble-circle); background: var(--card);
  box-shadow: 2px 2px 0 var(--shadow); cursor: pointer;
  transition: transform 0.4s var(--ease-spring), box-shadow 0.2s;
}
.icon-btn:hover { transform: rotate(-20deg) scale(1.06); box-shadow: 4px 4px 0 var(--shadow); }
.icon-btn:active { transform: scale(0.92); box-shadow: 0 0 0 var(--shadow); }
.ico-sun { display: none; }
:root[data-theme="dark"] .ico-sun { display: block; }
:root[data-theme="dark"] .ico-moon { display: none; }

.ripple { position: absolute; border-radius: 50%; pointer-events: none; background: currentColor; opacity: 0.18; transform: scale(0); animation: ripple 0.6s var(--ease) forwards; }
@keyframes ripple { to { transform: scale(1); opacity: 0; } }

/* --------------------------------------------------------------------- nav */
.nav { position: fixed; inset: 14px 0 auto 0; z-index: 50; pointer-events: none; }
.nav-inner {
  pointer-events: auto; width: min(1200px, 100% - 32px); margin-inline: auto;
  display: flex; align-items: center; gap: 14px; padding: 8px 10px 8px 16px;
  border-radius: var(--wobble-pill); background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  transition: box-shadow 0.3s, transform 0.4s var(--ease);
}
.nav.is-scrolled .nav-inner { box-shadow: 4px 5px 0 var(--shadow-soft); }
.brand { display: flex; align-items: center; gap: 6px; text-decoration: none; }
.brand-mark { width: 38px; height: 38px; transition: transform 0.8s var(--ease-spring); }
.brand-mark .chilli { fill: var(--chilli); stroke: var(--ink); stroke-width: 2.2; stroke-linejoin: round; }
.brand-mark .stem { fill: none; stroke: var(--cardamom); stroke-width: 3; stroke-linecap: round; }
.brand:hover .brand-mark { transform: rotate(-18deg) scale(1.08); }
.brand-word { font-family: var(--font-hand); font-weight: 700; font-size: 1.8rem; line-height: 1; letter-spacing: 0.01em; }
.nav-links { display: flex; gap: 2px; margin-inline: auto; }
.nav-links a {
  position: relative; padding: 6px 12px; text-decoration: none; font-family: var(--font-hand); font-size: 1.12rem; color: var(--ink-2);
  background: linear-gradient(var(--hl), var(--hl)) no-repeat 50% 82% / 0% 38%;
  transition: background-size 0.35s var(--ease), color 0.2s;
}
.nav-links a:hover, .nav-links a.is-active { color: var(--ink); background-size: 82% 38%; }
.nav-actions { display: flex; align-items: center; gap: 8px; }


/* -------------------------------------------------------------------- hero */
.hero { padding: 150px 0 40px; }
.hero-inner { position: relative; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 32px; align-items: center; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 10px; margin: 0 0 22px; padding: 4px 14px 4px 12px;
  border-radius: var(--wobble-pill); font-size: 0.88rem; color: var(--ink-2); box-shadow: 2px 2px 0 var(--shadow-soft);
}
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ink-3); }
.live-dot.is-live { background: var(--cardamom); animation: pulse 2s infinite; }
.live-dot.is-down { background: var(--chilli); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--cardamom) 60%, transparent); } 80%, 100% { box-shadow: 0 0 0 10px transparent; } }
.display { margin: 0; font-family: var(--font-hand); font-weight: 700; font-size: clamp(3rem, 7.4vw, 6.3rem); line-height: 1.02; letter-spacing: -0.01em; }
.marker {
  position: relative; white-space: nowrap; padding: 0 0.08em;
  background: var(--grad-ink); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.marker::after {
  content: ""; position: absolute; left: -2%; right: -2%; bottom: 0.2em; height: 0.3em; z-index: -1;
  background: var(--hl); border-radius: 40% 60% 50% 45% / 60% 40% 55% 45%;
  transform: scaleX(0) rotate(-1.5deg); transform-origin: left; transition: transform 0.9s var(--ease) 0.5s;
}
.display.is-in .marker::after, html:not(.js) .marker::after { transform: scaleX(1) rotate(-1.5deg); }
.hindi { margin: 10px 0 0; font-family: var(--font-hand); font-size: clamp(1.3rem, 2.4vw, 1.75rem); color: var(--accent-text); }
.lead { max-width: 54ch; margin: 18px 0 26px; color: var(--ink-2); font-size: clamp(1.02rem, 1.5vw, 1.15rem); }

.hero-search { display: flex; align-items: center; gap: 10px; max-width: 600px; padding: 7px 7px 7px 18px; border-radius: var(--wobble-pill); box-shadow: 4px 5px 0 var(--shadow); transition: transform 0.3s var(--ease), box-shadow 0.3s; }
.hero-search:focus-within { transform: translate(-1px, -2px) rotate(-0.4deg); box-shadow: 6px 7px 0 var(--shadow); }
.hero-search > .ico { color: var(--ink-3); }
.hero-search input { flex: 1; min-width: 0; height: 46px; border: 0; background: none; outline: none; font-size: 1.1rem; }
.hero-search input::placeholder { color: var(--ink-3); }

.scribble-note { display: flex; align-items: flex-end; gap: 4px; margin: 6px 0 0 36px; font-family: var(--font-note); font-size: 1.6rem; color: var(--chilli); line-height: 1; transform: rotate(-4deg); }
.scribble-note svg { width: 54px; height: 36px; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.scribble-note path, .doodle path, .scribble path { stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset 1.4s var(--ease) 0.3s; }
.scribble-note.is-in path, .doodle.is-in path, .scribble.is-in path, html:not(.js) .doodle path, html:not(.js) .scribble path, html:not(.js) .scribble-note path { stroke-dashoffset: 0; }

.quick-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 13px; cursor: pointer;
  border: 1.8px solid var(--ink); border-radius: var(--wobble-pill); background: var(--card);
  font-family: var(--font-hand); font-size: 1rem; color: var(--ink);
  box-shadow: 2px 2px 0 var(--shadow-soft);
  transition: transform 0.3s var(--ease-spring), box-shadow 0.2s, background-color 0.2s;
}
.chip:nth-child(3n+1) { transform: rotate(-1.2deg); }
.chip:nth-child(3n+2) { transform: rotate(0.8deg); }
.chip:hover { transform: rotate(0) translateY(-3px); box-shadow: 3px 4px 0 var(--shadow); background: var(--note); }
.chip small { font-family: var(--font-body); font-size: 0.72rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.06em; }
.chip[aria-selected="true"] { background: var(--ink); color: var(--paper); }

/* hero doodles + sticky notes */
.hero-art { position: relative; min-height: 440px; }
.doodle { position: absolute; fill: none; stroke: var(--ink); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; opacity: 0.75; }
.d-anise { width: 110px; right: 8%; top: -10px; stroke: var(--cinnamon); animation: spin 40s linear infinite; }
.d-leaf { width: 120px; left: 0; top: 52%; stroke: var(--cardamom); transform: rotate(-24deg); }
.d-bowl { width: 130px; right: 4%; bottom: -14px; stroke: var(--chilli); }
@keyframes spin { to { rotate: 360deg; } }
.note {
  position: absolute; padding: 16px 18px 18px; width: 250px;
  background: var(--note); color: var(--ink); border: 1.8px solid var(--ink);
  border-radius: 6px 14px 8px 18px / 16px 8px 14px 6px; box-shadow: 4px 6px 0 var(--shadow-soft);
  transition: transform 0.6s var(--ease), opacity 0.8s var(--ease); opacity: 0;
  animation: floaty 7s ease-in-out infinite;
}
.note::before { content: ""; position: absolute; top: -12px; left: 50%; width: 76px; height: 22px; background: var(--tape); transform: translateX(-50%) rotate(-4deg); }
.hero-art.is-ready .note { opacity: 1; }
.note-a { top: 30px; left: 8%; rotate: -3deg; animation-delay: -1s; }
.note-b { top: 205px; right: 2%; width: 230px; background: var(--note-2); rotate: 2.5deg; animation-delay: -3s; }
.note-c { top: 300px; left: 14%; width: 200px; background: var(--note-3); rotate: -1.5deg; animation-delay: -5s; }
@keyframes floaty { 0%, 100% { translate: 0 0; } 50% { translate: 0 -9px; } }
.note-eyebrow { margin: 0 0 6px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.note-title { margin: 0; font-family: var(--font-hand); font-weight: 700; font-size: 1.35rem; line-height: 1.15; }
.note-sub { margin: 4px 0 0; font-size: 0.85rem; color: var(--ink-2); }
.note-big { margin: 6px 0 0; font-family: var(--font-hand); font-weight: 700; font-size: 2.3rem; line-height: 1; color: var(--chilli); }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin-top: 58px; }
.stat {
  position: relative; display: flex; flex-direction: column; gap: 2px; padding: 20px 22px;
  border: 2px solid var(--ink); border-radius: var(--wobble-b); background: var(--card);
  box-shadow: 4px 5px 0 var(--shadow-soft);
}
.stat:nth-child(1) { rotate: -1deg; } .stat:nth-child(2) { rotate: 0.7deg; } .stat:nth-child(3) { rotate: -0.4deg; } .stat:nth-child(4) { rotate: 1deg; }
.stat::after { content: ""; position: absolute; left: 22px; right: 40%; bottom: 14px; height: 6px; border-radius: 6px; background: var(--grad-spice); opacity: 0.85; }
.stat:nth-child(2)::after { background: var(--grad-chilli); }
.stat:nth-child(3)::after { background: var(--grad-leaf); }
.stat:nth-child(4)::after { background: var(--grad-ink); }
.stat-value { font-family: var(--font-hand); font-weight: 700; font-size: clamp(2rem, 3.6vw, 2.8rem); line-height: 1.05; }
.stat-label { color: var(--ink-3); font-size: 0.9rem; margin-bottom: 12px; }

/* ---------------------------------------------------------------- sections */
.section { padding: 90px 0; }
.section-head { display: grid; grid-template-columns: auto 1fr; gap: 22px; align-items: start; margin-bottom: 30px; }
.section-index {
  display: grid; place-items: center; width: 52px; height: 52px; margin-top: 24px;
  font-family: var(--font-hand); font-weight: 700; font-size: 1.3rem; color: var(--accent-text);
  border: 2px solid var(--ink); border-radius: var(--wobble-circle); background: var(--note); rotate: -6deg;
}
.section-hindi { margin: 0; font-family: var(--font-hand); font-size: 1.3rem; color: var(--accent-text); }
.section-title { margin: 0; font-family: var(--font-hand); font-weight: 700; font-size: clamp(2.4rem, 5vw, 3.8rem); line-height: 1.05; }
.scribble { width: min(340px, 70%); height: 20px; margin-top: 2px; fill: none; stroke: var(--chilli); stroke-width: 3.5; stroke-linecap: round; }
.section-sub { margin: 12px 0 0; max-width: 64ch; color: var(--ink-2); }

.word { display: inline-block; overflow: hidden; vertical-align: bottom; padding-bottom: 0.1em; }
.js .word > span { display: inline-block; transform: translateY(110%) rotate(6deg); transition: transform 0.85s var(--ease); transition-delay: calc(var(--i) * 80ms); }
.section-title.is-in .word > span { transform: none; }

.js [data-reveal] { opacity: 0; transform: translateY(26px) rotate(-0.6deg); transition: opacity 0.85s var(--ease), transform 0.85s var(--ease); transition-delay: var(--d, 0ms); }
.js [data-reveal].is-in { opacity: 1; transform: none; }

/* ---------------------------------------------------------------- filters */
.filters, .viz-filters { display: grid; gap: 14px 16px; padding: 20px 22px; border-radius: var(--wobble-c); box-shadow: 4px 5px 0 var(--shadow-soft); }
.filters { grid-template-columns: repeat(6, minmax(0, 1fr)); align-items: end; }
.filters .f-2 { grid-column: span 2; }
.filters .f-1 { grid-column: span 1; }
.filters .f-row { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 18px; padding-top: 10px; border-top: 1.5px dashed var(--rule-strong); }
.filters .f-toggles { display: flex; flex-wrap: wrap; gap: 10px 22px; }
.viz-filters { grid-template-columns: repeat(2, minmax(160px, 260px)) 1fr; align-items: end; margin-bottom: 22px; }
.viz-note { margin: 0; justify-self: end; color: var(--ink-3); font-size: 0.9rem; }

.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; margin: 0; padding: 0; border: 0; }
.field > span:not(.input-wrap), .field-label { font-family: var(--font-hand); font-weight: 700; font-size: 1rem; color: var(--ink-2); }
.field small { font-family: var(--font-body); font-weight: 400; font-size: 0.78rem; color: var(--ink-3); }
.field input, .field select, .field textarea {
  width: 100%; height: 44px; padding: 0 14px;
  border: 1.8px solid var(--ink); border-radius: var(--wobble-pill); background: var(--card-2); outline: none;
  transition: box-shadow 0.2s, transform 0.2s, background-color 0.2s;
}
.field select { appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6.6 9.4c1.8 1.9 3.6 3.7 5.4 5.6 1.9-1.8 3.7-3.7 5.6-5.5' fill='none' stroke='%23b49c80' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 20px; }
.field select option { background: var(--card); color: var(--ink); }
.field input:focus, .field select:focus, .field textarea:focus { background-color: var(--card); box-shadow: 3px 3px 0 var(--turmeric); transform: translate(-1px, -1px); }
.field input::placeholder { color: var(--ink-3); opacity: 0.85; }
.field input[aria-invalid="true"] { border-color: var(--chilli); box-shadow: 3px 3px 0 var(--chilli); }
.input-wrap { position: relative; display: block; }
.input-wrap .ico { position: absolute; left: 13px; top: 50%; translate: 0 -50%; color: var(--ink-3); pointer-events: none; }
.input-wrap input { padding-left: 42px; }

.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-family: var(--font-hand); font-size: 1.05rem; color: var(--ink-2); user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { position: relative; width: 46px; height: 26px; border: 2px solid var(--ink); border-radius: var(--wobble-pill); background: var(--card-2); transition: background-color 0.3s; }
.switch-track::after { content: ""; position: absolute; top: 2px; left: 3px; width: 16px; height: 16px; border: 2px solid var(--ink); border-radius: var(--wobble-circle); background: var(--card); transition: transform 0.4s var(--ease-spring), background-color 0.3s; }
.switch input:checked + .switch-track { background: var(--grad-leaf); }
.switch input:checked + .switch-track::after { transform: translateX(19px) rotate(180deg); background: var(--note); }
.switch input:focus-visible + .switch-track { outline: 2.5px dashed var(--chilli); outline-offset: 3px; }

/* ---------------------------------------------------------------- results */
.results-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; margin: 26px 4px 22px; }
.results-meta p { margin: 0; color: var(--ink-2); }
.results-meta strong { color: var(--ink); }
.plan-chip { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 4px 12px; border-radius: var(--wobble-pill); font-family: var(--font-mono); font-size: 0.74rem !important; color: var(--ink-2); box-shadow: 2px 2px 0 var(--shadow-soft); }
.plan-chip .tag-ix { color: var(--cardamom); font-weight: 700; }
.plan-chip .tag-scan { color: var(--chilli); font-weight: 700; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 24px 20px; transition: opacity 0.3s; }
.cards.is-loading { opacity: 0.45; pointer-events: none; }
.card {
  --r: -0.6deg;
  position: relative; display: flex; flex-direction: column; gap: 12px; padding: 18px 18px 16px;
  border: 2px solid var(--ink); border-radius: var(--wobble-a); background: var(--card);
  box-shadow: 4px 5px 0 var(--shadow-soft); cursor: pointer; text-align: left;
  opacity: 0; transform: translateY(18px) rotate(calc(var(--r) * 3));
  animation: card-in 0.75s var(--ease) forwards; animation-delay: calc(var(--i) * 50ms);
  transition: transform 0.35s var(--ease-spring), box-shadow 0.3s;
}
.card:nth-child(3n+2) { --r: 0.55deg; border-radius: var(--wobble-b); }
.card:nth-child(3n) { --r: -0.25deg; border-radius: var(--wobble-c); }
@keyframes card-in { to { opacity: 1; transform: rotate(var(--r)); } }
.card:hover { transform: rotate(0) translateY(-5px); box-shadow: 7px 9px 0 var(--shadow); }
.card:active { transform: rotate(0) translate(2px, 2px); box-shadow: 2px 2px 0 var(--shadow); }
.card:nth-child(4n+1)::before { content: ""; position: absolute; top: -11px; left: 50%; width: 64px; height: 20px; background: var(--tape); transform: translateX(-50%) rotate(-3deg); }
.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.card h3 { margin: 0; font-family: var(--font-hand); font-weight: 700; font-size: 1.28rem; line-height: 1.2; }
.card-sub { margin: 2px 0 0; color: var(--ink-2); font-size: 0.92rem; }
.card-address { display: flex; gap: 6px; margin: 0; color: var(--ink-3); font-size: 0.88rem; }
.card-address .ico { width: 16px; height: 16px; margin-top: 3px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 0 9px; border: 1.5px solid var(--rule-strong); border-radius: var(--wobble-pill); font-size: 0.78rem; font-weight: 600; color: var(--ink-2); background: var(--card-2); }
.tag .ico { width: 14px; height: 14px; }
.tag-good { color: var(--band-excellent); border-color: currentColor; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; padding-top: 12px; border-top: 1.5px dashed var(--rule-strong); font-size: 0.84rem; color: var(--ink-3); }
.card-foot b { font-family: var(--font-hand); font-size: 1.1rem; color: var(--ink); }

/* rating / grade badge: hand-drawn circle with the value always written inside */
.badge {
  --c: var(--band-none);
  display: grid; place-items: center; flex: none; width: 50px; height: 50px;
  border: 2.4px solid var(--c); border-radius: var(--wobble-circle); color: var(--c);
  background: color-mix(in srgb, var(--c) 10%, var(--card));
  font-family: var(--font-hand); font-weight: 700; font-size: 1.15rem; line-height: 1; rotate: -4deg; text-align: center;
}
.badge small { display: none; font-family: var(--font-body); font-size: 0.55rem; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase; }
.badge-sm { width: 34px; height: 34px; font-size: 0.92rem; }
.badge-lg { width: 82px; height: 82px; font-size: 1.9rem; }
.badge-lg small { display: block; margin-top: 2px; }
.badge[data-band="Excellent"] { --c: var(--band-excellent); }
.badge[data-band="Very Good"] { --c: var(--band-verygood); }
.badge[data-band="Good"] { --c: var(--band-good); }
.badge[data-band="Average"] { --c: var(--band-average); }
.badge[data-band="Poor"] { --c: var(--band-poor); }
.badge[data-grade="A"] { --c: var(--grade-a); }
.badge[data-grade="B"] { --c: var(--grade-b); }
.badge[data-grade="C"] { --c: var(--grade-c); }

.skeleton { height: 210px; border: 2px dashed var(--rule-strong); border-radius: var(--wobble-a); background: var(--card-2); position: relative; overflow: hidden; }
.skeleton::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 20%, color-mix(in srgb, var(--turmeric) 22%, transparent) 50%, transparent 80%); animation: shimmer 1.4s infinite; }
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.empty { grid-column: 1 / -1; padding: 50px 24px; text-align: center; color: var(--ink-2); border: 2px dashed var(--rule-strong); border-radius: var(--wobble-a); background: var(--card); }
.empty h3 { margin: 0 0 4px; font-family: var(--font-hand); font-size: 2rem; color: var(--ink); }

.pager { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 30px; }
.pager-info { font-family: var(--font-hand); font-size: 1.1rem; color: var(--ink-2); }

/* --------------------------------------------------------------- analytics */
.scope-tag { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border: 1.6px solid var(--accent-text); border-radius: var(--wobble-pill); font-family: var(--font-hand); font-weight: 700; font-size: 0.85rem; color: var(--accent-text); rotate: 2deg; }
.viz-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.viz-card { display: flex; flex-direction: column; gap: 12px; padding: 20px 22px; min-width: 0; border-radius: var(--wobble-b); box-shadow: 5px 6px 0 var(--shadow-soft); }
.viz-card:nth-child(even) { border-radius: var(--wobble-c); }
.viz-wide { grid-column: 1 / -1; }
.viz-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.viz-head h3 { margin: 0; font-family: var(--font-hand); font-weight: 700; font-size: 1.5rem; line-height: 1.15; }
.viz-head p { margin: 2px 0 0; color: var(--ink-3); font-size: 0.9rem; }
.viz-tabs, .mini-toggle { display: inline-flex; gap: 2px; padding: 3px; border: 1.8px solid var(--ink); border-radius: var(--wobble-pill); background: var(--card-2); align-self: flex-start; flex: none; }
.viz-tabs button, .mini-toggle button {
  height: 30px; padding: 0 12px; border: 0; border-radius: var(--wobble-pill); background: none; cursor: pointer;
  font-family: var(--font-hand); font-weight: 700; font-size: 0.95rem; color: var(--ink-3); transition: background-color 0.2s, color 0.2s;
}
.viz-tabs button:hover, .mini-toggle button:hover { color: var(--ink); }
.viz-tabs button[aria-selected="true"], .mini-toggle button.is-on { background: var(--ink); color: var(--paper); }
.viz-body { position: relative; min-height: 120px; transition: opacity 0.3s; }
.viz-body.is-loading { opacity: 0.45; }

.bars { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0; list-style: none; }
.bar-row { display: grid; grid-template-columns: minmax(96px, 34%) 1fr auto; align-items: center; gap: 12px; padding: 4px 8px; margin: 0 -8px; border-radius: var(--wobble-pill); transition: background-color 0.2s; }
.bar-row:hover, .bar-row:focus-visible { background: color-mix(in srgb, var(--turmeric) 16%, transparent); }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.95rem; color: var(--ink-2); }
.bar-track { position: relative; display: block; height: 20px; }
.bar-track::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 1.5px dashed var(--rule-strong); }
.bar-draw { position: absolute; inset: 0; transform-origin: 0 50%; transform: scaleX(0); transition: transform 1.1s var(--ease); transition-delay: calc(var(--i) * 60ms); }
.is-drawn .bar-draw, .bar-draw.is-static { transform: scaleX(1); }
.bar-draw svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.bar-fallback { position: absolute; left: 0; top: 3px; bottom: 3px; width: var(--w); border: 1.8px solid var(--ink); border-radius: 3px 8px 6px 2px; background: repeating-linear-gradient(-45deg, var(--chart) 0 3px, transparent 3px 7px); }
.has-rough .bar-fallback { display: none; }
.bar-value { font-family: var(--font-hand); font-weight: 700; font-size: 1.05rem; min-width: 4ch; text-align: right; }

.cols { position: relative; }
.cols svg { width: 100%; height: auto; overflow: visible; }
.cols .axis-label { fill: var(--ink-3); font-size: 13px; font-family: var(--font-hand); }
.cols .grid-line { stroke: var(--rule-strong); stroke-width: 1; stroke-dasharray: 3 5; }
.cols .col-g { transform-origin: center bottom; transform-box: fill-box; transform: scaleY(0); transition: transform 1.1s var(--ease); transition-delay: calc(var(--i) * 90ms); }
.is-drawn .cols .col-g, .cols.is-drawn .col-g { transform: scaleY(1); }
.cols .col-hit { fill: transparent; }
.cols .col-fallback { fill: var(--chart); stroke: var(--ink); stroke-width: 1.6; }
.has-rough .cols .col-fallback { display: none; }
.cols .col-value { fill: var(--ink); font-size: 15px; font-family: var(--font-hand); font-weight: 700; }

.tooltip {
  position: fixed; z-index: 80; pointer-events: none; padding: 8px 12px; max-width: 260px;
  background: var(--note); color: var(--ink); border: 1.8px solid var(--ink); border-radius: var(--wobble-a);
  box-shadow: 3px 4px 0 var(--shadow-soft); font-size: 0.86rem;
  opacity: 0; transform: translateY(4px) rotate(-1deg); transition: opacity 0.15s, transform 0.15s;
}
.tooltip.is-on { opacity: 1; transform: rotate(-1deg); }
.tooltip b { display: block; font-family: var(--font-hand); font-size: 1.05rem; }
.tooltip span { color: var(--ink-2); }

.data-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.data-table th, .data-table td { padding: 8px 10px; text-align: left; border-bottom: 1.5px dashed var(--rule-strong); }
.data-table th { font-family: var(--font-hand); font-weight: 700; font-size: 1rem; color: var(--ink-2); }
.data-table td.num, .data-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table tbody tr:hover { background: color-mix(in srgb, var(--turmeric) 14%, transparent); }
.data-table tr.is-link { cursor: pointer; }
.table-scroll { overflow-x: auto; }

.code {
  margin: 0; max-height: 360px; overflow: auto; padding: 16px; border: 1.8px dashed var(--rule-strong); border-radius: 12px;
  background: var(--card-2); font-family: var(--font-mono); font-size: 0.78rem; line-height: 1.65; color: var(--ink-2); white-space: pre;
}
.code .k { color: var(--cinnamon); }
.code .s { color: var(--cardamom); }
.code .n { color: var(--accent-text); }
.code .op { color: var(--chilli); font-weight: 500; }

.rank-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 18px; margin: 0; padding: 0; list-style: none; }
.rank { display: grid; grid-template-columns: 34px 1fr auto auto; align-items: center; gap: 12px; padding: 8px 10px; border: 1.8px solid transparent; border-radius: var(--wobble-pill); cursor: pointer; transition: background-color 0.2s, border-color 0.2s, transform 0.3s var(--ease-spring); }
.rank:hover { background: var(--card-2); border-color: var(--ink); transform: rotate(-0.6deg) translateX(3px); }
.rank-no { font-family: var(--font-hand); font-weight: 700; font-size: 1.25rem; color: var(--accent-text); }
.rank-name { min-width: 0; }
.rank-name b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-hand); font-size: 1.1rem; }
.rank-name span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.82rem; color: var(--ink-3); }
.rank-meta { font-size: 0.82rem; color: var(--ink-3); text-align: right; }

/* ----------------------------------------------------------------- indexes */
.index-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.index-toolbar p { margin: 0; color: var(--ink-2); }
.index-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(262px, 1fr)); gap: 20px; margin-bottom: 26px; }
.index-card {
  position: relative; display: flex; flex-direction: column; gap: 10px; padding: 14px 18px 18px;
  border: 2px solid var(--ink); border-radius: 4px 10px 6px 12px / 10px 4px 12px 6px;
  background:
    linear-gradient(var(--chilli), var(--chilli)) 0 44px / 100% 2px no-repeat,
    repeating-linear-gradient(var(--card) 0 25px, var(--rule) 25px 26px) 0 46px / 100% calc(100% - 46px) no-repeat,
    var(--card);
  box-shadow: 4px 5px 0 var(--shadow-soft);
  transition: transform 0.35s var(--ease-spring), box-shadow 0.3s;
}
.index-card:nth-child(odd) { rotate: -0.8deg; }
.index-card:nth-child(even) { rotate: 0.6deg; }
.index-card:hover { transform: translateY(-4px) rotate(0.6deg); box-shadow: 6px 8px 0 var(--shadow); }
.index-name { margin: 0; min-height: 28px; font-family: var(--font-mono); font-size: 0.8rem; font-weight: 500; color: var(--ink); word-break: break-all; }
.index-keys { display: flex; flex-wrap: wrap; gap: 6px; }
.key-pill { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border: 1.5px solid var(--ink); border-radius: var(--wobble-pill); background: var(--card-2); font-family: var(--font-mono); font-size: 0.74rem; }
.key-pill i { font-style: normal; color: var(--cardamom); font-weight: 700; }
.index-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.itag { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border: 1.5px solid currentColor; border-radius: var(--wobble-pill); font-family: var(--font-hand); font-weight: 700; font-size: 0.82rem; color: var(--ink-3); background: var(--card); }
.itag-compound { color: var(--accent-text); }
.itag-unique { color: var(--kokum); }
.itag-multikey { color: var(--cardamom); }
.index-purpose { margin: 0; color: var(--ink-2); font-size: 0.9rem; line-height: 26px; }

.lab { padding: 24px; border-radius: var(--wobble-c); box-shadow: 5px 6px 0 var(--shadow-soft); }
.lab-head h3 { margin: 0; font-family: var(--font-hand); font-weight: 700; font-size: 2.1rem; line-height: 1.1; }
.lab-head p { margin: 2px 0 0; color: var(--ink-3); }
.lab-presets { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 18px; }
.lab-headline { margin: 0 0 16px; font-family: var(--font-hand); font-size: clamp(1.2rem, 2.2vw, 1.55rem); line-height: 1.35; }
.lab-headline em { font-style: normal; color: var(--chilli); font-weight: 700; }
.lab-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.plan { padding: 16px 18px; border: 2px solid var(--ink); border-radius: var(--wobble-b); background: var(--card-2); }
.plan h4 { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-family: var(--font-hand); font-size: 1.15rem; }
.plan h4 .dot { width: 12px; height: 12px; border: 2px solid var(--ink); border-radius: var(--wobble-circle); background: var(--cardamom); }
.plan.is-scan h4 .dot { background: var(--chilli); }
.stages { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 12px; }
.stage { padding: 1px 9px; border: 1.6px solid var(--ink); border-radius: var(--wobble-pill); background: var(--card); font-family: var(--font-mono); font-size: 0.74rem; }
.stage.ix { color: var(--cardamom); border-color: var(--cardamom); font-weight: 700; }
.stage.scan { color: var(--chilli); border-color: var(--chilli); font-weight: 700; }
.stage-arrow { font-family: var(--font-hand); color: var(--ink-3); }
.metrics { display: grid; gap: 6px; margin: 0; }
.metric { display: grid; grid-template-columns: minmax(110px, auto) 1fr auto; align-items: center; gap: 12px; font-size: 0.9rem; }
.metric dt { color: var(--ink-3); white-space: nowrap; }
.metric dd { margin: 0; text-align: right; font-family: var(--font-hand); font-weight: 700; font-size: 1.1rem; }
.metric .bar-track { height: 16px; }
.lab-filter { margin-top: 14px; }
.lab-filter summary { cursor: pointer; font-family: var(--font-hand); color: var(--ink-2); }
.hint { margin: 4px 0 0; font-size: 0.82rem; color: var(--ink-3); }

/* ------------------------------------------------------------------ footer */
.footer { padding: 54px 0 64px; margin-top: 40px; border-top: 2px dashed var(--rule-strong); }
.footer-inner { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.footer p { margin: 0 0 4px; }
.footer-brand { font-family: var(--font-hand); font-weight: 700; font-size: 2.6rem !important; line-height: 1; margin-bottom: 8px !important; }
.footer-brand span { color: var(--chilli); }
.footer-meta { text-align: right; }
.signature { font-family: var(--font-note); font-size: 2rem !important; line-height: 1; color: var(--accent-text); transform: rotate(-3deg); }

/* ------------------------------------------------------------------ drawer */
.scrim { position: fixed; inset: 0; z-index: 70; background: rgba(27, 19, 14, 0.4); opacity: 0; transition: opacity 0.35s var(--ease); }
.scrim.is-on { opacity: 1; }
.drawer {
  position: fixed; z-index: 75; top: 14px; right: 14px; bottom: 14px; width: min(540px, calc(100% - 28px));
  display: flex; flex-direction: column; overflow: hidden;
  border-radius: 14px 26px 18px 30px / 26px 14px 30px 18px; box-shadow: 8px 10px 0 var(--shadow-soft);
  transform: translateX(calc(100% + 30px)) rotate(2deg); transition: transform 0.6s var(--ease);
}
.drawer.is-on { transform: none; }
.drawer-inner { flex: 1; overflow-y: auto; padding: 28px; overscroll-behavior: contain; }
.drawer-close { position: absolute; top: 16px; right: 16px; z-index: 2; }
.d-eyebrow { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 52px 10px 0; }
.d-title { margin: 0; padding-right: 44px; font-family: var(--font-hand); font-weight: 700; font-size: clamp(2rem, 4vw, 2.6rem); line-height: 1.05; }
.d-address { display: flex; gap: 8px; margin: 12px 0 0; color: var(--ink-2); }
.d-address .ico { margin-top: 3px; }
.d-address a { color: var(--accent-text); font-family: var(--font-hand); font-weight: 700; text-underline-offset: 3px; }
.d-summary { display: grid; grid-template-columns: auto 1fr 1fr; gap: 16px; align-items: center; margin: 22px 0; padding: 16px; border: 2px solid var(--ink); border-radius: var(--wobble-c); background: var(--note); rotate: -0.6deg; }
.d-summary .kv span { display: block; font-size: 0.76rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }
.d-summary .kv b { font-family: var(--font-hand); font-size: 1.6rem; line-height: 1.1; }
.d-summary .kv small { color: var(--ink-3); font-size: 0.8rem; }
.d-section-title { margin: 24px 0 8px; font-family: var(--font-hand); font-weight: 700; font-size: 1.25rem; }
.d-ids { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; font-size: 0.88rem; }
.d-ids dt { color: var(--ink-3); }
.d-ids dd { margin: 0; font-family: var(--font-mono); font-size: 0.8rem; word-break: break-all; }
.services { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.service { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1.8px dashed var(--rule-strong); border-radius: var(--wobble-pill); font-family: var(--font-hand); font-size: 1.05rem; color: var(--ink-3); }
.service.on { border-style: solid; border-color: var(--cardamom); color: var(--cardamom); background: color-mix(in srgb, var(--cardamom) 10%, transparent); }
.timeline { margin: 0; padding: 0; list-style: none; }
.timeline li { display: grid; grid-template-columns: 96px 34px 1fr 40px; align-items: center; gap: 12px; padding: 7px 0; border-bottom: 1.5px dashed var(--rule-strong); font-size: 0.9rem; }
.timeline .t-date { font-family: var(--font-mono); font-size: 0.76rem; color: var(--ink-3); }
.timeline .t-score { text-align: right; font-family: var(--font-hand); font-weight: 700; }
.drawer-actions { display: flex; flex-wrap: wrap; gap: 10px; padding: 14px 24px 18px; border-top: 2px dashed var(--rule-strong); background: var(--card-2); }
.drawer-actions .btn-danger { margin-left: auto; }

/* ------------------------------------------------------------------- modal */
.modal-layer { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 16px; background: rgba(27, 19, 14, 0.45); opacity: 0; transition: opacity 0.3s var(--ease); }
.modal-layer.is-on { opacity: 1; }
.modal { width: min(660px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; padding: 30px 28px 26px; border-radius: var(--wobble-c); box-shadow: 8px 10px 0 var(--shadow-soft); transform: translateY(18px) rotate(-1.5deg) scale(0.97); transition: transform 0.5s var(--ease-spring); }
.modal-layer.is-on .modal { transform: rotate(-0.4deg); }
.tape::before { content: ""; position: absolute; top: 0; left: 50%; width: 110px; height: 22px; background: var(--tape); transform: translateX(-50%) rotate(-2deg); }
.modal-sm { width: min(520px, 100%); }
.modal h2 { margin: 0 0 2px; font-family: var(--font-hand); font-weight: 700; font-size: 2.3rem; line-height: 1.05; }
.modal .modal-sub { margin: 0 0 20px; color: var(--ink-3); }
.form-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-3 { grid-column: span 3; }
.form-grid .span-4 { grid-column: span 4; }
.form-grid .span-6 { grid-column: span 6; }
.form-divider { grid-column: span 6; margin: 8px 0 -4px; display: flex; align-items: center; gap: 10px; font-family: var(--font-hand); font-weight: 700; color: var(--ink-2); }
.form-divider::after { content: ""; flex: 1; border-top: 1.8px dashed var(--rule-strong); }
.form-errors { margin: 0 0 16px; padding: 12px 16px; border: 2px solid var(--chilli); border-radius: var(--wobble-a); background: color-mix(in srgb, var(--chilli) 10%, var(--card)); color: var(--chilli); font-weight: 600; }
.form-errors ul { margin: 0; padding-left: 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 24px; }
.rating-picker { display: flex; align-items: center; gap: 14px; }
.rating-picker input[type="range"] { flex: 1; accent-color: var(--chilli); height: 30px; border: 0; background: none; box-shadow: none; padding: 0; transform: none; }
.rating-picker output { font-family: var(--font-hand); font-weight: 700; font-size: 2.4rem; min-width: 2.6ch; text-align: center; color: var(--chilli); }

/* ------------------------------------------------------------------ toasts */
.toasts { position: fixed; z-index: 100; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 10px; width: min(360px, calc(100% - 36px)); }
.toast { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; padding: 12px 14px; background: var(--note); border: 2px solid var(--ink); border-radius: 6px 14px 8px 18px / 16px 8px 14px 6px; box-shadow: 4px 5px 0 var(--shadow-soft); rotate: -1.5deg; animation: toast-in 0.55s var(--ease-spring); }
.toast.is-out { animation: toast-out 0.3s var(--ease) forwards; }
.toast .ico { margin-top: 2px; color: var(--cardamom); }
.toast.is-error { background: var(--note-2); }
.toast.is-error .ico { color: var(--chilli); }
.toast b { display: block; font-family: var(--font-hand); font-size: 1.1rem; }
.toast span { color: var(--ink-2); font-size: 0.92rem; }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) rotate(6deg) scale(0.9); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(30px) rotate(8deg); } }

.banner { position: fixed; z-index: 55; left: 50%; top: 88px; translate: -50% 0; padding: 6px 16px; background: var(--note); border: 2px solid var(--ink); border-radius: var(--wobble-pill); font-family: var(--font-hand); color: var(--ink); box-shadow: 3px 3px 0 var(--shadow-soft); animation: toast-in 0.4s var(--ease); }

/* -------------------------------------------------------------- ink cursor */
html.has-cursor, html.has-cursor * { cursor: none !important; }
html.has-cursor :is(input:not([type="range"]):not([type="checkbox"]), textarea, [contenteditable="true"], .code) { cursor: text !important; }
.cursor-dot, .cursor-ring, .spice { position: fixed; left: 0; top: 0; z-index: 1000; pointer-events: none; opacity: 0; }
.cursor-dot { width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: var(--wobble-circle); background: var(--chilli); box-shadow: 0 0 0 1.5px var(--paper); transition: opacity 0.2s, scale 0.25s var(--ease-spring); }
.cursor-ring {
  display: grid; place-items: center; width: 38px; height: 38px;
  border: 2px solid var(--ink); border-radius: var(--wobble-circle);
  transition: opacity 0.25s, border-radius 0.35s var(--ease), background-color 0.25s, border-color 0.25s, scale 0.3s var(--ease-spring);
}
.cursor-ring::before { content: ""; position: absolute; inset: -4px; border: 1.5px solid var(--ink); border-radius: 44% 56% 48% 52% / 56% 44% 54% 46%; opacity: 0.35; animation: ring-wobble 4s linear infinite; }
.cursor-label { font-family: var(--font-hand); font-weight: 700; font-size: 0.95rem; color: var(--paper); opacity: 0; transition: opacity 0.2s; }
html.cursor-in .cursor-dot, html.cursor-in .cursor-ring { opacity: 1; }
html.cursor-text .cursor-dot, html.cursor-text .cursor-ring { opacity: 0; }
.cursor-ring.is-hover { scale: 1.45; border-color: var(--chilli); background: color-mix(in srgb, var(--turmeric) 22%, transparent); }
.cursor-ring.is-hover::before { border-color: var(--chilli); }
.cursor-ring.is-snap { border-radius: var(--wobble-pill); border-style: dashed; border-color: var(--chilli); background: color-mix(in srgb, var(--turmeric) 14%, transparent); }
.cursor-ring.is-snap::before { opacity: 0; }
.cursor-ring.is-label { scale: 1.9; background: var(--ink); border-color: var(--ink); }
.cursor-ring.is-label .cursor-label { opacity: 1; scale: 0.53; }
.cursor-ring.is-down { scale: 0.82; }
.cursor-ring.is-hover.is-down { scale: 1.2; }
.cursor-ring.is-label.is-down { scale: 1.6; }
html:has(.cursor-ring.is-snap) .cursor-dot, html:has(.cursor-ring.is-label) .cursor-dot { scale: 0; }
@keyframes ring-wobble { to { rotate: 360deg; } }
.spice { width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; border-radius: var(--wobble-circle); background: var(--c, var(--turmeric)); }
.spice.is-on { animation: spice-fall 1.1s var(--ease) forwards; }
@keyframes spice-fall {
  0% { opacity: 0.85; transform: translate(0, 0) scale(1); }
  100% { opacity: 0; transform: translate(var(--dx, 0), 26px) scale(0.3) rotate(120deg); }
}

/* -------------------------------------------------------------- responsive */
@media (max-width: 1080px) {
  .hero-inner { grid-template-columns: minmax(0, 1fr); }
  .hero-art { display: none; }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters .f-2, .filters .f-1 { grid-column: span 1; }
  .filters .f-name { grid-column: 1 / -1; }
  .viz-grid { grid-template-columns: minmax(0, 1fr); }
  .rank-list { grid-template-columns: minmax(0, 1fr); }
  .nav-links { display: none; }
  .nav-actions { margin-left: auto; }
}
@media (max-width: 760px) {
  body { font-size: 16px; }
  .hide-sm { display: none; }
  .nav { inset-block-start: 10px; }
  .nav-inner { gap: 8px; padding-left: 10px; }
  .nav-actions .btn-sm { width: 42px; height: 42px; padding: 0; }
  .nav-actions .btn-sm > span { display: none; }
  .hero { padding: 116px 0 30px; }
  .hero-search .btn span { display: none; }
  .hero-search .btn { width: 48px; padding: 0; }
  .scribble-note { margin-left: 12px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 40px; }
  .section { padding: 60px 0; }
  .section-head { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .section-index { margin-top: 0; }
  .filters { grid-template-columns: minmax(0, 1fr); }
  .viz-filters { grid-template-columns: minmax(0, 1fr); }
  .viz-note { justify-self: start; }
  .viz-head { flex-direction: column; }
  .lab-cols { grid-template-columns: minmax(0, 1fr); }
  .index-toolbar { flex-direction: column; align-items: flex-start; }
  .footer-meta { text-align: left; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .form-grid > * { grid-column: 1 / -1 !important; }
  .d-summary { grid-template-columns: auto 1fr; }
  .services { grid-template-columns: minmax(0, 1fr); }
  .drawer { top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; max-height: 88vh; transform: translateY(calc(100% + 24px)); }
  .drawer-inner { padding: 22px; }
  .drawer-actions { padding: 12px 18px 16px; }
  .timeline li { grid-template-columns: 84px 34px 1fr 34px; }
  .plan-chip { border-radius: 14px; }
}
@media (max-width: 380px) {
  .stat { padding: 16px; }
}

/* ---------------------------------------------------------- reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; transition-delay: 0ms !important; }
  html { scroll-behavior: auto; }
  .js [data-reveal] { opacity: 1; transform: none; }
  .js .word > span { transform: none; }
  .bar-draw, .cols .col-g { transform: none; }
  .card { opacity: 1; transform: none; }
  .note { opacity: 1; }
}
@media (forced-colors: active) {
  .bar-fallback { forced-color-adjust: none; background: CanvasText; }
}
