/* ============================================================================
   🍃 theme-daisy-vanilla.css — Zero-dependency vanilla twin (#250)

   Shares the exact HTML DOM of the DaisyUI prototype (theme-daisy.html,
   `bones/templates/theme-daisy-vanilla.html` differs only in the stylesheet
   href) but is styled entirely by hand — no vendored daisyUI, no @import,
   no CDN, no build step. The "internet thing that doesn't need the internet":
   swap the template link and the page keeps its look with zero dependencies.

   The palette mirrors the dracula theme the prototype renders in (sRGB hex
   converted from daisyUI's oklch definitions — same values the prototype's
   audit mirror uses), and the component classes the DOM carries (.navbar,
   .btn, .badge, .card) are hand-rolled here with the same contract, so the
   rendered DOM between the two themes is diffable to a single stylesheet link.

   The `rotkeeper.sh a11y` gate reads the hex `:root` tokens below (--bg-color,
   --surface-color, --text-primary, --text-secondary, --accent-color, --code-bg,
   --code-text); keep them in sync with theme-daisy.css if the palette moves.
   ============================================================================ */

/* ============================================================================
   1. TOKENS — hand-authored, mirrors the dracula palette (no daisyUI needed)
   ============================================================================ */

:root {
  /* daisyUI token names kept for class-contract parity with theme-daisy.css */
  --color-base-100: #050609;
  --color-base-200: #040507;
  --color-base-300: #030406;
  --color-base-content: #efefe4;
  --color-primary: #ff3190;
  --color-primary-content: #020001;
  --color-warning: #e0f443;
  --color-warning-content: #020201;
  --color-error: #ff1717;
  --color-error-content: #020000;
  --radius-selector: 0.5rem;
  --radius-field: 0.25rem;
  --radius-box: 0.5rem;
  --border: 1px;
  --depth: 1;

  /* semantic audit tokens (a11y gate ground truth) */
  --bg-color:        #050609; /* base-100 */
  --surface-color:   #040507; /* base-200 */
  --text-primary:    #efefe4; /* base-content */
  --text-secondary:  #91928c; /* base-content @ ~60% on base-100 */
  --accent-color:    #ff3190; /* primary */
  --code-bg:         #030406; /* base-300 */
  --code-text:       #efefe4; /* base-content */

  --daisy-measure:   66ch;
  --daisy-radius:    var(--radius-box);
}

/* Palette-driven themes: the twin template emits `data-theme="$palette$"` when
   `palette:` frontmatter is present (DOM parity with theme-daisy.html). This
   stylesheet ships one hand-written palette (dracula), so any palette value
   still renders dracula — the guard below makes the absent/empty case explicit
   and parallel to theme-daisy.css. Registering more palettes here is a
   hand-written exercise, deliberately out of scope for the zero-dep twin. */
html:not([data-theme]),
html[data-theme=""] {
  color-scheme: dark;
  --color-base-100: #050609;
  --color-base-200: #040507;
  --color-base-300: #030406;
  --color-base-content: #efefe4;
  --color-primary: #ff3190;
  --color-primary-content: #020001;
  --color-warning: #e0f443;
  --color-warning-content: #020201;
  --color-error: #ff1717;
  --color-error-content: #020000;
  --radius-selector: 0.5rem;
  --radius-field: 0.25rem;
  --radius-box: 0.5rem;
  --border: 1px;
  --depth: 1;
}

/* ============================================================================
   2. BASE
   ============================================================================ */

*, *::before, *::after {
  box-sizing: border-box;
}

body.daisy-body {
  margin: 0;
  background: var(--color-base-100);
  color: var(--color-base-content);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
    sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  font-size: 16px;
  line-height: 1.75;
  min-height: 100vh;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* ============================================================================
   3. LAYOUT SHELL
   ============================================================================ */

.daisy-shell {
  max-width: var(--daisy-measure);
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
}

.daisy-header {
  margin-bottom: 2rem;
}

/* ============================================================================
   4. COMPONENT CLASSES — hand-rolled twins of the daisyUI classes the DOM
      carries (so the shared markup needs no framework stylesheet)
   ============================================================================ */

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
}

