/* Low Stress Learning — single-source stylesheet.
   Design tokens, self-hosted font, base reset, page-level rules,
   components, and the utility classes used throughout the site.
   No external CSS, no CDN scripts. */


/* === Design tokens === */
:root {
  --brand: #84a98c;        /* muted sage */
  --brand-deep: #52796f;   /* forest */
  --accent: #cdb4db;       /* soft lavender */
  --bubble: #f4ecdd;       /* warm off-white */
  --paper: #fbf7f0;        /* page cream */
  --ink: #2f3e36;          /* deep mossy text */
}


/* === Self-hosted Atkinson Hyperlegible (latin subset) === */
@font-face {
  font-family: 'Atkinson Hyperlegible';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/atkinson-hyperlegible-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Atkinson Hyperlegible';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/assets/fonts/atkinson-hyperlegible-700.woff2') format('woff2');
}


/* === Reset (minimum needed once Tailwind's preflight is gone) === */
*, ::before, ::after {
  box-sizing: border-box;
  border-width: 0;
  border-style: solid;
  border-color: currentColor;
}
html {
  -webkit-text-size-adjust: 100%;
  line-height: 1.5;
}
body { margin: 0; }
h1, h2, h3, h4, h5, h6, p, dl, dd, blockquote, figure {
  margin: 0;
  font-size: inherit;
  font-weight: inherit;
}
a { color: inherit; text-decoration: inherit; }
button {
  background: transparent;
  padding: 0;
  margin: 0;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
button:disabled { cursor: default; }
input, textarea, select {
  font: inherit;
  color: inherit;
  margin: 0;
}
input::placeholder { opacity: 1; color: #9ca3af; }
img, svg, iframe { display: block; max-width: 100%; }
[hidden] { display: none; }


/* === Base === */
html {
  background: var(--paper);
}
html, body {
  font-family: 'Atkinson Hyperlegible', system-ui, -apple-system, BlinkMacSystemFont,
    'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  color: var(--ink);
}
body {
  background:
    radial-gradient(circle at 85% -10%, rgba(132, 169, 140, 0.18) 0, transparent 45%),
    var(--paper);
  min-height: 100vh;
}


/* === Page transitions === */
@view-transition {
  navigation: auto;
}
@keyframes page-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
main {
  animation: page-fade-in 0.35s ease both;
}
body.leaving main {
  animation: none;
  opacity: 0;
  transition: opacity 0.18s ease;
}
.fade-on-load {
  opacity: 0;
  transition: opacity 0.35s ease;
}
.fade-on-load.is-loaded {
  opacity: 1;
}
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.25s;
}


/* === Components === */
.kid-card {
  background: white;
  border-radius: 1.5rem;
  box-shadow: 0 6px 20px -14px rgb(47 62 54 / 0.25);
  border: 1px solid rgb(47 62 54 / 0.06);
}

.kid-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 700;
  border-radius: 9999px;
  padding: 0.85rem 1.6rem;
  background: var(--brand);
  color: white;
  transition: transform 0.12s ease, background 0.18s ease, box-shadow 0.18s ease;
  box-shadow: 0 3px 0 var(--brand-deep), 0 6px 14px -6px rgb(82 121 111 / 0.35);
}
.kid-btn:hover { background: var(--brand-deep); }
.kid-btn:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 var(--brand-deep), 0 3px 8px -4px rgb(82 121 111 / 0.35);
}
.kid-btn[disabled] { opacity: 0.55; cursor: not-allowed; }

.kid-input {
  width: 100%;
  padding: 0.85rem 1rem;
  border-radius: 1rem;
  border: 1.5px solid #d9d3c4;
  font-size: 1.05rem;
  background: white;
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.kid-input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgb(132 169 140 / 0.2);
}

.otp-input {
  letter-spacing: 0.5em;
  text-align: center;
  font-size: 1.6rem;
  font-weight: 700;
}

.video-card {
  display: flex;
  flex-direction: column;
  border-radius: 1.25rem;
  overflow: hidden;
  background: white;
  box-shadow: 0 4px 16px -10px rgb(47 62 54 / 0.18);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  border: 1px solid rgb(47 62 54 / 0.05);
}
.video-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px -16px rgb(47 62 54 / 0.28);
  border-color: var(--brand);
}
.video-card .thumb {
  aspect-ratio: 16 / 9;
  background: var(--bubble) center/cover no-repeat;
}

.subject-pill {
  display: inline-block;
  padding: 0.2rem 0.7rem;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 9999px;
  background: var(--bubble);
  color: var(--brand-deep);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}


/* === Utilities ===
   Hand-curated, only what the site actually uses. Class names mirror
   Tailwind so existing markup and JS template literals keep working. */

/* Display */
.block          { display: block; }
.inline-block   { display: inline-block; }
.flex           { display: flex; }
.inline-flex    { display: inline-flex; }
.grid           { display: grid; }
.hidden         { display: none; }

/* Flex direction & wrap */
.flex-col       { flex-direction: column; }
.flex-wrap      { flex-wrap: wrap; }

/* Alignment */
.items-center   { align-items: center; }
.items-end      { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }

/* Gap */
.gap-2          { gap: 0.5rem; }
.gap-4          { gap: 1rem; }
.gap-5          { gap: 1.25rem; }
.gap-6          { gap: 1.5rem; }
.gap-12         { gap: 3rem; }

/* Grid */
.grid-cols-2    { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.col-span-full  { grid-column: 1 / -1; }

/* Sizing */
.w-full         { width: 100%; }
.max-w-md       { max-width: 28rem; }
.max-w-xl       { max-width: 36rem; }
.max-w-5xl      { max-width: 64rem; }
.max-w-6xl      { max-width: 72rem; }
.aspect-video   { aspect-ratio: 16 / 9; }

/* Margin auto */
.mx-auto        { margin-left: auto; margin-right: auto; }
.ml-auto        { margin-left: auto; }

/* Padding */
.px-4           { padding-left: 1rem; padding-right: 1rem; }
.px-6           { padding-left: 1.5rem; padding-right: 1.5rem; }
.py-2           { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-16          { padding-top: 4rem; padding-bottom: 4rem; }
.pt-6           { padding-top: 1.5rem; }
.pt-8           { padding-top: 2rem; }
.pt-12          { padding-top: 3rem; }
.pb-2           { padding-bottom: 0.5rem; }
.pb-24          { padding-bottom: 6rem; }
.p-5            { padding: 1.25rem; }
.p-6            { padding: 1.5rem; }
.p-8            { padding: 2rem; }

/* Margin */
.mb-1           { margin-bottom: 0.25rem; }
.mb-2           { margin-bottom: 0.5rem; }
.mb-4           { margin-bottom: 1rem; }
.mb-6           { margin-bottom: 1.5rem; }
.mb-8           { margin-bottom: 2rem; }
.mt-1           { margin-top: 0.25rem; }
.mt-2           { margin-top: 0.5rem; }
.mt-3           { margin-top: 0.75rem; }
.mt-4           { margin-top: 1rem; }
.mt-6           { margin-top: 1.5rem; }
.mt-8           { margin-top: 2rem; }

/* space-y-4 — Tailwind's vertical-rhythm utility */
.space-y-4 > * + * { margin-top: 1rem; }

/* Typography — size & line-height */
.text-xs        { font-size: 0.75rem;  line-height: 1rem;     }
.text-sm        { font-size: 0.875rem; line-height: 1.25rem;  }
.text-lg        { font-size: 1.125rem; line-height: 1.75rem;  }
.text-xl        { font-size: 1.25rem;  line-height: 1.75rem;  }
.text-3xl       { font-size: 1.875rem; line-height: 2.25rem;  }
.text-4xl       { font-size: 2.25rem;  line-height: 2.5rem;   }
.text-5xl       { font-size: 3rem;     line-height: 1;        }
.text-6xl       { font-size: 3.75rem;  line-height: 1;        }

/* Typography — weight */
.font-normal    { font-weight: 400; }
.font-bold      { font-weight: 700; }
.font-extrabold { font-weight: 800; }

/* Typography — leading & tracking */
.leading-tight  { line-height: 1.25; }
.tracking-tight { letter-spacing: -0.025em; }
.tracking-wide  { letter-spacing: 0.025em; }

/* Typography — alignment & transforms */
.text-center    { text-align: center; }
.uppercase      { text-transform: uppercase; }

/* Line clamp */
.line-clamp-2 {
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

/* Colors — text */
.text-gray-400  { color: #9ca3af; }
.text-gray-500  { color: #6b7280; }
.text-gray-600  { color: #4b5563; }
.text-gray-700  { color: #374151; }
.text-gray-800  { color: #1f2937; }
.text-gray-900  { color: #111827; }
.text-red-600   { color: #dc2626; }
.text-green-600 { color: #16a34a; }

/* Colors — background */
.bg-gray-900    { background-color: #111827; }

/* Borders */
.border-2       { border-width: 2px; }
.rounded-2xl    { border-radius: 1rem; }
.rounded-full   { border-radius: 9999px; }

/* Effects */
.overflow-hidden { overflow: hidden; }
.transition {
  transition-property: color, background-color, border-color, text-decoration-color,
    fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 150ms;
}

/* Hover variants */
.hover\:underline:hover       { text-decoration: underline; }
.hover\:text-gray-800:hover   { color: #1f2937; }
.hover\:border-current:hover  { border-color: currentColor; }


/* === Auth-state visibility ===
   `<html class="is-authed">` is set synchronously in each page's <head> from
   a localStorage hint, written by real auth signals (server-confirmed session,
   successful OTP verify, logout). The right variant paints on the first
   frame; no DOM swap needed.
   Elements marked .show-guest / .show-user keep their natural display when
   visible — only display: none is applied in the wrong state. */
:not(.is-authed) .show-user  { display: none; }
.is-authed       .show-guest { display: none; }


/* === Responsive — sm: ≥640px === */
@media (min-width: 640px) {
  .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* === Responsive — md: ≥768px === */
@media (min-width: 768px) {
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md\:text-6xl    { font-size: 3.75rem; line-height: 1; }
}

/* === Responsive — lg: ≥1024px === */
@media (min-width: 1024px) {
  .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
