/* Learn Anything portal. No build step: plain CSS with custom properties. */

:root {
  --accent: #4f46e5;
  --accent-strong: #4338ca;
  --accent-weak: #e0e7ff;
  --on-accent: #fff;
  --bg: #fbf8ff;
  --surface: #ffffff;
  --surface-2: #f4f2fa;
  --surface-3: #eae7f1;
  --border: #e1ddea;
  --text: #1c1b22;
  --muted: #5f5c6b;
  --good: #15803d;
  --good-weak: #dcfce7;
  --warn: #b45309;
  --warn-weak: #fef3c7;
  --bad: #dc2626;
  --bad-weak: #fee2e2;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(20 16 40 / 6%), 0 4px 16px rgb(20 16 40 / 6%);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --accent: #a5b4fc;
    --accent-strong: #c7d2fe;
    --accent-weak: #312e81;
    --on-accent: #1e1b4b;
    --bg: #13121a;
    --surface: #1b1a22;
    --surface-2: #22212b;
    --surface-3: #2c2b35;
    --border: #353441;
    --text: #ebe9f2;
    --muted: #a9a6b6;
    --good: #4ade80;
    --good-weak: #14532d;
    --warn: #fbbf24;
    --warn-weak: #78350f;
    --bad: #f87171;
    --bad-weak: #7f1d1d;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 4px 16px rgb(0 0 0 / 25%);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
/* Classes that set display (.badge, .btn…) would otherwise override the hidden attribute. */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.5 var(--font);
  color: var(--text);
  background: var(--bg);
}
a { color: var(--accent); text-underline-offset: 2px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; font-weight: 650; }
h1 { font-size: 1.9rem; letter-spacing: -.01em; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
code, .mono { font-family: var(--mono); font-size: .9em; }
img { max-width: 100%; }

/* Layout */
.site-header {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 24px;
  padding: 12px max(16px, calc((100vw - 1180px) / 2));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text); text-decoration: none; font-size: 1.05rem; }
