/* Smart Chalk. One loud thing (the chalkboard), everything else quiet and readable for busy teachers. */
:root {
  --paper: #f4f6f2;      /* cool school-paper white */
  --card: #ffffff;
  --ink: #18231e;
  --ink-2: #4a5750;
  --line: #d9e0da;
  --board: #24463a;      /* chalkboard green */
  --board-2: #1c382e;
  --wood: #7a4a2c;
  --chalk: #f7f5ee;
  --yellow: #f2c230;     /* chalk yellow / school bus */
  --sky: #8ec9ea;
  --red: #c8412f;        /* grading pen */
  --ok: #2f7d4f;
  --radius: 10px;
  --shadow: 0 1px 0 rgba(24, 35, 30, .06), 0 8px 24px -16px rgba(24, 35, 30, .35);
  --chalk-font: "Cabin Sketch", "Comic Sans MS", cursive;
  --hand-font: "Patrick Hand", "Comic Sans MS", cursive;
  --ui: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #121a16; --card: #19231e; --ink: #edf1ec; --ink-2: #a9b6ae; --line: #2c3a33;
    --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 8px 24px -16px rgba(0, 0, 0, .8); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #121a16; --card: #19231e; --ink: #edf1ec; --ink-2: #a9b6ae; --line: #2c3a33;
  --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 8px 24px -16px rgba(0, 0, 0, .8); color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 17px/1.55 var(--ui); }
img, video { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 .5em; font-weight: 700; }
h2 { font-size: clamp(1.6rem, 3.2vw, 2.2rem); letter-spacing: -.01em; }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
.wrap { width: min(1160px, 100% - 32px); margin-inline: auto; }
.muted { color: var(--ink-2); }
.small { font-size: .9rem; }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; border-radius: 4px; }

/* ---------- Header ---------- */
.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; gap: 22px; height: 64px; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; font: 700 1.6rem/1 var(--chalk-font); color: var(--ink); white-space: nowrap; }
.logo .stick { width: 14px; height: 30px; border-radius: 7px; background: var(--chalk); border: 2px solid var(--ink); position: relative; }
.logo .stick::after { content: ""; position: absolute; left: 1px; right: 1px; top: 1px; height: 6px; border-radius: 5px 5px 2px 2px; background: var(--yellow); }
.nav { display: flex; gap: 4px; margin-left: 8px; }
.nav a { text-decoration: none; padding: 8px 12px; border-radius: 8px; color: var(--ink-2); font-weight: 700; font-size: .95rem; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); background: color-mix(in srgb, var(--ink) 6%, transparent); }
.top .right { margin-left: auto; display: flex; gap: 10px; align-items: center; }
@media (max-width: 720px) { .nav { display: none; } .top .right .who { display: none; } }
.top .menu-btn { display: none; }
@media (max-width: 720px) { .top .menu-btn { display: inline-flex; } }
.mobile-nav { border-bottom: 1px solid var(--line); background: var(--paper); }
.mobile-nav a { display: block; padding: 12px 16px; text-decoration: none; font-weight: 700; border-top: 1px solid var(--line); }