.navbar-start,
.navbar-end {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.navbar-center {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-width: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 0.9rem;
  border: 1px solid transparent;
  border-radius: var(--radius-field);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.btn-ghost {
  background: transparent;
  color: var(--color-base-content);
}

.btn-ghost:hover {
  background: var(--color-base-300);
  color: var(--color-base-content);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  height: 1.4rem;
  padding-inline: 0.6em;
  border: 1px solid transparent;
  border-radius: var(--radius-selector);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-primary {
  background: var(--color-primary);
  color: var(--color-primary-content);
}

.badge-outline {
  background: transparent;
  color: var(--color-base-content);
  border-color: var(--color-base-content);
}

.card {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-box);
}

.card-body {
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
}

/* ============================================================================
   5. NAVBAR CHROME + CONFIG-DRIVEN NAV SLOT
   ============================================================================ */

.daisy-navbar {
  border: 1px solid var(--color-base-300);
  border-radius: var(--daisy-radius);
  background: var(--color-base-200);
}

.daisy-brand {
  font-weight: 700;
  letter-spacing: 0.03em;
}

/* The adapter fills <site-nav> with <nav><ul><li><a>; styled here directly
   (the shared config-driven slot cannot carry component classes itself). */
.daisy-nav {
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
}

.daisy-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.25rem;
  margin: 0;
  list-style: none;
}

.daisy-nav li {
  margin: 0;
  list-style: none;
}

.daisy-nav a {
  display: inline-block;
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-field);
  color: var(--color-base-content);
  text-decoration: none;
  font-size: 0.88rem;
  white-space: nowrap;
}

.daisy-nav a:hover {
  background: var(--color-base-300);
  color: var(--color-base-content);
}

.daisy-nav a:focus-visible {
  outline: 2px solid var(--color-base-content);
  outline-offset: 2px;
}

/* ============================================================================
   6. TITLE BLOCK + METADATA BADGES
   ============================================================================ */

.daisy-title {
  margin: 1.5rem 0 0.25rem;
  font-size: 2.1rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--color-base-content);
}

.daisy-deck {
  margin: 0;
  color: var(--text-secondary);
  font-size: 1.05rem;
}

.daisy-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.9rem;
}

/* ============================================================================
   7. ARTICLE SURFACE
   ============================================================================ */

.daisy-article {
  background: var(--color-base-200);
  border: 1px solid var(--color-base-300);
  box-shadow: 0 1px 2px oklch(0% 0 0 / 0.3);
}

.daisy-article .card-body {
  font-size: 1rem;
  gap: 0;
}

/* ============================================================================
   8. BODY-CONTENT TYPOGRAPHY (rendered $body$)
   ============================================================================ */

.daisy-article h1,
.daisy-article h2,
.daisy-article h3,
.daisy-article h4,
.daisy-article h5,
.daisy-article h6 {
  margin: 1.6em 0 0.6em;
  font-weight: 700;
  line-height: 1.25;
  color: var(--color-base-content);
}

.daisy-article h1 { font-size: 1.9rem; }
.daisy-article h2 {
  font-size: 1.55rem;
  padding-bottom: 0.35em;
  border-bottom: 1px solid var(--color-base-300);
}
.daisy-article h3 { font-size: 1.28rem; color: var(--color-primary); }
.daisy-article h4 { font-size: 1.1rem; }
.daisy-article h5 { font-size: 0.95rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-secondary); }
.daisy-article h6 { font-size: 0.88rem; color: var(--text-secondary); }

.daisy-article p {
  margin: 0 0 1.15em;
}