.brand svg { width: 30px; height: 30px; }
.site-nav { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.site-nav a, .site-nav button.link { padding: 8px 12px; border-radius: 999px; color: var(--text); text-decoration: none; font-weight: 550; white-space: nowrap; }
.site-nav a:hover, .site-nav button.link:hover { background: var(--surface-3); }
/* A button in the nav keeps button colours (the rule above would give it dark text on indigo). */
.site-nav a.btn { color: var(--on-accent); border-radius: 10px; }
.site-nav a.btn:hover { background: var(--accent-strong); }
@media (max-width: 720px) {
  .site-header { gap: 8px; }
  .site-nav { gap: 0; }
  .site-nav .who { display: none; }
  .site-nav a, .site-nav button.link { padding: 8px; }
}
@media (max-width: 420px) {
  .brand-name { display: none; }
}
.site-nav .who { color: var(--muted); font-size: .9rem; padding: 0 8px; }
main { max-width: 1180px; margin: 0 auto; padding: 32px 16px 80px; }
main.wide { max-width: none; padding: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--muted); margin: 4px 0 0; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 860px) { .grid-2 { grid-template-columns: 1fr; } }
.stack > * + * { margin-top: 16px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card h2 { margin-bottom: 12px; }
.card.danger { border-color: color-mix(in srgb, var(--bad) 40%, var(--border)); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px; border-radius: 10px; border: 1px solid transparent;
  font: inherit; font-weight: 600; font-size: .95rem; line-height: 1.2;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  background: var(--accent); color: var(--on-accent);
  transition: background .15s, box-shadow .15s;
}
.btn:hover { background: var(--accent-strong); }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 1px; }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn.secondary:hover { background: var(--surface-2); }
.btn.ghost { background: transparent; color: var(--text); }
.btn.ghost:hover { background: var(--surface-3); }
.btn.danger { background: var(--bad); color: #fff; }
.btn.good { background: var(--good); color: #fff; }
.btn.small { padding: 6px 10px; font-size: .85rem; border-radius: 8px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.icon-btn { background: none; border: 0; padding: 6px; border-radius: 8px; cursor: pointer; color: var(--muted); font: inherit; line-height: 1; }
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
button.link { background: none; border: 0; font: inherit; cursor: pointer; }

/* Forms */
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
.field { margin-bottom: 16px; }
.field .help, .helptext { display: block; color: var(--muted); font-size: .85rem; margin-top: 4px; font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input:not([type]), select, textarea {
  width: 100%; padding: 9px 12px; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  font-weight: 400;
}
textarea { resize: vertical; min-height: 44px; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 18px; height: 18px; margin: 0; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; margin: 0; }
.errorlist { list-style: none; padding: 0; margin: 6px 0 0; color: var(--bad); font-size: .875rem; }
.form-narrow { max-width: 440px; margin: 40px auto; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .8rem; font-weight: 650; background: var(--surface-3); color: var(--muted); white-space: nowrap; }
.badge.published { background: var(--good-weak); color: var(--good); }
.badge.unlisted { background: var(--accent-weak); color: var(--accent); }
.badge.private, .badge.draft { background: var(--surface-3); color: var(--muted); }
.badge.suspended, .badge.deleted { background: var(--bad-weak); color: var(--bad); }
.badge.changes { background: var(--warn-weak); color: var(--warn); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; }

/* Tables */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 650; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.table td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table a.title { font-weight: 650; color: var(--text); text-decoration: none; }
.table a.title:hover { color: var(--accent); }
/* On phones a .stack table becomes a list of cards: first cell on its own line, last cell at the end. */
@media (max-width: 640px) {
  .table.stack thead { display: none; }
  .table.stack tr { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
  .table.stack tr:last-child { border-bottom: 0; }
  .table.stack td { display: block; padding: 0; border: 0; }
  .table.stack td:first-child { flex-basis: 100%; }
  .table.stack td:last-child { margin-left: auto; }
  .table.stack .stack-only { display: inline; }
}
/* Words a table's header says for it on wider screens. */
.stack-only { display: none; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; font-weight: 600; font-size: .9rem; margin-bottom: 8px; }

/* Messages and issues */
.messages { list-style: none; padding: 0; margin: 0 0 20px; }
.messages li { padding: 12px 16px; border-radius: 10px; margin-bottom: 8px; background: var(--surface-2); border: 1px solid var(--border); }
.messages .success { background: var(--good-weak); border-color: transparent; color: var(--good); }
.messages .warning { background: var(--warn-weak); border-color: transparent; color: var(--warn); }
.messages .error { background: var(--bad-weak); border-color: transparent; color: var(--bad); }
.issues { list-style: none; padding: 0; margin: 0; }
.issues li { padding: 8px 0; border-top: 1px solid var(--border); font-size: .92rem; }
.issues li:first-child { border-top: 0; }
.issues .path { font-family: var(--mono); font-size: .8rem; color: var(--muted); display: block; }
.issues .error .sev { color: var(--bad); }
.issues .warning .sev { color: var(--warn); }
.banner { padding: 14px 18px; border-radius: var(--radius); margin-bottom: 20px; }
.banner.bad { background: var(--bad-weak); color: var(--bad); }

/* Landing and public pages */
.hero { display: grid; grid-template-columns: 1.2fr 1fr; gap: 40px; align-items: center; padding: 32px 0 48px; }
.hero h1 { font-size: clamp(2rem, 4vw, 3rem); }
.hero .lead { font-size: 1.15rem; color: var(--muted); max-width: 40ch; }
.hero-art { aspect-ratio: 4 / 3; border-radius: 28px; background: linear-gradient(135deg, var(--accent-weak), var(--surface-3)); display: grid; place-items: center; }
.hero-art svg { width: 55%; height: auto; }
@media (max-width: 760px) { .hero { grid-template-columns: 1fr; } .hero-art { display: none; } }
.lesson-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.lesson-tile { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; color: var(--text); text-decoration: none; box-shadow: var(--shadow); transition: transform .15s; }
.lesson-tile:hover { transform: translateY(-2px); }
.lesson-tile .cover { aspect-ratio: 16 / 9; background: var(--surface-3); display: grid; place-items: center; font-size: 2rem; font-weight: 700; color: var(--muted); }
.lesson-tile .cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lesson-tile .body { padding: 12px 14px 14px; }
.lesson-tile .title { font-weight: 650; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { font-size: .8rem; padding: 2px 8px; border-radius: 999px; background: var(--surface-3); color: var(--muted); }
.public-cover { width: 100%; border-radius: var(--radius); display: block; }
.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty h2 { color: var(--text); }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
