/* assets/style.css
   Modern, shadcn-inspired theme for Bache Archive.
   Works with the redesigned index.html (October 2025). */

/* ===== Root Tokens ====================================================== */
:root {
  --bg: #0b0b0c;
  --card: #121215;
  --muted: #a1a1aa;
  --text: #fafafa;
  --border: #26262b;
  --brand: #7c3aed;      /* violet-600 */
  --brand-600: #6d28d9;  /* violet-700 */
  --brand-700: #5b21b6;  /* violet-800 */
  --radius: 16px;
  --shadow: 0 10px 18px rgba(0,0,0,.25), 0 2px 6px rgba(0,0,0,.18);
  --focus: 0 0 0 3px rgba(99,102,241,0.35);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #fbfbfc;
    --card: #ffffff;
    --muted: #52525b;
    --text: #0b0b0c;
    --border: #e6e6eb;
    --brand: #6d28d9;
    --brand-600: #5b21b6;
    --brand-700: #4c1d95;
    --shadow: 0 8px 16px rgba(12,12,13,.08), 0 1px 3px rgba(12,12,13,.06);
    --focus: 0 0 0 3px rgba(109,40,217,0.28);
  }
}

/* ===== Base Reset ======================================================= */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 16px/1.6 ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Inter, "Helvetica Neue", Arial;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 20% -10%, rgba(124,58,237,.08), transparent 60%),
    radial-gradient(900px 600px at 120% 10%, rgba(99,102,241,.06), transparent 50%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}
:focus-visible {
  outline: none;
  box-shadow: var(--focus);
  border-radius: 10px;
}

/* ===== Layout =========================================================== */
.container {
  max-width: 1000px;
  margin: 48px auto;
  padding: 0 20px 56px;
}

header.hero {
  text-align: center;
  margin-bottom: 2rem;
}

.title {
  font-size: clamp(28px, 4.5vw, 40px);
  letter-spacing: -0.02em;
  margin: 0.25rem 0 0.5rem;
}
.subtitle {
  color: var(--muted);
  max-width: 48rem;
  margin: 0 auto 1rem;
}
.pill {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fff;
  background: var(--brand);
  padding: 6px 10px;
  border-radius: 999px;
}

/* ===== Sections ========================================================= */
.section { margin: 2rem 0; }
.two-col {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: 1fr;
}
@media (min-width: 900px) {
  .two-col { grid-template-columns: 3fr 2fr; align-items: start; }
}
.stack { display: grid; gap: 1rem; }
.stack.small { gap: .5rem; }

/* ===== Cards ============================================================ */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

/* ===== Buttons ========================================================== */
.btnrow {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
  justify-content: center;
}
.btn, .btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 12px;
  text-decoration: none;
  font-weight: 600;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease, border-color .12s ease, color .12s ease;
}
.btn {
  color: white;
  background: linear-gradient(180deg, var(--brand), var(--brand-600));
  border: 1px solid rgba(255,255,255,.08);
}
.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 0 3px rgba(124,58,237,.25);
  background: linear-gradient(180deg, var(--brand-600), var(--brand-700));
}
.btn-outline {
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border);
}
.btn-outline:hover {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(124,58,237,.25);
}

/* ===== Text & Lists ===================================================== */
h2, h3 { margin: 0 0 12px 0; letter-spacing: -0.01em; }
h2 { font-size: 22px; }
h3 { font-size: 18px; color: var(--muted); }
p  { margin: 0 0 12px 0; }
ul { margin: 0 0 8px 20px; }
li { margin: 6px 0; }

a { color: var(--brand); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }

.hr {
  height: 1px;
  background: var(--border);
  margin: 2rem 0;
  border-radius: 999px;
}

.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.list-compact { padding-left: 18px; margin: 0; }
.list-compact li { margin: 4px 0; }

/* ===== Markdown Content (.md) ========================================== */
.md { line-height: 1.7; }
.md h2, .md h3, .md h4 { scroll-margin-top: 100px; }
.md h2 { font-size: 22px; margin-top: .25rem; }
.md h3 { font-size: 18px; color: var(--muted); }
.md p { margin: 0 0 1rem 0; }
.md ul, .md ol { margin: 0 0 1rem 1.25rem; }
.md li { margin: .4rem 0; }

/* Blockquotes */
.md blockquote {
  margin: 0 0 1rem 0;
  padding: .75rem 1rem;
  border-left: 4px solid var(--brand);
  background: rgba(124,58,237,.08);
  border-radius: 8px;
}
@media (prefers-color-scheme: light) {
  .md blockquote { background: rgba(109,40,217,.08); }
}

/* Code & Preformatted */
.md code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .95em;
  background: rgba(127,127,127,.15);
  padding: .15em .35em;
  border-radius: 6px;
}
.md pre {
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #0e0e12;
}
@media (prefers-color-scheme: light) {
  .md pre { background: #f6f6fb; }
}

/* Tables */
.md table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1rem 0;
  font-size: 0.95rem;
}
.md th, .md td {
  border: 1px solid var(--border);
  padding: .6rem .7rem;
  text-align: left;
}
.md thead th {
  background: rgba(127,127,127,.08);
  font-weight: 700;
}
.md tbody tr:nth-child(odd) {
  background: rgba(127,127,127,.04);
}

/* Footnotes */
.md .footnote-ref { font-variant-position: super; font-size: .8em; }

/* ===== Meta Card (About this document) ================================= */
.doc-meta .card p { margin: 0; }
.doc-meta strong { font-weight: 700; }

/* ===== Media Embeds ===================================================== */
.playlist-embed {
  aspect-ratio: 16/9;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
  background: black;
}

/* ===== Legacy Scholar Section (kept harmless) ========================== */
/* We no longer use <details class="scholar"> for Fair Use; keep styles in case older pages remain. */
details.scholar {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(127,127,127,.06);
}
details.scholar > summary {
  cursor: pointer;
  list-style: none;
  padding: 1rem 1.25rem;
  font-weight: 700;
}
details.scholar[open] > summary { border-bottom: 1px solid var(--border); }
details.scholar .scholar-body { padding: 1rem 1.25rem; }

/* ===== Footer =========================================================== */
.footer {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  margin-top: 2rem;
}

/* ===== Accessibility / Responsive tweaks =============================== */
@media (prefers-reduced-motion: reduce) {
  .btn, .btn-outline { transition: none; }
}
@media (max-width: 420px) {
  .btn, .btn-outline { width: 100%; justify-content: center; }
}
@media print {
  body { background: #fff; color: #000; }
  .card { box-shadow: none; }
  .playlist-embed { display: none; }
  .btn, .btn-outline {
    border: 1px solid #ccc;
    color: #000 !important;
    background: transparent !important;
    box-shadow: none !important;
  }
  /* Ensure meta and Fair Use are printed clearly */
  .doc-meta .card { background: #fff; border-color: #ccc; }
  blockquote { background: #fff !important; }
}
