/* ThinkAlgo landing — brand guideline v3.0, light tone.
   Palette: Draft Paper bg, Think Ink / Code Night text, Algo Gold accents (~60/30/10).
   Type: Quicksand (headings) · Plus Jakarta Sans (body) · JetBrains Mono (labels).
   Breakpoints: md 768px, lg 1024px. Spacing in multiples of 8px. */

:root {
  --nav-h: 64px;
  --bar-h: calc(68px + env(safe-area-inset-bottom, 0px));
  --safe-h: calc(100svh - var(--nav-h) - var(--bar-h));

  --algo-gold: #DCA027;      /* logo, primary button, accents — never small text on white */
  --circuit-yellow: #E9AA21; /* hover, small details */
  --deep-gold: #8A5A00;      /* gold text & links on light backgrounds (AA) */
  --think-ink: #040707;      /* headings, body */
  --code-night: #1B2133;     /* dark surfaces */
  --draft-paper: #FAFAF7;    /* page background */
  --graphite: #5B6170;       /* secondary text */
  --gold-50: #FCF7EE; --gold-100: #F9EED8; --gold-200: #F2DDB1;
  --night-50: #EDEDEF; --night-100: #D6D7DA;
  --line: #E7E5DE;
  --surface-2: #F3F2ED;
  --err: #C93A3A;
  --ok: #187A42;

  --font-title: "Quicksand", "Arial Rounded MT Bold", system-ui, sans-serif;
  --font-body: "Plus Jakarta Sans", Arial, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
}
@media (min-width: 768px) { :root { --nav-h: 72px; --bar-h: 0px; } }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
ul, ol { list-style: none; }
img, svg { display: block; }
img { max-width: 100%; height: auto; }
button, input { font: inherit; color: inherit; }
a { color: inherit; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
section[id], #enroll-form { scroll-margin-top: var(--nav-h); }

body {
  background: var(--draft-paper);
  color: var(--think-ink);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
h1, h2, h3 { font-family: var(--font-title); font-weight: 700; line-height: 1.15; letter-spacing: -0.01em; }
:focus-visible { outline: 3px solid var(--algo-gold); outline-offset: 3px; border-radius: 8px; }

.ic { flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.gold { color: var(--algo-gold); }
.ok { color: var(--ok); }
.gold-text { color: var(--deep-gold); }

/* ---------- Small utilities ---------- */
.container { width: 100%; max-width: 75rem; margin-inline: auto; }
.grid { display: grid; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.row { display: flex; align-items: center; }
.col { display: flex; flex-direction: column; }
.grow { flex: 1; }
.min-w-0 { min-width: 0; }
.w-full { width: 100%; }
.mt-2 { margin-top: 8px; }
.strong { font-weight: 700; }
.sub { color: var(--graphite); font-size: .9375rem; line-height: 1.5; }
.t-xl { font-size: 1.25rem; line-height: 1.25; }
.t-title { font-size: 1.0625rem; line-height: 1.25; }
.t-card { font-size: 1rem; line-height: 1.25; }
.md-block { display: none; }
.md-flex, .md-inline { display: none !important; }

/* Mono label: small uppercase, spaced, Deep Gold (guideline "nhãn mono nhỏ") */
.label { align-self: flex-start; font-family: var(--font-mono); font-size: .75rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--deep-gold); }
.mono-note { font-family: var(--font-mono); font-size: .8125rem; color: var(--graphite); letter-spacing: .02em; }

@media (min-width: 768px) {
  .md-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .md-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .grid.gap-2.md-cols-2, .grid.gap-2.md-cols-3, .grid.gap-2.md-cols-4 { gap: 16px; }
  .md-gap-3 { gap: 12px !important; }
  .md-gap-6 { gap: 24px; }
  .md-hidden { display: none !important; }
  .md-block { display: block; }
  .md-flex { display: flex !important; }
  .md-inline { display: inline-flex !important; }
  .t-xl { font-size: 1.375rem; }
  .t-card { font-size: 1.0625rem; }
}

/* ---------- Background patterns (Code Night at ~7% on Draft Paper) ---------- */
.backdrop {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; color: var(--code-night);
  background-image:
    linear-gradient(rgb(27 33 51 / .035) 1px, transparent 1px),
    linear-gradient(90deg, rgb(27 33 51 / .035) 1px, transparent 1px);
  background-size: 24px 24px;
}
.pattern { position: absolute; opacity: .08; }
.pattern-math { left: -40px; top: 8%; width: min(520px, 70vw); }
.pattern-circuit { right: -20px; bottom: 6%; width: min(520px, 75vw); }

/* ---------- Screen layout: one beat = one safe viewport ---------- */
main { position: relative; z-index: 10; }
.beat {
  position: relative; display: flex; flex-direction: column; justify-content: center;
  height: var(--safe-h); padding: 16px 16px 24px; overflow: hidden;
}
@media (min-width: 768px) { .beat { padding: 24px 96px 32px; } }
.beat-inner { position: relative; z-index: 10; width: 100%; max-width: 75rem; margin-inline: auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: clamp(16px, 3.5svh, 32px); flex-shrink: 0; }
.h-beat { font-family: var(--font-title); font-size: clamp(1.5rem, 3svh + 1vw, 2.75rem); font-weight: 700; line-height: 1.15; }
.h-hero { font-size: clamp(1.75rem, 4svh + 1.4vw, 3.5rem); line-height: 1.1; }
.t-lead { max-width: 60ch; font-size: clamp(1rem, 1.4svh + .45vw, 1.25rem); font-weight: 500; color: var(--graphite); }

/* Main information frame: white card on Draft Paper, hairline border */
.frame { display: flex; flex-direction: column; gap: 16px; width: 100%; max-width: 66rem; padding: 20px 16px; text-align: left; background: #fff; border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 1px 2px rgb(27 33 51 / .04), 0 8px 24px -12px rgb(27 33 51 / .10); }
@media (min-width: 768px) { .frame { gap: 24px; padding: 32px 40px; } }
.tile { background: var(--surface-2); border-radius: 14px; padding: 12px; }
@media (min-width: 768px) { .tile { padding: 16px; } }
.tile.accent { background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--algo-gold); }
.note { font-size: 1.0625rem; font-weight: 500; }

.badge { display: grid; place-items: center; flex-shrink: 0; width: 40px; height: 40px; border-radius: 10px; background: var(--gold-100); color: var(--think-ink); }
.badge-lg { width: 48px; height: 48px; border-radius: 12px; }
.num { flex-shrink: 0; min-width: 40px; font-family: var(--font-mono); font-size: 1.125rem; font-weight: 600; color: var(--deep-gold); }
.step-no { font-family: var(--font-mono); font-size: .75rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--graphite); }

/* ---------- Buttons: primary gold + ink text, secondary outline, text link Deep Gold ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 48px; padding: .75rem 1.5rem;
  background: var(--algo-gold); color: var(--think-ink);
  border: 1.5px solid var(--algo-gold); border-radius: 10px;
  font-family: var(--font-body); font-weight: 700; font-size: 1rem; line-height: 1.1; white-space: nowrap;
  cursor: pointer; text-decoration: none; user-select: none;
  transition: background-color .15s ease, border-color .15s ease, transform .15s ease;
}
.btn:hover { background: var(--circuit-yellow); border-color: var(--circuit-yellow); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .7; cursor: progress; }
.btn-outline { background: #fff; border-color: var(--think-ink); }
.btn-outline:hover { background: var(--gold-50); border-color: var(--think-ink); }
.btn-sm { min-height: 44px; padding: .55rem 1.1rem; font-size: .9375rem; }
.btn-square { width: 44px; height: 44px; min-height: 0; padding: 0; }
.link { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--deep-gold); text-decoration: none; }
.link:hover { text-decoration: underline; text-underline-offset: 4px; }

/* ---------- Nav ---------- */
.site-nav { position: sticky; top: 0; z-index: 50; height: var(--nav-h); background: rgb(250 250 247 / .92); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.nav-row { display: flex; height: 100%; align-items: center; justify-content: space-between; gap: 16px; padding-inline: 16px; }
.brand img { width: 150px; height: auto; }
@media (min-width: 768px) { .brand img { width: 182px; } }
.nav-right { display: flex; align-items: center; gap: 8px; }
.nav-links { display: none; align-items: center; gap: 4px; margin-right: 8px; }
.nav-links a { white-space: nowrap; border-radius: 8px; padding: 8px 14px; font-weight: 500; text-decoration: none; color: var(--graphite); transition: color .15s, background-color .15s; }
.nav-links a:hover { color: var(--think-ink); background: var(--surface-2); }
.nav-links a[aria-current="true"] { color: var(--think-ink); font-weight: 700; box-shadow: inset 0 -2px 0 var(--algo-gold); border-radius: 0; }
.mobile-menu { position: absolute; left: 0; right: 0; top: 100%; padding: 0 16px 16px; background: var(--draft-paper); border-bottom: 1px solid var(--line); }
.mobile-menu ul { display: flex; flex-direction: column; gap: 2px; padding-block: 8px; }
.mobile-menu ul a { display: block; border-radius: 10px; padding: 12px 16px; font-family: var(--font-title); font-size: 1.125rem; font-weight: 700; text-decoration: none; }
.mobile-menu ul a:hover { background: var(--surface-2); }
@media (min-width: 1024px) {
  .nav-links { display: flex; }
  .menu-btn, .mobile-menu { display: none !important; }
}

/* ---------- Sections ---------- */
.hero-hl { gap: 12px; }
@media (min-width: 768px) { .hero-hl { align-items: flex-start; } }
.cta-row { flex-wrap: wrap; gap: 12px; }
.scroll-hint { display: flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: .8125rem; color: var(--graphite); text-decoration: none; }

.tabs { display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 12px; align-self: flex-start; }
.tab { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border: 0; border-radius: 9px; background: transparent; font-weight: 700; font-size: .9375rem; color: var(--graphite); cursor: pointer; }
.tab[aria-selected="true"] { background: #fff; color: var(--think-ink); box-shadow: 0 1px 2px rgb(27 33 51 / .12); }
.journey { display: flex; flex-direction: column; gap: 10px; }
.journey.is-off { display: none; }
@media (min-width: 768px) { .journey.is-off { display: flex; } }
.checks > li { display: flex; align-items: flex-start; gap: 8px; }
.checks > li + li { margin-top: 4px; }
.checks .ic { margin-top: 2px; }
.goal { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; font-weight: 700; }

/* Code Night strip = the "30% ink" in the 60/30/10 split */
.perk { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 12px; background: var(--code-night); color: #fff; font-weight: 500; line-height: 1.4; }

.group-card { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 16px; text-align: center; background: var(--gold-50); border: 1px solid var(--gold-200); border-radius: 14px; }
@media (min-width: 768px) { .group-card { flex-direction: row; text-align: left; padding: 16px 20px; } }

/* Enroll form */
.enroll-side { flex-direction: column; gap: 16px; }
@media (min-width: 768px) { .enroll-frame { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 40px; align-items: start; } }
.form-title { margin-bottom: 12px; font-size: 1.25rem; }
@media (min-width: 768px) { .form-title { font-size: 1.5rem; } }
.field { display: grid; gap: 6px; font-weight: 700; font-size: .9375rem; }
.field input { min-height: 48px; padding-inline: 14px; border: 1.5px solid var(--night-100); border-radius: 10px; background: #fff; font-size: 1rem; font-weight: 500; transition: border-color .15s; }
.field input:focus { outline: none; border-color: var(--algo-gold); box-shadow: 0 0 0 3px rgb(220 160 39 / .25); }
.field input[aria-invalid="true"] { border-color: var(--err); }
.field input::placeholder { font-weight: 400; color: var(--graphite); opacity: .7; }
.err { font-size: .875rem; font-weight: 500; color: var(--err); }
.hp { position: absolute; left: -9999px; width: 0; height: 0; overflow: hidden; }
.send-err { padding: 10px 12px; border: 1px solid var(--err); border-left-width: 4px; border-radius: 10px; background: #fff; font-size: .875rem; font-weight: 500; }
.privacy { text-align: center; font-size: .8125rem; color: var(--graphite); }
.success { display: flex; align-items: flex-start; gap: 12px; padding: 16px; border-radius: 12px; background: var(--surface-2); font-size: 1.0625rem; font-weight: 700; }
.form-alt { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--night-100); }
[hidden] { display: none !important; }

/* ---------- Footer & fixed Zalo ---------- */
.site-footer { position: relative; z-index: 2; padding: 48px 16px 0; background: #fff; border-top: 1px solid var(--line); }
.footer-inner { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding-bottom: calc(var(--bar-h) + 24px); }
@media (min-width: 768px) { .footer-inner { padding-bottom: 48px; } }
.footer-logo { width: 150px; margin-bottom: 8px; }
.slogan { font-family: var(--font-title); font-size: 1.375rem; font-weight: 700; }
.site-footer .btn { margin-block: 8px; }

.bottom-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; display: flex; align-items: center; gap: 12px; height: var(--bar-h); padding: 0 12px env(safe-area-inset-bottom, 0px); background: rgb(250 250 247 / .96); border-top: 1px solid var(--line); }
.bottom-bar .btn { flex: 1; min-height: 46px; padding-block: .5rem; }
@media (min-width: 768px) { .bottom-bar { display: none; } }

.fab { position: fixed; right: 24px; bottom: 24px; z-index: 50; display: none; place-items: center; width: 56px; height: 56px; border-radius: 999px; background: var(--code-night); color: #fff; box-shadow: 0 6px 18px -6px rgb(27 33 51 / .5); transition: transform .15s ease; }
.fab:hover { transform: translateY(-2px); }
.fab .ic { color: var(--circuit-yellow); }
@media (min-width: 768px) { .fab { display: grid; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; }
}

/* ---------- Compact tier: short windows. Cuts secondary content, never text size. ---------- */
@media (max-height: 700px) {
  .beat { padding-top: 12px; padding-bottom: 16px; }
  .beat-inner { gap: 16px; }
  .c-hide { display: none !important; }
  .frame { gap: 12px; padding: 14px 16px; }
  .frame > .label { display: none; }
  .tile { padding: 8px 12px; }
  .c-gap { gap: 8px !important; }
  .c-field { min-height: 44px !important; }
  .h-beat { font-size: clamp(1.375rem, 5svh, 2rem); }
}
