/* Codeday public site: dark by default (black, one violet accent), with a light theme.
   Loaded after app.css by layout/main.php only; Studio and the player keep their own look. */

html[data-theme=dark] body.site {
  --paper: #000;
  --paper-2: #0f0f14;
  --card: #0b0b10;
  --card-2: #13131a;
  --ink: #fff;
  --ink-2: rgba(255, 255, 255, .72);
  --ink-3: rgba(255, 255, 255, .48);
  --line: rgba(255, 255, 255, .12);
  --line-2: rgba(255, 255, 255, .2);
  --nav-bg: rgba(0, 0, 0, .72);
  --primary-bg: #fff;
  --primary-ink: #000;
  --done: #22c55e;
  --done-ink: #052e16;
  --dot-bg: #1c1b2b;
  color-scheme: dark;
}
html[data-theme=light] body.site {
  --paper: #f4f4f5;
  --paper-2: #e9e9ee;
  --card: #fff;
  --card-2: #f7f7fa;
  --ink: #0b0b12;
  --ink-2: #4b4b5a;
  --ink-3: #7a7a8a;
  --line: #e2e2e8;
  --line-2: #cfcfd8;
  --nav-bg: rgba(244, 244, 245, .8);
  --primary-bg: #0b0b12;
  --primary-ink: #fff;
  --done: #16a34a;
  --done-ink: #fff;
  --dot-bg: #e7e3ff;
  color-scheme: light;
}
body.site {
  --violet: #977dff;
  --violet-2: #b6a6ff;
  --violet-soft: rgba(151, 125, 255, .16);
  --marker: var(--violet);
  --marker-soft: rgba(151, 125, 255, .28);
  --focus: var(--violet);
  --leaf: var(--done);
  --leaf-soft: rgba(34, 197, 94, .15);
  --f-display: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --f-body: var(--f-display);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-body);
  transition: background-color .3s ease, color .3s ease;
}
body.site h1, body.site h2, body.site h3 { font-family: var(--f-display); letter-spacing: -0.02em; }
body.site a:hover { text-decoration-color: var(--violet); }
.skip:focus { position: fixed; left: 12px; top: 12px; width: auto; height: auto; clip: auto; z-index: 60; background: var(--card); padding: 8px 12px; border-radius: 8px; }
.ic { display: inline-block; flex: none; }

/* ---- buttons ---- */
body.site .btn { font-family: var(--f-body); font-weight: 700; border-radius: 12px; }
.btn-primary, body.site .btn.btn-primary { background: var(--primary-bg); color: var(--primary-ink); border-color: var(--primary-bg); }
.btn-primary:hover, body.site .btn.btn-primary:hover { background: var(--primary-bg); transform: scale(1.02); }
.btn-outline, body.site .btn.btn-outline, body.site .btn.btn-ghost { background: color-mix(in srgb, var(--card) 70%, transparent); color: var(--ink); border-color: var(--line-2); }
.btn-outline:hover, body.site .btn.btn-outline:hover, body.site .btn.btn-ghost:hover { background: var(--card-2); border-color: var(--ink-3); }
body.site .btn:not(.btn-primary):not(.btn-outline):not(.btn-ghost):not(.btn-danger):not(.btn-run) { background: var(--primary-bg); color: var(--primary-ink); border-color: var(--primary-bg); }
.btn-lg { padding: 15px 28px; font-size: .9rem; }
.btn .ic-arrow-right { transition: transform .15s ease; }
.btn:hover .ic-arrow-right { transform: translateX(2px); }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 999px; border: 0; background: transparent; color: var(--ink-2); cursor: pointer; }
.icon-btn:hover { background: var(--violet-soft); color: var(--ink); }
.linkish { color: var(--ink-2); }
body.site input[type=text], body.site input[type=email], body.site input[type=password], body.site select, body.site textarea { background: var(--card-2); border-color: var(--line-2); color: var(--ink); border-radius: 10px; }
body.site input:focus, body.site select:focus, body.site textarea:focus { border-color: var(--violet); box-shadow: 0 0 0 3px var(--violet-soft); }
body.site input[readonly] { opacity: .75; }
body.site .alert { border-radius: 10px; }
body.site .alert-note { background: var(--violet-soft); border-color: var(--violet); }
body.site .empty { border-color: var(--line-2); border-radius: 16px; }

