/* ==========================================================================
   learn.klajdkoskija.com
   --------------------------------------------------------------------------
   Same design tokens as klajdkoskija.com, so the two sites feel like one
   place. Only the pieces this app actually uses are here.

   1.  Tokens & themes            6.  Course page
   2.  Reset & base               7.  Player
   3.  Layout & header            8.  Dashboard & tables
   4.  Buttons, tags, forms       9.  Admin
   5.  Cards & catalogue         10.  Footer, motion, print
   ========================================================================== */


/* ==========================================================================
   1. TOKENS & THEMES
   ========================================================================== */

:root {
  --font-display: "Space Grotesk", "Montserrat", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --step--1: clamp(0.80rem, 0.77rem + 0.14vw, 0.875rem);
  --step-0:  clamp(0.95rem, 0.91rem + 0.20vw, 1.05rem);
  --step-1:  clamp(1.10rem, 1.02rem + 0.36vw, 1.30rem);
  --step-2:  clamp(1.35rem, 1.18rem + 0.75vw, 1.80rem);
  --step-3:  clamp(1.70rem, 1.35rem + 1.55vw, 2.60rem);
  --step-4:  clamp(2.20rem, 1.55rem + 2.90vw, 3.60rem);

  --space-xs: 0.5rem;
  --space-sm: 0.875rem;
  --space-md: 1.5rem;
  --space-lg: 2.5rem;
  --space-xl: 4rem;
  --section-y: clamp(3rem, 2.4rem + 4vw, 6rem);

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;
  --radius-pill: 999px;

  --container: 1180px;
  --header-h: 74px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* --- Dark (default) ---------------------------------------------------- */
:root,
:root[data-theme="dark"] {
  color-scheme: dark;

  --bg:          hsl(216 33% 7%);
  --bg-alt:      hsl(216 30% 9.5%);
  --surface:     hsl(216 26% 12.5%);
  --surface-2:   hsl(216 24% 16%);
  --border:      hsl(216 20% 21%);
  --border-soft: hsl(216 20% 21% / 0.6);

  --text:        hsl(210 28% 96%);
  --text-muted:  hsl(213 16% 66%);
  --text-faint:  hsl(213 14% 48%);

  --accent:      hsl(162 72% 53%);
  --accent-hover:hsl(162 78% 62%);
  --accent-ink:  hsl(216 40% 8%);
  --accent-soft: hsl(162 72% 53% / 0.12);
  --accent-line: hsl(162 72% 53% / 0.32);

  --warn:        hsl(38 92% 62%);
  --warn-soft:   hsl(38 92% 62% / 0.14);
  --danger:      hsl(0 72% 62%);
  --danger-soft: hsl(0 72% 62% / 0.14);

  --shadow-sm: 0 1px 2px hsl(216 40% 3% / 0.4);
  --shadow:    0 12px 32px -12px hsl(216 50% 2% / 0.7);
  --glow: radial-gradient(60% 60% at 50% 0%, hsl(162 72% 53% / 0.16), transparent 70%);
}

/* --- Light -------------------------------------------------------------- */
:root[data-theme="light"] {
  color-scheme: light;

  --bg:          hsl(210 40% 98.5%);
  --bg-alt:      hsl(212 34% 95.5%);
  --surface:     hsl(0 0% 100%);
  --surface-2:   hsl(210 40% 97%);
  --border:      hsl(214 24% 88%);
  --border-soft: hsl(214 24% 88% / 0.8);

  --text:        hsl(216 38% 12%);
  --text-muted:  hsl(215 15% 40%);
  --text-faint:  hsl(215 13% 52%);

  --accent:      hsl(168 82% 28%);
  --accent-hover:hsl(168 82% 22%);
  --accent-ink:  hsl(0 0% 100%);
  --accent-soft: hsl(168 82% 28% / 0.09);
  --accent-line: hsl(168 82% 28% / 0.25);

  --warn:        hsl(32 85% 38%);
  --warn-soft:   hsl(32 85% 38% / 0.10);
  --danger:      hsl(0 68% 45%);
  --danger-soft: hsl(0 68% 45% / 0.10);

  --shadow-sm: 0 1px 2px hsl(216 30% 40% / 0.08);
  --shadow:    0 12px 28px -14px hsl(216 30% 30% / 0.22);
  --glow: radial-gradient(60% 60% at 50% 0%, hsl(168 82% 28% / 0.09), transparent 70%);
}

/* Follow the OS until the visitor picks a theme. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    color-scheme: light;
    --bg:          hsl(210 40% 98.5%);
    --bg-alt:      hsl(212 34% 95.5%);
    --surface:     hsl(0 0% 100%);
    --surface-2:   hsl(210 40% 97%);
    --border:      hsl(214 24% 88%);
    --border-soft: hsl(214 24% 88% / 0.8);
    --text:        hsl(216 38% 12%);
    --text-muted:  hsl(215 15% 40%);
    --text-faint:  hsl(215 13% 52%);
    --accent:      hsl(168 82% 28%);
    --accent-hover:hsl(168 82% 22%);
    --accent-ink:  hsl(0 0% 100%);
    --accent-soft: hsl(168 82% 28% / 0.09);
    --accent-line: hsl(168 82% 28% / 0.25);
    --warn:        hsl(32 85% 38%);
    --warn-soft:   hsl(32 85% 38% / 0.10);
    --danger:      hsl(0 68% 45%);
    --danger-soft: hsl(0 68% 45% / 0.10);
    --shadow-sm: 0 1px 2px hsl(216 30% 40% / 0.08);
    --shadow:    0 12px 28px -14px hsl(216 30% 30% / 0.22);
    --glow: radial-gradient(60% 60% at 50% 0%, hsl(168 82% 28% / 0.09), transparent 70%);
  }
}


/* ==========================================================================
   2. RESET & BASE
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  /* Column flex + margin-top:auto on the footer keeps it at the bottom of
     short pages (an empty catalogue, a 404) instead of floating mid-screen. */
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--font-display);
  line-height: 1.15;
  margin: 0 0 var(--space-sm);
  letter-spacing: -0.02em;
}

