/*
 * ═══════════════════════════════════════════════════════════════════════════
 *  VELLUM.CSS  —  Chronology Studio shared design system
 *  Source of truth: chronology.studio / root_index.html
 *  Used by: all tools under chronology.studio/tools/
 *
 *  Required in every <head> (before this stylesheet):
 *    <link rel="preconnect" href="https://fonts.googleapis.com">
 *    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
 *    <link href="https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,600;1,300;1,400;1,600&family=EB+Garamond:ital,wght@0,400;0,500;1,400&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
 *
 *  Table of contents
 *  ─────────────────────────────────────────────────────────────────────────
 *  1.  Reset
 *  2.  Design tokens
 *  3.  Base
 *  4.  Layout helpers
 *  5.  Navigation
 *  6.  Page header  (tool pages)
 *  7.  Buttons
 *  8.  Cards  (tool cards, viewer cards)
 *  9.  Code blocks
 *  10. Drop zone
 *  11. Footer
 *  12. Animations
 *  13. Responsive
 * ═══════════════════════════════════════════════════════════════════════════
 */


/* ─────────────────────────────────────────────────────────────────────────
   1. RESET
   ───────────────────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
img, svg { display: block; max-width: 100%; }


/* ─────────────────────────────────────────────────────────────────────────
   2. DESIGN TOKENS
   ─────────────────────────────────────────────────────────────────────────
   Canonical names come from root_index.html.
   Aliases at the bottom keep viewer-specific code working without changes.
   ───────────────────────────────────────────────────────────────────────── */

:root {

  /* Parchment surface scale */
  --cream:          #f5efe2;   /* page background */
  --cream-light:    #f9f4eb;   /* raised surface (cards, inputs) */
  --cream-dark:     #ede4d0;   /* recessed surface (chrome bars) */
  --cream-deeper:   #e4d8c0;   /* pressed surface */
  --cream-darker:   #e0d4bc;   /* extra step used by tool chrome */
  --cream-deepest:  #d4c8ae;   /* deepest tint, table stripes etc. */

  /* Ink / text scale */
  --sepia:          #2a1a0e;   /* primary text, nav background */
  --sepia-mid:      #4a3020;   /* secondary dark text */
  --brown:          #6a4a32;   /* body text on cream, muted labels */
  --brown-light:    #9a7050;   /* placeholder, metadata, footnotes */

  /* Russet — primary accent (interactive, highlights) */
  --russet:         #8f3a18;
  --russet-hi:      #a84820;   /* hover state */
  --russet-dim:     #5a2210;   /* subtle accent, borders on hover */
  --russet-pale:    #f0ddd4;   /* tinted chip / badge background */
  --russet-ghost:   #faf2ee;   /* very faint tint for hover states */

  /* Gold — decorative accent (logo dot, significance markers) */
  --gold:           #b5821a;
  --gold-pale:      #f5edd0;
  --gold-ghost:     #fdf7ea;

  /* Sage — optional third accent (e.g. positive status) */
  --sage:           #4a6741;
  --sage-pale:      #e0ead6;

  /* Borders */
  --border:         #d4c0a0;                    /* default solid border */
  --border-light:   #e8dcc8;                    /* subtle divider */
  --border-strong:  rgba(143, 58, 24, 0.36);    /* emphasis border */

  /* Elevation */
  --shadow:         0 2px 12px rgba(44, 26, 14, 0.09);
  --shadow-lg:      0 8px 40px rgba(44, 26, 14, 0.14);

  /* Typography */
  --font-display:   'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --font-body:      'EB Garamond', Georgia, serif;
  --font-mono:      'JetBrains Mono', 'Courier New', monospace;

  /* Interaction */
  --ease:           0.28s ease;
  --radius:         3px;

  /* Chrome */
  --nav-h:          54px;

  /* ── Aliases for backward compat with viewer-local var names ─────────── */
  --ink:            var(--sepia);
  --ink-muted:      var(--brown);
  --ink-faint:      var(--brown-light);
}