/* ---- navigation ---- */
.nav { position: sticky; top: 0; z-index: 30; background: var(--nav-bg); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid transparent; transition: border-color .2s, background .3s; }
.nav.scrolled { border-bottom-color: var(--line); }
.nav.over { position: fixed; left: 0; right: 0; background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; }
.nav.over.scrolled { background: var(--nav-bg); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.nav-in { max-width: 1280px; margin: 0 auto; height: 64px; padding: 0 24px; display: flex; align-items: center; gap: 28px; }
.logo { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.25rem; letter-spacing: -.02em; color: var(--ink); text-decoration: none; }
.logo .ic { color: var(--violet); }
.logo-name { letter-spacing: -.02em; }
.logo-tld { color: var(--violet); }
.logo:hover { text-decoration: none; }
.logo.sm { font-size: 1rem; }
.nav-main { display: flex; gap: 22px; }
.nav-main a, .nav-link { color: var(--ink-2); text-decoration: none; font-size: .9rem; font-weight: 500; display: inline-flex; align-items: center; gap: 8px; background: none; border: 0; cursor: pointer; font-family: inherit; padding: 6px 0; }
.nav-main a:hover, .nav-main a[aria-current=page], .nav-link:hover, .nav-link[aria-current=page] { color: var(--ink); text-decoration: none; }
.nav-main a[aria-current=page] { box-shadow: inset 0 -2px var(--violet); }
.nav-end { margin-left: auto; display: flex; align-items: center; gap: 18px; }
.nav-out { margin: 0; padding-left: 18px; border-left: 1px solid var(--line); }
.theme-btn .i-moon, html[data-theme=light] .theme-btn .i-sun { display: none; }
html[data-theme=light] .theme-btn .i-moon { display: inline; }
.menu-btn { display: none; margin-left: auto; }
.nav-sheet { border-top: 1px solid var(--line); padding: 8px 24px 16px; display: grid; background: var(--paper); }
.nav-sheet a, .nav-sheet button { padding: 12px 0; color: var(--ink); text-decoration: none; font: 600 1rem var(--f-body); background: none; border: 0; text-align: left; border-bottom: 1px solid var(--line); cursor: pointer; }
.nav-sheet form { margin: 0; }

main.page { padding: 48px 0 96px; min-height: calc(100vh - 140px); }
body.site .wrap { max-width: 1180px; padding: 0 24px; }
.foot { border-top: 1px solid var(--line); padding: 28px 0; color: var(--ink-3); font-size: .85rem; }
.foot .wrap { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; justify-content: space-between; }

/* ---- home hero ---- */
.hero { position: relative; min-height: 100vh; min-height: 100svh; overflow: hidden; display: flex; align-items: center; background: var(--paper); }
.globe { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; touch-action: pan-y; }
.globe.grabbing { cursor: grabbing; }
.hero-in { position: relative; z-index: 1; width: 100%; max-width: 1280px; margin: 0 auto; padding: 96px 24px 64px; pointer-events: none; }
.hero-copy { max-width: 620px; padding-left: clamp(0px, 4vw, 72px); pointer-events: auto; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line-2); background: color-mix(in srgb, var(--ink) 5%, transparent); border-radius: 999px; padding: 6px 16px; font-size: .74rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); margin: 0 0 32px; backdrop-filter: blur(6px); }
.eyebrow .ic { opacity: .65; }
.hero h1 { font-size: clamp(2.9rem, 7vw, 4.5rem); line-height: 1.05; font-weight: 900; letter-spacing: -0.025em; margin: 0 0 28px; color: var(--ink); }
.hero h1 span, .cat-head h1 span { display: block; color: var(--violet); }
.hero .lede { font-size: 1.125rem; line-height: 1.625; color: color-mix(in srgb, var(--ink) 90%, transparent); max-width: 34rem; margin: 0 0 44px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 16px; }
.hero-actions .btn-outline { background: rgba(255, 255, 255, .04); }
html[data-theme=light] .hero-actions .btn-outline { background: #fff; }

.demo-dialog { border: 0; padding: 0; background: transparent; max-width: min(640px, calc(100vw - 32px)); width: 100%; color: inherit; }
.demo-dialog::backdrop { background: rgba(0, 0, 0, .72); backdrop-filter: blur(4px); }
.demo-dialog .demo { margin: 0; }
.demo-dialog .demo-bar .icon-btn { width: 30px; height: 30px; color: #c9d4e3; }
.demo-note { color: #fff; text-align: center; font-size: .9rem; margin: 14px auto 0; opacity: .8; }

/* ---- catalogue ---- */
.cat-head { margin-bottom: 36px; }
.cat-head .eyebrow { margin-bottom: 20px; }
.cat-head h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); font-weight: 900; line-height: 1.05; margin-bottom: 16px; }
.cat-head h1 span { display: inline; }
.cat-head .lede { color: var(--ink-2); font-size: 1.05rem; max-width: 40rem; }
body.site .courses { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 22px; }
body.site .course-card { display: flex; flex-direction: column; gap: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; min-height: 0; text-decoration: none; color: var(--ink); transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease; }
body.site .course-card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--violet) 60%, transparent); box-shadow: 0 18px 40px -24px rgba(151, 125, 255, .6); }
.cc-art { position: relative; display: grid; place-items: center; height: 132px; color: #fff; background:
  radial-gradient(circle at 20% 20%, hsl(var(--hue, 255) 90% 70% / .55), transparent 55%),
  radial-gradient(circle at 85% 80%, hsl(calc(var(--hue, 255) + 40) 90% 60% / .45), transparent 50%),
  linear-gradient(135deg, hsl(var(--hue, 255) 45% 18%), #07070b); }
.cc-art.sm { height: 56px; width: 56px; border-radius: 14px; flex: none; }
.cc-cat { position: absolute; left: 14px; bottom: 12px; font-size: .7rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; background: rgba(0, 0, 0, .45); padding: 4px 10px; border-radius: 999px; }
.cc-body { display: flex; flex-direction: column; gap: 10px; padding: 18px 20px 20px; flex: 1; }
.cc-body h3 { font-size: 1.2rem; font-weight: 800; margin: 0; }
.cc-sum { color: var(--ink-2); font-size: .92rem; line-height: 1.5; }
.cc-facts { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--ink-3); font-size: .8rem; }
.cc-facts span { display: inline-flex; align-items: center; gap: 5px; }
.cc-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: .85rem; }
.cc-who { color: var(--ink-2); }
.cc-go { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--violet); }
.cc-prog { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: var(--ink-2); font-size: .8rem; }
.cc-prog .bar, .cx-progress .bar { display: inline-block; width: 90px; height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; }
.cc-prog .bar span, .cx-progress .bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--violet), var(--done)); border-radius: 99px; }
.cc-prog.wide { display: flex; }
.cc-prog.wide .bar { width: min(260px, 50vw); }