h1 { font-size: var(--step-4); }
h2 { font-size: var(--step-2); }
h3 { font-size: var(--step-1); }

p { margin: 0 0 var(--space-sm); }

a { color: var(--accent); text-decoration-color: var(--accent-line); text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }

img, video, iframe { max-width: 100%; display: block; }

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
  background: var(--surface-2);
  padding: 0.1em 0.4em;
  border-radius: var(--radius-sm);
}

hr.rule { border: 0; border-top: 1px solid var(--border); margin: var(--space-lg) 0; }

svg { width: 1.15em; height: 1.15em; fill: none; }

/* The sprite is 0×0 in the markup; taking it out of flow stops that empty box
   from adding a stray line at the top of the page. Do not switch this to
   display:none — see the note above the sprite in layout.php. */
.sprite { position: absolute; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-ink);
  padding: var(--space-xs) var(--space-sm);
  z-index: 100;
}
.skip-link:focus { left: var(--space-sm); top: var(--space-xs); }

.muted { color: var(--text-muted); }
.small { font-size: var(--step--1); }
.center { text-align: center; }
.right { text-align: right; }
.accent { color: var(--accent); }


/* ==========================================================================
   3. LAYOUT & HEADER
   ========================================================================== */

.container {
  width: min(100% - 2.5rem, var(--container));
  margin-inline: auto;
}
.container.narrow { width: min(100% - 2.5rem, 860px); }

.section { padding-block: var(--section-y); }
.section--alt { background: var(--bg-alt); border-block: 1px solid var(--border-soft); }

.section-title {
  font-size: var(--step-2);
  margin-bottom: var(--space-md);
}

.eyebrow {
  font-family: var(--font-display);
  font-size: var(--step--1);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: var(--space-xs);
}
.eyebrow a { color: inherit; }

.page-title { margin-bottom: var(--space-sm); }
.lede { font-size: var(--step-1); color: var(--text-muted); max-width: 62ch; }

