/* Jako OS Tutorials. Tokens are the product's own (src/styles/index.css,
 * DESIGN.md): Cream ground, Paper cards, Ink text, Jako Green for the one
 * primary action. Georgia for brand statements, the system UI stack (Inter
 * when installed) for everything you work with. No web fonts are loaded. */

:root {
  color-scheme: light;
  --cream: #f7f1eb;
  --sand: #efe7da;
  --paper: #ffffff;
  --ink: #1c1e22;
  --body: #3c3a34;
  --muted: #6f695d; /* Muted, one step darker so small text passes 4.5:1 on Cream */
  --rule: #e2dacb;
  --rule-strong: #d6ccba;
  --green: #20674f;
  --green-deep: #154635;
  --gold: #e8b23a;
  --oxblood: #7a3038;
  --error-wash: #faf3f3;
  --error-rule: #e8d3d4;
  --focus: #20674f;
  --shadow: 0 1px 2px rgb(28 30 34 / 0.05), 0 8px 24px -12px rgb(28 30 34 / 0.18);
  --shadow-hover: 0 2px 4px rgb(28 30 34 / 0.06), 0 16px 32px -14px rgb(28 30 34 / 0.28);

  --serif: Georgia, Gelasio, 'Times New Roman', serif;
  --sans: Inter, 'Inter Display', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --r-control: 4px;
  --r-panel: 8px;
  --r-pill: 999px;
  --gutter: clamp(16px, 4vw, 40px);
  --max: 1200px;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --cream: #1a1d21;
    --sand: #24282e;
    --paper: #20242a;
    --ink: #f7f1eb;
    --body: #d6d2c9;
    --muted: #a7a297;
    --rule: #33373d;
    --rule-strong: #43484f;
    --green: #6fbf95;
    --green-deep: #8fd0ad;
    --oxblood: #e08a92;
    --error-wash: #2a2023;
    --error-rule: #4a3034;
    --focus: #8fd0ad;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px -12px rgb(0 0 0 / 0.5);
    --shadow-hover: 0 2px 4px rgb(0 0 0 / 0.35), 0 16px 32px -14px rgb(0 0 0 / 0.6);
  }
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--cream);
  color: var(--ink);
  font: 400 1rem/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

a {
  color: var(--green);
  text-underline-offset: 0.18em;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.main:focus,
[tabindex='-1']:focus {
  outline: none;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 8px;
  top: -48px;
  z-index: 10;
  padding: 8px 14px;
  border-radius: var(--r-control);
  background: var(--ink);
  color: var(--cream);
  text-decoration: none;
}

.skip-link:focus {
  top: 8px;
}

/* ------------------------------------------------------------- top bar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: color-mix(in srgb, var(--cream) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--rule);
}

.topbar__inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 12px var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 60px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  min-width: 0;
}

.brand__mark {
  width: 28px;
  height: 28px;
  color: var(--green);
  flex: none;
}

.brand__name {
  font: 400 1.3rem/1 var(--serif);
  letter-spacing: -0.02em;
}

.brand__sub {
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  padding-left: 10px;
  border-left: 1px solid var(--rule-strong);
}

.account {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.account[hidden] {
  display: none;
}

.account__email {
  font-size: 0.875rem;
  color: var(--body);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 28ch;
}

/* ------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 12px 20px;
  border-radius: var(--r-control);
  border: 1px solid transparent;
  font: 500 0.9375rem/1.2 var(--sans);
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    color 160ms ease;
}

.btn--primary {
  background: var(--green);
  color: #fff;
}

.btn--primary:hover {
  background: var(--green-deep);
}

@media (prefers-color-scheme: dark) {
  .btn--primary {
    color: #0b100e;
  }
}

.btn--secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--rule-strong);
}

.btn--secondary:hover {
  background: var(--sand);
}

.btn--quiet {
  min-height: 36px;
  padding: 6px 12px;
  background: transparent;
  color: var(--ink);
  border-color: var(--rule-strong);
  font-size: 0.875rem;
}

.btn--quiet:hover {
  background: var(--sand);
}

.btn--link {
  display: inline;
  min-height: 0;
  padding: 0;
  background: none;
  border: 0;
  color: var(--green);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

/* ------------------------------------------------------------- layout */

.main {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(24px, 5vw, 56px) var(--gutter) 96px;
}

.eyebrow {
  margin: 0 0 16px;
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--green);
}

