/* labs.voiceover.my — doodle-style palette, fonts from the kit (Baloo 2, Nunito; SIL OFL 1.1). */
@font-face { font-family: 'Baloo 2'; font-weight: 800; font-display: swap; src: url(fonts/Baloo2-800.woff2) format('woff2'); }
@font-face { font-family: 'Nunito'; font-weight: 600; font-display: swap; src: url(fonts/Nunito-600.woff2) format('woff2'); }
@font-face { font-family: 'Nunito'; font-weight: 800; font-display: swap; src: url(fonts/Nunito-800.woff2) format('woff2'); }

:root {
  --bg: #fbf3e4;
  --paper: #fffdf8;
  --ink: #2b2118;
  --muted: #5e4d3e;
  --accent: #c2461d;
  --accent-ink: #9a3412;
  --accent-soft: #f7c9a8;
  --teal: #2f7a6d;
  --ok-bg: #e3f2ec; --ok-ink: #1f5b4f;
  --warn-bg: #fdf0cf; --warn-ink: #6b4a00;
  --err-bg: #fbe3dc; --err-ink: #8c2a10;
  --radius: 18px;
  --shadow: 4px 4px 0 var(--ink);
  --gutter: clamp(16px, 4vw, 48px);
  --font-head: 'Baloo 2', 'Nunito', system-ui, sans-serif;
  --font-body: 'Nunito', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  background: var(--bg);
  background-image:
    radial-gradient(circle at 12% 18%, rgba(247, 201, 168, .55), transparent 42%),
    radial-gradient(circle at 88% 82%, rgba(170, 214, 200, .45), transparent 40%);
  background-attachment: fixed;
  color: var(--ink);
  font: 600 1rem/1.55 var(--font-body);
  display: flex;
  flex-direction: column;
}
img, video { display: block; max-width: 100%; }
a { color: var(--accent-ink); text-underline-offset: 3px; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; background: rgba(43, 33, 24, .07); padding: .1em .35em; border-radius: 6px; }
h1, h2 { font-family: var(--font-head); font-weight: 800; line-height: 1.08; margin: 0; letter-spacing: -.01em; }
p { margin: 0; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 10; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; text-decoration: none; }
.skip:focus { top: 12px; }