/* Header: transparent over the hero, and it grows a background once you
   scroll — .is-stuck is toggled by app.js, exactly as on the main site. */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  border-bottom: 1px solid transparent;
  transition: background-color 0.3s var(--ease), border-color 0.3s var(--ease),
              backdrop-filter 0.3s var(--ease);
}
.site-header.is-stuck {
  background: var(--bg); /* fallback where color-mix is unsupported */
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px) saturate(160%);
  border-bottom-color: var(--border-soft);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

/* Logo: the main site's white SVG wordmark, re-coloured through a CSS mask so
   one file serves both themes. The "Learn" pill is the only difference — it
   says which of the two sites you are on. */
.brand-lockup {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex: none;
  text-decoration: none;
  color: var(--text);
  transition: color 0.25s var(--ease);
}
.brand-lockup:hover { color: var(--accent); }

.brand {
  display: block;
  flex: none;
  width: 168px;
  aspect-ratio: 279 / 52;
  background-color: currentColor;
  -webkit-mask: url("../img/logo.svg") no-repeat left center / contain;
          mask: url("../img/logo.svg") no-repeat left center / contain;
}

.brand-tag {
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--accent-line);
  background: var(--accent-soft);
  padding: 0.28rem 0.5rem 0.22rem;
  border-radius: var(--radius-sm);
}

.nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.nav a {
  position: relative;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: var(--step-0);
  font-weight: 500;
  text-decoration: none;
  transition: color 0.2s var(--ease), background-color 0.2s var(--ease);
}
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a.is-active { color: var(--text); }
.nav a.is-active::after {
  content: "";
  position: absolute;
  left: 0.85rem;
  right: 0.85rem;
  bottom: 0.2rem;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}

/* Sign in / sign out sits at the end of the nav, so on mobile it drops into
   the drawer with everything else instead of crowding the header bar.

   These re-state the button colours because ".nav a" outranks ".btn--primary"
   on specificity and would otherwise repaint the label in the muted nav
   colour — green text on a green pill. */
.nav-auth { margin: 0 0 0 0.4rem; }
.nav a.nav-auth,
.nav a.nav-auth:hover {
  color: var(--accent-ink);
  padding: 0.45rem 0.85rem;
}
.nav a.nav-auth:hover { background: var(--accent-hover); }

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.user-chip {
  font-size: var(--step--1);
  color: var(--text-faint);
  max-width: 18ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Icon-only buttons: theme toggle, menu, socials, back-to-top */
.icon-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease),
              background-color 0.2s var(--ease);
}
.icon-btn:hover {
  color: var(--accent);
  border-color: var(--accent-line);
  background: var(--accent-soft);
}
.icon-btn svg { width: 19px; height: 19px; }

/* Sun/moon swap driven by the data-theme attribute app.js always sets. */
.icon-btn .icon-moon { display: none; }
:root[data-theme="light"] .icon-btn .icon-moon { display: block; }
:root[data-theme="light"] .icon-btn .icon-sun  { display: none; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) .icon-btn .icon-moon { display: block; }
  :root:not([data-theme]) .icon-btn .icon-sun  { display: none; }
}

.nav-toggle { display: none; }
body.is-locked { overflow: hidden; }

/* Mobile drawer */
@media (max-width: 860px) {
  .nav-toggle { display: grid; }
  .user-chip { display: none; }

  .nav {
    position: fixed;
    inset: var(--header-h) 0 auto 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0.15rem;
    padding: 1rem 1.25rem 1.5rem;
    background: var(--bg-alt);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    opacity: 0;
    visibility: hidden;
    translate: 0 -0.75rem;
    /* visibility is discrete: hold it until the fade-out finishes, and flip it
       instantly on the way in (see .is-open). */
    transition: opacity 0.25s var(--ease), translate 0.25s var(--ease),
                visibility 0s linear 0.25s;
  }
  .nav.is-open {
    opacity: 1;
    visibility: visible;
    translate: 0 0;
    transition: opacity 0.25s var(--ease), translate 0.25s var(--ease),
                visibility 0s;
  }
  .nav a { padding: 0.7rem 0.85rem; }
  .nav-auth { margin: 0.5rem 0 0; }
  .nav a.nav-auth, .nav-auth .btn { justify-content: center; width: 100%; }
}

@media (max-width: 560px) {
  :root { --header-h: 66px; }
  .brand { width: 132px; }
}