/* ─────────────────────────────────────────────────────────────────────────
   3. BASE
   ───────────────────────────────────────────────────────────────────────── */

html { scroll-behavior: smooth; }

body {
  background:   var(--cream);
  color:        var(--sepia);
  font-family:  var(--font-body);
  font-size:    17px;
  font-weight:  400;
  line-height:  1.65;
  overflow-x:   hidden;
}

/* Parchment grain overlay — add once per page */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.022'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

a { color: inherit; text-decoration: none; }

code {
  font-family:      var(--font-mono);
  font-size:        0.78em;
  color:            var(--russet);
  background:       var(--russet-pale);
  padding:          1px 5px;
  border-radius:    3px;
}


/* ─────────────────────────────────────────────────────────────────────────
   4. LAYOUT HELPERS
   ───────────────────────────────────────────────────────────────────────── */

/* Standard content wrapper */
.wrap {
  max-width:  1080px;
  margin:     0 auto;
  padding:    0 48px;
  position:   relative;
  z-index:    1;
}

/* Wider wrapper for viewer tools */
.wrap-wide {
  max-width:  1200px;
  margin:     0 auto;
  padding:    0 48px;
  position:   relative;
  z-index:    1;
}

.section  { padding: 96px 0; }
.divider  { height: 1px; background: var(--border); }

/* Mono eyebrow label — used above section headings and page headers */
.eyebrow {
  font-family:      var(--font-mono);
  font-size:        10px;
  letter-spacing:   0.22em;
  text-transform:   uppercase;
  color:            var(--russet);
  margin-bottom:    20px;
  display:          block;
}

/* Section-level heading (homepage sections) */
.section-h {
  font-family:  var(--font-display);
  font-size:    clamp(38px, 4.5vw, 58px);
  font-weight:  400;
  font-style:   italic;
  line-height:  1.08;
  color:        var(--sepia);
  margin-bottom: 16px;
}
.section-h em { font-style: normal; color: var(--russet); }

.section-sub {
  font-family:    var(--font-body);
  font-size:      16px;
  color:          var(--brown);
  max-width:      480px;
  line-height:    1.75;
  margin-bottom:  52px;
}

