/* Ujvall - one stylesheet, one layer. Each element is styled in one place. */

/* ---------- Tokens ---------- */
:root {
  --paper: #FBFAF6;
  --white: #FFFFFF;
  --ink: #17243B;
  --ink-2: #44506A;
  --ink-3: #5E6A82;
  --pen: #24498A;
  --grid: #E3EAF3;
  --rule: #E7E2D8;
  --margin: #EFC9C9;
  --marigold: #E7A33E;
  --marigold-soft: #FFF3DC;
  --marigold-deep: #8A5A12;
  --night: #15213A;

  --f-text: "Mukta", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-hand: "Kalam", "Comic Sans MS", cursive;

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 72px; --s9: 112px;
  --r: 14px;
  --wrap: 1120px;

  --t-h1: clamp(2.25rem, 1.5rem + 3vw, 3.5rem);
  --t-h2: clamp(1.6rem, 1.2rem + 1.8vw, 2.4rem);
  --t-body: 1.0625rem;
  --t-small: 0.9375rem;

  --lift: 0 1px 2px rgba(23,36,59,.05), 0 18px 40px -22px rgba(23,36,59,.28);
  --lift-photo: 0 2px 4px rgba(23,36,59,.06), 0 28px 60px -30px rgba(23,36,59,.45);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--f-text); font-size: var(--t-body); line-height: 1.6; color: var(--ink); background: var(--paper); overflow-x: hidden; }
h1, h2, h3 { text-wrap: balance; margin: 0; line-height: 1.15; letter-spacing: -0.01em; font-weight: 700; }
h1 { font-size: var(--t-h1); line-height: 1.06; letter-spacing: -0.02em; }
h2 { font-size: var(--t-h2); max-width: 22ch; }
h3 { font-size: 1.25rem; font-weight: 600; }
p { margin: 0; }
a { color: inherit; }
a:focus-visible, button:focus-visible { outline: 3px solid var(--marigold); outline-offset: 3px; border-radius: 6px; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--s5); }
section { padding: var(--s8) 0; }
.br-desk { display: none; }
@media (min-width: 900px) { .br-desk { display: inline; } }
.hand { font-family: var(--f-hand); color: var(--pen); }
.hand.small { font-size: 1.3rem; }
.eyebrow { font-size: var(--t-small); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; margin-bottom: var(--s3); }

