/* ============ Tokens ============ */
:root {
  /* Sampled from the car illustration and the current site. Warm neutrals throughout. */
  --paper: #efede7;
  --paper-2: #e5e2da;
  --paper-3: #d9d5cb;
  --ink: #1e1a17;
  --ink-2: #5d5750;
  --line: rgba(30, 26, 23, .14);
  --night: #1e1a17;
  --on-night: #efede7;
  --on-night-2: rgba(239, 237, 231, .68);

  --red: #ff4a4b;        /* the one accent */
  --red-ink: #d93536;    /* red text on light paper (contrast) */
  --green: #8da978;      /* status only: someone is free */

  --f-display: "Bricolage Grotesque", Georgia, serif;
  --f-body: "Manrope", system-ui, sans-serif;
  --f-dot: "Doto", "Courier New", monospace;

  /* type scale */
  --fs-1: 14px;
  --fs-2: 16px;
  --fs-3: 18px;
  --fs-4: clamp(20px, 1.6vw + 12px, 26px);
  --fs-5: clamp(26px, 2.4vw + 14px, 40px);
  --fs-6: clamp(34px, 4vw + 14px, 64px);
  --fs-7: clamp(42px, min(8vw, 12vh) + 8px, 120px);

  --r: 20px;
  --r-in: 12px;          /* r minus 8px padding */
  --gut: clamp(16px, 4vw, 48px);
  --gut-l: max(var(--gut), env(safe-area-inset-left));
  --gut-r: max(var(--gut), env(safe-area-inset-right));
  --max: 1280px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

/* ============ Base ============ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--fs-3)/1.6 var(--f-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
/* film grain */
body::after {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none; z-index: 90;
  opacity: .06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
::selection { background: var(--red); color: #fff; }
[hidden] { display: none !important; }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 {
  margin: 0;
  font-family: var(--f-display); font-weight: 600;
  letter-spacing: -.025em; line-height: 1.04;
  text-wrap: balance; overflow-wrap: break-word; hyphens: auto;
}
p { margin: 0 0 1em; text-wrap: pretty; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; border-radius: 6px; }
.prose a, p a { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.prose a:hover, p a:hover { color: var(--red-ink); }

.wrap { width: 100%; max-width: calc(var(--max) + var(--gut-l) + var(--gut-r)); margin-inline: auto; padding-inline: var(--gut-l) var(--gut-r); }
.dot { font-family: var(--f-dot); font-weight: 900; letter-spacing: 0; }
.muted { color: var(--ink-2); }
.small { font-size: var(--fs-1); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Squared maths notebook paper with the red margin line */
.notebook {
  --margin: 64px;
  background-color: var(--paper);
  background-image:
    linear-gradient(90deg, transparent calc(var(--margin) - 1px), rgba(255, 74, 75, .55) calc(var(--margin) - 1px), rgba(255, 74, 75, .55) var(--margin), transparent var(--margin)),
    linear-gradient(rgba(30, 26, 23, .07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(30, 26, 23, .07) 1px, transparent 1px);
  background-size: 100% 100%, 20px 20px, 20px 20px;
}
@media (max-width: 900px) { .notebook { --margin: 8px; } }

.night { background: var(--night); color: var(--on-night); }
.night .muted { color: var(--on-night-2); }

/* ============ Cursor ============ */
@media (pointer: fine) {
  html.has-cursor, html.has-cursor * { cursor: none !important; }
}
.cursor, .cursor-ring {
  position: fixed; left: 0; top: 0; z-index: 120;
  pointer-events: none; border-radius: 50%;
  translate: -50% -50%;
  opacity: 0; transition: opacity .3s;
}
html.has-cursor .cursor, html.has-cursor .cursor-ring { opacity: 1; }
.cursor[popover], .cursor-ring[popover] { margin: 0; padding: 0; inset: auto; left: 0; top: 0; overflow: visible; background-color: transparent; }
.cursor, .cursor[popover] { width: 6px; height: 6px; background: var(--red); border: 0; }
.cursor-ring {
  width: 24px; height: 24px;
  border: 1px solid #fff; mix-blend-mode: difference;
  display: grid; place-items: center;
  font: 600 11px/1 var(--f-body); color: #fff;
  transition: width .3s var(--ease), height .3s var(--ease), background .2s, border-color .2s, opacity .3s;
}
.cursor-ring.is-link { width: 36px; height: 36px; background: #fff; }
.cursor-ring.is-label { width: 60px; height: 60px; background: var(--ink); border-color: var(--ink); mix-blend-mode: normal; }
.cursor-ring.is-down { width: 18px; height: 18px; }
.cursor-ring span { opacity: 0; transition: opacity .2s; }
.cursor-ring.is-label span { opacity: 1; }

/* ============ Header ============ */
.site-head {
  position: fixed; inset: 0 0 auto; z-index: 100;
  padding-top: max(12px, env(safe-area-inset-top));
  transition: transform .45s var(--ease);
}
.site-head.is-hidden { transform: translateY(-120%); }
.head-bar {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 8px 8px 8px 18px;
  border: 1px solid var(--line); border-radius: var(--r);
}
/* blur lives on a pseudo-element: backdrop-filter on the bar itself would trap the fixed mobile menu inside it */
.head-bar::before {
  content: ""; position: absolute; inset: 0; z-index: -2; border-radius: inherit;
  background: rgba(239, 237, 231, .88);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.nav-open .head-bar { border-color: transparent; }
.nav-open .head-bar::before { opacity: 0; }
.nav-open .logo { color: var(--on-night); position: relative; }
.nav-open .burger { background: var(--paper); color: var(--ink); margin-left: auto; }
.nav-open .head-cta { display: none; }
.logo { display: flex; align-items: baseline; font: 700 21px/1 var(--f-display); letter-spacing: -.03em; }
.logo .sos { font-family: var(--f-dot); font-weight: 900; color: var(--red); font-size: 24px; letter-spacing: 0; }
.nav { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.nav a {
  padding: 10px 14px; border-radius: var(--r-in);
  font-size: var(--fs-2); font-weight: 500;
  transition: background .2s, color .2s;
}
.nav a:hover { background: var(--paper-2); }
.nav a:active { background: var(--paper-3); }
.nav a[aria-current="page"] { background: var(--ink); color: var(--paper); }

/* "Reikia pagalbos?" call to action, far right, with the live status dot */
.nav-cta, .head-cta {
  display: inline-flex; align-items: center; gap: 9px;
  min-height: 44px; padding: 10px 16px !important; border-radius: var(--r-in);
  background: var(--paper-2); color: var(--ink);
  font-size: var(--fs-2); font-weight: 600 !important; white-space: nowrap;
  transition: background .2s, color .2s;
}
.nav .nav-cta { margin-left: 10px; }
.nav-cta:hover, .head-cta:hover { background: var(--paper-3); }
.nav-cta[aria-current="page"], .head-cta[aria-current="page"] { background: var(--ink); color: var(--paper); }
.head-cta { display: none; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #9a948b; flex: none; }
[data-state="free"] .status-dot { background: var(--green); box-shadow: 0 0 0 3px rgba(141, 169, 120, .3); }
[data-state="busy"] .status-dot { background: var(--red); }

.burger { display: none; width: 44px; height: 44px; border: 0; border-radius: var(--r-in); background: var(--ink); color: var(--paper); place-items: center; flex: none; }
.burger span, .burger span::before { display: block; width: 16px; height: 1.5px; background: currentColor; position: relative; transition: transform .3s; }
.burger span::before { content: ""; position: absolute; top: 5px; }
.burger span { transform: translateY(-2.5px); }
.nav-open .burger span { transform: rotate(45deg); }
.nav-open .burger span::before { transform: translateY(-5px) rotate(-90deg); }

@media (max-width: 1000px) {
  .burger { display: grid; }
  .head-cta { display: inline-flex; margin-left: auto; }
  .nav {
    position: fixed; inset: 0; z-index: -1; height: 100dvh;
    flex-direction: column; align-items: flex-start; justify-content: center; gap: 4px; margin: 0;
    padding: max(96px, env(safe-area-inset-top)) var(--gut-r) max(40px, env(safe-area-inset-bottom)) var(--gut-l);
    background: var(--night); visibility: hidden; opacity: 0;
    transition: opacity .3s var(--ease), visibility 0s .3s;
    overflow-y: auto;
  }
  .nav-open .nav { visibility: visible; opacity: 1; transition: opacity .3s var(--ease); }
  .nav a { color: var(--on-night); font: 600 clamp(28px, min(8vw, 7vh), 48px)/1.15 var(--f-display); padding: 6px 0; }
  .nav a:hover, .nav a:active, .nav a[aria-current="page"] { background: none; color: var(--red); }
  .nav .nav-cta { margin: 20px 0 0; font: 600 clamp(22px, 6vw, 30px)/1.1 var(--f-display) !important; padding: 14px 20px !important; background: var(--paper); color: var(--ink); }
  .nav .nav-cta .status-dot { width: 12px; height: 12px; }
}
@media (max-width: 400px) {
  .head-cta { display: none; }
  .burger { margin-left: auto; }
}
@media (orientation: landscape) and (max-height: 560px) {
  .head-bar { padding: 4px 4px 4px 14px; }
  .head-cta, .burger { min-height: 40px; height: 40px; }
}

/* ============ Buttons ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 14px 22px; border: 0; border-radius: var(--r-in);
  background: var(--ink); color: var(--paper);
  font: 600 var(--fs-2)/1.2 var(--f-body);
  transition: background .2s, color .2s, transform .2s var(--ease), box-shadow .2s;
}
.btn:hover { background: #000; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .6; cursor: progress; }
.btn .arr { transition: transform .3s var(--ease); }
.btn:hover .arr { transform: translateX(3px); }
.btn-red { background: var(--red); color: #fff; }
.btn-red:hover { background: var(--red-ink); }
.btn-line { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); }
.btn-line:hover { background: var(--ink); color: var(--paper); }
.night .btn-line { color: var(--on-night); box-shadow: inset 0 0 0 1.5px var(--on-night); }
.night .btn-line:hover { background: var(--on-night); color: var(--ink); }
@media (max-width: 400px) { .hero-cta .btn, .form-foot .btn { width: 100%; } }

/* ============ Sections ============ */
section { position: relative; }
.sec { padding-block: clamp(72px, 11vw, 150px); }
.sec-title { font-size: var(--fs-6); max-width: 18ch; margin-bottom: clamp(32px, 5vw, 64px); }

.reveal { opacity: 0; transform: translateY(28px); transition: opacity .9s var(--ease), transform .9s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* ============ Hero ============ */
.hero { min-height: 100svh; min-height: 100dvh; padding-top: calc(104px + env(safe-area-inset-top)); display: flex; flex-direction: column; overflow: clip; }
.hero > .wrap { flex: 1; display: flex; }
.hero-grid { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: end; padding-bottom: clamp(32px, 6vh, 72px); }
.hero-grid > * { min-width: 0; }
.hero-copy { align-self: center; padding-left: max(0px, calc(var(--margin) - var(--gut-l) + 20px)); }
.hero h1 { font-size: var(--fs-7); line-height: .95; letter-spacing: -.035em; }
.hero h1 .dot { display: block; color: var(--red); font-size: .8em; margin-top: .12em; letter-spacing: -.02em; }
.hero-sub { max-width: 34ch; font-size: var(--fs-4); line-height: 1.45; color: var(--ink-2); margin: 24px 0 32px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 10px; }

.car-stage { position: relative; perspective: 1200px; width: min(100%, 680px); justify-self: end; display: block; }
.car-3d { transform-style: preserve-3d; transition: transform .6s var(--ease); }
.car-3d img { width: 100%; filter: drop-shadow(0 22px 18px rgba(30, 26, 23, .22)); }

@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; align-items: start; align-content: center; }
  .hero-copy { padding-left: 0; }
  .car-stage { order: -1; justify-self: center; width: min(86%, 500px, 46svh * 1.22); }
}
/* phones and small tablets held sideways */
@media (orientation: landscape) and (max-height: 560px) {
  .hero { padding-top: calc(80px + env(safe-area-inset-top)); }
  .hero-grid { grid-template-columns: 1.1fr .9fr; align-items: center; padding-bottom: 20px; }
  .hero-copy { padding-left: 0; }
  .car-stage { order: 0; width: min(100%, 64vh * 1.22); }
  .hero h1 { font-size: clamp(30px, 10vh, 60px); }
  .hero-sub { font-size: var(--fs-2); margin: 12px 0 18px; }
  .hero-cta .btn { min-height: 44px; padding: 10px 16px; }
}

/* ============ Why us (list, not cards) ============ */
.why { border-top: 1px solid var(--line); }
.why-row {
  display: grid; grid-template-columns: 90px minmax(0, 1fr) minmax(0, 1.1fr); gap: 24px; align-items: baseline;
  padding-block: clamp(24px, 4vw, 44px); border-bottom: 1px solid var(--line);
}
.why-row .dot { font-size: var(--fs-5); color: var(--red); line-height: 1; }
.why-row h3 { font-size: var(--fs-5); }
.why-row p { margin: 0; color: var(--ink-2); max-width: 46ch; }
@media (max-width: 760px) { .why-row { grid-template-columns: 1fr; gap: 10px; } }

/* ============ AI compare ============ */
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(32px, 6vw, 96px); align-items: start; }
@media (max-width: 900px) { .compare { grid-template-columns: 1fr; } }
.compare-lead { font-size: var(--fs-4); line-height: 1.45; color: var(--on-night-2); }
.compare-lead strong { color: var(--on-night); font-weight: 600; }
.vs { width: 100%; border-collapse: collapse; font-size: var(--fs-2); }
.vs th, .vs td { padding: 16px 12px; text-align: left; border-bottom: 1px solid rgba(239, 237, 231, .14); }
.vs th { font-weight: 600; color: var(--on-night-2); }
.vs th:first-child, .vs td:first-child { padding-left: 0; }
.vs th:not(:first-child), .vs td:not(:first-child) { width: 1%; white-space: nowrap; }
.vs td.y { color: var(--on-night); font-weight: 600; }
.vs td.n { color: var(--on-night-2); }
.vs .us { color: var(--red); }
@media (max-width: 380px) { .vs th, .vs td { padding: 14px 6px; font-size: var(--fs-1); } }

/* ============ Solve (scroll scene) ============ */
.solve { height: 280vh; }
.solve-sticky { position: sticky; top: 0; height: 100svh; height: 100dvh; display: grid; align-items: center; overflow: hidden; }
.solve-grid { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: clamp(32px, 6vw, 96px); align-items: center; }
.solve-text h2 { font-size: var(--fs-6); max-width: 14ch; }
.solve-text p { margin: 20px 0 0; font-size: var(--fs-4); color: var(--on-night-2); max-width: 34ch; }
.nb {
  --margin: 48px;
  margin: 0; color: var(--ink); border-radius: var(--r);
  padding: clamp(24px, 3vw, 40px) clamp(20px, 3vw, 40px) clamp(24px, 3vw, 36px) calc(var(--margin) + 22px);
  box-shadow: 0 40px 70px -30px rgba(0, 0, 0, .7);
  transform: rotate(-1.2deg); transition: transform .5s var(--ease);
}
.nb-task { margin: 0 0 12px; font-size: var(--fs-2); color: var(--ink-2); }
.nb-line { padding: 8px 0; }
.nb-line .m { display: block; width: fit-content; font: 600 clamp(22px, 2.3vw, 32px)/1.3 var(--f-display); letter-spacing: -.01em; white-space: nowrap; }
.nb-line .note { display: block; margin-top: 4px; padding-left: 12px; border-left: 2px solid var(--red); font-size: 15px; line-height: 1.45; color: var(--red-ink); max-width: 40ch; }
.nb-ans { position: relative; width: fit-content; margin-top: 6px; }
.ring { position: absolute; left: -18px; top: -6px; width: calc(100% + 36px); height: calc(100% + 12px); overflow: visible; pointer-events: none; }
.ring path { fill: none; stroke: var(--red); stroke-width: 2.5; stroke-linecap: round; }
.nb-line sub { font-size: .6em; vertical-align: -.25em; line-height: 0; }
.nb-check { margin: 18px 0 0; font-size: 15px; color: var(--ink-2); }
@media (max-width: 860px), (max-height: 600px) {
  .solve { height: auto; }
  .solve-sticky { position: relative; height: auto; padding-block: clamp(72px, 11vw, 150px); }
  .solve-grid { grid-template-columns: 1fr; }
  .solve-text h2 { max-width: 18ch; }
}
@media (max-width: 420px) { .nb { --margin: 20px; transform: none; } .nb-line .m { white-space: normal; } }

/* ============ Steps (card stack) ============ */
.how { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: clamp(32px, 6vw, 96px); align-items: center; }
.how-intro .sec-title { margin-bottom: 18px; }
.how-intro .muted { max-width: 32ch; margin-bottom: 28px; }
@media (max-width: 860px) { .how { grid-template-columns: 1fr; } .how-intro { order: 0; } }
.stack-nav { display: flex; align-items: center; gap: 12px; }
.stack-nav button { width: 52px; height: 52px; border-radius: 50%; border: 1.5px solid var(--ink); background: none; font-size: 20px; transition: background .2s, color .2s; }
.stack-nav button:hover { background: var(--ink); color: var(--paper); }
.stack-nav button:active { transform: translateY(1px); }
.stack-count { min-width: 56px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.stack { --off: 14px; display: grid; padding: 0 0 calc(var(--off) * 3); touch-action: pan-y; user-select: none; outline: none; }
.stack:focus-visible { outline: 2px solid var(--red); outline-offset: 6px; border-radius: var(--r); }
.stack .step {
  grid-area: 1 / 1; width: 100%; min-height: clamp(300px, 40vh, 400px);
  padding: clamp(22px, 3vw, 34px); border-radius: var(--r);
  display: flex; flex-direction: column; justify-content: space-between; gap: 32px;
  transform: translateY(calc(var(--k) * var(--off))) scale(calc(1 - var(--k) * .05));
  transform-origin: bottom center; z-index: calc(10 - var(--k));
  box-shadow: 0 18px 36px -24px rgba(30, 26, 23, .5);
  transition: transform .5s var(--ease), opacity .4s;
  cursor: pointer;
}
.stack .step.out { transform: translate(-60%, 0) rotate(-8deg); opacity: 0; z-index: 20; }
.stack .step.instant { transition: none; }
.step .dot { font-size: clamp(56px, 7vw, 104px); line-height: .8; }
.step h3 { font-size: var(--fs-5); margin-bottom: 10px; }
.step p { margin: 0; max-width: 38ch; }
.step.s1 { background: var(--paper-2); }
.step.s1 p { color: var(--ink-2); }
.step.s2 { background: var(--green); }
.step.s3 { background: var(--red); color: #fff; }
.step.s4 { background: var(--ink); color: var(--paper); }
.step.s4 p { color: var(--on-night-2); }
@media (max-width: 500px) { .stack { --off: 10px; } }

/* ============ FAQ ============ */
.faq { border-top: 1px solid var(--line); max-width: 920px; }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
  list-style: none; display: flex; align-items: center; gap: 20px;
  padding: 22px 0; font: 600 var(--fs-4)/1.3 var(--f-display); letter-spacing: -.01em;
  transition: color .2s;
}
.faq summary:hover { color: var(--red-ink); }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+"; margin-left: auto; flex: none;
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  border: 1.5px solid currentColor; font: 400 22px/1 var(--f-body);
  transition: transform .35s var(--ease), background .2s, color .2s, border-color .2s;
}
.faq details[open] summary::after { transform: rotate(45deg); background: var(--ink); border-color: var(--ink); color: var(--paper); }
.faq .ans { padding: 0 60px 24px 0; color: var(--ink-2); max-width: 64ch; }
@media (max-width: 600px) { .faq .ans { padding-right: 0; } }

/* ============ CTA ============ */
.cta-band { display: grid; grid-template-columns: minmax(0, 1.4fr) auto; gap: 32px; align-items: end; }
.cta-band h2 { font-size: var(--fs-6); max-width: 16ch; }
@media (max-width: 760px) { .cta-band { grid-template-columns: 1fr; } }

/* ============ Footer ============ */
.site-foot { background: var(--night); color: var(--on-night); padding: 72px 0 max(24px, env(safe-area-inset-bottom)); overflow: hidden; }
.foot-top { display: grid; grid-template-columns: 1.3fr 1fr 1fr 1fr; gap: 32px; }
.foot-top h2 { font-size: var(--fs-5); }
.foot-top a.mail { display: inline-block; margin-top: 14px; font-size: var(--fs-4); border-bottom: 1px solid currentColor; transition: color .2s; }
.foot-top a.mail:hover { color: var(--red); }
.foot-h { font-size: var(--fs-1); color: var(--on-night-2); margin-bottom: 12px; }
.foot-links { display: flex; flex-direction: column; gap: 4px; }
.foot-links a { color: var(--on-night-2); transition: color .2s; padding-block: 6px; }
.foot-links a:hover { color: var(--on-night); }
#wordmark { width: 100%; height: clamp(100px, 21vw, 300px); display: block; margin: 48px 0 16px; touch-action: pan-y; }
.foot-bottom { display: flex; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; font-size: var(--fs-1); color: var(--on-night-2); }
@media (max-width: 900px) { .foot-top { grid-template-columns: 1fr 1fr; } .foot-top > :first-child { grid-column: 1 / -1; } }
@media (max-width: 340px) { .foot-top { grid-template-columns: 1fr; } }

/* ============ Page transition ============ */
.wipe { position: fixed; inset: 0; z-index: 110; background: var(--paper-2); transform: translateY(100%); pointer-events: none; display: grid; place-items: center; }
.wipe .logo { opacity: 0; font-size: clamp(48px, 9vw, 96px); }
.wipe .logo .sos { font-size: 1.14em; }
.wipe.out { transform: none; transition: transform .45s var(--ease); }
.wipe.out .logo { opacity: 1; transition: opacity .2s .2s; }
.wipe.in { transform: translateY(-100%); transition: transform .5s var(--ease); }

/* ============ Sub-page hero ============ */
.page-hero { padding: calc(clamp(130px, 16vw, 200px) + env(safe-area-inset-top)) 0 clamp(44px, 6vw, 80px); }
.page-hero h1 { font-size: var(--fs-7); line-height: .95; letter-spacing: -.035em; }
.page-hero h1 .dot { color: var(--red); font-size: min(1.22em, calc((100vw - 2 * var(--gut) - 8px) / 5.2)); line-height: .8; white-space: nowrap; }
.page-hero .lead { max-width: 50ch; font-size: var(--fs-4); line-height: 1.45; color: var(--ink-2); margin: 24px 0 0; }
.notebook.page-hero .wrap { padding-left: max(var(--gut-l), calc(var(--margin) + 20px)); }
@media (orientation: landscape) and (max-height: 560px) { .page-hero { padding-top: calc(100px + env(safe-area-inset-top)); } }

/* ============ Legal ============ */
.prose { max-width: 70ch; padding-block: clamp(40px, 6vw, 72px) clamp(72px, 10vw, 140px); }
.prose h2 { font-size: var(--fs-5); margin: 48px 0 14px; }
.prose h2:first-child { margin-top: 0; }
.prose ul { padding-left: 1.2em; margin: 0 0 1em; }
.prose li { margin-bottom: .4em; }
.prose .updated { color: var(--ink-2); font-size: var(--fs-2); }
.todo { background: #fff2b8; padding: 0 4px; border-radius: 4px; }

/* ============ Help page ============ */
.help-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: clamp(20px, 3vw, 40px); align-items: start; padding-bottom: clamp(72px, 10vw, 140px); }
@media (max-width: 960px) { .help-grid { grid-template-columns: 1fr; } }
.av { position: sticky; top: 100px; padding: clamp(22px, 3vw, 32px); border-radius: var(--r); background: var(--night); color: var(--on-night); }
@media (max-width: 960px), (max-height: 760px) { .av { position: relative; top: 0; } }
.av-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.av-top p { margin: 0; color: var(--on-night-2); font-size: var(--fs-2); }
.av-state { font-size: clamp(52px, 8vw, 96px); line-height: .9; margin: 22px 0 12px; color: #8a847b; }
.av[data-state="free"] .av-state { color: var(--green); }
.av[data-state="busy"] .av-state { color: var(--red); }
.av-sub { font-size: var(--fs-3); min-height: 3.2em; color: var(--on-night-2); margin: 0; }
.av-sub strong { color: var(--on-night); font-weight: 600; }
.av-people { display: flex; gap: 6px; }
.av-people span { width: 32px; height: 32px; border-radius: 50%; border: 1.5px solid rgba(239, 237, 231, .3); display: grid; place-items: center; font-size: 13px; font-weight: 600; }
.av-people span.on { border-color: var(--green); background: var(--green); color: var(--ink); }

.week { margin-top: 28px; display: grid; gap: 6px; }
.week-row { display: grid; grid-template-columns: 28px minmax(0, 1fr); align-items: center; gap: 8px; }
.week-row > span { font-size: 12px; color: var(--on-night-2); }
.week-row.today > span { color: var(--on-night); font-weight: 700; }
.week-cells { display: grid; grid-template-columns: repeat(28, minmax(0, 1fr)); gap: 3px; }
.week-cells i { aspect-ratio: 1; border-radius: 50%; background: rgba(239, 237, 231, .12); }
.week-cells i.on { background: var(--green); }
.week-cells i.now { box-shadow: 0 0 0 2px var(--red); }
.week-cells i[data-t] { cursor: pointer; transition: transform .15s var(--ease), background .15s; }
.week-cells i[data-t]:hover { transform: scale(1.5); }
.week-cells i.picked { background: var(--on-night); box-shadow: 0 0 0 2px var(--red); transform: scale(1.35); }
.week-hint { margin: 10px 0 0; font-size: 13px; color: var(--on-night-2); }
.own { margin-top: 22px; }
.own .slots-h { display: block; margin: 0 0 10px; }
.av { min-width: 0; }
.own input {
  min-width: 0; max-width: 100%;
  width: 100%; min-height: 48px; padding: 10px 14px; border-radius: var(--r-in);
  border: 1.5px solid rgba(239, 237, 231, .3); background: transparent; color: var(--on-night);
  font: 600 var(--fs-2)/1.2 var(--f-body); color-scheme: dark;
}
.own input:hover { border-color: rgba(239, 237, 231, .6); }
.own input:focus { outline: 2px solid var(--red); outline-offset: 2px; border-color: var(--on-night); }
.own-note { margin: 10px 0 0; font-size: var(--fs-1); color: var(--on-night-2); }
.req { color: var(--red-ink); font-weight: 600; }
.week-axis { display: flex; justify-content: space-between; margin-left: 36px; font-size: 12px; color: var(--on-night-2); }

.slots-h { margin: 26px 0 0; font-size: var(--fs-2); color: var(--on-night-2); }
.slots { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.slot {
  min-height: 44px; padding: 10px 14px; border-radius: var(--r-in); border: 1.5px solid rgba(239, 237, 231, .3); background: none; color: var(--on-night);
  font-size: var(--fs-2); font-weight: 600; transition: background .2s, border-color .2s, color .2s;
}
.slot:hover { border-color: var(--on-night); }
.slot:active { transform: translateY(1px); }
.slot[aria-pressed="true"] { background: var(--on-night); border-color: var(--on-night); color: var(--ink); }

/* form */
.form { display: grid; gap: 12px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .row2 { grid-template-columns: 1fr; } }
.field { position: relative; display: block; }
.field input, .field select, .field textarea {
  width: 100%; min-height: 64px; padding: 28px 16px 10px; border-radius: var(--r-in);
  background: var(--paper-2); border: 1.5px solid transparent; outline: 0;
  font-size: 17px; transition: border-color .2s, background .2s;
  -webkit-appearance: none; appearance: none;
}
.field textarea { min-height: 170px; resize: vertical; }
.field select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%231e1a17' stroke-width='1.6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 18px center; }
.field input:hover, .field select:hover, .field textarea:hover { border-color: var(--line); }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--ink); background: #fff; }
.field > span { position: absolute; left: 17px; top: 9px; font-size: 13px; font-weight: 600; color: var(--ink-2); pointer-events: none; }
.field > span b { color: var(--red-ink); font-weight: 600; }
.field.invalid input, .field.invalid textarea { border-color: var(--red); }
.field > .err, .check .err { position: static; display: block; margin: 6px 0 0 2px; font-size: var(--fs-1); font-weight: 600; line-height: 1.4; color: var(--red-ink); pointer-events: auto; }

.drop {
  position: relative; display: grid; place-items: center; text-align: center;
  min-height: 150px; padding: 24px; border-radius: var(--r-in);
  border: 1.5px dashed rgba(30, 26, 23, .35); transition: border-color .2s, background .2s;
}
.drop:hover, .drop.is-over { border-color: var(--ink); background: rgba(30, 26, 23, .03); }
.drop input { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }
.drop:focus-within { outline: 2px solid var(--red); outline-offset: 3px; }
.drop-empty { display: grid; gap: 4px; justify-items: center; }
.drop-empty strong { font-weight: 600; }
.drop-empty span { color: var(--ink-2); font-size: var(--fs-1); }
.drop.has-file { padding: 10px; border-style: solid; border-color: var(--line); }
.drop.has-file .drop-empty { display: none; }
.preview { display: none; width: 100%; }
.drop.has-file .preview { display: flex; align-items: center; gap: 14px; text-align: left; }
.preview img { width: 96px; height: 96px; object-fit: cover; border-radius: 8px; flex: none; }
.preview .meta { font-size: var(--fs-1); color: var(--ink-2); overflow-wrap: anywhere; }
.preview button { position: relative; z-index: 2; margin-left: auto; min-height: 44px; padding: 0 14px; flex: none; border-radius: var(--r-in); border: 1.5px solid var(--ink); background: none; font-size: var(--fs-1); font-weight: 600; }
.preview button:hover { background: var(--ink); color: var(--paper); }

.check { display: flex; gap: 12px; align-items: flex-start; font-size: var(--fs-1); line-height: 1.5; color: var(--ink-2); }
.check input {
  -webkit-appearance: none; appearance: none; flex: none;
  width: 22px; height: 22px; margin: 0; border-radius: 6px;
  border: 1.5px solid var(--ink); background: var(--paper);
  display: grid; place-items: center; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.check input::after { content: ""; width: 6px; height: 11px; border: solid #fff; border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg) scale(0); transition: transform .15s var(--ease); }
.check input:hover { border-color: var(--red); }
.check input:checked { background: var(--red); border-color: var(--red); }
.check input:checked::after { transform: translateY(-1px) rotate(45deg) scale(1); }
.check.invalid input { border-color: var(--red); }
.check.invalid { color: var(--red-ink); }
.form-foot { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 4px; }
.form-msg { font-size: var(--fs-2); }
.form-msg.err { color: var(--red-ink); }
.hp { position: absolute; left: -9999px; }
.chosen { display: none; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 10px 10px 16px; border-radius: var(--r-in); background: var(--paper-2); font-size: var(--fs-2); }
.chosen.on { display: flex; }
.chosen button { margin-left: auto; min-height: 40px; padding: 0 12px; border: 0; border-radius: 8px; background: var(--paper); font-size: var(--fs-1); font-weight: 600; }

.sent { display: none; padding: clamp(32px, 6vw, 56px) clamp(22px, 4vw, 44px); border-radius: var(--r); background: var(--paper-2); overflow: hidden; }
.sent.on { display: block; }
.sent img { width: min(240px, 70%); margin-bottom: 24px; }
.sent.on img { animation: driveoff 2.4s var(--ease) .8s forwards; }
@keyframes driveoff { 25% { transform: translateX(8px); } 100% { transform: translateX(-140vw); } }
.sent h2 { font-size: var(--fs-6); margin-bottom: 14px; }

/* ============ About page ============ */
.manifesto { font-family: var(--f-display); font-size: var(--fs-6); line-height: 1.08; letter-spacing: -.03em; font-weight: 600; max-width: 22ch; text-wrap: balance; }
.manifesto .w { color: rgba(30, 26, 23, .16); transition: color .3s; }
.manifesto .w.lit { color: var(--ink); }
.manifesto .w.red.lit { color: var(--red); }

.story { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(32px, 6vw, 90px); align-items: center; }
@media (max-width: 860px) { .story { grid-template-columns: 1fr; } }
.story p { color: var(--ink-2); }
.story p strong { color: var(--ink); font-weight: 600; }
.photo-frame { border-radius: var(--r); overflow: hidden; transform: rotate(-1.5deg); box-shadow: 0 22px 40px -20px rgba(30, 26, 23, .45); }
.photo-frame img { width: 100%; }
.facts { margin-top: 20px; padding-left: 1.1em; color: var(--ink-2); }
.facts li { margin-bottom: .3em; }

.team-sec { padding-bottom: clamp(48px, 6vw, 80px); }
.team { display: grid; grid-template-columns: repeat(2, minmax(0, 420px)); justify-content: center; gap: 20px; }
@media (max-width: 640px) { .team { grid-template-columns: minmax(0, 440px); } }
.member { perspective: 1600px; cursor: pointer; }
.flip { display: grid; height: 100%; transform-style: preserve-3d; transition: transform .75s var(--ease); }
.member.flipped .flip { transform: rotateY(180deg); }
.face { grid-area: 1 / 1; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: var(--r); overflow: hidden; }
.front { background: var(--paper-2); display: flex; flex-direction: column; }
.front .info { margin-top: auto; }
.back { transform: rotateY(180deg); display: flex; flex-direction: column; padding: clamp(22px, 3vw, 32px); background: var(--night); color: var(--on-night); }
.member .ph { aspect-ratio: 4 / 4.6; overflow: hidden; }
.member img { width: 100%; height: 100%; object-fit: cover; object-position: center 30%; filter: grayscale(1); transform: scale(1.03); transition: filter .6s var(--ease), transform .8s var(--ease); }
.member:hover img, .member:focus-within img { filter: none; transform: scale(1); }
@media (hover: none) { .member img { filter: none; } }
.member .info { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 16px 16px 20px; }
.member h3 { font-size: var(--fs-4); }
.member .role { margin: 4px 0 0; font-size: var(--fs-2); color: var(--ink-2); }
.back .role { color: var(--on-night-2); }
.flip-btn { flex: none; min-height: 44px; padding: 0 16px; border-radius: var(--r-in); border: 1.5px solid currentColor; background: none; font-size: var(--fs-2); font-weight: 600; transition: background .2s, color .2s; }
.front .flip-btn:hover { background: var(--ink); color: var(--paper); }
.back .flip-btn:hover { background: var(--on-night); color: var(--ink); }
.exp { list-style: none; padding: 0; margin: 24px 0 auto; display: grid; gap: 14px; }
.exp li { position: relative; padding-left: 20px; color: var(--on-night-2); line-height: 1.45; }
.exp li::before { content: ""; position: absolute; left: 0; top: .55em; width: 8px; height: 8px; border-radius: 50%; background: var(--red); }
.bio { margin: 18px 0 auto; font-size: var(--fs-2); line-height: 1.6; color: var(--on-night-2); }
.back-foot { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }

.timeline { display: grid; }
.post { display: grid; grid-template-columns: 110px minmax(0, 1fr) 240px; gap: 28px; align-items: start; padding-block: 28px; border-top: 1px solid rgba(239, 237, 231, .16); }
.post:last-child { border-bottom: 1px solid rgba(239, 237, 231, .16); }
.post .when { color: var(--on-night-2); font-size: var(--fs-2); padding-top: 6px; }
.post h3 { font-size: var(--fs-5); margin-bottom: 10px; }
.post p { margin: 0; color: var(--on-night-2); max-width: 52ch; }
.post img, .post-tile { border-radius: var(--r-in); aspect-ratio: 4 / 3; object-fit: cover; width: 100%; }
.post-tile { display: grid; place-items: center; --margin: 22px; }
.post-tile .dot { color: var(--red); font-size: clamp(34px, 4vw, 52px); }
.post .more { display: inline-flex; align-items: center; margin-top: 14px; min-height: 44px; padding: 0; border: 0; background: none; color: var(--on-night); font-weight: 600; text-decoration: underline; text-underline-offset: 4px; }
.post .more:hover { color: var(--red); }
@media (max-width: 860px) { .post { grid-template-columns: 1fr; gap: 14px; } .post img, .post-tile { max-width: 420px; order: -1; } .post .when { padding: 0; } }

dialog.article { width: min(720px, calc(100vw - 24px)); max-height: min(88dvh, 900px); padding: 0; border: 0; border-radius: var(--r); background: var(--paper); color: var(--ink); overscroll-behavior: contain; }
dialog.article::backdrop { background: rgba(30, 26, 23, .6); }
dialog.article[open] { animation: pop .4s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(24px); } }
.article-in { padding: clamp(22px, 4vw, 48px); }
.article-in .muted { margin: 0; font-size: var(--fs-2); }
.article-in h2 { font-size: var(--fs-5); margin: 10px 0 20px; }
.article-in img { width: 100%; max-height: min(70vh, 640px); object-fit: cover; object-position: center 35%; border-radius: var(--r-in); margin-bottom: 22px; }
.article-in p { color: var(--ink-2); }
.article-close { position: sticky; top: 12px; float: right; margin: 12px 12px 0 0; z-index: 2; min-height: 44px; padding: 0 14px; border-radius: var(--r-in); border: 0; background: var(--ink); color: var(--paper); font-size: var(--fs-1); font-weight: 600; }

.li-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.li-nav { display: flex; gap: 8px; margin-bottom: clamp(32px, 5vw, 64px); }
.li-nav button { width: 48px; height: 48px; border-radius: 50%; border: 1.5px solid var(--ink); background: none; font-size: 20px; transition: background .2s, color .2s, opacity .2s; }
.li-nav button:hover:not(:disabled) { background: var(--ink); color: var(--paper); }
.li-nav button:disabled { opacity: .3; cursor: default; }
.li-track {
  --edge: max(var(--gut-l), calc((100vw - var(--max)) / 2));
  display: flex; gap: 16px; overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory; scroll-padding-inline: var(--edge);
  padding: 4px var(--edge) 24px; margin-bottom: 24px;
  scrollbar-width: thin; scrollbar-color: var(--paper-3) transparent;
}
.li-card {
  flex: none; width: min(80vw, 340px); scroll-snap-align: start;
  display: flex; flex-direction: column; border-radius: var(--r); overflow: hidden;
  background: var(--paper-2); transition: background .2s, transform .3s var(--ease);
}
.li-card:hover { background: var(--paper-3); transform: translateY(-3px); }
.li-img { aspect-ratio: 16 / 10; overflow: hidden; background: var(--paper-3); }
.li-img img { width: 100%; height: 100%; object-fit: cover; }
.li-body { display: flex; flex-direction: column; flex: 1; padding: 18px 20px 20px; }
.li-meta { margin: 0 0 8px; font-size: var(--fs-1); color: var(--ink-2); }
.li-text { margin: 0 0 16px; font-size: var(--fs-2); line-height: 1.5; white-space: pre-line; display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.li-more { margin-top: auto; font-weight: 600; font-size: var(--fs-2); }
.li-card:hover .li-more { color: var(--red-ink); }
@media (max-width: 600px) { .li-nav { display: none; } }
.socials { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .socials { grid-template-columns: 1fr; } }
.social { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: clamp(20px, 3vw, 32px); border-radius: var(--r); background: var(--paper-2); transition: background .2s; }
.social:hover { background: var(--paper-3); }
.social h3 { font-size: var(--fs-5); }
.social p { margin: 4px 0 0; color: var(--ink-2); font-size: var(--fs-2); }
.social .arr { font-size: var(--fs-5); transition: transform .3s var(--ease); }
.social:hover .arr { transform: translateX(4px); }
.li-load { margin-bottom: 16px; }

/* ============ Contacts ============ */
.contact-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 16px; }
@media (max-width: 900px) { .contact-grid { grid-template-columns: 1fr; } }
.mail-card { display: flex; flex-direction: column; justify-content: space-between; gap: 36px; min-height: 340px; padding: clamp(24px, 4vw, 44px); border-radius: var(--r); background: var(--red); color: #fff; }
.mail-card p { margin: 0; color: rgba(255, 255, 255, .85); }
.mail-card .big { font: 600 clamp(24px, 4.6vw, 60px)/1.05 var(--f-display); letter-spacing: -.035em; overflow-wrap: anywhere; }
.mail-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.mail-actions .btn { background: #fff; color: var(--ink); }
.mail-actions .btn:hover { background: var(--ink); color: #fff; }
.mail-actions .btn-line { background: transparent; color: #fff; box-shadow: inset 0 0 0 1.5px #fff; }
.side-cards { display: grid; gap: 16px; align-content: start; }
.mini { display: flex; align-items: center; gap: 16px; padding: 16px 18px; border-radius: var(--r); background: var(--paper-2); transition: background .2s; }
.mini:hover { background: var(--paper-3); }
.mini img { width: 60px; height: 60px; border-radius: 50%; object-fit: cover; flex: none; }
.mini h3 { font-size: var(--fs-4); }
.mini p { margin: 2px 0 0; font-size: var(--fs-1); color: var(--ink-2); }
.mini .go { margin-left: auto; flex: none; font-weight: 700; }
.mini.dark { background: var(--night); color: var(--on-night); }
.mini.dark p { color: var(--on-night-2); }
.mini.dark .status-dot { width: 12px; height: 12px; margin: 0 6px; }
.form-card { padding: clamp(22px, 4vw, 44px); border-radius: var(--r); background: var(--paper-2); }
.form-card h2 { font-size: var(--fs-5); margin-bottom: 24px; }
.form-card .field input, .form-card .field textarea { background: var(--paper); }
.form-card .field input:focus, .form-card .field textarea:focus { background: #fff; }
.toast { position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); z-index: 105; translate: -50% 0; padding: 12px 18px; border-radius: var(--r-in); background: var(--ink); color: var(--paper); font-size: var(--fs-2); font-weight: 600; opacity: 0; transform: translateY(16px); transition: opacity .25s, transform .35s var(--ease); pointer-events: none; }
.toast.on { opacity: 1; transform: none; }

/* ============ Reduced motion ============ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; animation-iteration-count: 1 !important; transition-duration: .001s !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
  .solve { height: auto; }
  .solve-sticky { position: relative; height: auto; padding-block: 120px; }
}

/* ============ Waiting game ============ */
.game { margin-top: 22px; }
.game-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.game-bar p { margin: 0; font-size: var(--fs-2); color: var(--on-night-2); }
.game-bar button { flex: none; min-height: 40px; padding: 0 14px; border-radius: var(--r-in); border: 1.5px solid rgba(239, 237, 231, .3); background: none; color: var(--on-night); font-size: var(--fs-1); font-weight: 600; }
.game-bar button:hover { border-color: var(--on-night); }
#gameCanvas { display: block; width: 100%; aspect-ratio: 600 / 260; border-radius: var(--r-in); background: rgba(239, 237, 231, .05); cursor: pointer; touch-action: manipulation; }
#gameCanvas:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }
.game-score { display: flex; justify-content: space-between; margin: 10px 0 0; font-size: var(--fs-2); color: var(--on-night-2); }
.game-score b { color: var(--on-night); font-variant-numeric: tabular-nums; }
.check a { color: var(--red-ink); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.check a:hover { color: var(--ink); }