/* ---------- Buttons & fields ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: var(--radius); border: 1.5px solid var(--ink); background: var(--ink); color: var(--paper); font: 700 .98rem/1 var(--ui); text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { filter: brightness(1.15); }
.btn.yellow { background: var(--yellow); border-color: var(--yellow); color: #1d2219; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--ink); filter: none; }
.btn.small { min-height: 36px; padding: 0 12px; font-size: .9rem; }
.btn.danger { background: transparent; color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, transparent); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
label.field { display: grid; gap: 6px; font-weight: 700; font-size: .95rem; }
label.field .hint { font-weight: 400; color: var(--ink-2); font-size: .88rem; }
input[type=text], input[type=email], input[type=search], input[type=password], input[type=number], input[type=date], select, textarea {
  width: 100%; min-height: 46px; padding: 10px 12px; border-radius: 8px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); font: 16px/1.4 var(--ui);
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); }
.seg { display: inline-flex; border: 1.5px solid var(--line); border-radius: 9px; padding: 3px; gap: 3px; background: var(--card); flex-wrap: wrap; }
.seg button { border: 0; background: transparent; color: var(--ink-2); font: 700 .92rem var(--ui); padding: 8px 12px; border-radius: 6px; cursor: pointer; min-height: 36px; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.checks label { display: inline-flex; align-items: center; gap: 8px; border: 1.5px solid var(--line); background: var(--card); border-radius: 8px; padding: 8px 12px; font-weight: 700; font-size: .92rem; cursor: pointer; }
.checks input { width: 18px; height: 18px; accent-color: var(--board); }
.err { color: var(--red); font-weight: 700; font-size: .95rem; }

/* ---------- The chalkboard ---------- */
.board {
  position: relative; background: radial-gradient(120% 90% at 40% 40%, #2c5445, var(--board) 55%, var(--board-2));
  border: 14px solid var(--wood); border-radius: 6px; color: var(--chalk);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .25), inset 0 0 80px rgba(0, 0, 0, .35), 0 20px 40px -24px rgba(0, 0, 0, .6);
}
.board::before { /* chalk dust */
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: radial-gradient(rgba(255,255,255,.08) 1px, transparent 1.4px), radial-gradient(rgba(255,255,255,.05) 1px, transparent 1.4px);
  background-size: 7px 9px, 13px 11px; background-position: 0 0, 3px 5px;
}
.board::after { /* chalk tray */
  content: ""; position: absolute; left: -14px; right: -14px; bottom: -26px; height: 12px; background: #5e3720; border-radius: 0 0 4px 4px;
}
.chalk { font-family: var(--chalk-font); font-weight: 700; letter-spacing: .01em; }
.hand { font-family: var(--hand-font); }

/* ---------- Home ---------- */
.hero { padding: 36px 0 70px; }
.hero .board { padding: clamp(28px, 5vw, 64px); display: grid; grid-template-columns: 1.05fr 1fr; gap: clamp(24px, 4vw, 56px); align-items: center; }
.hero h1 { font: 700 clamp(2.6rem, 6.4vw, 5.2rem)/0.98 var(--chalk-font); margin: 0 0 18px; color: var(--chalk); text-shadow: 0 2px 0 rgba(0,0,0,.25); }
.hero h1 .y { color: var(--yellow); display: block; }
.hero .lede { font: 1.5rem/1.35 var(--hand-font); color: #dfe9e3; max-width: 30ch; margin-bottom: 26px; }
.hero .ctas { display: flex; gap: 12px; flex-wrap: wrap; }
.hero .btn.ghost { color: var(--chalk); border-color: rgba(255,255,255,.35); }
.hero .btn.ghost:hover { border-color: var(--chalk); }
.hero .fine { margin-top: 16px; font: 1.15rem var(--hand-font); color: var(--sky); }
.player { position: relative; border-radius: 8px; overflow: hidden; background: #000; aspect-ratio: 16/9; box-shadow: 0 0 0 3px rgba(255,255,255,.12); }
.player video, .player img { width: 100%; height: 100%; object-fit: cover; }
.player .play { position: absolute; inset: 0; display: grid; place-items: center; background: transparent; border: 0; cursor: pointer; }
.player .play span { width: 74px; height: 74px; border-radius: 50%; background: var(--yellow); display: grid; place-items: center; box-shadow: 0 6px 20px rgba(0,0,0,.4); }
.player .play span::before { content: ""; border-left: 22px solid #1d2219; border-top: 14px solid transparent; border-bottom: 14px solid transparent; margin-left: 6px; }
.player-note { margin-top: 12px; font: 1.1rem var(--hand-font); color: #cfe0d6; }
@media (max-width: 860px) { .hero .board { grid-template-columns: 1fr; } }

.section { padding: 64px 0; }
.section + .section { border-top: 1px solid var(--line); }
.section .intro { max-width: 640px; margin-bottom: 34px; }
.section .intro p { color: var(--ink-2); font-size: 1.08rem; }

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; counter-reset: step; list-style: none; padding: 0; margin: 0; }
.steps li { counter-increment: step; }
.steps li::before { content: counter(step); display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--board); color: var(--yellow); font: 700 1.5rem/1 var(--chalk-font); margin-bottom: 14px; }
.steps p { color: var(--ink-2); }
@media (max-width: 760px) { .steps { grid-template-columns: 1fr; } }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: center; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } }
.ticks { list-style: none; padding: 0; margin: 0 0 24px; display: grid; gap: 10px; }
.ticks li { padding-left: 30px; position: relative; }
.ticks li::before { content: ""; position: absolute; left: 4px; top: 7px; width: 12px; height: 7px; border-left: 3px solid var(--ok); border-bottom: 3px solid var(--ok); transform: rotate(-45deg); }

