/* AfterClass website: introduction page, privacy policy and terms.
   Same "student desk" look as the Mini App (public/app/styles.css). */

:root {
  --bg: #f4efe5;
  --dot: rgba(36, 32, 52, 0.11);
  --surface: #fffcf6;
  --surface-2: #ece5d6;
  --ink: #211f2d;
  --ink-2: #6f6a7b;
  --line: #e2dac8;
  --marker: #ffd84a;
  --marker-ink: #211f2d;
  --hero: #211f2d;
  --hero-ink: #fbf6ec;
  --red: #e4553a;
  --shadow: rgba(60, 44, 20, 0.22);
  --display: 'Bricolage Grotesque', 'Kantumruy Pro', system-ui, sans-serif;
  --font: 'DM Sans', 'Kantumruy Pro', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --hand: 'Caveat', 'Kantumruy Pro', cursive;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16151e;
    --dot: rgba(255, 255, 255, 0.07);
    --surface: #211f2c;
    --surface-2: #2b2939;
    --ink: #f4efe5;
    --ink-2: #a39eb1;
    --line: #34313f;
    --marker: #f5cf45;
    --hero: #2b2939;
    --shadow: rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background-color: var(--bg);
  background-image: radial-gradient(var(--dot) 1.1px, transparent 1.3px);
  background-size: 20px 20px;
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--display); line-height: 1.12; letter-spacing: -0.02em; margin: 0; }
p { margin: 0; }
a { color: inherit; }
img, svg { display: block; }

/* English / Khmer: every text exists twice; html[lang] decides which shows. */
html[lang='en'] [data-l='km'], html[lang='km'] [data-l='en'] { display: none !important; }
html[lang='km'] body { line-height: 1.8; }
html[lang='km'] :is(h1, h2, h3) { letter-spacing: 0; line-height: 1.45; }
html[lang='km'] .hand { font-family: var(--font); font-size: 18px; font-weight: 600; transform: none; }

.wrap { width: min(1080px, 100% - 32px); margin: 0 auto; }

/* ------------------------------------------------------------ header */
.site-head {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
}
.site-head .wrap { display: flex; align-items: center; gap: 16px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; font-family: var(--display); font-weight: 800; font-size: 20px; }
.brand svg { width: 30px; height: 30px; }
.site-nav { display: flex; gap: 22px; margin-left: auto; font-weight: 600; font-size: 15px; }
.site-nav a { text-decoration: none; color: var(--ink-2); }
.site-nav a:hover { color: var(--ink); }
.lang-toggle { display: inline-flex; padding: 3px; gap: 2px; border-radius: 22px; background: var(--surface); border: 1px solid var(--line); }
.lang-toggle button {
  font: inherit; font-size: 14px; font-weight: 700; color: var(--ink-2);
  min-width: 44px; height: 34px; padding: 0 10px; border: 0; border-radius: 17px; background: none; cursor: pointer;
}
.lang-toggle button:last-child { font-family: 'Kantumruy Pro', var(--font); font-weight: 600; }
.lang-toggle button[aria-pressed='true'] { background: var(--ink); color: var(--bg); }
@media (max-width: 720px) { .site-nav { display: none; } .lang-toggle { margin-left: auto; } }

