/* Main Kejap hub.
   Shape lock: cards 16px, chips 8px. One accent (sambal red), neutral greys only.
   Light = off-white, dark = charcoal. */
:root {
  --accent: #d7372b;
  --paper: #f7f7f5;
  --card: #ffffff;
  --ink: #1c1c1e;
  --ink-soft: #6b6b70;
  --line: #e4e4e2;
  --chip: #ededeb;
  --shadow: 0 1px 2px rgba(28, 28, 30, 0.05), 0 8px 24px rgba(28, 28, 30, 0.07);
  --shadow-hover: 0 2px 4px rgba(28, 28, 30, 0.07), 0 14px 32px rgba(28, 28, 30, 0.12);
  --display: "Bungee", "Arial Black", system-ui, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #1c1c1e;
    --card: #2a2a2d;
    --ink: #f2f2f0;
    --ink-soft: #a1a1a6;
    --line: #3a3a3d;
    --chip: #3a3a3d;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
    --shadow-hover: 0 2px 4px rgba(0, 0, 0, 0.35), 0 14px 32px rgba(0, 0, 0, 0.35);
  }
}
:root[data-theme="dark"] {
  --paper: #1c1c1e; --card: #2a2a2d; --ink: #f2f2f0; --ink-soft: #a1a1a6; --line: #3a3a3d; --chip: #3a3a3d;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
  --shadow-hover: 0 2px 4px rgba(0, 0, 0, 0.35), 0 14px 32px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 16px/1.5 var(--body);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
a { color: inherit; }

.masthead, .page, .foot { max-width: 960px; margin: 0 auto; padding-left: 16px; padding-right: 16px; }

.masthead { padding-top: 28px; padding-bottom: 28px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.logo-wrap { margin: 0; line-height: 1; }
.logo {
  display: inline-flex; gap: 8px; align-items: baseline; text-decoration: none;
  font: 400 clamp(36px, 10vw, 56px) / 1 var(--display); letter-spacing: 0.01em;
}
.logo span { color: var(--accent); }

/* theme toggle: moon in light (tap → dark), sun in dark (tap → light) */
.theme-btn {
  flex: none; width: 44px; height: 44px; border: 0; border-radius: 999px; cursor: pointer;
  display: grid; place-items: center; background: var(--chip); color: var(--ink);
  transition: transform 120ms var(--ease-out);
}
.theme-btn:active { transform: scale(0.94); }
.theme-btn svg { width: 22px; height: 22px; grid-area: 1 / 1; }
.theme-btn .ic-sun { display: none; }
:root[data-theme="dark"] .theme-btn .ic-sun { display: block; }
:root[data-theme="dark"] .theme-btn .ic-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-btn .ic-sun { display: block; }
  :root:not([data-theme="light"]) .theme-btn .ic-moon { display: none; }
}
.theme-btn:focus-visible { outline: 3px solid #f2b33d; outline-offset: 3px; }

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

/* grid */
.grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 720px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; } }
.card {
  display: block; height: 100%; text-decoration: none; background: var(--card); border-radius: 16px; overflow: hidden;
  box-shadow: var(--shadow); transition: transform 120ms var(--ease-out);
}
a.card:active { transform: scale(0.97); }
.card .thumb { aspect-ratio: 1 / 1; }
.card-body { padding: 12px 14px 14px; }
.card-title { margin: 0; font: 400 18px/1.15 var(--display); }
.card .meta { margin-top: 6px; }
.plays:not(:empty)::before { content: "·"; margin-right: 8px; }
.card .catch { font-size: 14px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.thumb { display: block; width: 100%; height: auto; object-fit: cover; background: var(--chip); }
.thumb-fallback { display: grid; place-items: center; padding: 16px; text-align: center; font: 400 20px/1.1 var(--display); color: var(--ink-soft); aspect-ratio: 1 / 1; }

.soon { box-shadow: none; background: transparent; border: 2px dashed var(--line); }
.soon-art { display: grid; place-items: center; background: transparent; color: var(--ink-soft); }
.soon-art svg { width: 38%; height: auto; }
.soon .card-title { color: var(--ink-soft); }

.meta { margin: 0; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; font-size: 13px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.chip { padding: 3px 8px; border-radius: 8px; background: var(--chip); color: var(--ink); font-weight: 700; font-size: 11px; letter-spacing: 0.08em; }
.catch { margin: 8px 0 0; color: var(--ink-soft); }

.foot { padding-top: 56px; padding-bottom: 40px; color: var(--ink-soft); font-size: 14px; }
.foot p { margin: 0; }
.foot a { color: var(--ink); font-weight: 600; text-decoration: none; }
.foot a:hover { text-decoration: underline; }
.noscript { max-width: 960px; margin: 0 auto; padding: 16px; }

a:focus-visible { outline: 3px solid #f2b33d; outline-offset: 3px; border-radius: 16px; }
.foot a:focus-visible { border-radius: 4px; }

@media (hover: hover) {
  .card { transition: transform 120ms var(--ease-out), box-shadow 200ms var(--ease-out); }
  a.card:hover { box-shadow: var(--shadow-hover); }
}
@media (prefers-reduced-motion: reduce) {
  .card { transition: none; }
}