.daisy-article a {
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

.daisy-article a:hover {
  color: color-mix(in oklab, var(--color-primary) 80%, var(--color-base-content));
}

.daisy-article ul,
.daisy-article ol {
  margin: 0 0 1.15em;
  padding-inline-start: 1.6em;
}

.daisy-article ul { list-style: disc; }
.daisy-article ol { list-style: decimal; }
.daisy-article ul ul { list-style: circle; }
.daisy-article ol ol { list-style: lower-alpha; }
.daisy-article ul ul ul { list-style: square; }

.daisy-article li {
  margin: 0.25em 0;
}

.daisy-article li > p {
  margin: 0.25em 0;
}

.daisy-article strong,
.daisy-article b {
  font-weight: 700;
  color: var(--color-base-content);
}

.daisy-article em,
.daisy-article i {
  font-style: italic;
}

.daisy-article mark {
  background: var(--color-warning);
  color: var(--color-warning-content);
  padding: 0 0.25em;
  border-radius: var(--radius-field);
}

.daisy-article kbd {
  background: var(--color-base-200);
  border: 1px solid var(--color-base-300);
  border-bottom-width: 2px;
  border-radius: var(--radius-field);
  padding: 0.1em 0.45em;
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85em;
}

/* Blockquotes double as the warning/note primitive in rendered content
   (docs use `> **Note:** …`). Same alert treatment as the prototype. */
.daisy-article blockquote {
  margin: 1.4em 0;
  padding: 0.9rem 1.1rem;
  border-inline-start: 4px solid var(--color-warning);
  background: color-mix(in oklab, var(--color-warning) 10%, var(--color-base-200));
  border-radius: var(--radius-field);
  color: var(--color-base-content);
}

.daisy-article blockquote p:last-child {
  margin-bottom: 0;
}

/* Code panels */
.daisy-article code {
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
}

.daisy-article :not(pre) > code {
  background: var(--color-base-300);
  color: var(--color-base-content);
  padding: 0.12em 0.35em;
  border-radius: var(--radius-field);
  overflow-wrap: anywhere;
}

.daisy-article pre {
  margin: 1.4em 0;
  padding: 1rem 1.2rem;
  background: var(--code-bg);
  color: var(--code-text);
  border: 1px solid var(--color-base-300);
  border-radius: var(--daisy-radius);
  overflow-x: auto;
  font-size: 0.88em;
  line-height: 1.65;
}

.daisy-article pre code {
  background: transparent;
  border: 0;
  padding: 0;
  color: inherit;
  font-size: 1em;
}

/* Tables */
.daisy-article table {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  margin: 1.4em 0;
  font-size: 0.92em;
}

.daisy-article th,
.daisy-article td {
  padding: 0.55rem 0.85rem;
  border-bottom: 1px solid var(--color-base-300);
  text-align: left;
  vertical-align: top;
}

.daisy-article thead th {
  background: var(--color-base-300);
  color: var(--color-base-content);
  font-weight: 600;
}

.daisy-article tbody tr:nth-child(even) {
  background: color-mix(in oklab, var(--color-base-content) 4%, transparent);
}

.daisy-article hr {
  border: 0;
  border-top: 1px solid var(--color-base-300);
  margin: 2.2em 0;
}

.daisy-article img,
.daisy-article video {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-field);
  border: 1px solid var(--color-base-300);
}

.daisy-article figure {
  margin: 1.4em 0;
}

.daisy-article figcaption {
  margin-top: 0.5em;
  font-size: 0.85em;
  color: var(--text-secondary);
  text-align: center;
}

.daisy-article dl {
  margin: 0 0 1.15em;
}

.daisy-article dt {
  font-weight: 700;
  margin-top: 1em;
}

.daisy-article dd {
  margin: 0.25em 0 0.25em 1.6em;
}

/* Pandoc / renderer hooks */
.daisy-article .footnotes {
  margin-top: 2em;
  padding-top: 1em;
  border-top: 1px solid var(--color-base-300);
  font-size: 0.9em;
  color: var(--text-secondary);
}

.daisy-article .task-list {
  list-style: none;
  padding-inline-start: 0;
}

.daisy-article .task-list input[type="checkbox"] {
  accent-color: var(--color-primary);
  margin-right: 0.5em;
}

/* ============================================================================
   9. FOOTER (shared skeleton slot)
   ============================================================================ */

.daisy-footer {
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--color-base-300);
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.daisy-footer .footer-credit {
  margin: 0;
}

.daisy-footer .footer-credit strong {
  color: var(--color-base-content);
}

.footer-asset-meta,
.footer-tags {
  margin: 0.3rem 0 0;
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
}

/* ============================================================================
   10. FOCUS & ACCESSIBILITY FLOOR
   ============================================================================ */

:focus {
  outline: 2px solid var(--color-base-content);
  outline-offset: 2px;
}

:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================================================
   11. NARROW VIEWPORTS
   ============================================================================ */

@media (max-width: 700px) {
  .daisy-shell {
    padding: 0.75rem 0.75rem 2rem;
  }

  .daisy-title {
    font-size: 1.7rem;
  }

  .daisy-navbar {
    flex-wrap: wrap;
  }

  .daisy-nav {
    flex: 1 1 100%;
    order: 3;
    overflow-x: visible;
  }

  .daisy-nav ul {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .daisy-article .card-body {
    padding: 1.1rem;
  }
}

/* ============================================================================
   12. PRINT
   ============================================================================ */

@media print {
  body.daisy-body {
    background: #fff;
    color: #000;
  }

  .navbar,
  .daisy-meta-row {
    display: none;
  }

  .daisy-article {
    background: #fff;
    border: none;
    box-shadow: none;
  }

  .daisy-article a {
    color: #000;
  }

  .daisy-article h3 {
    color: #000;
  }

  .daisy-article pre {
    background: #f5f5f5;
    color: #000;
    border-color: #ccc;
  }
}