/* ------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: 56px; padding: 0 26px; border-radius: 18px;
  font-weight: 700; font-size: 17px; text-decoration: none;
  transition: transform 0.15s;
}
.btn:active { transform: scale(0.97); }
.btn svg { width: 20px; height: 20px; }
.btn.marker { background: var(--marker); color: var(--marker-ink); box-shadow: 0 14px 28px -16px rgba(120, 90, 0, 0.6); }
.btn.ghost { background: var(--surface); border: 1px solid var(--line); }
.btn.dark { background: var(--ink); color: var(--bg); }

/* ------------------------------------------------------------ hero */
.hero .wrap { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 40px; align-items: center; padding: 72px 0 56px; }
.hand { font-family: var(--hand); font-size: 30px; color: var(--red); transform: rotate(-2deg); transform-origin: left; line-height: 1; }
.hero h1 { font-size: clamp(40px, 6.4vw, 68px); font-weight: 800; margin-top: 12px; }
.hero h1 mark { background: linear-gradient(transparent 58%, var(--marker) 58% 92%, transparent 92%); color: inherit; padding: 0 2px; }
.lead { font-size: clamp(17px, 2.2vw, 20px); color: var(--ink-2); margin-top: 18px; max-width: 34em; }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.small-note { margin-top: 14px; font-size: 14px; color: var(--ink-2); }

.invite {
  display: none; margin-top: 22px; padding: 14px 18px; border-radius: 18px;
  background: var(--surface); border: 1.5px dashed var(--red); font-weight: 600;
}
.has-invite .invite { display: block; }

/* desk illustration */
.desk { position: relative; height: 420px; }
.nb {
  position: absolute; width: 190px; aspect-ratio: 5 / 7; border-radius: 6px 22px 22px 6px; background: var(--c);
  box-shadow: 2px 2px 0 var(--surface), 3px 3px 0 var(--line), 5px 5px 0 var(--surface), 6px 6px 0 var(--line), 22px 28px 36px -18px var(--shadow);
}
.nb::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 17px; background: var(--s); border-radius: 6px 0 0 6px; }
.nb::after { content: ''; position: absolute; top: 0; bottom: 0; right: 22px; width: 8px; background: var(--b); opacity: 0.55; }
.nb .label {
  position: absolute; left: 25px; right: 9px; top: 20px; z-index: 1;
  background: #fffcf6; color: #211f2d; border-radius: 9px; padding: 10px 10px;
  font-family: var(--display); font-weight: 700; font-size: 16px; line-height: 1.2; letter-spacing: -0.01em;
  overflow-wrap: break-word; /* last resort for a very long class name */
}
.nb .label small { display: block; font-family: var(--font); font-weight: 600; font-size: 12px; color: #6f6a7b; margin-top: 3px; }
.nb .face { position: absolute; left: 26px; bottom: 20px; width: 52px; z-index: 1; transform: rotate(-9deg); filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.2)); }
.nb.n1 { --c: #3f6fd6; --s: #3459af; --b: #1c3260; left: 4%; top: 70px; transform: rotate(-8deg); }
.nb.n2 { --c: #e4553a; --s: #bb4630; --b: #66261a; left: 38%; top: 10px; transform: rotate(6deg); }
.paper-card {
  position: absolute; right: 0; bottom: 0; width: 70%; padding: 24px 22px 20px 44px; border-radius: 6px 20px 20px 6px;
  background-color: var(--surface);
  background-image: repeating-linear-gradient(transparent 0 27px, var(--line) 27px 28px);
  background-position: 0 18px;
  box-shadow: 0 24px 40px -26px var(--shadow); transform: rotate(-3deg); line-height: 28px; font-size: 15px;
}
.paper-card::before { content: ''; position: absolute; top: 0; bottom: 0; left: 28px; width: 1.5px; background: #eba79c; }
.paper-card .tape { position: absolute; top: -12px; left: 40%; width: 84px; height: 24px; background: var(--marker); opacity: 0.8; transform: rotate(-4deg); }
.paper-card b { font-family: var(--hand); font-size: 22px; color: var(--red); font-weight: 600; }
html[lang='km'] .paper-card b { font-family: var(--font); font-size: 14px; }

@media (max-width: 880px) {
  .hero .wrap { grid-template-columns: 1fr; padding-top: 44px; }
  .desk { height: 360px; max-width: 460px; width: 100%; margin: 0 auto; }
  .nb { width: 150px; }
  .nb .label { left: 21px; right: 7px; top: 16px; padding: 8px; font-size: 13px; }
  .nb .label small { font-size: 11px; }
  .nb .face { width: 42px; left: 22px; bottom: 16px; }
}

/* ------------------------------------------------------------ sections */
section.block { padding: 64px 0; }
.kicker { font-size: 13px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-2); }
html[lang='km'] .kicker { letter-spacing: 0; text-transform: none; font-size: 15px; }
.block h2 { font-size: clamp(30px, 4.4vw, 44px); font-weight: 800; margin-top: 8px; max-width: 18em; }
.block .lead { margin-top: 12px; }

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 34px; counter-reset: step; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 24px; padding: 24px; }
.step { position: relative; }
.step::before {
  counter-increment: step; content: counter(step);
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
  background: var(--marker); color: var(--marker-ink); font-family: var(--display); font-weight: 800; font-size: 20px; margin-bottom: 14px;
}
.card h3 { font-size: 21px; font-weight: 700; }
.card p, .card li { color: var(--ink-2); margin-top: 8px; font-size: 16px; }
.card ul { margin: 8px 0 0; padding-left: 20px; }
@media (max-width: 820px) { .steps { grid-template-columns: 1fr; } }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 34px; }
@media (max-width: 820px) { .split { grid-template-columns: 1fr; } }
.check-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.check-list li { display: flex; gap: 12px; align-items: flex-start; color: var(--ink); margin: 0; }
.check-list svg { flex: none; width: 24px; height: 24px; padding: 4px; border-radius: 50%; background: var(--marker); color: var(--marker-ink); margin-top: 2px; }