.hero {
  padding-block: clamp(3rem, 2rem + 6vw, 6rem) var(--section-y);
  background-image: var(--glow);
}
.hero .lede { margin-block: var(--space-sm) var(--space-md); }

.btn-row { display: flex; flex-wrap: wrap; gap: var(--space-sm); align-items: center; }
.btn-row.center { justify-content: center; }

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: var(--space-lg);
  align-items: start;
}
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }


/* ==========================================================================
   4. BUTTONS, TAGS, FORMS, FLASHES
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.2rem;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  font-size: var(--step--1);
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s var(--ease), background-color 0.15s var(--ease);
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn--sm { padding: 0.45rem 0.85rem; }
.btn--block { display: flex; justify-content: center; width: 100%; }

.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--primary:hover { background: var(--accent-hover); color: var(--accent-ink); }

.btn--ghost {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}
.btn--ghost:hover { border-color: var(--accent-line); color: var(--text); }

.btn--danger { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }

.tag {
  display: inline-block;
  font-size: var(--step--1);
  font-weight: 600;
  padding: 0.15rem 0.6rem;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.tag--ok   { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-line); }
.tag--warn { background: var(--warn-soft); color: var(--warn); border-color: var(--warn); }

.flash {
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius);
  border: 1px solid var(--accent-line);
  background: var(--accent-soft);
  color: var(--text);
  margin-block: var(--space-md) 0;
}
.flash--error { border-color: var(--danger); background: var(--danger-soft); }
.flash--warn  { border-color: var(--warn); background: var(--warn-soft); }

.form { display: grid; gap: var(--space-sm); margin-block: var(--space-md); }
.form label { display: grid; gap: 0.35rem; }
.form label > span {
  font-size: var(--step--1);
  font-weight: 600;
  color: var(--text-muted);
}
.form label > span small { font-weight: 400; color: var(--text-faint); }

.form input,
.form select,
.form textarea {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.75rem;
  width: 100%;
}
.form textarea { resize: vertical; }
.form input:focus, .form select:focus, .form textarea:focus { border-color: var(--accent); }

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--space-sm);
  align-items: end;
}
.form label.check {
  flex-direction: row;
  grid-auto-flow: column;
  justify-content: start;
  align-items: center;
  gap: 0.5rem;
}
.form label.check input { width: auto; }

.form--inline {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  align-items: end;
}

.empty {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: var(--space-lg);
  text-align: center;
  color: var(--text-muted);
  background: var(--surface);
}

.prose { max-width: 68ch; color: var(--text-muted); }
.prose p { margin-bottom: var(--space-sm); }


/* ==========================================================================
   5. CARDS & CATALOGUE
   ========================================================================== */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-md);
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform 0.2s var(--ease), border-color 0.2s var(--ease);
}
.card:hover { transform: translateY(-3px); border-color: var(--accent-line); }

.card-media {
  display: block;
  aspect-ratio: 16 / 9;
  background: var(--surface-2);
  display: grid;
  place-items: center;
}
.card-media img { width: 100%; height: 100%; object-fit: cover; }
.card-media-fallback {
  font-family: var(--font-display);
  font-size: var(--step-3);
  color: var(--accent);
  opacity: 0.7;
}