.my-list { display: grid; gap: 14px; }
.my-row { display: flex; align-items: center; gap: 18px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; }
.my-main { flex: 1; min-width: 0; }
.my-main h3 { margin: 0 0 8px; font-size: 1.1rem; }
.my-main h3 a { text-decoration: none; }

/* ---- course page (Scrimba-style outline) ---- */
.cx-hero { text-align: center; max-width: 820px; margin: 0 auto 40px; }
.cx-hero h1 { font-size: clamp(2.4rem, 6vw, 3.6rem); font-weight: 900; line-height: 1.05; margin: 0 0 18px; }
.cx-chips { list-style: none; padding: 0; margin: 0 0 20px; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.cx-chips li { display: inline-flex; align-items: center; gap: 6px; background: var(--card-2); border: 1px solid var(--line); color: var(--ink-2); font-size: .85rem; padding: 4px 10px; border-radius: 8px; }
.cx-chips .cx-who { padding-left: 4px; color: var(--ink); font-weight: 600; }
.cx-avatar { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: linear-gradient(135deg, var(--violet), #5b3fd6); color: #fff; font-size: .62rem; font-weight: 800; letter-spacing: .02em; }
.cx-avatar.lg { width: 56px; height: 56px; font-size: 1.1rem; }
.cx-lede { font-size: 1.2rem; line-height: 1.55; color: var(--ink-2); margin: 0 auto 26px; max-width: 40rem; }
.cx-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.cx-actions form { margin: 0; }
.cx-btn { display: inline-flex; align-items: center; gap: 10px; padding: 13px 18px; border-radius: 8px; font: 800 .95rem/1 var(--f-body); letter-spacing: .03em; text-transform: uppercase; text-decoration: none; border: 1px solid transparent; cursor: pointer; transition: transform .1s ease, filter .15s ease; }
.cx-btn:hover { text-decoration: none; filter: brightness(1.12); }
.cx-btn:active { transform: translateY(1px); }
.cx-btn.go { background: color-mix(in srgb, var(--done) 18%, var(--card)); color: var(--done); border-color: color-mix(in srgb, var(--done) 35%, transparent); }
.cx-btn.alt { background: var(--violet-soft); color: var(--violet-2); border-color: color-mix(in srgb, var(--violet) 35%, transparent); }
html[data-theme=light] .cx-btn.alt { color: #5b3fd6; }
.cx-progress { display: inline-flex; align-items: center; gap: 12px; margin-top: 22px; color: var(--ink-2); }
.cx-progress .bar { width: 220px; }
.cx-note { margin: 18px auto 0; color: var(--ink-3); font-size: .9rem; }
.cx-start { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; max-width: 760px; margin: 0 auto 28px; padding: 14px 18px; border-radius: 12px; background: var(--violet-soft); border: 1px solid color-mix(in srgb, var(--violet) 40%, transparent); }
.cx-start form { margin: 0; }

.cx-outline { max-width: 760px; margin: 0 auto; border-top: 1px solid var(--line); padding-top: 28px; }
.cx-outline-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 16px; }
.cx-outline-head h2 { font-size: 1.3rem; margin: 0; }
.cx-outline-head .linkish { font-size: .85rem; font-weight: 600; }
.grow { flex: 1; }
.cx-mod { position: relative; }
.cx-mod-title { margin: 0; font-size: inherit; }
.cx-mod-head { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 0; background: none; border: 0; color: var(--ink-2); font: 400 1.4rem/1.25 var(--f-display); text-align: left; cursor: pointer; }
.cx-mod-head:hover, .cx-mod.open .cx-mod-head { color: var(--ink); }
.cx-chev { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--dot-bg); color: var(--ink-2); flex: none; transition: transform .2s ease, background .2s; }
.cx-mod.open .cx-chev { transform: rotate(90deg); }
.cx-mod-head:hover .cx-chev { background: var(--violet-soft); color: var(--ink); }
.cx-mod-name { min-width: 0; }
.cx-pct { font: 800 .72rem/1 var(--f-body); color: #facc15; background: rgba(250, 204, 21, .12); padding: 3px 6px; border-radius: 5px; }
.cx-mod.complete .cx-pct { color: var(--done); background: var(--leaf-soft); }
.cx-meta { flex: none; display: inline-flex; align-items: center; gap: 5px; font-size: .78rem; color: var(--ink-3); background: var(--card-2); border: 1px solid var(--line); padding: 3px 7px; border-radius: 6px; white-space: nowrap; }
.cx-lessons { list-style: none; margin: 4px 0 18px; padding: 0 0 0 32px; position: relative; }
.cx-lessons::before { content: ''; position: absolute; left: 47px; top: 8px; bottom: 8px; width: 2px; background: var(--line-2); border-radius: 2px; }
.cx-dot { box-shadow: 0 0 0 3px var(--paper); }
.cx-lessons li form { margin: 0; }
.cx-lesson { position: relative; width: 100%; display: grid; grid-template-columns: 32px minmax(0, 1fr) auto auto; align-items: center; gap: 0 14px; padding: 7px 0; color: var(--ink-2); text-decoration: none; background: none; border: 0; font: 600 1.12rem/1.35 var(--f-display); text-align: left; cursor: pointer; }
a.cx-lesson:hover, button.cx-lesson:hover { color: var(--ink); text-decoration: none; }
.cx-lesson.done { color: var(--done); }
.cx-lesson.done:hover { color: color-mix(in srgb, var(--done) 80%, var(--ink)); }
.cx-lesson.soon, .cx-lesson.locked { color: var(--ink-3); }
div.cx-lesson { cursor: default; }
.cx-dot { position: relative; z-index: 1; display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--dot-bg); color: var(--ink); box-shadow: 0 0 0 4px var(--paper); }
.cx-lesson.done .cx-dot { background: var(--done); color: var(--done-ink); }
.cx-lesson.done .cx-dot .ic { stroke-width: 3; }
.cx-lesson.play .cx-dot .ic, .cx-lesson.next .cx-dot .ic { fill: currentColor; stroke-width: 1; width: 12px; height: 12px; margin-left: 2px; }
.cx-lesson.locked .cx-dot, .cx-lesson.soon .cx-dot { color: var(--ink-3); }
.cx-dot[style*='--ring']::after { content: ''; position: absolute; inset: -3px; border-radius: 50%; background: conic-gradient(#facc15 calc(var(--ring) * 1%), transparent 0); -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px)); mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px)); }
.cx-lesson.next .cx-dot { background: var(--violet); color: #fff; }
.cx-lesson.next { color: var(--ink); }
.cx-title { min-width: 0; }
.cx-tag { display: inline-block; vertical-align: 2px; margin-left: 6px; font: 700 .64rem/1 var(--f-body); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); background: var(--card-2); border: 1px solid var(--line); padding: 3px 6px; border-radius: 4px; }
.cx-tag.now { color: var(--violet-2); border-color: color-mix(in srgb, var(--violet) 45%, transparent); background: var(--violet-soft); }
html[data-theme=light] .cx-tag.now { color: #5b3fd6; }
.cx-chal { color: #facc15; display: inline-flex; }
.cx-lesson.done .cx-chal { color: var(--done); }
.cx-dur { grid-column: 4; font: 500 .74rem/1 var(--f-body); color: var(--ink-3); background: var(--card-2); border: 1px solid var(--line); padding: 3px 6px; border-radius: 5px; min-width: 40px; text-align: center; }
.cx-dur:empty { visibility: hidden; }
.cx-finish { display: flex; align-items: center; gap: 12px; padding: 8px 0 0; color: #facc15; font: 600 1.05rem var(--f-display); }
.cx-finish .cx-dot { background: rgba(250, 204, 21, .14); color: #facc15; }
.cx-finish.got .cx-dot { background: #facc15; color: #000; }
.cx-about, .cx-teacher { max-width: 760px; margin: 56px auto 0; }
.cx-about h2, .cx-teacher h2 { font-size: 1.8rem; font-weight: 800; text-align: center; margin-bottom: 18px; }
.prose { color: var(--ink-2); line-height: 1.7; }
.prose h2, .prose h3 { color: var(--ink); margin-top: 1.4em; }
.prose a { color: var(--violet-2); }
.cx-teacher-card { display: flex; align-items: center; gap: 16px; justify-content: center; }

/* ---- forms: auth, invite, account ---- */
body.site .auth { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 36px; margin-top: 8px; }
body.site .auth h1 { font-weight: 900; font-size: 2rem; }
body.site .auth .eyebrow { margin-bottom: 18px; }
.invite-note { margin: 0 0 18px; padding: 10px 14px; border-left: 3px solid var(--violet); background: var(--violet-soft); border-radius: 0 8px 8px 0; }
.account h1 { font-weight: 900; font-size: 2.4rem; margin-bottom: 6px; }
.account-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; margin-top: 20px; }
.card-form { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 24px; }
.card-form h2 { font-size: 1.2rem; }

@media (max-width: 860px) {
  .nav-main, .nav-end { display: none; }
  .menu-btn { display: inline-grid; }
  .hero { align-items: flex-start; }
  .hero-in { padding-top: 112px; }
  .hero-copy { padding-left: 0; }
  .globe { opacity: .55; }
  .cx-lessons { padding-left: 0; }
  .cx-lessons::before { left: 15px; }
  .cx-mod-head { font-size: 1.15rem; }
  .cx-lesson { font-size: 1rem; }
  .my-row { flex-wrap: wrap; }
}
@media (max-width: 520px) {
  body.site .wrap, .nav-in, .hero-in { padding-left: 16px; padding-right: 16px; }
  .hero-actions .btn { flex: 1 1 100%; }
  .cx-meta:not(:last-child) { display: none; }
  .cx-lesson { grid-template-columns: 32px minmax(0, 1fr) auto; }
  .cx-chal { display: none; }
  .cx-dur { grid-column: 3; }
  body.site .courses { grid-template-columns: 1fr; }
  body.site .auth { padding: 24px 18px; }
}
@media (prefers-reduced-motion: reduce) {
  body.site, .cx-chev, body.site .course-card { transition: none; }
}