/* Top bar */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px var(--gutter); max-width: 1440px; width: 100%; margin: 0 auto; }
.brand { display: inline-flex; align-items: center; gap: 8px; font: 800 1.15rem/1 var(--font-head); color: var(--ink); text-decoration: none; white-space: nowrap; }
.brand-mark { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--accent); color: #fff; font-size: .8rem; border: 2px solid var(--ink); }
.brand-dim { color: var(--muted); }
.logout { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who { color: var(--muted); font-size: .9rem; 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: 48px; padding: 10px 22px; border-radius: 999px;
  font: 800 1rem/1.1 var(--font-body); text-decoration: none; cursor: pointer;
  border: 2px solid var(--ink); transition: transform .12s ease, box-shadow .12s ease, background-color .12s ease;
}
.btn-primary { background: var(--accent); color: #fff; box-shadow: 3px 3px 0 var(--ink); }
.btn-primary:hover { background: var(--accent-ink); }
.btn-primary:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.btn-ghost { background: var(--paper); color: var(--ink); }
.btn-ghost:hover { background: #fff; box-shadow: 2px 2px 0 var(--ink); }
.btn-sm { min-height: 44px; padding: 8px 16px; font-size: .92rem; }
.size { font-weight: 600; opacity: .85; font-size: .85em; }

.card { background: var(--paper); border: 2px solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow); padding: clamp(18px, 3vw, 28px); }
.card-title { font-size: 1.4rem; margin-bottom: 6px; }
.muted { color: var(--muted); }
.eyebrow { display: inline-block; font-weight: 800; font-size: .85rem; letter-spacing: .06em; text-transform: uppercase; color: var(--teal); margin-bottom: 12px; }
.lede { font-size: clamp(1.02rem, 1.4vw, 1.15rem); color: var(--muted); max-width: 46ch; }
.hl { color: var(--accent-ink); background: linear-gradient(transparent 62%, var(--accent-soft) 62%, var(--accent-soft) 92%, transparent 92%); }

/* Status messages */
.status { margin-top: 16px; padding: 12px 16px; border-radius: 12px; border: 2px solid currentColor; font-weight: 700; max-width: 460px; }
.status-ok { background: var(--ok-bg); color: var(--ok-ink); }
.status-warn { background: var(--warn-bg); color: var(--warn-ink); }
.status-err { background: var(--err-bg); color: var(--err-ink); }

/* Home hero */
.hero {
  flex: 1; width: 100%; max-width: 1440px; margin: 0 auto;
  padding: clamp(8px, 2vw, 24px) var(--gutter) clamp(32px, 5vw, 64px);
  display: grid; gap: 24px; align-content: start;
}
.hero-copy { display: contents; }
.hero-copy > .eyebrow, .hero-copy > h1, .hero-copy > .lede { order: 1; }
.hero-media { order: 2; }
.hero-copy > .login-card, .hero-copy > .status { order: 3; }
.hero h1 { font-size: clamp(2rem, 7.2vw, 3.6rem); margin: -6px 0 -8px; }
.hero .eyebrow { margin-bottom: -12px; }
.login-card { display: grid; gap: 10px; max-width: 460px; width: 100%; }
.login-card .card-title { margin-bottom: 0; }
.login-card label { font-weight: 800; margin-top: 4px; }
.login-card input {
  width: 100%; min-height: 50px; padding: 10px 14px; border-radius: 12px;
  border: 2px solid var(--ink); background: #fff; color: var(--ink); font: 600 1rem var(--font-body);
}
.login-card input::placeholder { color: #8a7867; }
.login-card input[aria-invalid="true"] { border-color: var(--err-ink); }
.login-card .btn { margin-top: 6px; width: 100%; }

.hero-media { margin: 0; width: 100%; }
.player { position: relative; border: 3px solid var(--ink); border-radius: 22px; overflow: hidden; box-shadow: 6px 6px 0 var(--ink); background: #f3e6cf; aspect-ratio: 16 / 9; }
.hero-video { width: 100%; height: 100%; object-fit: cover; }
.player-controls { position: absolute; left: 12px; bottom: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.player-controls[hidden] { display: none; }
.pill {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 16px 8px 12px;
  border-radius: 999px; border: 2px solid #fff; background: rgba(43, 33, 24, .82); color: #fff;
  font: 800 .92rem/1 var(--font-body); cursor: pointer; backdrop-filter: blur(4px);
}
.pill:hover { background: rgba(43, 33, 24, .95); }
.pill-strong { background: var(--accent); border-color: var(--ink); }
.pill-strong:hover { background: var(--accent-ink); }
.pill:focus-visible { outline-color: #fff; box-shadow: 0 0 0 5px var(--ink); }
.ico { width: 18px; height: 18px; background: currentColor; flex: none; -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat; }
[data-action="play"][aria-pressed="true"] .ico { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='5' y='4' width='5' height='16' rx='1.5'/%3E%3Crect x='14' y='4' width='5' height='16' rx='1.5'/%3E%3C/svg%3E"); }
[data-action="play"][aria-pressed="false"] .ico { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 4.5v15a1 1 0 0 0 1.5.86l12-7.5a1 1 0 0 0 0-1.72l-12-7.5A1 1 0 0 0 7 4.5z'/%3E%3C/svg%3E"); }
[data-action="sound"][aria-pressed="false"] .ico { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M11 5 6 9H2v6h4l5 4V5z' fill='black'/%3E%3Cpath d='m23 9-6 6M17 9l6 6'/%3E%3C/svg%3E"); }
[data-action="sound"][aria-pressed="true"] .ico { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M11 5 6 9H2v6h4l5 4V5z' fill='black'/%3E%3Cpath d='M15.5 8.5a5 5 0 0 1 0 7M19 5a10 10 0 0 1 0 14'/%3E%3C/svg%3E"); }

@media (max-width: 699px) {
  .hero-media { width: min(100%, calc(70svh * 9 / 16), 420px); justify-self: center; }
  .player { aspect-ratio: 9 / 16; border-radius: 20px; }
  .login-card { max-width: none; }
}
@media (min-width: 960px) {
  .hero { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); align-items: center; align-content: center; column-gap: clamp(32px, 4vw, 72px); }
  .hero-copy { display: flex; flex-direction: column; gap: 18px; }
  .hero h1, .hero .eyebrow { margin: 0; }
  .hero .eyebrow { margin-bottom: -6px; }
  .login-card { margin-top: 8px; }
}

/* Library */
.library { flex: 1; width: 100%; max-width: 1440px; margin: 0 auto; padding: clamp(8px, 2vw, 24px) var(--gutter) 64px; }
.lib-head { display: grid; gap: 24px; align-items: end; margin-bottom: clamp(24px, 4vw, 40px); }
.lib-head h1 { font-size: clamp(1.9rem, 5vw, 3rem); margin-bottom: 10px; }
.kit-card { display: grid; gap: 10px; }
.kit-card .card-title { margin-bottom: 0; }
@media (min-width: 900px) { .lib-head { grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); } }

.video-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: clamp(18px, 2.5vw, 28px); grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.video-card > article { height: 100%; display: flex; flex-direction: column; background: var(--paper); border: 2px solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.thumb { position: relative; display: block; aspect-ratio: 16 / 9; background: #eadbc2; border-bottom: 2px solid var(--ink); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-play { position: absolute; left: 10px; bottom: 10px; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; background: rgba(43, 33, 24, .78); color: #fff; font-size: .95rem; padding-left: 3px; border: 2px solid #fff; transition: transform .15s ease; }
.thumb:hover .thumb-play { transform: scale(1.08); }
.thumb-time { position: absolute; right: 10px; bottom: 10px; background: rgba(43, 33, 24, .85); color: #fff; font-size: .8rem; font-weight: 800; padding: 3px 8px; border-radius: 8px; }
.video-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.style-tag { align-self: flex-start; font-size: .8rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--teal); background: #e1f0ec; border: 1.5px solid var(--teal); padding: 2px 10px; border-radius: 999px; }
.video-title { font-size: 1.35rem; }
.look { color: var(--muted); font-size: .95rem; }
.good { font-size: .95rem; }
.fmts { list-style: none; margin: auto 0 0; padding: 12px 0 0; display: grid; gap: 10px; border-top: 2px dashed rgba(43, 33, 24, .2); }
.fmt { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fmt-name { font: 800 1rem var(--font-head); min-width: 3.2em; }
.fmt .btn { flex: 1 1 auto; }

/* Viewer dialog */
.viewer { width: min(100% - 24px, 1100px); max-height: calc(100svh - 24px); padding: 0; border: 3px solid var(--ink); border-radius: 20px; background: var(--paper); color: var(--ink); box-shadow: 8px 8px 0 var(--ink); overflow: hidden; }
.viewer::backdrop { background: rgba(28, 20, 12, .72); }
.viewer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px 10px 18px; border-bottom: 2px solid var(--ink); }
.viewer-title { font-size: 1.1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-video { width: 100%; max-height: calc(100svh - 110px); background: #000; margin: 0 auto; }
.viewer.is-portrait { width: fit-content; max-width: calc(100% - 24px); }
.viewer.is-portrait .viewer-head { max-width: 100%; }
.viewer.is-portrait .viewer-video { width: auto; height: min(calc(100svh - 110px), 1000px); max-width: 100%; aspect-ratio: 9 / 16; object-fit: contain; }

/* Simple centred pages */
.center { flex: 1; display: grid; place-items: center; padding: 24px var(--gutter) 64px; }
.narrow { max-width: 440px; width: 100%; display: grid; gap: 14px; }
.narrow .btn { width: 100%; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
@media (forced-colors: active) {
  .btn, .pill, .card, .player { border: 2px solid CanvasText; }
  .ico { background: CanvasText; forced-color-adjust: none; }
}
.logout .btn { white-space: nowrap; }
@media (max-width: 599px) { .who { display: none; } }