/* ---------- Page background: one surface behind everything ---------- */
body::before { content: ""; position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background-image: linear-gradient(rgba(36,73,138,.075) 1px, transparent 1px), linear-gradient(90deg, rgba(36,73,138,.075) 1px, transparent 1px);
  background-size: 28px 28px;
  -webkit-mask-image: radial-gradient(ellipse 90% 85% at 50% 45%, #000 30%, transparent 100%);
          mask-image: radial-gradient(ellipse 90% 85% at 50% 45%, #000 30%, transparent 100%); }
body::after { content: ""; position: fixed; inset: -10%; z-index: -1; pointer-events: none;
  background:
    radial-gradient(38vmax 38vmax at 85% 20%, rgba(231,163,62,.16), transparent 70%),
    radial-gradient(34vmax 34vmax at 8% 85%, rgba(36,73,138,.07), transparent 70%);
  animation: float 24s ease-in-out infinite alternate; }
@keyframes float { to { transform: translate(-4%, 3%) scale(1.06); } }

/* ---------- Header ---------- */
.site-header { position: sticky; top: 0; z-index: 10; background: var(--paper); transition: box-shadow .3s; }
.site-header.scrolled { box-shadow: 0 10px 30px -22px rgba(23,36,59,.35); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.wordmark { font-weight: 700; font-size: 1.4rem; letter-spacing: -0.02em; text-decoration: none; display: inline-flex; align-items: flex-start; gap: 3px; }
.wordmark.small { font-size: 1.15rem; }
.light-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--marigold); margin-top: 6px; box-shadow: 0 0 0 4px rgba(231,163,62,.18), 0 0 14px rgba(231,163,62,.55); }
.header-nav { display: none; gap: var(--s5); font-size: var(--t-small); }
.header-nav a { text-decoration: none; color: var(--ink-2); padding: var(--s2) 0; }
.header-nav a:hover { color: var(--ink); }
@media (min-width: 900px) { .header-nav { display: flex; } }

/* ---------- Night panel: hero + problem, one rounded object on the paper ---------- */
.night { position: relative; margin: 4px 10px 0; border-radius: 28px; background: var(--night); color: #F3F1EA; overflow: hidden;
  box-shadow: 0 2px 6px rgba(23,36,59,.08), 0 40px 80px -40px rgba(23,36,59,.55); }
@media (min-width: 900px) { .night { margin: 8px 16px 0; border-radius: 36px; } }
.night::before { content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px);
  background-size: 28px 28px;
  -webkit-mask-image: radial-gradient(ellipse 70% 40% at 70% 18%, #000, transparent 80%);
          mask-image: radial-gradient(ellipse 70% 40% at 70% 18%, #000, transparent 80%); }
.night::after { content: ""; position: absolute; width: 780px; height: 780px; right: -160px; top: 0; pointer-events: none;
  background: radial-gradient(closest-side, rgba(231,163,62,.2), rgba(231,163,62,0)); }
.night > section { position: relative; z-index: 1; }

/* ---------- Hero ---------- */
.hero { padding: var(--s7) 0 var(--s7); }
@media (min-width: 900px) { .hero { padding: var(--s8) 0; } }
.hero-grid { display: grid; gap: var(--s6); align-items: center; }
@media (min-width: 900px) { .hero-grid { grid-template-columns: 1fr 1.15fr; gap: var(--s7); } }
.hero .eyebrow { color: #E7B871; }
.hero h1 { color: #FFFFFF; }
.lede { font-size: 1.25rem; color: #D9DDE6; margin-top: var(--s5); max-width: 32ch; }
.facts-inline { list-style: none; padding: 0; margin: var(--s6) 0; display: flex; flex-wrap: wrap; gap: var(--s2) var(--s5); color: #C9CFDB; font-size: var(--t-small); }
.facts-inline li { display: inline-flex; align-items: center; gap: var(--s2); }
.facts-inline svg { width: 18px; height: 18px; color: #E7B871; }
.link-arrow { display: inline-flex; gap: var(--s2); align-items: center; font-weight: 600; text-decoration: none; padding: var(--s3) var(--s5); border: 1.5px solid rgba(255,255,255,.7); color: #FFFFFF; border-radius: 999px; min-height: 48px; transition: background .2s, color .2s; }
.link-arrow:hover { background: #FFFFFF; color: var(--night); }
@media (max-width: 899px) { .hero .link-arrow { display: none; } .facts-inline { margin-bottom: 0; } }
.hero-visual { display: flex; justify-content: center; }
@media (min-width: 900px) { .hero-visual { justify-content: flex-end; } }

/* ---------- Demo device ---------- */
.device { position: relative; margin: 0; width: 100%; max-width: 480px; color: var(--ink); background: var(--white); border-radius: 18px; overflow: hidden;
  box-shadow: 0 0 0 1px rgba(255,255,255,.06), 0 40px 90px -30px rgba(0,0,0,.65), 0 0 60px -10px rgba(231,163,62,.25); }
.device-bar { display: flex; align-items: center; justify-content: space-between; padding: var(--s3) var(--s4); border-bottom: 1px solid var(--rule); background: #F7F5F0; font-size: var(--t-small); }
.ai-id { display: inline-flex; align-items: center; gap: var(--s2); font-weight: 700; }
.offline-pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; background: var(--white); border: 1px solid var(--rule); color: var(--ink-2); font-size: .8125rem; }
.offline-pill svg { width: 14px; height: 14px; }
.device-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s3) var(--s4); border-top: 1px solid var(--rule); font-size: var(--t-small); color: var(--ink-2); background: #F7F5F0; }
.ghost-btn { font: inherit; font-weight: 600; color: var(--ink); background: var(--white); border: 1px solid #CFC9BC; border-radius: 999px; padding: 6px 16px; min-height: 36px; cursor: pointer; }
.ghost-btn:hover { border-color: var(--ink); }

.notebook { position: relative; padding: var(--s4) var(--s4) var(--s4) 44px; background-color: var(--white);
  background-image:
    linear-gradient(90deg, transparent 31px, var(--margin) 31px, var(--margin) 33px, transparent 33px),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 100% 100%, 24px 24px, 24px 24px; }
.nb-head { display: flex; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; font-size: .8125rem; color: var(--ink-2); margin-bottom: var(--s4); }
.learner { font-variant-numeric: tabular-nums; background: var(--paper); border: 1px solid var(--rule); border-radius: 6px; padding: 0 8px; }
@media (max-width: 440px) { .nb-head .learner { display: none; } }

.lines { display: grid; gap: 2px; }
.line { position: relative; margin: 0; min-height: 44px; display: flex; align-items: center; }
.line .hand { font-size: 1.6rem; line-height: 1.2; white-space: nowrap; clip-path: inset(-10% 100% -25% 0); }
.line.write .hand { clip-path: inset(-10% 0 -25% 0); transition: clip-path var(--dur, 1.1s) steps(18, end); }
.line .hand mark { background: none; color: var(--pen); box-shadow: inset 0 -0.42em 0 var(--marigold-soft); border-bottom: 2px solid var(--marigold); padding: 0 2px; }
.line .pt { border-radius: 6px; padding: 0 3px; transition: background .4s, box-shadow .4s; }
.line .pt.on { background: rgba(231,163,62,.22); box-shadow: 0 0 0 2px rgba(231,163,62,.55); }
.line .final { position: relative; padding: 0 10px; }
.line .final::after { content: ""; position: absolute; inset: -4px -2px -6px -4px; border: 2px solid var(--marigold); border-radius: 46% 54% 50% 48% / 58% 46% 54% 42%; transform: rotate(-3deg); opacity: 0; transition: opacity .5s .3s; }
.line.write .final::after { opacity: 1; }
.line.reading::after { content: ""; position: absolute; left: -8px; right: 0; top: 4px; bottom: 4px; border-radius: 8px;
  background: linear-gradient(90deg, rgba(231,163,62,0), rgba(231,163,62,.30), rgba(231,163,62,0)) no-repeat; background-size: 45% 100%;
  animation: scan 1s ease-in-out forwards; }
@keyframes scan { from { background-position: -60% 0; } to { background-position: 160% 0; } }
.notebook.fade .lines { opacity: 0; transition: opacity .6s; }

.orb { position: relative; display: inline-block; width: 14px; height: 14px; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 35% 35%, #FFE6B3 0%, #F2B24E 45%, #D98A1E 100%);
  box-shadow: 0 0 0 3px rgba(231,163,62,.18), 0 0 14px rgba(231,163,62,.7); }
.orb.big { width: 30px; height: 30px; box-shadow: 0 0 0 5px rgba(231,163,62,.15), 0 0 22px rgba(231,163,62,.65); }
.device.thinking .orb { animation: breathe 1.1s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.18); box-shadow: 0 0 0 7px rgba(231,163,62,.12), 0 0 30px rgba(231,163,62,.9); } }

.tutor { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s4); border-top: 1px solid var(--rule); background: linear-gradient(180deg, #FFF8EA, #FFF3DC); min-height: 104px; transition: background .4s; }
.tutor.done { background: linear-gradient(180deg, #F2F8F0, #E8F2E5); }
.tutor-body { min-width: 0; }
.tutor-label { display: block; font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--marigold-deep); }
.tutor.done .tutor-label { color: #2F6B37; }
.tutor-text { font-size: 1rem; line-height: 1.45; color: var(--ink); margin-top: 2px; min-height: 2.9em; }
.caret { display: inline-block; width: 2px; height: 1.05em; background: var(--marigold-deep); margin-left: 2px; vertical-align: -0.15em; opacity: 0; }
.device.is-typing .caret { opacity: 1; animation: blinkc .8s steps(2) infinite; }
@keyframes blinkc { 50% { opacity: 0; } }

/* ---------- Problem (inside the night panel) ---------- */
.problem { padding: 0 0 var(--s8); }
.band { position: relative; width: calc(100% - 2 * var(--s3)); max-width: 1360px; margin: 0 auto; height: clamp(380px, 62vh, 600px); border-radius: 22px; overflow: hidden; }
@media (min-width: 900px) { .band { width: calc(100% - 2 * var(--s5)); border-radius: 28px; } }
.band img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 40%; }
.band::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(21,33,58,0) 40%, rgba(21,33,58,.75) 100%); }
.band-text { position: absolute; left: 0; right: 0; bottom: var(--s6); z-index: 1; }
.band-text h2 { color: #FFFFFF; max-width: 26ch; text-shadow: 0 2px 18px rgba(0,0,0,.35); }
.stats { display: grid; gap: var(--s7); margin-top: var(--s8); }
@media (min-width: 900px) { .stats { grid-template-columns: repeat(3, 1fr); gap: var(--s6); } }
.stat { border-top: 1px solid rgba(243,241,234,.18); padding-top: var(--s5); }
.stat-num { font-family: var(--f-hand); font-weight: 700; font-size: clamp(2.6rem, 2rem + 2.4vw, 3.6rem); line-height: 1; color: var(--marigold); }
.stat-text { margin-top: var(--s4); font-size: 1.125rem; color: #E7E4DC; max-width: 30ch; }
.stat-src { margin-top: var(--s3); font-size: .875rem; color: #B9BFCC; }
.dots { display: flex; gap: 6px; margin-top: var(--s4); }
.dots i { width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid #8C96AB; }
.dots i.on { background: #8C96AB; }
.problem-close { margin-top: var(--s8); font-size: clamp(1.25rem, 1rem + 1vw, 1.6rem); line-height: 1.4; color: #FFFFFF; max-width: 40ch; }

/* ---------- Objects on the paper ---------- */
.photo { margin: 0; border-radius: 18px; overflow: hidden; background: var(--rule); box-shadow: var(--lift-photo); }
.photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.card { background: rgba(255,255,255,.9); border: 1px solid rgba(23,36,59,.06); border-radius: var(--r); padding: var(--s5); box-shadow: var(--lift); }
.card-ic { width: 28px; height: 28px; color: var(--pen); margin-bottom: var(--s4); }
.card p { margin-top: var(--s2); color: var(--ink-2); }

/* ---------- What Ujvall does ---------- */
.does { padding-top: var(--s9); }
.does h2 { max-width: 30ch; }
.does-grid { display: grid; gap: var(--s5); margin-top: var(--s7); }
.cards { display: grid; gap: var(--s4); }
.does-photo { aspect-ratio: 4 / 3; }
@media (min-width: 900px) {
  .does-grid { grid-template-columns: 1.1fr 1fr; gap: var(--s6); align-items: stretch; }
  .does-photo { aspect-ratio: auto; min-height: 100%; }
  .does-grid .card { display: grid; grid-template-columns: 28px 1fr; column-gap: var(--s4); }
  .does-grid .card-ic { grid-row: 1 / span 2; margin: 2px 0 0; }
  .does-grid .card p { margin-top: var(--s1); }
}

/* ---------- Session ---------- */
.steps { list-style: none; padding: 0; margin: var(--s7) 0 0; display: grid; gap: var(--s6); }
.steps li { position: relative; display: grid; grid-template-columns: 32px 1fr; column-gap: var(--s4); align-items: center; }
.steps li .step-n { grid-row: 1 / span 2; align-self: start; }
.step-n { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; border: 1.5px solid var(--ink); background: var(--paper); font-weight: 700; font-size: .9375rem; }
.step-visual { height: 48px; display: flex; align-items: center; gap: var(--s2); margin: 0 0 var(--s1); }
.steps li > p:last-child { color: var(--ink-2); }
@media (min-width: 760px) {
  .steps { grid-template-columns: repeat(4, 1fr); gap: var(--s5); }
  .steps li { display: block; }
  .step-visual { height: 64px; margin: var(--s4) 0 var(--s2); }
  .steps li:not(:last-child)::after { content: ""; position: absolute; top: 16px; left: 44px; right: -8px; border-top: 1.5px dashed #CFC9BC; }
}
.code-chip { font-variant-numeric: tabular-nums; font-weight: 600; letter-spacing: .04em; background: var(--white); border: 1px dashed #B9B2A3; border-radius: 8px; padding: 6px 12px; }
.clock { width: 40px; height: 40px; border-radius: 50%; background: conic-gradient(var(--marigold) 0 240deg, var(--marigold-soft) 240deg 360deg); box-shadow: inset 0 0 0 2px var(--white); }
.mins { font-weight: 600; }
.person { width: 40px; height: 40px; color: var(--pen); }

/* ---------- Safety ---------- */
.safety-grid { display: grid; gap: var(--s6); }
@media (min-width: 900px) { .safety-grid { grid-template-columns: .8fr 1.2fr; gap: var(--s8); align-items: start; } .safety-grid > div { position: sticky; top: 96px; } }
.sub { margin-top: var(--s3); color: var(--ink-2); font-size: 1.125rem; }
.safety-photo { margin-top: var(--s6); aspect-ratio: 4 / 3; }
@media (max-width: 899px) { .safety-photo { aspect-ratio: 16 / 10; } }
.checks { list-style: none; margin: 0; padding: var(--s2) var(--s5); display: grid; background: rgba(255,255,255,.9); border-radius: var(--r); box-shadow: var(--lift); }
.checks li { position: relative; padding: var(--s4) 0 var(--s4) 44px; }
.checks li + li { border-top: 1px solid rgba(23,36,59,.06); }
.checks li::before { content: ""; position: absolute; left: 4px; top: 20px; width: 22px; height: 22px; border-radius: 50%; background: #EEF5EC url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232F6B37' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4 8-9'/%3E%3C/svg%3E") center / 14px no-repeat; }

/* ---------- Where we are ---------- */
.path-grid { display: grid; gap: var(--s6); align-items: center; }
@media (min-width: 900px) { .path-grid { grid-template-columns: 1.1fr 1fr; gap: var(--s8); } }
.path-photo { aspect-ratio: 3 / 2; }
.path-list { list-style: none; padding: 0; margin: var(--s6) 0 0; display: grid; gap: var(--s5); position: relative; }
.path-list::after { content: ""; position: absolute; left: 6px; top: 20px; bottom: 30px; border-left: 2px dotted #CFC9BC; }
.path-list li { position: relative; padding: 0 0 0 var(--s6); }
.path-list li::before { content: ""; position: absolute; z-index: 1; top: 6px; left: 0; width: 14px; height: 14px; border-radius: 50%; border: 2px solid #B9B2A3; background: var(--paper); }
.path-list li.now::before { border-color: var(--marigold); background: var(--marigold); box-shadow: 0 0 0 5px rgba(231,163,62,.2); }
.path-tag { font-size: .8125rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.path-list li.now .path-tag { color: var(--marigold-deep); }
.path-list p { margin-top: var(--s2); font-size: 1.125rem; }

/* ---------- Why it matters ---------- */
.why-grid { display: grid; gap: var(--s6); }
@media (min-width: 900px) { .why-grid { grid-template-columns: .8fr 1.2fr; gap: var(--s8); } }
.goals { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s5); }
.goal { font-size: var(--t-small); font-weight: 600; border: 1.5px solid var(--ink); border-radius: 999px; padding: 4px 14px; background: var(--paper); }
.why-text { display: grid; gap: var(--s4); font-size: 1.125rem; }
.evidence { font-size: var(--t-small); color: var(--ink-2); }
.evidence a { color: var(--pen); text-underline-offset: 3px; }

/* ---------- Contact ---------- */
.contact { text-align: center; }
.contact-inner { display: grid; justify-items: center; gap: var(--s5); }
.contact h2 { max-width: none; }
.contact-photo { width: 100%; max-width: 880px; aspect-ratio: 16 / 7; margin-bottom: var(--s5); }
.contact-photo img { object-position: center 35%; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 52px; padding: 0 var(--s6); border-radius: 999px; background: var(--ink); color: var(--white); text-decoration: none; font-weight: 600; font-size: 1.0625rem; transition: background .2s; box-shadow: var(--lift); }
.btn:hover { background: #24375A; }

/* ---------- Footer ---------- */
.site-footer { padding: var(--s6) 0; font-size: var(--t-small); color: var(--ink-2); }
.footer-inner { display: grid; gap: var(--s2); }
@media (min-width: 760px) { .footer-inner { grid-template-columns: auto auto 1fr; gap: var(--s5); align-items: center; } .privacy { text-align: right; } }

/* ---------- Rise on scroll ---------- */
.js-reveal .reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s ease, transform .7s ease; }
.js-reveal .reveal.in { opacity: 1; transform: none; }

/* ---------- Reduced motion: final states, nothing moves ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  body::after { animation: none; }
  .line .hand { clip-path: none !important; }
  .line .final::after { opacity: 1; }
  .device .orb { animation: none !important; }
  .js-reveal .reveal { opacity: 1; transform: none; transition: none; }
}