/* The quiz paper */
.paper { background: #fffefa; color: #1d2520; border-radius: 4px; padding: 30px 34px 34px; box-shadow: 0 1px 0 #e7e2d4, 0 20px 40px -22px rgba(0,0,0,.45); transform: rotate(-1.2deg); position: relative;
  background-image: linear-gradient(90deg, transparent 54px, rgba(200,65,47,.35) 54px, rgba(200,65,47,.35) 56px, transparent 56px), repeating-linear-gradient(transparent 0 31px, #dbe6ee 31px 32px); padding-left: 76px; }
.paper .ptitle { font-weight: 700; font-size: 1.25rem; margin-bottom: 6px; }
.paper .name { font-size: .9rem; color: #5b665f; margin-bottom: 18px; }
.paper ol { margin: 0; padding-left: 20px; display: grid; gap: 14px; }
.paper .opts { font-size: .95rem; color: #3f4a43; }
.paper .mark { position: absolute; right: 18px; top: -14px; font: 2.2rem/1 var(--hand-font); color: var(--red); transform: rotate(8deg); }
.paper .circ { border: 2px solid var(--red); border-radius: 50%; padding: 0 5px; }

/* Library cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 22px; }
.vcard { text-decoration: none; display: block; }
.vcard .thumb { position: relative; aspect-ratio: 16/9; border-radius: 8px; overflow: hidden; background: var(--board); border: 1px solid var(--line); }
.vcard .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s; }
.vcard:hover .thumb img { transform: scale(1.03); }
.vcard .len { position: absolute; right: 8px; bottom: 8px; background: rgba(0,0,0,.78); color: #fff; font-size: .8rem; font-weight: 700; padding: 2px 7px; border-radius: 5px; }
.vcard h3 { margin: 10px 0 2px; font-size: 1.02rem; }
.vcard .meta { color: var(--ink-2); font-size: .88rem; }
.tag { display: inline-block; font-size: .8rem; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: color-mix(in srgb, var(--board) 12%, transparent); color: var(--board); }
:root[data-theme="dark"] .tag { color: #a8e0b0; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tag { color: #a8e0b0; } }
.shelf { display: flex; gap: 8px; flex-wrap: wrap; }
.shelf a, .shelf button { display: inline-flex; gap: 8px; align-items: center; text-decoration: none; padding: 9px 14px; border: 1.5px solid var(--line); border-radius: 999px; font-weight: 700; font-size: .93rem; background: var(--card); color: var(--ink); cursor: pointer; font-family: var(--ui); }
.shelf a:hover, .shelf button:hover { border-color: var(--ink); }
.shelf [aria-pressed="true"] { background: var(--board); color: var(--chalk); border-color: var(--board); }
.shelf .n { color: var(--ink-2); font-weight: 400; }
.shelf [aria-pressed="true"] .n { color: #bcd2c6; }

/* Pricing */
.plans { display: grid; grid-template-columns: repeat(2, minmax(0, 380px)); gap: 22px; }
@media (max-width: 760px) { .plans { grid-template-columns: 1fr; } }
.plan { border: 1.5px solid var(--line); border-radius: 14px; padding: 28px; background: var(--card); display: flex; flex-direction: column; }
.plan.pro { border-color: var(--board); box-shadow: 0 0 0 3px color-mix(in srgb, var(--board) 15%, transparent); }
.plan .price { font-size: 2.8rem; font-weight: 700; line-height: 1; margin: 6px 0 4px; }
.plan .price small { font-size: 1rem; color: var(--ink-2); font-weight: 400; }
.plan .ticks { margin: 18px 0 26px; flex: 1; }

.faq details { border-bottom: 1px solid var(--line); padding: 16px 0; max-width: 760px; }
.faq summary { font-weight: 700; cursor: pointer; font-size: 1.05rem; }
.faq details p { margin: 10px 0 0; color: var(--ink-2); }

footer.site { padding: 36px 0 48px; border-top: 1px solid var(--line); color: var(--ink-2); font-size: .92rem; }
footer.site .wrap { display: flex; gap: 20px; flex-wrap: wrap; align-items: center; }
footer.site a { text-decoration: none; }
footer.site .links { margin-left: auto; display: flex; gap: 18px; flex-wrap: wrap; }

/* Dialog */
dialog { border: 0; border-radius: 16px; padding: 0; width: min(440px, calc(100% - 32px)); background: var(--card); color: var(--ink); box-shadow: 0 30px 60px -20px rgba(0,0,0,.5); }
dialog::backdrop { background: rgba(16, 26, 21, .55); }
dialog .in { padding: 28px; display: grid; gap: 14px; }
dialog h2 { font-size: 1.5rem; margin: 0; }
dialog .x { position: absolute; right: 12px; top: 12px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 12px 18px; border-radius: 10px; font-weight: 700; z-index: 50; box-shadow: var(--shadow); max-width: calc(100% - 32px); }
.panel { background: var(--card); border: 1.5px solid var(--line); border-radius: 14px; padding: 24px; }
.empty { text-align: center; padding: 48px 20px; border: 2px dashed var(--line); border-radius: 14px; color: var(--ink-2); }
.empty .big { font: 700 1.8rem var(--chalk-font); color: var(--ink); margin-bottom: 6px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- Header student link ---------- */
.nav-student { font-weight: 700; color: var(--board); text-decoration: none; padding: 8px 10px; border-radius: 8px; white-space: nowrap; }
.nav-student:hover { background: color-mix(in srgb, var(--board) 10%, transparent); }
:root[data-theme="dark"] .nav-student { color: #a8e0b0; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .nav-student { color: #a8e0b0; } }
@media (max-width: 900px) { .nav-student { display: none; } }

/* ---------- Calendar ---------- */
.cal-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.cal-head h3 { margin: 0; flex: 1; text-align: center; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1.5px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--card); }
.cal-w { padding: 8px; font-size: .8rem; font-weight: 700; color: var(--ink-2); border-bottom: 1.5px solid var(--line); text-align: center; }
.cal-d { min-height: 92px; padding: 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cal-d:nth-child(7n) { border-right: 0; }
.cal-d.out { background: color-mix(in srgb, var(--line) 30%, transparent); }
.cal-d .n { font-size: .82rem; color: var(--ink-2); font-weight: 700; }
.cal-d.today .n { background: var(--board); color: var(--chalk); border-radius: 999px; width: 24px; height: 24px; display: grid; place-items: center; }
.cal-i { display: block; font-size: .78rem; font-weight: 700; padding: 3px 6px; border-radius: 6px; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: color-mix(in srgb, var(--sky) 35%, var(--card)); color: var(--ink); }
.cal-i.done { background: color-mix(in srgb, var(--ok) 22%, var(--card)); }
.cal-i.late { background: color-mix(in srgb, var(--red) 22%, var(--card)); }
.cal-i.due { background: color-mix(in srgb, var(--yellow) 45%, var(--card)); }
@media (max-width: 640px) { .cal-d { min-height: 64px; padding: 3px; } .cal-i { font-size: .68rem; padding: 2px 3px; } .cal-w { font-size: .7rem; padding: 6px 2px; } }

/* ---------- Grades ---------- */
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: .8rem; font-weight: 700; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.pill.ok { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.pill.bad { background: color-mix(in srgb, var(--red) 15%, transparent); color: var(--red); }
.pill.wait { background: color-mix(in srgb, var(--yellow) 35%, transparent); color: var(--ink); }
.pill.none { background: color-mix(in srgb, var(--line) 70%, transparent); color: var(--ink-2); }
:root[data-theme="dark"] .pill.ok { color: #7fd39b; } :root[data-theme="dark"] .pill.bad { color: #f08a7c; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pill.ok { color: #7fd39b; } :root:not([data-theme="light"]) .pill.bad { color: #f08a7c; } }
.grade-big { font: 700 2.6rem/1 var(--ui); font-variant-numeric: tabular-nums; }

/* Homepage gradebook example */
.gbook { overflow-x: auto; border: 1.5px solid var(--line); border-radius: 14px; background: var(--card); box-shadow: var(--shadow); }
.gbook table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.gbook th, .gbook td { padding: 11px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.gbook th { font-size: .8rem; color: var(--ink-2); }
.gbook tr:last-child td { border-bottom: 0; }
.plans.one { grid-template-columns: minmax(0, 440px); }

/* Phones: keep the header on one line (the menu holds the rest). */
@media (max-width: 520px) {
  .top .wrap { gap: 10px; }
  .top .logo { font-size: 1.3rem; gap: 8px; }
  .top .logo .stick { width: 11px; height: 24px; }
  .top .right { gap: 6px; }
  .top .right .go { display: none; }
}
/* Keep the top menu on one line: names never wrap, and it tightens on smaller laptops. */
.nav a { white-space: nowrap; }
.top .right .who { white-space: nowrap; max-width: 14ch; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1760px) { .nav-student { display: none; } .nav a { padding: 8px 9px; } }
@media (max-width: 1320px) { .nav a { padding: 8px 6px; font-size: .92rem; } }
@media (max-width: 1240px) { .nav a { padding: 8px 5px; font-size: .86rem; } }
@media (max-width: 1180px) { .nav { display: none; } .top .menu-btn { display: inline-flex; } }

/* Ask Smart Chalk */
.tutor-a { background: var(--board, #24463a); color: #f7f5ee; border-radius: 10px; padding: 24px 26px; border: 10px solid #7a4d2a; line-height: 1.55; }
.tutor-a h3 { margin: 0 0 8px; color: #f2c230; font-size: 1.35rem; }
.tutor-a h4 { margin: 16px 0 6px; color: #dfe9e3; font-size: .95rem; text-transform: uppercase; letter-spacing: .04em; }
.tutor-a ol { margin: 0; padding-left: 22px; display: grid; gap: 6px; }
.tutor-a .ans { margin: 10px 0 0; color: #f2c230; }
.tutor-a .ex { margin-top: 14px; padding-top: 10px; border-top: 1px dashed rgba(247,245,238,.3); }
.tutor-a details summary { cursor: pointer; color: #9fd0ee; }
.tutor-a p { margin: 4px 0; }
.tutor-form textarea { min-height: 110px; }
.tutor-log td.q { max-width: 46ch; }
.tutor-log .no { color: var(--red, #c0392b); font-weight: 600; }

/* Language picker */
.langpick { min-width: 58px; width: 64px; flex: none; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); border-radius: 8px; padding: 5px 4px; font: 700 .8rem/1 inherit; cursor: pointer; }
.langpick-full { border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 6px; padding: 3px 6px; }
[hidden] { display: none !important; }
/* Translated menus are longer than English: use the Menu button sooner. */
@media (max-width: 1440px) { html:not([lang="en"]) .nav { display: none; } html:not([lang="en"]) .top .menu-btn { display: inline-flex; } html:not([lang="en"]) .top .right .who { display: none; } }
.top .right .who { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; vertical-align: middle; }
.top .right .who { display: none; } /* the name is on the studio page; no room in the header */