.card-body { padding: var(--space-md); display: flex; flex-direction: column; gap: 0.4rem; flex: 1; }
.card-body h3 { margin: 0; font-size: var(--step-1); }
.card-body h3 a { color: var(--text); text-decoration: none; }
.card-body h3 a:hover { color: var(--accent); }
.card-meta { display: flex; gap: 0.4rem; flex-wrap: wrap; margin: 0; }
.card-sub { color: var(--text-muted); margin: 0; }
.card-facts { font-size: var(--step--1); color: var(--text-faint); margin: 0; }
.card-foot {
  margin: auto 0 0;
  padding-top: var(--space-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
}
.price { font-family: var(--font-display); font-weight: 700; font-size: var(--step-1); }


/* ==========================================================================
   6. COURSE PAGE
   ========================================================================== */

.buy-box {
  position: sticky;
  top: calc(var(--header-h) + 1rem);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  box-shadow: var(--shadow);
  display: grid;
  gap: var(--space-sm);
}
.buy-cover { border-radius: var(--radius); width: 100%; aspect-ratio: 16/9; object-fit: cover; }
.buy-price {
  font-family: var(--font-display);
  font-size: var(--step-3);
  font-weight: 700;
  margin: 0;
  line-height: 1.1;
}
.buy-price small { display: block; font-size: var(--step--1); font-weight: 400; color: var(--text-faint); }
.buy-note { font-size: var(--step--1); color: var(--text-faint); margin: 0; }
.buy-facts { list-style: none; margin: 0; padding: var(--space-sm) 0 0; border-top: 1px solid var(--border-soft); display: grid; gap: 0.3rem; }
.buy-facts li { font-size: var(--step--1); color: var(--text-muted); padding-left: 1.2rem; position: relative; }
.buy-facts li::before { content: "✓"; position: absolute; left: 0; color: var(--accent); }
@media (max-width: 900px) { .buy-box { position: static; } }

.lesson-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; counter-reset: lesson; }
.lesson-row {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr) auto;
  gap: var(--space-sm);
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-sm) var(--space-md);
}
.lesson-row.is-done { border-color: var(--accent-line); }
.lesson-num { font-family: var(--font-display); color: var(--text-faint); }
.lesson-main { display: grid; gap: 0.1rem; min-width: 0; }
.lesson-title { font-weight: 600; color: var(--text); text-decoration: none; }
a.lesson-title:hover { color: var(--accent); }
.lesson-sum { font-size: var(--step--1); color: var(--text-faint); }
.lesson-side { display: flex; align-items: center; gap: var(--space-sm); font-size: var(--step--1); white-space: nowrap; }
.icon-done { color: var(--accent); }
.icon-lock { color: var(--text-faint); }


/* ==========================================================================
   7. PLAYER
   ========================================================================== */

.player-page { padding-block: var(--space-lg) var(--section-y); }
.split-player {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: var(--space-lg);
  align-items: start;
}
@media (max-width: 1000px) { .split-player { grid-template-columns: 1fr; } }

.player-frame {
  aspect-ratio: 16 / 9;
  background: #000;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: grid;
  place-items: center;
  margin-bottom: var(--space-md);
}
.player-frame video,
.player-frame iframe { width: 100%; height: 100%; border: 0; }
.player-empty { color: var(--text-muted); padding: var(--space-md); text-align: center; }

.player-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  padding-block: var(--space-sm);
  border-top: 1px solid var(--border-soft);
}
.player-nav { display: flex; gap: var(--space-xs); }

.preview-cta {
  margin-top: var(--space-md);
  padding: var(--space-md);
  border-radius: var(--radius);
  border: 1px solid var(--accent-line);
  background: var(--accent-soft);
}

.player-side {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-sm);
  position: sticky;
  top: calc(var(--header-h) + 1rem);
  max-height: calc(100vh - var(--header-h) - 2rem);
  overflow-y: auto;
}
.side-title { font-size: var(--step-0); padding: var(--space-xs) var(--space-sm); margin: 0; color: var(--text-muted); }
.side-list { list-style: none; margin: 0; padding: 0; }
.side-list a, .side-locked {
  display: grid;
  grid-template-columns: 1.6rem minmax(0, 1fr) auto;
  gap: 0.5rem;
  align-items: center;
  padding: 0.55rem var(--space-sm);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text);
  font-size: var(--step--1);
}
.side-list a:hover { background: var(--surface-2); }
.side-list li.is-current a { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.side-list li.is-done .side-name::after { content: " ✓"; color: var(--accent); }
.side-num { color: var(--text-faint); }
.side-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-time { color: var(--text-faint); font-size: var(--step--1); }
.side-locked { color: var(--text-faint); }


/* ==========================================================================
   8. DASHBOARD, TABLES, STATS
   ========================================================================== */

.bar {
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  overflow: hidden;
  border: 1px solid var(--border-soft);
}
.bar-fill { display: block; height: 100%; background: var(--accent); transition: width 0.3s var(--ease); }

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-sm);
  margin-block: var(--space-md);
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-sm) var(--space-md);
}
.stat dt { font-size: var(--step--1); color: var(--text-faint); }
.stat dd { margin: 0; font-family: var(--font-display); font-size: var(--step-2); font-weight: 700; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--step--1);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: block;
  overflow-x: auto;
}
.table th, .table td { padding: 0.65rem var(--space-sm); text-align: left; border-bottom: 1px solid var(--border-soft); }
.table th { color: var(--text-faint); font-weight: 600; white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table td span.small { display: block; }


/* ==========================================================================
   9. ADMIN
   ========================================================================== */

.health { list-style: none; margin: 0 0 var(--space-md); padding: 0; display: grid; gap: 0.3rem; font-size: var(--step--1); }
.health li { padding-left: 1.4rem; position: relative; color: var(--text-muted); }
.health li::before { position: absolute; left: 0; }
.health li.ok::before { content: "✓"; color: var(--accent); }
.health li.bad::before { content: "!"; color: var(--warn); font-weight: 700; }

.lesson-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  margin-bottom: var(--space-md);
}
.lesson-card--new { border-style: dashed; }
.lesson-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-sm);
}
.lesson-card-head h3 { margin: 0; }
.lesson-card-foot {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--border-soft);
}
.lesson-card-foot form { margin: 0; }

