/* SignDarpan — "darpan = mirror". Dark, editorial, humane. Fraunces + Hanken Grotesk.
   Signature cyan (the in-app target outline) + warm saffron. Built for accessibility. */

:root {
  --ink: #0a0c10;
  --ink-2: #0e1218;
  --panel: #141a23;
  --panel-2: #1a212c;
  --paper: #f1ece1;
  --muted: #9aa2b1;
  --faint: #717a89;
  --cyan: #3ce0cd;
  --cyan-2: #16b6a4;
  --saffron: #f2a93b;
  --rose: #f06b5d;
  --line: rgba(241, 236, 225, 0.10);
  --line-2: rgba(241, 236, 225, 0.20);
  --display: "Fraunces", Georgia, serif;
  --body: "Hanken Grotesk", system-ui, sans-serif;
  --maxw: 1120px;
  --r: 16px;
  --shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.7);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--ink);
  color: var(--paper);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  background-image:
    radial-gradient(1100px 600px at 78% -8%, rgba(60, 224, 205, 0.10), transparent 60%),
    radial-gradient(900px 600px at 8% 8%, rgba(242, 169, 59, 0.07), transparent 55%);
}

/* film grain for warmth/depth */
.grain {
  position: fixed; inset: 0; z-index: 9999; pointer-events: none; opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

a { color: inherit; text-decoration: none; }
em { font-style: italic; }
:focus-visible { outline: 2.5px solid var(--cyan); outline-offset: 3px; border-radius: 6px; }

/* ---------------- header ---------------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; gap: 22px;
  padding: 16px clamp(18px, 4vw, 48px);
  background: rgba(10, 12, 16, 0.72);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; margin-right: auto; }
.brand-mark {
  position: relative; width: 34px; height: 34px; flex: none;
  border: 1.5px solid var(--cyan); border-radius: 10px;
  display: grid; place-items: center; overflow: hidden;
  box-shadow: 0 0 22px -6px var(--cyan-2);
}
.brand-mark b, .brand-mark i {
  position: absolute; font-family: var(--display); font-weight: 600; font-size: 19px;
  font-style: normal; line-height: 1; color: var(--cyan);
}
.brand-mark b { transform: translateX(-5px); }
.brand-mark i { transform: translateX(5px) scaleX(-1); opacity: 0.45; } /* the mirror */
.brand-name { font-family: var(--display); font-weight: 600; font-size: 20px; letter-spacing: -0.01em; }
.brand-name em { color: var(--cyan); font-weight: 400; margin-left: 7px; font-size: 16px; opacity: 0.85; }
.brand-name.small { font-size: 18px; }
.site-nav { display: flex; gap: 6px; }
.site-nav a {
  padding: 8px 14px; border-radius: 999px; color: var(--muted); font-weight: 500; font-size: 15px;
  transition: color 0.18s, background 0.18s;
}
.site-nav a:hover { color: var(--paper); background: rgba(241, 236, 225, 0.06); }
.site-nav a.active { color: var(--ink); background: var(--cyan); }
.pill {
  font-size: 12.5px; font-weight: 600; letter-spacing: 0.02em; color: var(--saffron);
  border: 1px solid rgba(242, 169, 59, 0.4); border-radius: 999px; padding: 5px 12px; white-space: nowrap;
}
@media (max-width: 720px) { .site-nav { display: none; } .pill { display: none; } }

/* ---------------- views ---------------- */
.view { max-width: var(--maxw); margin: 0 auto; padding: 0 clamp(18px, 4vw, 48px) 80px; }
.view[hidden] { display: none; }
.view-head { padding: 48px 0 26px; max-width: 760px; }
.band-title {
  font-family: var(--display); font-weight: 600; font-size: clamp(28px, 4vw, 42px);
  letter-spacing: -0.02em; line-height: 1.05;
}
.view-sub { color: var(--muted); margin-top: 12px; font-size: 18px; }

/* ---------------- buttons ---------------- */
.btn {
  font-family: var(--body); font-weight: 600; font-size: 16px; cursor: pointer;
  border-radius: 999px; padding: 13px 24px; border: 1px solid transparent;
  transition: transform 0.15s, background 0.18s, color 0.18s, border-color 0.18s, box-shadow 0.18s;
  color: var(--paper); background: transparent;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--cyan); color: #05201d; box-shadow: 0 14px 34px -14px var(--cyan-2); }
.btn-primary:hover { background: #5cead7; }
.btn-ghost { border-color: var(--line-2); color: var(--paper); }
.btn-ghost:hover { border-color: var(--cyan); color: var(--cyan); }
.btn-sm { padding: 8px 16px; font-size: 14px; }

/* ---------------- HOME: hero ---------------- */
.hero {
  display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 48px; align-items: center;
  padding: clamp(48px, 8vw, 96px) 0 64px;
}
.eyebrow {
  display: inline-flex; align-items: center; gap: 9px; color: var(--muted);
  font-size: 14px; font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase;
}
.eyebrow .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 12px var(--cyan); }
.hero-title {
  font-family: var(--display); font-weight: 600; font-size: clamp(40px, 7.2vw, 84px);
  line-height: 0.98; letter-spacing: -0.035em; margin: 22px 0 24px;
}
.mirrorword { font-style: italic; color: var(--cyan); position: relative; }
.ink-accent { color: var(--saffron); font-style: italic; }
.hero-sub { font-size: clamp(17px, 1.6vw, 20px); color: #cfd4dd; max-width: 30em; }
.hero-sub strong { color: var(--cyan); font-weight: 700; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 14px; margin: 30px 0 18px; }
.hero-cta .btn { font-size: 17px; padding: 15px 28px; }
.hero-cta .btn-primary { font-size: 19px; padding: 18px 38px; }
.hero-foot { color: var(--faint); font-size: 14px; }

/* hero mirror visual */
.hero-mirror {
  position: relative; aspect-ratio: 4 / 5; border-radius: 22px; overflow: hidden;
  border: 1px solid var(--line-2); box-shadow: var(--shadow);
  display: grid; grid-template-columns: 1fr 1fr;
  background: linear-gradient(160deg, #10151d, #0b0e13);
}
.mirror-panel { position: relative; display: grid; place-items: end start; padding: 16px; }
.mirror-panel span { font-family: var(--body); font-weight: 800; font-size: 13px; letter-spacing: 0.18em; color: var(--muted); }
.teacher-side { background:
  radial-gradient(120% 90% at 30% 20%, rgba(242, 169, 59, 0.16), transparent 60%); }
.you-side { background:
  radial-gradient(120% 90% at 70% 20%, rgba(60, 224, 205, 0.18), transparent 60%); transform: scaleX(-1); }
.you-side span { transform: scaleX(-1); color: var(--cyan); }
.mirror-seam { position: absolute; left: 50%; top: 6%; bottom: 6%; width: 1px; transform: translateX(-50%);
  background: linear-gradient(var(--cyan), transparent 50%, var(--saffron)); opacity: 0.6; }
.hero-mirror::after { /* a stylised hand made of dots, on the "you" side */
  content: ""; position: absolute; right: 16%; top: 34%; width: 34%; aspect-ratio: 1;
  background:
    radial-gradient(circle, var(--cyan) 0 3px, transparent 3px) 0 0 / 22% 18%,
    radial-gradient(circle, var(--cyan) 0 2px, transparent 2px) 11% 9% / 22% 18%;
  opacity: 0.5; filter: drop-shadow(0 0 6px var(--cyan-2)); mask: radial-gradient(circle, #000 60%, transparent);
}

/* staggered reveal */
.hero-copy > * { opacity: 0; transform: translateY(14px); animation: rise 0.7s cubic-bezier(.2,.7,.2,1) forwards; }
.hero-copy > *:nth-child(1) { animation-delay: 0.05s; }
.hero-copy > *:nth-child(2) { animation-delay: 0.14s; }
.hero-copy > *:nth-child(3) { animation-delay: 0.23s; }
.hero-copy > *:nth-child(4) { animation-delay: 0.32s; }
.hero-copy > *:nth-child(5) { animation-delay: 0.4s; }
.hero-mirror { opacity: 0; animation: rise 0.9s 0.25s cubic-bezier(.2,.7,.2,1) forwards; }
@keyframes rise { to { opacity: 1; transform: none; } }

/* ---------------- HOME: bands ---------------- */
.band { padding: 56px 0; border-top: 1px solid var(--line); }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 26px; margin: 30px 0 18px; }
.stat { border-left: 2px solid var(--cyan); padding-left: 18px; }
.stat-num { display: block; font-family: var(--display); font-size: clamp(32px, 4vw, 48px); font-weight: 600; letter-spacing: -0.02em; }
.stat-label { color: var(--muted); font-size: 15.5px; }
.why-line { font-family: var(--display); font-size: clamp(20px, 2.4vw, 28px); line-height: 1.35; max-width: 24em; color: var(--paper); }
.why-line em { color: var(--saffron); font-style: italic; }

.steps { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 30px; }
.step { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 26px 22px; transition: transform 0.2s, border-color 0.2s; }
.step:hover { transform: translateY(-4px); border-color: var(--line-2); }
.step-n { font-family: var(--display); font-size: 14px; color: var(--cyan); letter-spacing: 0.1em; }
.step h3 { font-family: var(--display); font-weight: 600; font-size: 22px; margin: 8px 0 8px; }
.step p { color: var(--muted); font-size: 15.5px; }

.ethics-card {
  background: linear-gradient(150deg, var(--panel-2), var(--panel)); border: 1px solid var(--line-2);
  border-radius: 22px; padding: clamp(28px, 4vw, 44px); box-shadow: var(--shadow); max-width: 760px;
}
.ethics-card h2 { font-family: var(--display); font-weight: 600; font-size: clamp(24px, 3vw, 34px); }
.ethics-card ul { list-style: none; margin: 20px 0 26px; display: grid; gap: 12px; }
.ethics-card li { padding-left: 26px; position: relative; color: #cfd4dd; }
.ethics-card li::before { content: "✦"; position: absolute; left: 0; color: var(--cyan); }
.ethics-card li b { color: var(--paper); }

/* ---------------- DICTIONARY ---------------- */
.dict-search {
  width: 100%; margin-top: 22px; padding: 15px 18px; font-size: 17px; font-family: var(--body);
  color: var(--paper); background: var(--ink-2); border: 1px solid var(--line-2); border-radius: 14px;
}
.dict-search::placeholder { color: var(--faint); }
.dict-search:focus { border-color: var(--cyan); outline: none; }
.dict-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.cat-chip {
  font-family: var(--body); font-size: 13.5px; font-weight: 600; cursor: pointer;
  padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line-2);
  background: transparent; color: var(--muted); text-transform: capitalize; transition: all 0.16s;
}
.cat-chip:hover { color: var(--paper); border-color: var(--cyan); }
.cat-chip.active { background: var(--cyan); color: #05201d; border-color: var(--cyan); }

.dict-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 14px; margin-top: 28px;
}
.sign-card {
  position: relative; text-align: left; cursor: pointer; overflow: hidden;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px 16px 16px;
  transition: transform 0.18s, border-color 0.18s, background 0.18s; color: var(--paper);
  font-family: var(--body);
}
.sign-card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--cyan);
  transform: scaleY(0); transform-origin: top; transition: transform 0.22s;
}
.sign-card:hover { transform: translateY(-4px); border-color: var(--line-2); background: var(--panel-2); }
.sign-card:hover::before { transform: scaleY(1); }
.sign-card .w { display: block; font-family: var(--display); font-weight: 600; font-size: 21px; letter-spacing: -0.01em; text-transform: capitalize; }
.sign-card .c { display: block; margin-top: 6px; color: var(--faint); font-size: 12.5px; text-transform: capitalize; letter-spacing: 0.02em; }
.sign-card .go { position: absolute; right: 14px; bottom: 14px; color: var(--cyan); opacity: 0; transform: translateX(-4px); transition: all 0.18s; }
.sign-card:hover .go { opacity: 1; transform: none; }
.dict-empty { color: var(--muted); margin-top: 30px; font-style: italic; }

/* ---------------- TYPE A SENTENCE ---------------- */
.search-form { display: flex; gap: 12px; margin-top: 22px; }
.search-form .dict-search { margin-top: 0; }
.results { display: grid; gap: 26px; margin-top: 10px; }
.result-title { font-family: var(--display); font-weight: 600; font-size: 20px; margin-bottom: 12px; }
.result-title.muted { color: var(--muted); }
.chip-row { display: flex; flex-wrap: wrap; gap: 10px; }
.sign-chip {
  display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-family: var(--body);
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 999px; padding: 9px 16px 9px 9px;
  color: var(--paper); font-weight: 600; text-transform: capitalize; transition: all 0.16s;
}
.sign-chip:hover { border-color: var(--cyan); color: var(--cyan); transform: translateY(-2px); }
.sign-chip .idx { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--cyan); color: #05201d; font-size: 12px; }
.miss-chip { background: rgba(240, 107, 93, 0.1); border: 1px dashed rgba(240, 107, 93, 0.4); color: #f3a399; border-radius: 999px; padding: 8px 14px; font-size: 14px; text-transform: capitalize; }

/* ---------------- PRACTICE ---------------- */
.view-practice { max-width: 1380px; }
.practice-top { display: flex; align-items: center; justify-content: space-between; padding: 28px 0 18px; gap: 12px; }
.lesson-progress { color: var(--muted); font-size: 14px; font-weight: 600; letter-spacing: 0.03em; }
.stage { display: grid; grid-template-columns: 1fr 1.35fr; gap: 16px; }   /* camera window bigger than teacher */
/* the hidden attribute must always win over component display rules (else .media-missing's display:grid keeps it on screen) */
[hidden] { display: none !important; }
/* cap teacher + camera box height so the Record button sits right under the camera window, not far below after a long scroll */
.teacher-panel .media,
.teacher-panel .media-missing,
.cam-wrap { aspect-ratio: auto; height: min(56vh, 540px); }
.panel { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 16px; overflow: hidden; }
.panel-tag { display: flex; align-items: baseline; justify-content: space-between; font-weight: 800; font-size: 12px; letter-spacing: 0.16em; color: var(--muted); margin-bottom: 10px; }
.panel-tag .credit { font-weight: 500; letter-spacing: 0.02em; color: var(--faint); font-size: 11px; }
.teacher-panel { border-top: 2px solid var(--saffron); }
.you-panel { border-top: 2px solid var(--cyan); }
.sign-word { font-family: var(--display); font-weight: 600; font-size: clamp(26px, 3vw, 38px); letter-spacing: -0.02em; margin-bottom: 12px; text-transform: capitalize; }
.media { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: #05070a; border-radius: 12px; display: block; }
.media.mirrored { transform: scaleX(-1); }
.media-missing { aspect-ratio: 4 / 3; display: grid; place-items: center; text-align: center; color: var(--muted); background: #05070a; border-radius: 12px; padding: 20px; font-size: 14px; }
.media-missing code { color: var(--cyan); }
.instruction { color: var(--muted); margin-top: 12px; font-size: 15px; }
.cam-wrap { position: relative; width: 100%; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 12px; background: #05070a; }
.cam-wrap .media { position: absolute; inset: 0; width: 100%; height: 100%; aspect-ratio: auto; border-radius: 0; }
.overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.rec-badge { position: absolute; top: 12px; right: 12px; display: flex; align-items: center; gap: 7px; background: rgba(240,107,93,0.92); color: #fff; font-weight: 800; font-size: 12px; letter-spacing: 0.1em; padding: 5px 11px; border-radius: 999px; }
.rec-dot { width: 8px; height: 8px; border-radius: 50%; background: #fff; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: 0.25; } }
.cam-status { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px; color: var(--paper); background: rgba(5,7,10,0.86); border-radius: 12px; font-size: 15px; }
.load-overlay { position: absolute; inset: 0; display: grid; place-items: center; gap: 14px; background: rgba(5,7,10,0.8); border-radius: 12px; }
.spinner { width: 34px; height: 34px; border: 3px solid var(--line-2); border-top-color: var(--cyan); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.load-overlay p { color: var(--muted); font-size: 14px; }

.verdict-bar { display: flex; align-items: center; gap: 14px; margin-top: 12px; padding: 14px 20px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--panel); font-size: 16px; }
.verdict-icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; font-weight: 800; flex: none; }
.verdict-text { flex: 1; }
.verdict-pct { font-family: var(--display); font-weight: 600; font-size: 22px; }
.verdict-bar.good { border-color: rgba(60,224,205,0.5); background: rgba(60,224,205,0.08); }
.verdict-bar.good .verdict-icon { background: var(--cyan); color: #05201d; }
.verdict-bar.warn .verdict-icon { background: var(--saffron); color: #2a1c05; }
.verdict-bar.bad { border-color: rgba(240,107,93,0.5); background: rgba(240,107,93,0.07); }
.verdict-bar.bad .verdict-icon { background: var(--rose); color: #fff; }
.verdict-bar.info .verdict-icon { background: var(--line-2); color: var(--paper); }

.practice-controls { display: flex; align-items: center; justify-content: center; gap: 18px; margin-top: 12px; flex-wrap: wrap; }
.btn-record { position: relative; padding: 17px 32px 17px 54px; font-size: 18px; }
.rec-ring { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; border-radius: 50%; background: var(--rose); box-shadow: 0 0 0 3px rgba(240,107,93,0.3); }
.btn-record.is-recording .rec-ring { animation: blink 1s infinite; }
.kbd-hint { color: var(--faint); font-size: 14px; }
kbd { font-family: var(--body); background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 6px; padding: 2px 7px; font-size: 12px; }

/* ---------------- footer ---------------- */
.site-footer { border-top: 1px solid var(--line); margin-top: 40px; padding: 44px clamp(18px,4vw,48px); }
.foot-grid { max-width: var(--maxw); margin: 0 auto; display: grid; grid-template-columns: 1.2fr 1fr; gap: 30px; }
.foot-grid p { color: var(--muted); font-size: 14px; margin-top: 8px; max-width: 40em; }
.foot-credits p { color: var(--faint); }

/* ---------------- responsive ---------------- */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .hero-mirror { max-width: 340px; }
  .stat-row, .steps { grid-template-columns: 1fr; }
  .stage { grid-template-columns: 1fr; }
  .foot-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto; }
  .hero-copy > *, .hero-mirror { opacity: 1; transform: none; }
}
