/* Public home page (index.php, docs/16-public-website.md). Colours are the learning pages' (practice/practice.css). */
:root { --bg: #F7F8FC; --ink: #20243A; --muted: #6C7290; --navy: #1E3A8A; --amber: #F9A826;
        --green: #0F9D63; --line: #DDE1EE; --card: #fff; --soft: #EEF2FF; --red: #D64545; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body { margin: 0; font-family: "Noto Sans Thai", "Leelawadee UI", sans-serif; color: var(--ink); background: var(--bg); line-height: 1.6; }
a { color: var(--navy); }
img { max-width: 100%; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.wrap.narrow { max-width: 780px; }
.muted { color: var(--muted); font-size: 14px; }
.small { font-size: 13px; margin: 0; }
.center { text-align: center; margin-top: 26px; }

/* header */
.top { position: sticky; top: 0; z-index: 5; background: rgba(255, 255, 255, .96); border-bottom: 1px solid var(--line); }
.bar { display: flex; align-items: center; gap: 14px; height: 64px; }
.logo img { height: 30px; display: block; }
.bar nav { display: flex; gap: 18px; flex: 1; justify-content: center; }
.bar nav a { text-decoration: none; color: var(--ink); font-weight: 600; font-size: 15px; }
.bar nav a:hover { color: var(--navy); }
.btn { display: inline-block; font: inherit; font-weight: 700; border-radius: 999px; padding: 9px 20px; text-decoration: none;
       border: 2px solid var(--navy); cursor: pointer; white-space: nowrap; text-align: center; line-height: 1.5; }
.btn.primary { background: var(--amber); border-color: var(--amber); color: #2A1C00; }
.btn.primary:hover { background: #F59E0B; border-color: #F59E0B; }
.btn.ghost { color: var(--navy); background: #fff; }
.btn.big { padding: 13px 28px; font-size: 18px; }
.btn:focus-visible, .choice:focus-visible, summary:focus-visible { outline: 3px solid #93C5FD; outline-offset: 2px; }

/* hero */
.hero { padding: 48px 0 44px; background: linear-gradient(180deg, #fff 0%, var(--soft) 100%); }
.hero .wrap { display: grid; grid-template-columns: 1.05fr 1fr; gap: 36px; align-items: center; }
.hero h1 { font-size: clamp(32px, 5vw, 50px); line-height: 1.3; margin: 0 0 14px; color: var(--navy); }
.lead { font-size: 19px; color: var(--muted); margin: 0 0 24px; }
.cta { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.hero small { display: block; margin-top: 14px; color: var(--muted); }
.video { border-radius: 18px; overflow: hidden; box-shadow: 0 12px 30px rgba(30, 58, 138, .18); background: #E8ECF6; aspect-ratio: 16 / 9; }
.video video { width: 100%; height: 100%; display: block; }
.caption { text-align: center; color: var(--muted); margin: 8px 0 0; font-size: 14px; }

/* sections */
section { padding: 56px 0; }
section.white { background: #fff; }
h2 { font-size: clamp(25px, 3.6vw, 34px); line-height: 1.35; margin: 0 0 8px; color: var(--navy); text-align: center; }
h2.left { text-align: left; }
.sub { text-align: center; color: var(--muted); margin: 0 auto 32px; max-width: 640px; }
.sub.one-line { max-width: none; }                 /* Chai: one line on a computer screen; wraps on a phone */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 22px; }
.card h3 { margin: 10px 0 6px; font-size: 20px; }
.card p { margin: 0; color: var(--muted); }
.ico { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; }
.ico svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ico.blue { background: #E6F0FF; color: var(--navy); } .ico.amber { background: #FFF1D6; color: #B45309; } .ico.green { background: #E3F7EE; color: var(--green); }

.flow { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; gap: 12px; }
.flow .arrow { align-self: center; font-size: 28px; color: var(--amber); font-weight: 700; }
.step { background: var(--bg); border-radius: 16px; border: 1px solid var(--line); padding: 20px; text-align: center; }
.step .ico { margin: 0 auto; }
.step b { display: block; font-size: 20px; margin: 8px 0 4px; }
.step span { color: var(--muted); font-size: 15px; }
.note { text-align: center; margin: 20px 0 0; color: var(--green); font-weight: 600; }

.grades { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.grade { border-radius: 16px; padding: 22px; background: #fff; border: 1px solid var(--line); }
.grade .g { font-size: 30px; font-weight: 700; color: var(--navy); }
.grade ul { margin: 8px 0 0; padding-left: 20px; color: var(--muted); }
.grade .count { color: var(--ink); font-weight: 600; }
.grade.soon { background: #F1F3F8; border-style: dashed; }
.pill { display: inline-block; font-size: 13px; font-weight: 700; padding: 2px 10px; border-radius: 999px; background: #E3F7EE; color: #0B7A4B; }
.pill.wait { background: #FFF1D6; color: #8A5A00; }

.report { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; align-items: center; }
.rep-card { background: #fff; border-radius: 18px; border: 1px solid var(--line); padding: 20px; box-shadow: 0 8px 22px rgba(32, 36, 58, .07); }
.rep-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.lv { font-weight: 700; font-size: 14px; padding: 3px 12px; border-radius: 999px; white-space: nowrap; }
.lv5 { background: #DDF5E9; color: #0B7A4B; } .lv4 { background: #E6F0FF; color: #1E3A8A; }
.lv3 { background: #F0EEFF; color: #4B45C6; } .lv2 { background: #FFF1D6; color: #8A5A00; }
.tip { margin-top: 14px; background: #FFF8EC; border-radius: 12px; padding: 12px 14px; font-size: 15px; }
.ticks { list-style: none; padding: 0; margin: 14px 0 0; }
.ticks li { position: relative; padding-left: 30px; margin-bottom: 10px; }
.ticks li::before { content: ""; position: absolute; left: 4px; top: 7px; width: 13px; height: 7px; border-left: 3px solid var(--green);
                    border-bottom: 3px solid var(--green); transform: rotate(-45deg); }

/* prices */
.toggle { display: flex; justify-content: center; gap: 6px; margin-bottom: 28px; flex-wrap: wrap; }
.toggle button { font: inherit; font-weight: 700; border: 2px solid var(--line); background: #fff; border-radius: 999px; padding: 7px 18px; cursor: pointer; color: var(--ink); }
.toggle button[aria-pressed="true"] { border-color: var(--navy); background: var(--navy); color: #fff; }
.plan { text-align: center; position: relative; display: flex; flex-direction: column; }
.plan h3 { font-size: 24px; color: var(--navy); margin: 0; }
.plan p { flex: 1; margin-top: 6px; }
.price { font-size: 42px; font-weight: 700; color: var(--ink); margin: 10px 0 0; line-height: 1.2; }
.per { color: var(--muted); font-size: 14px; }
.plan.best { border: 2px solid var(--amber); }
.plan.best::before { content: "รวมชั้นก่อนหน้า"; position: absolute; top: -14px; left: 50%; transform: translateX(-50%); background: var(--amber);
                     padding: 1px 14px; border-radius: 999px; font-weight: 700; font-size: 13px; white-space: nowrap; color: #2A1C00; }
.fine { text-align: center; color: var(--muted); margin-top: 24px; font-size: 15px; }
.soon-note { text-align: center; font-size: 18px; background: #fff; border: 1px dashed var(--line); border-radius: 16px; padding: 24px; }

/* schools */
.school { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; align-items: start; }
.lead-form { background: var(--bg); border: 1px solid var(--line); border-radius: 16px; padding: 22px; display: grid; gap: 10px; }
.lead-form label { font-weight: 600; font-size: 14px; display: grid; gap: 4px; }
.lead-form input, .lead-form select { font: inherit; font-weight: 400; width: 100%; padding: 9px 12px; border-radius: 10px; border: 1px solid #C9CFE0; background: #fff; color: var(--ink); }
.lead-form input:focus, .lead-form select:focus { outline: 2px solid #93C5FD; border-color: var(--navy); }
.lead-form .hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.lead-form.done { background: #E3F7EE; border-color: #A7E3C6; }
.lead-form.done p { margin: 0; }
.err { color: var(--red); margin: 0; min-height: 0; font-size: 14px; }
.err:empty { display: none; }

/* FAQ */
details { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; margin-bottom: 10px; }
summary { font-weight: 700; cursor: pointer; }
details p { margin: 8px 0 0; color: var(--muted); }

footer { background: var(--navy); color: #DCE3FF; padding: 32px 0; font-size: 15px; }
footer a { color: #fff; }
footer p { margin: 8px 0 0; }
footer .cols { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
footer img { height: 28px; display: block; }

/* login chooser */
dialog { border: none; border-radius: 18px; padding: 22px; width: min(420px, calc(100vw - 32px)); box-shadow: 0 20px 50px rgba(0, 0, 0, .25); }
dialog::backdrop { background: rgba(20, 28, 60, .45); }
dialog h3 { margin: 0 0 12px; color: var(--navy); }
.choice { display: block; text-decoration: none; color: var(--ink); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; }
.choice:hover { border-color: var(--navy); background: var(--soft); }
.choice b { display: block; }
.choice span { color: var(--muted); font-size: 14px; }
dialog .btn { width: 100%; margin-top: 4px; }

@media (max-width: 860px) {
  .bar nav { display: none; }
  .bar .logo { flex: 1; }
  .hero .wrap, .report, .school { grid-template-columns: 1fr; }
  .cards, .grades { grid-template-columns: 1fr; }
  .flow { grid-template-columns: 1fr; }
  .flow .arrow { transform: rotate(90deg); justify-self: center; }
  .plan.best { margin-top: 8px; }
}
@media (max-width: 420px) {
  .bar { gap: 8px; }
  .bar .btn { padding: 7px 12px; font-size: 14px; }
  .logo img { height: 26px; }
}