.uploader {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: var(--space-sm) var(--space-md);
  margin-bottom: var(--space-sm);
  background: var(--bg-alt);
}
.upload-label { display: grid; gap: 0.35rem; font-size: var(--step--1); }
.upload-label > span { font-weight: 600; color: var(--text-muted); }
.upload-label small { font-weight: 400; color: var(--text-faint); }
.upload-progress { margin-top: var(--space-sm); display: grid; gap: 0.35rem; }
.upload-progress p { margin: 0; }


/* ==========================================================================
   10. FOOTER, MOTION, PRINT
   ========================================================================== */

/* Footer: same three-column layout as klajdkoskija.com — brand and blurb,
   then two link columns, then the bottom bar with the socials. */
.site-footer {
  margin-top: auto;
  padding-block: var(--space-xl) var(--space-lg);
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
}

.footer-top {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) repeat(2, minmax(0, 1fr));
  gap: var(--space-lg);
  padding-bottom: var(--space-lg);
}

.footer-brand .brand-lockup { margin-bottom: 1rem; }
.footer-brand p {
  max-width: 34ch;
  color: var(--text-muted);
  font-size: var(--step--1);
  margin: 0;
}

.footer-col h3 {
  margin-bottom: 0.9rem;
  font-family: var(--font-body);
  font-size: var(--step--1);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.footer-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.55rem; }
.footer-col a {
  color: var(--text-muted);
  font-size: var(--step-0);
  text-decoration: none;
  transition: color 0.2s var(--ease);
}
.footer-col a:hover { color: var(--accent); }

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: var(--space-md);
  border-top: 1px solid var(--border);
  color: var(--text-faint);
  font-size: var(--step--1);
}
.footer-bottom p { margin: 0; }
.footer-socials { display: flex; gap: 0.5rem; }

/* Back to top: hidden until you are well down the page. */
.to-top {
  position: fixed;
  right: clamp(1rem, 2vw, 2rem);
  bottom: clamp(1rem, 2vw, 2rem);
  z-index: 90;
  width: 44px;
  height: 44px;
  background: var(--surface);
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  translate: 0 0.5rem;
  transition: opacity 0.25s var(--ease), translate 0.25s var(--ease),
              visibility 0s linear 0.25s;
}
.to-top.is-visible {
  opacity: 1;
  visibility: visible;
  translate: 0 0;
  transition: opacity 0.25s var(--ease), translate 0.25s var(--ease), visibility 0s;
}

@media (max-width: 980px) {
  .footer-top { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .footer-top { grid-template-columns: 1fr; gap: var(--space-md); }
  .footer-bottom { justify-content: center; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .btn:hover, .card:hover { transform: none; }
}

@media print {
  .site-header, .site-footer, .btn, .player-side, .to-top { display: none !important; }
  body { background: #fff; color: #000; display: block; }
}