.dark-card { background: var(--hero); color: var(--hero-ink); border: 0; }
.dark-card p, .dark-card li { color: rgba(251, 246, 236, 0.72); }
.dark-card code {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 15px;
  background: rgba(255, 255, 255, 0.1); padding: 2px 8px; border-radius: 8px; color: var(--hero-ink);
}
.dark-card ol { margin: 14px 0 0; padding-left: 22px; display: grid; gap: 10px; }

.final { text-align: center; }
.final h2 { margin: 8px auto 0; }
.final .cta-row { justify-content: center; }

/* ------------------------------------------------------------ footer */
.site-foot { border-top: 1px solid var(--line); padding: 28px 0 40px; margin-top: 40px; color: var(--ink-2); font-size: 14px; }
.site-foot .wrap { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; }
.site-foot nav { display: flex; gap: 20px; flex-wrap: wrap; }
.site-foot a { text-decoration: none; font-weight: 600; }
.site-foot a:hover { color: var(--ink); }
.site-foot .spacer { flex: 1; }

/* ------------------------------------------------------------ legal pages */
.legal { padding: 48px 0 24px; }
.legal .wrap { max-width: 760px; }
.legal h1 { font-size: clamp(34px, 5vw, 48px); font-weight: 800; }
.legal .meta { color: var(--ink-2); margin-top: 10px; font-size: 15px; }
.legal .summary { margin-top: 26px; }
.legal .summary h2 { font-size: 20px; }
.legal .summary ul { margin: 10px 0 0; padding-left: 20px; color: var(--ink); }
.legal article h2 { font-size: 24px; font-weight: 700; margin-top: 40px; }
.legal article h3 { font-size: 18px; font-weight: 700; margin-top: 22px; }
.legal article p, .legal article li { margin-top: 10px; }
.legal article ul { padding-left: 22px; margin: 6px 0 0; }
.legal table { width: 100%; border-collapse: collapse; margin-top: 14px; font-size: 15px; }
.legal th, .legal td { text-align: left; vertical-align: top; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.legal th { font-weight: 700; color: var(--ink-2); font-size: 13px; }
.legal .table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); margin-top: 14px; }
.legal .table-wrap table { margin: 0; }
.legal .note { margin-top: 18px; padding: 14px 16px; border-radius: 14px; background: var(--surface-2); font-size: 15px; }
