/* cache.pw — VHS-cassette minimal theme */

:root {
  --bg: #f7f4ee;
  --bg-elev: #ffffff;
  --ink: #1a1817;
  --ink-soft: #5b5650;
  --ink-mute: #8a847c;
  --line: #e2dccf;
  --line-soft: #ede7d8;
  --accent: #c43d2a;
  --accent-soft: #f3dcd4;
  --tape: #2b2622;
  --maxw: 64rem;
  --radius: 6px;
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Inter, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15110f;
    --bg-elev: #1d1916;
    --ink: #ece6dc;
    --ink-soft: #b0a89c;
    --ink-mute: #756e64;
    --line: #2e2823;
    --line-soft: #221d1a;
    --accent: #e25841;
    --accent-soft: #3a2520;
    --tape: #ece6dc;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 16px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--font-mono); font-size: 0.92em; background: var(--line-soft); padding: 0.1em 0.35em; border-radius: 3px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.6em; font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.9rem, 4.6vw, 2.9rem); letter-spacing: -0.025em; }
h2 { font-size: clamp(1.45rem, 3vw, 1.9rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
.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; }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 1.25rem; }

/* ── Header ─────────────────────────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(140%) blur(8px);
  -webkit-backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 3.75rem; gap: 1rem; }
.brand {
  display: inline-flex; align-items: center; gap: 0.6rem;
  color: var(--ink); font-weight: 700; font-size: 1.05rem;
  font-family: var(--font-mono); letter-spacing: -0.02em;
}
.brand:hover { text-decoration: none; color: var(--accent); }
.brand-mark { width: 2.4rem; height: 1.5rem; color: var(--ink); flex-shrink: 0; }
.brand:hover .brand-mark { color: var(--accent); transition: color .2s; }
.brand-dot { color: var(--ink-mute); font-weight: 500; }

.primary-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 1.4rem; align-items: center; }
.primary-nav a, .primary-nav summary {
  color: var(--ink-soft); font-size: 0.92rem; font-weight: 500;
  font-family: var(--font-mono); cursor: pointer;
}
.primary-nav a:hover, .primary-nav summary:hover { color: var(--accent); text-decoration: none; }
.lang details { position: relative; }
.lang summary { list-style: none; user-select: none; padding: 0.3rem 0; }
.lang summary::-webkit-details-marker { display: none; }
.lang summary::after { content: " ▾"; color: var(--ink-mute); }
.lang-list {
  position: absolute; right: 0; top: 100%; margin-top: 0.4rem;
  background: var(--bg-elev); border: 1px solid var(--line);
  padding: 0.4rem 0; border-radius: var(--radius);
  min-width: 11rem; display: block; gap: 0;
  flex-direction: column;
  box-shadow: 0 6px 24px -8px rgba(0,0,0,0.18);
}
.lang-list li { width: 100%; }
.lang-list a { display: block; padding: 0.35rem 1rem; color: var(--ink); font-size: 0.9rem; font-family: var(--font-sans); }
.lang-list a:hover { background: var(--line-soft); color: var(--accent); }

.nav-toggle {
  display: none; background: none; border: 1px solid var(--line); padding: 0.5rem;
  border-radius: var(--radius); cursor: pointer;
  flex-direction: column; gap: 4px; width: 2.5rem; height: 2.5rem;
  align-items: center; justify-content: center;
}
.nav-toggle span { display: block; width: 1.1rem; height: 2px; background: var(--ink); border-radius: 2px; }

@media (max-width: 760px) {
  .js .nav-toggle { display: flex; }
  .js .primary-nav {
    position: absolute; top: 100%; left: 0; right: 0;
    background: var(--bg-elev); border-bottom: 1px solid var(--line);
    max-height: 0; overflow: hidden;
    visibility: hidden;
    transition: max-height .25s ease, visibility 0s linear .25s;
  }
  .js .primary-nav.open {
    max-height: 32rem;
    visibility: visible;
    transition: max-height .25s ease, visibility 0s;
  }
  .primary-nav ul { flex-direction: column; align-items: stretch; gap: 0; padding: 0.6rem 1.25rem 1rem; }
  .primary-nav > ul > li { padding: 0.5rem 0; border-bottom: 1px dashed var(--line); }
  .primary-nav > ul > li:last-child { border-bottom: none; }
  .lang-list { position: static; box-shadow: none; border: none; padding: 0.3rem 0 0 1rem; background: transparent; }
}

/* No-JS fallback: hide burger, render nav inline so the lang switcher is reachable. */
.no-js .nav-toggle { display: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .rec { animation: none; }
  * { transition: none !important; }
}

/* ── Hero ───────────────────────────────────────── */
.hero { padding: clamp(3rem, 8vw, 6rem) 0 clamp(2.5rem, 6vw, 4.5rem); }
.kicker {
  font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.18em;
  color: var(--ink-mute); text-transform: uppercase; margin: 0 0 1.4rem;
  display: inline-flex; align-items: center; gap: 0.55rem;
}
.rec {
  width: 0.7rem; height: 0.7rem; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent);
  animation: pulse 2.4s infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); }
  50% { box-shadow: 0 0 0 8px transparent; }
}
.lede { font-size: 1.18rem; color: var(--ink-soft); max-width: 38rem; }
.status-line {
  margin-top: 1.5rem; padding: 0.85rem 1rem;
  background: var(--accent-soft); border-left: 3px solid var(--accent);
  font-size: 0.95rem; border-radius: 0 var(--radius) var(--radius) 0;
}
.status-line strong { color: var(--ink); }
.hero-cta { margin-top: 2rem; display: flex; flex-wrap: wrap; gap: 0.75rem; }