/* Scroll reveal */
.reveal { opacity: 0; transform: translateY(20px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.in { opacity: 1; transform: none; }
.reveal-d1 { transition-delay: 0.08s; }
.reveal-d2 { transition-delay: 0.16s; }
.reveal-d3 { transition-delay: 0.24s; }
.reveal-d4 { transition-delay: 0.32s; }
.reveal-d5 { transition-delay: 0.40s; }
.reveal-d6 { transition-delay: 0.48s; }


/* ─────────────────────────────────────────────────────────────────────────
   5. NAVIGATION
   ─────────────────────────────────────────────────────────────────────────
   Dark sepia bar — consistent across all pages.

   HTML pattern:
     <nav id="nav">
       <a href="/" class="nav-logo">chronology<em>.</em>studio</a>
       <button id="nav-toggle" class="nav-toggle" aria-label="Open navigation"
               aria-expanded="false" aria-controls="nav-links">
         <span></span><span></span><span></span>
       </button>
       <ul class="nav-links" id="nav-links">
         <li class="nav-dropdown">
           <button class="nav-dropdown-trigger" aria-haspopup="true" aria-expanded="false">
             Author <svg>…</svg>
           </button>
           <ul class="nav-dropdown-menu" role="menu">…</ul>
         </li>
         <li><a href="…">Label</a></li>
         …
         <li><span class="nav-badge">v0.3</span></li>
       </ul>
     </nav>
   ───────────────────────────────────────────────────────────────────────── */

/* ── Shared nav chrome ─────────────────────────────────────────────────── */

nav {
  position:     sticky;
  top:          0;
  left:         0;
  right:        0;
  z-index:      200;
  height:       var(--nav-h);
  display:      flex;
  align-items:  center;
  padding:      0 48px;
  background:   var(--sepia);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.nav-logo {
  display:        flex;
  align-items:    center;
  flex:           1;
  text-decoration: none;
  font-family:    var(--font-display);
  font-size:      1.05rem;
  font-weight:    500;
  color:          var(--cream-light);
  letter-spacing: 0.04em;
}
.nav-logo em { font-style: normal; color: #c8960c; }

.nav-links {
  display:      flex;
  gap:          28px;
  align-items:  center;
  list-style:   none;
}
.nav-links a {
  font-family:    var(--font-body);
  font-size:      14px;
  font-style:     italic;
  color:          rgba(249, 244, 235, 0.60);
  text-decoration: none;
  transition:     color var(--ease);
}
.nav-links a:hover { color: var(--cream-light); }

/* Active page highlight (inline style from nav_active() PHP helper) */
.nav-links a[style*="cream-light"] { color: var(--cream-light); }

/* Version badge */
.nav-badge {
  font-family:    var(--font-mono);
  font-size:      0.64rem;
  letter-spacing: 0.06em;
  color:          rgba(249, 244, 235, 0.50);
  background:     rgba(255, 255, 255, 0.07);
  border:         1px solid rgba(255, 255, 255, 0.12);
  padding:        2px 8px;
  border-radius:  10px;
}

/* ── Dropdown trigger (shared styles) ──────────────────────────────────── */

.nav-dropdown-trigger {
  font-family:    var(--font-body);
  font-size:      14px;
  font-style:     italic;
  color:          rgba(249, 244, 235, 0.60);
  background:     none;
  border:         none;
  cursor:         pointer;
  padding:        0;
  display:        flex;
  align-items:    center;
  gap:            5px;
  line-height:    1;
  transition:     color var(--ease);
}
.nav-dropdown-trigger[style*="cream-light"] { color: var(--cream-light); }

.nav-dropdown-trigger svg {
  width:       9px;
  height:      9px;
  flex-shrink: 0;
  opacity:     0.55;
  transition:  transform var(--ease), opacity var(--ease);
}

/* ── Dropdown menu (shared item styles) ────────────────────────────────── */

.nav-dropdown-menu {
  list-style: none;
  background: var(--sepia);
}
.nav-dropdown-menu li { display: block; }
.nav-dropdown-menu a {
  display:         block;
  font-family:     var(--font-body);
  font-size:       13px;
  font-style:      italic;
  color:           rgba(249, 244, 235, 0.60);
  text-decoration: none;
  transition:      color var(--ease), background var(--ease);
}
.nav-dropdown-menu a[style*="cream-light"] { color: var(--cream-light); }

/* ── Hamburger — hidden on desktop ────────────────────────────────────── */

.nav-toggle {
  display:    none;   /* shown only in mobile media query below */
}

/* ── DESKTOP dropdown (hover/focus-within) — min-width: 961px ─────────── */

@media (min-width: 961px) {
  .nav-dropdown { position: relative; }

  .nav-dropdown:hover .nav-dropdown-trigger,
  .nav-dropdown:focus-within .nav-dropdown-trigger { color: var(--cream-light); }

  .nav-dropdown:hover .nav-dropdown-trigger svg,
  .nav-dropdown:focus-within .nav-dropdown-trigger svg { transform: rotate(180deg); opacity: 0.9; }

  .nav-dropdown-menu {
    position:       absolute;
    top:            calc(100% + 10px);
    right:          -12px;
    border:         1px solid rgba(255, 255, 255, 0.09);
    border-radius:  5px;
    padding:        5px 0;
    min-width:      152px;
    box-shadow:     0 8px 28px rgba(0, 0, 0, 0.30);
    z-index:        300;
    /* Hidden state */
    opacity:        0;
    visibility:     hidden;
    pointer-events: none;
    transform:      translateY(-5px);
    transition:     opacity var(--ease), transform var(--ease), visibility var(--ease);
  }
  /* Invisible bridge: lets cursor travel from trigger to menu without closing */
  .nav-dropdown-menu::before {
    content:  '';
    position: absolute;
    top:      -10px; left: 0; right: 0;
    height:   10px;
  }
  .nav-dropdown:hover .nav-dropdown-menu,
  .nav-dropdown:focus-within .nav-dropdown-menu {
    opacity:        1;
    visibility:     visible;
    pointer-events: auto;
    transform:      none;
  }

  .nav-dropdown-menu a {
    padding:    7px 16px;
    white-space: nowrap;
  }
  .nav-dropdown-menu a:hover { color: var(--cream-light); background: rgba(255, 255, 255, 0.05); }
}


/* ─────────────────────────────────────────────────────────────────────────
   6. PAGE HEADER  (tool pages)
   ─────────────────────────────────────────────────────────────────────────
   The above-the-fold block on every tool page.

   HTML pattern:
     <div class="page-header wrap-wide">
       <p class="eyebrow">Timeline Viewer</p>
       <h1><em>Horizon</em></h1>
       <div class="header-rule"></div>
       <p class="subtitle">One-line description with optional <code>.chron</code> reference.</p>
     </div>
   ───────────────────────────────────────────────────────────────────────── */

.page-header {
  margin:     3.5rem auto 2.5rem;
  padding:    0 48px;
  position:   relative;
  z-index:    1;
  animation:  fadeUp 0.5s ease both;
}

.page-header h1 {
  font-family:    var(--font-display);
  font-size:      clamp(42px, 5.5vw, 72px);
  font-weight:    300;
  font-style:     italic;
  color:          var(--sepia);
  letter-spacing: -0.015em;
  line-height:    1.05;
  margin-bottom:  0.3rem;
}
.page-header h1 em {
  font-style: italic;   /* em inside italic h1 = upright — override below if needed */
  color:      var(--russet);
}

/* Short russet rule under the h1 */
.header-rule {
  width:      52px;
  height:     1.5px;
  background: var(--russet);
  opacity:    0.45;
  margin:     1rem 0;
}

.page-header .subtitle {
  font-family: var(--font-body);
  font-size:   1rem;
  font-style:  italic;
  color:       var(--brown);
  line-height: 1.6;
  max-width:   560px;
}
.page-header .subtitle code {
  font-style: normal;
}


/* ─────────────────────────────────────────────────────────────────────────
   7. BUTTONS
   ───────────────────────────────────────────────────────────────────────── */

.btn-fill {
  display:        inline-block;
  padding:        11px 26px;
  background:     var(--russet);
  color:          var(--cream-light);
  border-radius:  var(--radius);
  font-family:    var(--font-display);
  font-size:      15px;
  font-style:     italic;
  text-decoration: none;
  border:         none;
  cursor:         pointer;
  transition:     background var(--ease), transform var(--ease);
}
.btn-fill:hover { background: var(--russet-hi); transform: translateY(-1px); }

.btn-ghost {
  display:        inline-block;
  padding:        11px 26px;
  background:     transparent;
  color:          var(--brown);
  border:         1px solid var(--border);
  border-radius:  var(--radius);
  font-family:    var(--font-body);
  font-size:      15px;
  text-decoration: none;
  cursor:         pointer;
  transition:     border-color var(--ease), color var(--ease);
}
.btn-ghost:hover { border-color: var(--russet-dim); color: var(--sepia); }

/* Small segmented control used in viewer toolbars */
.seg-btns { display: flex; }
.btn-seg {
  font-family:    var(--font-body);
  font-size:      0.85rem;
  font-style:     italic;
  background:     var(--cream-dark);
  border:         1px solid var(--border);
  color:          var(--brown);
  padding:        3px 11px;
  cursor:         pointer;
  border-radius:  0;
  transition:     all 0.18s;
}
.btn-seg:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.btn-seg:last-child  { border-radius: 0 var(--radius) var(--radius) 0; }
.btn-seg.active { background: var(--russet); color: var(--cream); border-color: var(--russet); font-style: normal; }
.btn-seg:not(.active):hover { background: var(--russet-pale); border-color: var(--russet); color: var(--russet); }

/* Icon / square button */
.btn-icon {
  height:         28px;
  min-width:      28px;
  padding:        0 7px;
  background:     var(--cream-dark);
  border:         1px solid var(--border);
  border-radius:  var(--radius);
  cursor:         pointer;
  color:          var(--brown);
  font-size:      1rem;
  font-family:    var(--font-mono);
  display:        flex;
  align-items:    center;
  justify-content: center;
  transition:     all 0.18s;
}
.btn-icon:hover { background: var(--russet-pale); border-color: var(--russet); color: var(--russet); }


/* ─────────────────────────────────────────────────────────────────────────
   8. CARDS
   ───────────────────────────────────────────────────────────────────────── */

/* Tool card — homepage grid */
.tool-card,
a.tool-card {
  background:     var(--cream-light);
  border:         1px solid var(--border);
  border-radius:  6px;
  padding:        32px 28px;
  position:       relative;
  overflow:       hidden;
  display:        block;
  color:          inherit;
  text-decoration: none;
  transition:     border-color var(--ease), transform var(--ease);
}
.tool-card::before, a.tool-card::before {
  content:    '';
  position:   absolute;
  top:        0; left: 0; right: 0;
  height:     2px;
  background: linear-gradient(90deg, transparent, var(--russet-dim), transparent);
  opacity:    0;
  transition: opacity var(--ease);
}
.tool-card:hover, a.tool-card:hover { border-color: var(--russet-dim); transform: translateY(-2px); }
.tool-card:hover::before, a.tool-card:hover::before { opacity: 1; }

.tool-num {
  font-family:    var(--font-mono);
  font-size:      9px;
  letter-spacing: 0.14em;
  color:          var(--russet);
  margin-bottom:  18px;
  display:        block;
}
.tool-icon {
  width:          36px;
  height:         36px;
  border:         1px solid var(--border);
  border-radius:  4px;
  display:        flex;
  align-items:    center;
  justify-content: center;
  color:          var(--russet);
  margin-bottom:  18px;
}
.tool-name {
  font-family:  var(--font-display);
  font-size:    24px;
  font-weight:  400;
  font-style:   italic;
  color:        var(--sepia);
  margin-bottom: 10px;
}
.tool-desc {
  font-family: var(--font-body);
  font-size:   14px;
  color:       var(--brown);
  line-height: 1.65;
}
.tool-pill {
  display:        inline-block;
  margin-top:     20px;
  padding:        3px 9px;
  background:     var(--cream-dark);
  border:         1px solid var(--border);
  border-radius:  2px;
  font-family:    var(--font-mono);
  font-size:      9px;
  letter-spacing: 0.1em;
  color:          var(--brown-light);
  text-transform: uppercase;
}
.tool-pill-live {
  display:        inline-block;
  margin-top:     20px;
  padding:        3px 9px;
  background:     transparent;
  border:         1px solid var(--russet-dim);
  border-radius:  2px;
  font-family:    var(--font-mono);
  font-size:      9px;
  letter-spacing: 0.1em;
  color:          var(--russet);
  text-transform: uppercase;
}

/* Viewer card — gallery */
.viewer-card,
a.viewer-card {
  border:         1px solid var(--border);
  border-radius:  6px;
  overflow:       hidden;
  background:     var(--cream);
  display:        block;
  color:          inherit;
  text-decoration: none;
  transition:     border-color var(--ease);
}
.viewer-card:hover, a.viewer-card:hover { border-color: var(--russet-dim); }
.viewer-preview {
  background:     var(--cream-dark);
  border-bottom:  1px solid var(--border);
  padding:        16px;
  height:         130px;
  display:        flex;
  align-items:    center;
  justify-content: center;
}
.viewer-info    { padding: 16px 18px; }
.viewer-name {
  font-family:  var(--font-display);
  font-size:    18px;
  font-style:   italic;
  color:        var(--sepia);
  margin-bottom: 5px;
}
.viewer-desc {
  font-size:   13px;
  color:       var(--brown);
  line-height: 1.55;
}

/* Format-family card */
.fmt-card {
  background:   var(--cream-light);
  border:       1px solid var(--border);
  border-radius: 4px;
  padding:      18px 14px;
  transition:   border-color var(--ease);
}
.fmt-card:hover { border-color: var(--russet-dim); }
.fmt-ext {
  font-family:    var(--font-mono);
  font-size:      10px;
  color:          var(--russet);
  margin-bottom:  7px;
}
.fmt-name {
  font-family:  var(--font-display);
  font-size:    14px;
  font-style:   italic;
  color:        var(--sepia);
  margin-bottom: 5px;
}
.fmt-desc {
  font-size:   12px;
  color:       var(--brown);
  line-height: 1.5;
}


/* ─────────────────────────────────────────────────────────────────────────
   9. CODE BLOCKS
   ───────────────────────────────────────────────────────────────────────── */

.code-block {
  background:   var(--cream-light);
  border:       1px solid var(--border);
  border-radius: 6px;
  overflow:     hidden;
}
.code-topbar {
  padding:      9px 16px;
  border-bottom: 1px solid var(--border);
  display:      flex;
  align-items:  center;
  gap:          7px;
  background:   var(--cream-dark);
}
.code-dot      { color: var(--russet); font-size: 10px; }
.code-filename {
  font-family:  var(--font-mono);
  font-size:    11px;
  color:        var(--brown-light);
}
.code-body {
  padding:      22px 22px 26px;
  font-family:  var(--font-mono);
  font-size:    12px;
  line-height:  1.9;
  color:        var(--brown);
  white-space:  pre;
  overflow-x:   auto;
}
/* Syntax colour helpers */
.ck { color: #6a3a14; }   /* key   */
.cs { color: #2a5e2a; }   /* string */
.cc { color: var(--brown-light); }  /* comment */


/* ─────────────────────────────────────────────────────────────────────────
   10. DROP ZONE  (file loading UI used in all viewers)
   ───────────────────────────────────────────────────────────────────────── */

.drop-zone {
  position:     relative;
  border:       2px dashed var(--border-strong);
  border-radius: 10px;
  background:   rgba(245, 239, 226, 0.5);
  padding:      3rem 2rem;
  text-align:   center;
  cursor:       pointer;
  transition:   background 0.22s, border-color 0.22s;
  animation:    fadeUp 0.5s 0.08s ease both;
}
.drop-zone:hover,
.drop-zone.drag-over { border-color: var(--russet); background: var(--russet-ghost); }

.drop-zone input[type="file"] {
  position: absolute;
  inset:    0;
  opacity:  0;
  cursor:   pointer;
}
.drop-zone h2 {
  font-family:  var(--font-display);
  font-size:    1.55rem;
  font-weight:  400;
  color:        var(--sepia);
  margin-bottom: 0.3rem;
}
.drop-zone p {
  font-size:  0.95rem;
  color:      var(--brown);
  font-style: italic;
}
.drop-file-types {
  display:        inline-block;
  margin-top:     1rem;
  font-family:    var(--font-mono);
  font-size:      0.7rem;
  color:          var(--russet);
  letter-spacing: 0.1em;
  background:     var(--russet-pale);
  padding:        3px 12px;
  border-radius:  10px;
}

/* Loaded-files bar */
.loaded-bar {
  display:      none;
  align-items:  center;
  gap:          0.75rem;
  margin-top:   0.9rem;
  padding:      0.65rem 1rem;
  background:   var(--cream-dark);
  border:       1px solid var(--border);
  border-radius: 6px;
  flex-wrap:    wrap;
}
.loaded-bar.show { display: flex; }
.loaded-label {
  font-family:    var(--font-mono);
  font-size:      0.68rem;
  color:          var(--brown-light);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  flex-shrink:    0;
}
.file-chips   { display: flex; gap: 0.4rem; flex-wrap: wrap; flex: 1; }
.file-chip {
  display:      inline-flex;
  align-items:  center;
  gap:          5px;
  font-family:  var(--font-mono);
  font-size:    0.7rem;
  color:        var(--brown);
  background:   var(--cream);
  border:       1px solid var(--border);
  border-radius: 12px;
  padding:      2px 10px 2px 7px;
}
.chip-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.chip-remove {
  background:   none;
  border:       none;
  cursor:       pointer;
  color:        var(--brown-light);
  font-size:    0.8rem;
  line-height:  1;
  padding:      0 0 0 5px;
  margin-right: -3px;
  transition:   color 0.15s;
  flex-shrink:  0;
}
.chip-remove:hover { color: var(--russet); }
.btn-clear {
  font-family:  var(--font-mono);
  font-size:    0.68rem;
  background:   none;
  border:       1px solid var(--border-strong);
  color:        var(--brown);
  border-radius: var(--radius);
  padding:      3px 10px;
  cursor:       pointer;
  transition:   all 0.18s;
  flex-shrink:  0;
}
.btn-clear:hover { background: var(--russet-pale); color: var(--russet); border-color: var(--russet); }

/* Error log */
.error-log {
  display:      none;
  margin-top:   0.9rem;
  background:   #fff5f3;
  border:       1px solid rgba(200, 60, 30, 0.22);
  border-radius: 6px;
  padding:      0.8rem 1.1rem;
}
.error-log.show  { display: block; }
.error-log h4 {
  font-family:    var(--font-mono);
  font-size:      0.7rem;
  color:          #b03020;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom:  0.4rem;
}
.error-item { font-size: 0.88rem; color: #7a2010; font-style: italic; }

/* Controls row (viewer toolbars) */
.controls-row {
  display:      none;
  align-items:  center;
  gap:          1.2rem;
  margin-top:   1.4rem;
  flex-wrap:    wrap;
}
.controls-row.show { display: flex; }
.ctrl-group { display: flex; align-items: center; gap: 0.5rem; }
.ctrl-label {
  font-family:    var(--font-mono);
  font-size:      0.67rem;
  color:          var(--brown-light);
  letter-spacing: 0.07em;
  text-transform: uppercase;
  white-space:    nowrap;
}
.ctrl-divider { width: 1px; height: 20px; background: var(--border); flex-shrink: 0; }


/* ─────────────────────────────────────────────────────────────────────────
   11. FOOTER
   ─────────────────────────────────────────────────────────────────────────
   HTML pattern:
     <footer>
       <div class="footer-inner">
         <p class="footer-left">chronology.studio — …</p>
         <ul class="footer-links">
           <li><a href="…">Label</a></li>
         </ul>
       </div>
     </footer>
   ───────────────────────────────────────────────────────────────────────── */

footer {
  position: relative;
  z-index:  1;
}
.footer-inner {
  padding:          32px 48px;
  border-top:       1px solid var(--border);
  max-width:        1200px;
  margin:           0 auto;
  display:          flex;
  align-items:      center;
  justify-content:  space-between;
}
.footer-left {
  font-family:    var(--font-mono);
  font-size:      10px;
  color:          var(--brown-light);
  letter-spacing: 0.04em;
}
.footer-links {
  display:    flex;
  gap:        24px;
  list-style: none;
  flex-wrap:  wrap;
}
.footer-links a {
  font-family:    var(--font-body);
  font-style:     italic;
  font-size:      13px;
  color:          var(--brown-light);
  text-decoration: none;
  transition:     color var(--ease);
}
.footer-links a:hover { color: var(--sepia); }


/* ─────────────────────────────────────────────────────────────────────────
   12. ANIMATIONS
   ───────────────────────────────────────────────────────────────────────── */

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: none; }
}
@keyframes drawLine {
  from { stroke-dashoffset: var(--len); }
  to   { stroke-dashoffset: 0; }
}


/* ─────────────────────────────────────────────────────────────────────────
   13. RESPONSIVE
   ───────────────────────────────────────────────────────────────────────── */

@media (max-width: 960px) {
  /* Layout */
  nav           { padding: 0 24px; flex-wrap: wrap; height: auto; min-height: var(--nav-h); }
  .wrap         { padding: 0 24px; }
  .wrap-wide    { padding: 0 24px; }
  .page-header  { padding: 0 24px; }
  .footer-inner { flex-direction: column; gap: 20px; padding: 28px 24px; }

  /* ── Hamburger button ── */
  .nav-toggle {
    display:          flex;
    flex-direction:   column;
    justify-content:  center;
    align-items:      center;
    gap:              6px;
    width:            44px;
    height:           44px;
    background:       none;
    border:           none;
    cursor:           pointer;
    padding:          0;
    border-radius:    4px;
    flex-shrink:      0;
    font-size:        0;       /* suppress any ghost text height */
    line-height:      0;
  }
  .nav-toggle span {
    display:          block;
    width:            22px;
    height:           2px;
    background:       rgba(249, 244, 235, 0.85);
    border-radius:    2px;
    transform-origin: center;
    transition:       transform 0.25s ease, opacity 0.25s ease, width 0.25s ease;
  }
  nav.nav-open .nav-toggle span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
  nav.nav-open .nav-toggle span:nth-child(2) { opacity: 0; width: 0; }
  nav.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

  /* ── Nav link list — slides open via max-height ── */
  .nav-links {
    display:        flex;
    flex-direction: column;
    align-items:    stretch;
    width:          100%;
    gap:            0;
    list-style:     none;
    max-height:     0;
    overflow:       hidden;
    padding:        0;
    border-top:     1px solid transparent;
    /* Smooth reveal */
    transition:     max-height 0.32s ease, padding 0.32s ease, border-color 0.32s ease;
  }
  nav.nav-open .nav-links {
    max-height:   600px;
    padding:      6px 0 16px;
    border-color: rgba(255, 255, 255, 0.07);
  }

  .nav-links > li { width: 100%; }

  /* Flat nav links */
  .nav-links > li > a {
    display:   block;
    padding:   10px 0;
    font-size: 15px;
  }

  /* ── Mobile dropdown — tap to expand, no hover logic ── */
  .nav-dropdown { position: static; }

  .nav-dropdown-trigger {
    width:           100%;
    padding:         10px 0;
    font-size:       15px;
    justify-content: space-between;
  }

  /* Menu hidden by default; opened by .is-open (set by JS) */
  .nav-dropdown-menu {
    position:   static;
    visibility: visible;
    opacity:    1;
    transform:  none;
    box-shadow: none;
    border:     none;
    padding:    0;
    min-width:  0;
    max-height: 0;
    overflow:   hidden;
    transition: max-height 0.25s ease;
  }

  .nav-dropdown.is-open .nav-dropdown-menu {
    max-height: 200px;
  }
  .nav-dropdown.is-open .nav-dropdown-trigger           { color: var(--cream-light); }
  .nav-dropdown.is-open .nav-dropdown-trigger svg       { transform: rotate(180deg); opacity: 0.9; }

  /* Submenu items: indented */
  .nav-dropdown-menu a {
    padding:    9px 0 9px 16px;
    font-size:  14px;
    white-space: normal;
  }

  /* Badge */
  .nav-badge { display: inline-block; margin-top: 4px; }
}

@media (max-width: 600px) {
  .page-header h1 { font-size: clamp(32px, 8vw, 48px); }
}