/* ------------------------------------------------------------- loading / notices */

.state {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  padding: 48px 0;
}

.spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--rule-strong);
  border-top-color: var(--green);
  animation: spin 800ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.notice {
  max-width: 560px;
  margin: clamp(24px, 8vh, 96px) auto 0;
  padding: clamp(24px, 4vw, 40px);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--r-panel);
  box-shadow: var(--shadow);
}

.notice--error {
  background: var(--error-wash);
  border-color: var(--error-rule);
}

.notice__title {
  margin: 0 0 8px;
  font: 400 clamp(1.6rem, 3vw, 2rem) / 1.2 var(--serif);
  letter-spacing: -0.02em;
}

.notice__body {
  margin: 0;
  color: var(--body);
}

.notice__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.noscript {
  max-width: 560px;
  margin: 48px auto;
  padding: 0 16px;
}

/* ------------------------------------------------------------- landing */

.landing {
  max-width: 760px;
  padding: clamp(24px, 9vh, 112px) 0 0;
}

.landing__title {
  margin: 0;
  font: 400 clamp(2.5rem, 7vw, 4.75rem) / 1.02 var(--serif);
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.landing__lead {
  max-width: 56ch;
  margin: 24px 0 0;
  font-size: clamp(1.0625rem, 2vw, 1.25rem);
  line-height: 1.55;
  color: var(--body);
}

.landing__actions {
  margin-top: 36px;
}

.landing__actions .btn {
  min-width: 160px;
}

.landing__note {
  margin: 14px 0 0;
  font-size: 0.875rem;
  color: var(--muted);
}

/* ------------------------------------------------------------- library */

.library__head {
  display: grid;
  gap: 8px;
  margin-bottom: clamp(24px, 4vw, 40px);
}

.library__title {
  margin: 0;
  font: 400 clamp(2.25rem, 5vw, 3.25rem) / 1.08 var(--serif);
  letter-spacing: -0.03em;
}

.library__lead {
  margin: 0 0 12px;
  color: var(--body);
}

.search {
  position: relative;
  max-width: 480px;
}

.search__icon {
  position: absolute;
  left: 14px;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.search__input {
  width: 100%;
  min-height: 48px;
  padding: 12px 16px 12px 42px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-control);
  background: var(--paper);
  color: var(--ink);
  font: 400 1rem/1.4 var(--sans);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.search__input::placeholder {
  color: var(--muted);
}

.search__input:focus-visible {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 22%, transparent);
}

.groups {
  display: grid;
  gap: clamp(36px, 5vw, 56px);
}

.group__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--rule);
}

.group__title {
  margin: 0;
  font: 400 clamp(1.4rem, 2.4vw, 1.75rem) / 1.2 var(--serif);
  letter-spacing: -0.02em;
}

.group__count {
  font-size: 0.8125rem;
  color: var(--muted);
  white-space: nowrap;
}

.grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  gap: clamp(16px, 2.4vw, 24px);
}

.card__link {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--r-panel);
  color: inherit;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition:
    transform 200ms cubic-bezier(0.2, 0.7, 0.2, 1),
    box-shadow 200ms ease,
    border-color 200ms ease;
}

.card__link:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
  border-color: var(--rule-strong);
}

.card__link:focus-visible {
  outline-offset: 3px;
}

.card__text {
  display: grid;
  gap: 6px;
  padding: 16px 18px 20px;
}

.card__title {
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--ink);
}

.card__desc {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--body);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* The poster, or its placeholder: Sand ground, the video number in the serif. */
.poster {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background:
    radial-gradient(circle at 85% 20%, color-mix(in srgb, var(--gold) 22%, transparent), transparent 55%),
    radial-gradient(circle at 10% 110%, color-mix(in srgb, var(--green) 18%, transparent), transparent 60%),
    var(--sand);
  border-bottom: 1px solid var(--rule);
}

.poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.poster__number {
  position: absolute;
  left: 18px;
  bottom: 6px;
  font: 400 clamp(3.5rem, 7vw, 4.5rem) / 1 var(--serif);
  letter-spacing: -0.04em;
  color: color-mix(in srgb, var(--ink) 78%, var(--sand));
}

.poster__duration {
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 3px 8px;
  border-radius: var(--r-pill);
  background: rgb(11 16 14 / 0.78);
  color: #f7f1eb;
  font-size: 0.75rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.empty {
  padding: 48px 24px;
  text-align: center;
  color: var(--body);
  background: var(--paper);
  border: 1px dashed var(--rule-strong);
  border-radius: var(--r-panel);
}

.empty p {
  margin: 0;
}

.empty__title {
  margin-bottom: 6px !important;
  font: 400 1.4rem/1.3 var(--serif);
  color: var(--ink);
  overflow-wrap: anywhere;
}

/* ------------------------------------------------------------- player */

.watch {
  max-width: 960px;
  margin: 0 auto;
}

.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  margin: -8px 0 12px;
  color: var(--body);
  text-decoration: none;
  font-size: 0.9375rem;
}

.back:hover {
  color: var(--ink);
  text-decoration: underline;
}

.player {
  overflow: hidden;
  border-radius: var(--r-panel);
  background: #0b100e;
  box-shadow: var(--shadow);
}

.player__video {
  width: 100%;
  aspect-ratio: 16 / 10;
  max-height: 74vh;
  background: #0b100e;
}

.player__video::cue {
  font-family: var(--sans);
  line-height: 1.35;
  background: rgb(11 16 14 / 0.78);
  color: #f7f1eb;
}

.watch__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  margin-top: 16px;
}

.watch__meta {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.field {
  display: flex;
  align-items: center;
  gap: 10px;
}

.field__label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--body);
}

.select {
  min-height: 40px;
  padding: 8px 36px 8px 12px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-control);
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23857f72' stroke-width='1.6'/%3E%3C/svg%3E")
      no-repeat right 12px center / 12px 8px,
    var(--paper);
  color: var(--ink);
  font: 400 0.9375rem/1.2 var(--sans);
  appearance: none;
  cursor: pointer;
}

.watch__title {
  margin: 20px 0 0;
  font: 400 clamp(1.9rem, 4.4vw, 2.75rem) / 1.12 var(--serif);
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.watch__desc {
  max-width: 64ch;
  margin: 12px 0 0;
  font-size: clamp(1.0625rem, 1.8vw, 1.1875rem);
  line-height: 1.55;
  color: var(--body);
}

.needs {
  display: inline-block;
  max-width: 100%;
  margin: 20px 0 0;
  padding: 10px 14px;
  border-left: 3px solid var(--gold);
  border-radius: 0 var(--r-control) var(--r-control) 0;
  background: var(--sand);
  color: var(--body);
  font-size: 0.9375rem;
}

.needs strong {
  color: var(--ink);
  font-weight: 600;
}

.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
}

.pager__link {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid var(--rule);
  border-radius: var(--r-panel);
  background: var(--paper);
  color: inherit;
  text-decoration: none;
  min-width: 0;
  transition: border-color 160ms ease, background-color 160ms ease;
}

.pager__link:hover {
  border-color: var(--rule-strong);
  background: color-mix(in srgb, var(--paper) 60%, var(--sand));
}

.pager__link--next {
  grid-column: 2;
  text-align: right;
}

.pager__dir {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--green);
}

.pager__title {
  font-weight: 600;
  color: var(--ink);
  overflow-wrap: anywhere;
}

@media (max-width: 560px) {
  .brand__sub {
    display: none;
  }

  .account__email {
    max-width: 16ch;
  }

  .pager {
    grid-template-columns: 1fr;
  }

  .pager__link--next {
    grid-column: 1;
  }

  .pager > span:empty {
    display: none;
  }
}

@media (max-width: 400px) {
  .brand__name {
    font-size: 1.15rem;
  }

  .account {
    gap: 8px;
  }

  .account__email {
    max-width: 13ch;
    font-size: 0.8125rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0ms !important;
    animation-duration: 0ms !important;
  }

  .card__link:hover {
    transform: none;
  }
}