/* ── Buttons ────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-family: var(--font-mono); font-weight: 600;
  font-size: 0.95rem; padding: 0.75rem 1.15rem;
  border-radius: var(--radius); border: 1px solid transparent;
  cursor: pointer; transition: transform .12s, background .15s, color .15s;
  line-height: 1; text-decoration: none;
}
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 85%, black); text-decoration: none; }
.btn-primary:active { transform: translateY(1px); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--ink); text-decoration: none; }
.link-arrow { font-family: var(--font-mono); font-weight: 600; }

/* ── Cassette forms ─────────────────────────────── */
.forms { padding: 2rem 0 3rem; }
.section-title { margin-top: 0; }
.section-lede { color: var(--ink-soft); max-width: 40rem; }

.cassette {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin: 1.25rem 0;
  position: relative;
  display: block;
}
.cassette--live::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--accent); border-radius: var(--radius) 0 0 var(--radius);
}
.cassette--dead { opacity: 0.85; background: var(--line-soft); }
.cassette--dead .tag-dead { color: var(--ink-mute); }
.cassette-head { margin-bottom: 1rem; }
.cassette-head h3 { margin: 0.55rem 0 0.25rem; }
.cassette-sub { color: var(--ink-soft); font-size: 0.95rem; margin: 0; }
.cassette input[type="url"] {
  width: 100%; padding: 0.8rem 1rem; font-size: 1.05rem;
  font-family: var(--font-mono);
  background: var(--bg); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius);
  margin-bottom: 0.85rem;
}
.cassette input[type="url"]:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
.cassette .url-error {
  display: block; color: var(--accent); font-family: var(--font-mono);
  font-size: 0.85rem; margin: -0.5rem 0 0.85rem;
}

/* ── Tags (cassette stickers) ───────────────────── */
.tag {
  display: inline-block; font-family: var(--font-mono);
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.12em;
  padding: 0.22rem 0.55rem; border-radius: 3px; text-transform: uppercase;
}
.tag-live { background: var(--accent); color: #fff; }
.tag-dead { background: transparent; color: var(--ink-mute); border: 1px solid var(--ink-mute); }

/* ── Prose sections ─────────────────────────────── */
.prose { padding: clamp(2rem, 5vw, 3.5rem) 0; border-top: 1px solid var(--line-soft); }
.prose article { margin: 0 0 3rem; }
.prose article:last-child { margin-bottom: 0; }
.prose h3 { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin-top: 0.5rem; }
.prose img { border-radius: var(--radius); border: 1px solid var(--line); margin: 0.5rem 0 1rem; max-width: 100%; }
.prose ul { padding-left: 1.25rem; }
.prose li { margin-bottom: 0.5rem; }
.cta-row { margin-top: 1.5rem; }

.legacy .tag-dead { font-weight: 700; }
.legacy article { padding-left: 1rem; border-left: 2px solid var(--line); opacity: 0.92; }

/* ── Footer ─────────────────────────────────────── */
.site-footer { border-top: 1px solid var(--line); margin-top: 4rem; padding: 2rem 0 3rem; color: var(--ink-mute); font-size: 0.88rem; }
.footer-inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.75rem; }
.footer-marks { font-family: var(--font-mono); letter-spacing: 0.1em; margin: 0; }

@media (max-width: 600px) {
  .footer-inner { flex-direction: column; align-items: flex-start; }
  h1 { letter-spacing: -0.02em; }
  .cassette { padding: 1.25rem; }
}
