/*
 * ╔══════════════════════════════════════════════════════════════╗
 * ║              YEGGE DESIGN SYSTEM  v1.0                      ║
 * ║                                                              ║
 * ║  Drop-in CSS design language. Dark by default, light on     ║
 * ║  [data-theme="light"]. Toggle with:                         ║
 * ║    document.documentElement.setAttribute('data-theme','light')
 * ║                                                              ║
 * ║  Contents                                                    ║
 * ║    1.  Reset & box model                                     ║
 * ║    2.  Color tokens  (dark + light)                         ║
 * ║    3.  Base typography                                       ║
 * ║    4.  Layout helpers                                        ║
 * ║    5.  Navigation / header                                   ║
 * ║    6.  Buttons                                               ║
 * ║    7.  Forms & inputs                                        ║
 * ║    8.  Cards & surfaces                                      ║
 * ║    9.  Tags / badges                                         ║
 * ║   10.  Prose / rich text                                     ║
 * ║   11.  Code blocks                                           ║
 * ║   12.  Tables                                                ║
 * ║   13.  Media embeds  (YouTube, Vimeo, iframes)              ║
 * ║   14.  Image gallery + lightbox                             ║
 * ║   15.  Modal / overlay                                       ║
 * ║   16.  Toast notifications                                   ║
 * ║   17.  Theme toggle button                                   ║
 * ║   18.  Redaction bars  ({{text}} pattern)                   ║
 * ║   19.  Utility classes                                       ║
 * ║   20.  Responsive breakpoints                               ║
 * ╚══════════════════════════════════════════════════════════════╝
 */


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   1. RESET & BOX MODEL
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

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

html {
  font-size: 15px;          /* bump to 16px at ≥1200px — see §20 */
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.75;
  min-height: 100vh;
  transition: background 0.2s, color 0.2s;
}

img, video, svg { display: block; max-width: 100%; }
button { cursor: pointer; font-family: inherit; }
a { color: inherit; }


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   2. COLOR TOKENS
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   Usage:
     --bg          page background
     --surface     first level surface  (cards, headers)
     --surface2    second level surface (inputs, nested cards)
     --surface3    third level surface  (hover states)
     --text        body / default text
     --text-bright high-contrast text   (headings, values)
     --text-muted  de-emphasized text   (labels, hints, dates)
     --border      subtle divider
     --border2     stronger divider / input borders
     --accent      interactive / focus ring colour
     --danger      destructive action colour
     --success     positive / live state colour
     --input-bg    background for text inputs / textareas
*/

:root {
  --bg:        #1a1a1a;
  --surface:   #212121;
  --surface2:  #2a2a2a;
  --surface3:  #313131;
  --text:      #919191;
  --text-bright: #c0c0c0;
  --text-muted:  #555;
  --border:    #2d2d2d;
  --border2:   #383838;
  --accent:    #888;
  --danger:    #7a3a3a;
  --danger-hover: #a04040;
  --success:   #3a6a3a;
  --input-bg:  #161616;
  --tag-bg:    #252525;
  --code-bg:   #161616;
}

[data-theme="light"] {
  --bg:        #d8d8d8;
  --surface:   #d0d0d0;
  --surface2:  #c8c8c8;
  --surface3:  #bebebe;
  --text:      #3d3d3d;
  --text-bright: #1a1a1a;
  --text-muted:  #888;
  --border:    #bfbfbf;
  --border2:   #adadad;
  --accent:    #666;
  --danger:    #c0524a;
  --danger-hover: #d05050;
  --success:   #4a7a4a;
  --input-bg:  #e4e4e4;
  --tag-bg:    #c8c8c8;
  --code-bg:   #e4e4e4;
}


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   3. BASE TYPOGRAPHY
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

h1, h2, h3, h4, h5, h6 {
  color: var(--text-bright);
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; border-bottom: 1px solid var(--border); padding-bottom: 0.4rem; }
h3 { font-size: 1rem; }
h4 { font-size: 0.9rem; color: var(--text); }

p { margin: 1rem 0; }
p:first-child { margin-top: 0; }

strong { color: var(--text-bright); font-weight: 600; }
em { font-style: italic; }

a {
  color: var(--text-bright);
  text-decoration: underline;
  text-decoration-color: var(--border2);
  transition: text-decoration-color 0.15s;
}
a:hover { text-decoration-color: var(--accent); }

ul, ol {
  margin: 1rem 0;
  padding-left: 1.5rem;
}
li { margin: 0.3rem 0; }

blockquote {
  border-left: 2px solid var(--border2);
  margin: 1.5rem 0;
  padding: 0.25rem 1.25rem;
  color: var(--text-muted);
  font-style: italic;
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

/* Eyebrow / overline label — spaced uppercase tiny text */
.label {
  display: block;
  font-size: 0.65rem;
  letter-spacing: 0.18em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 0.35rem;
  font-weight: 500;
}

/* Muted helper / hint text */
.hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.5;
}


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   4. LAYOUT HELPERS
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

/* Centred reading column */
.container {
  max-width: 740px;
  margin: 0 auto;
  padding: 0 2rem;
  width: 100%;
}

.container--wide { max-width: 1100px; }
.container--full { max-width: none; padding: 0 clamp(1.5rem, 4vw, 4rem); }

/* Flex row helpers */
.row          { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.row--between { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.spacer       { flex: 1; }

/* Two-column grid */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* Section spacing */
.section { padding: 3rem 0; }


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   5. NAVIGATION / HEADER
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   HTML pattern:
     <header class="site-header">
       <nav class="site-nav">
         <a href="/" class="nav-brand">SITE</a>
         <span class="nav-sep">|</span>
         <a href="/about" class="nav-link">About</a>
       </nav>
       <div class="header-controls">...</div>
     </header>
*/

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2rem 2rem 1.5rem;
  position: relative;
  z-index: 20;
}

/* Sticky variant */
.site-header--sticky {
  position: sticky;
  top: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 1.25rem 1.75rem;
}

.site-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
}

/* Brand / logo link */
.nav-brand {
  font-size: 0.7rem;
  letter-spacing: 0.25em;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 600;
  text-transform: uppercase;
  transition: color 0.15s;
}
.nav-brand:hover { color: var(--text); text-decoration: none; }

/* Regular nav link — same weight as brand */
.nav-link {
  font-size: 0.7rem;
  letter-spacing: 0.25em;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 600;
  text-transform: uppercase;
  transition: color 0.15s;
}
.nav-link:hover { color: var(--text); }

/* Decorators */
.nav-sep  { font-size: 0.65rem; color: var(--text-muted); opacity: 0.35; margin: 0 0.55rem; user-select: none; }
.nav-dash { font-size: 0.65rem; color: var(--text-muted); opacity: 0.35; margin: 0 0.65rem; user-select: none; }

.header-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   6. BUTTONS
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   Variants:   .btn  .btn--primary  .btn--danger
   Sizes:      .btn--sm  .btn--lg
   Icon-only:  .btn--icon
*/

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45em 1em;
  border-radius: 2px;
  border: 1px solid var(--border2);
  background: var(--surface2);
  color: var(--text);
  font-size: 0.82rem;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  letter-spacing: 0.02em;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  user-select: none;
}

.btn:hover {
  background: var(--surface3);
  color: var(--text-bright);
  border-color: var(--accent);
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* Primary — slightly brighter surface */
.btn--primary {
  background: var(--surface3);
  border-color: var(--accent);
  color: var(--text-bright);
}
.btn--primary:hover { background: #3a3a3a; }

/* Danger */
.btn--danger { border-color: var(--danger); color: #a06060; }
.btn--danger:hover { background: var(--danger); color: var(--text-bright); border-color: var(--danger-hover); }

/* Ghost — no background */
.btn--ghost { background: transparent; border-color: transparent; }
.btn--ghost:hover { background: var(--surface2); border-color: var(--border); }

/* Sizes */
.btn--sm { padding: 0.25em 0.7em; font-size: 0.72rem; }
.btn--lg { padding: 0.6em 1.5em;  font-size: 0.9rem; }
.btn--icon { padding: 0.35em 0.55em; }

/* Full-width */
.btn--block { width: 100%; justify-content: center; }


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   7. FORMS & INPUTS
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.form-group  { margin-bottom: 1rem; }
.form-row    { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="url"],
input[type="number"],
input[type="tel"],
input[type="date"],
textarea,
select {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--border2);
  border-radius: 2px;
  color: var(--text-bright);
  font-family: inherit;
  font-size: 0.88rem;
  padding: 0.5em 0.75em;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.15s;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
}

input::placeholder, textarea::placeholder {
  color: var(--text-muted);
}

textarea { resize: vertical; min-height: 120px; }

/* Inline monospace input (e.g. slug, token) */
input.mono {
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: 0.82rem;
  letter-spacing: 0.03em;
}

/* Borderless title input */
input.input--title {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  padding: 0.3em 0;
  font-size: 1.1rem;
  color: var(--text-bright);
  width: 100%;
}
input.input--title:focus { border-bottom-color: var(--accent); }

/* Checkbox / toggle label row */
.check-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}
.check-label input[type="checkbox"] { cursor: pointer; }


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   8. CARDS & SURFACES
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.card {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 3px;
  padding: 1.5rem;
}

.card--flush { padding: 0; overflow: hidden; }

.card-header {
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  color: var(--text-muted);
  text-transform: uppercase;
  background: var(--surface);
}

.card-body   { padding: 1.25rem; flex: 1; overflow-y: auto; }
.card-footer {
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  align-items: center;
}

/* Divider */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   9. TAGS / BADGES
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.tag {
  display: inline-block;
  font-size: 0.65rem;
  color: var(--text-muted);
  background: var(--tag-bg);
  padding: 0.15em 0.55em;
  border-radius: 2px;
  letter-spacing: 0.06em;
  text-transform: lowercase;
  text-decoration: none;
  transition: color 0.15s, background 0.15s;
}

a.tag:hover, .tag--active {
  color: var(--text-bright);
  background: var(--surface2);
}

.tag--status {
  border: 1px solid var(--border2);
  background: transparent;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.tag--live    { border-color: var(--success); color: #6a9a6a; }
.tag--draft   { color: var(--text-muted); }

.tags {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  align-items: center;
}


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   10. PROSE / RICH TEXT
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   Wrap rendered markdown or HTML in .prose
*/

.prose { color: var(--text); }

.prose h1, .prose h2,
.prose h3, .prose h4 {
  color: var(--text-bright);
  font-weight: 500;
  margin: 2rem 0 0.75rem;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.prose h1 { font-size: 1.4rem; }
.prose h2 { font-size: 1.15rem; border-bottom: 1px solid var(--border); padding-bottom: 0.4rem; }
.prose h3 { font-size: 1rem; }
.prose h4 { font-size: 0.9rem; color: var(--text); }

.prose p                { margin: 1rem 0; }
.prose p:first-child    { margin-top: 0; }
.prose a                { color: var(--text-bright); text-decoration: underline; text-decoration-color: var(--border2); }
.prose a:hover          { text-decoration-color: var(--accent); }
.prose strong           { color: var(--text-bright); font-weight: 600; }
.prose ul, .prose ol    { margin: 1rem 0; padding-left: 1.5rem; }
.prose li               { margin: 0.3rem 0; }

.prose blockquote {
  border-left: 2px solid var(--border2);
  margin: 1.5rem 0;
  padding: 0.25rem 1.25rem;
  color: var(--text-muted);
  font-style: italic;
}

.prose hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

.prose img {
  max-width: 100%;
  height: auto;
  border-radius: 2px;
  margin: 1.5rem auto;
}


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   11. CODE BLOCKS
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   Works standalone or inside .prose
*/

code {
  font-family: 'SFMono-Regular', 'Fira Code', Consolas, 'Liberation Mono', monospace;
  font-size: 0.85em;
  background: var(--code-bg);
  color: var(--text-bright);
  padding: 0.15em 0.4em;
  border-radius: 3px;
  border: 1px solid var(--border);
}

pre {
  background: var(--code-bg) !important;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  margin: 1.5rem 0;
  position: relative;
}

pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.83rem;
  line-height: 1.65;
  color: inherit;
}

/* Copy button (position: absolute inside a .code-wrap wrapper) */
.code-wrap { position: relative; }

.code-copy {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  background: var(--surface2);
  border: 1px solid var(--border2);
  color: var(--text-muted);
  font-size: 0.65rem;
  padding: 0.2em 0.6em;
  border-radius: 2px;
  letter-spacing: 0.05em;
  font-family: inherit;
  transition: color 0.15s;
  z-index: 1;
}
.code-copy:hover { color: var(--text); }


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   12. TABLES
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.88rem;
}

th {
  background: var(--surface2);
  color: var(--text-bright);
  font-weight: 500;
  text-align: left;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

td {
  padding: 0.75rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text);
}

tr:hover td { background: var(--surface); }

/* Responsive table: scroll on small screens */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   13. MEDIA EMBEDS
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   16:9 responsive wrappers for iframes.
   Usage: <div class="embed-video"><iframe ...></iframe></div>
*/

.embed-video,
.embed-youtube,
.embed-vimeo {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 */
  height: 0;
  overflow: hidden;
  background: var(--surface2);
  border-radius: 3px;
  margin: 1.5rem 0;
}

.embed-video iframe,
.embed-youtube iframe,
.embed-vimeo iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border: none;
}

/* SoundCloud / audio — no aspect ratio needed */
.embed-audio iframe {
  width: 100%;
  border: none;
  display: block;
  border-radius: 3px;
  margin: 1.5rem 0;
}

/* Generic iframe box */
.embed-generic iframe {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 3px;
  display: block;
  margin: 1.5rem 0;
}


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   14. IMAGE GALLERY + LIGHTBOX
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   Gallery:
     <div class="gallery">
       <img src="..." alt="caption">
     </div>

   Lightbox (JS controlled — add .is-open):
     <div class="lightbox" hidden>
       <button class="lightbox-close" onclick="closeLightbox()">×</button>
       <img class="lightbox-img" src="" alt="">
       <p class="lightbox-caption"></p>
     </div>
*/

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.5rem;
  margin: 1.5rem 0;
}

.gallery img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-radius: 2px;
  cursor: zoom-in;
  margin: 0;
  transition: opacity 0.15s;
}
.gallery img:hover { opacity: 0.85; }

/* Lightbox overlay */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0.75rem;
  z-index: 1000;
  padding: 2rem;
  cursor: zoom-out;
}
.lightbox[hidden] { display: none !important; }

.lightbox-img {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 2px;
  cursor: default;
}

.lightbox-caption {
  color: #777;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
}

.lightbox-close {
  position: fixed;
  top: 1.25rem;
  right: 1.5rem;
  background: none;
  border: none;
  color: #666;
  font-size: 1.75rem;
  cursor: pointer;
  line-height: 1;
  padding: 0.25rem;
  transition: color 0.15s;
}
.lightbox-close:hover { color: #aaa; }


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   15. MODAL / OVERLAY
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   Usage:
     <div class="overlay" id="myModal" hidden>
       <div class="modal">
         <div class="modal-header">Title <button>×</button></div>
         <div class="modal-body">...</div>
         <div class="modal-footer">...</div>
       </div>
     </div>
*/

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1rem;
}
.overlay[hidden] { display: none !important; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 3px;
  width: min(600px, 100%);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  color: var(--text-muted);
  text-transform: uppercase;
  flex-shrink: 0;
}

.modal-body   { flex: 1; overflow-y: auto; padding: 1.25rem; }

.modal-footer {
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  align-items: center;
  flex-shrink: 0;
}


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   16. TOAST NOTIFICATIONS
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   Usage:
     <div class="toast" id="toast"></div>
   JS: show by adding class "toast--visible" (and "toast--error")
*/

.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--surface3);
  border: 1px solid var(--border2);
  color: var(--text);
  padding: 0.6rem 1rem;
  border-radius: 2px;
  font-size: 0.78rem;
  z-index: 400;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  max-width: calc(100vw - 3rem);
}

.toast--visible { opacity: 1; transform: none; pointer-events: auto; }
.toast--error   { border-color: var(--danger-hover); color: #c07070; }


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   17. THEME TOGGLE BUTTON
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   A plain circle button that communicates dark/light mode.
   Usage:
     <button class="theme-toggle" onclick="toggleTheme()"></button>
   JS:
     function toggleTheme() {
       const next = document.documentElement.getAttribute('data-theme') === 'light' ? 'dark' : 'light';
       document.documentElement.setAttribute('data-theme', next);
       localStorage.setItem('theme', next);
     }
     // On load:
     const saved = localStorage.getItem('theme') || 'dark';
     document.documentElement.setAttribute('data-theme', saved);
*/

.theme-toggle {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid var(--border2);
  background: var(--surface2);
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  transition: background 0.2s, border-color 0.2s;
}
.theme-toggle:hover { border-color: var(--accent); }


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   18. REDACTION BARS
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   Renders text as a solid black bar. Click to reveal.
   JS: el.addEventListener('click', e => e.target.closest('.redacted')?.classList.toggle('redacted--revealed'))
   Usage in source: wrap text in <span class="redacted">secret</span>
*/

.redacted {
  display: inline;
  background: #111;
  color: transparent;
  border-radius: 2px;
  padding: 0.05em 0.3em;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transition: background 0.2s, color 0.15s;
}

.redacted--revealed {
  background: var(--surface2);
  color: var(--text-bright);
  cursor: text;
  user-select: text;
  -webkit-user-select: text;
}

.redacted:not(.redacted--revealed)::selection {
  background: transparent;
  color: transparent;
}

[data-theme="light"] .redacted { background: #1a1a1a; }


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   19. UTILITY CLASSES
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

/* Text */
.text-bright  { color: var(--text-bright); }
.text-muted   { color: var(--text-muted); }
.text-danger  { color: #c07070; }
.text-success { color: #6a9a6a; }
.text-sm      { font-size: 0.8rem; }
.text-xs      { font-size: 0.7rem; }
.text-mono    { font-family: 'SFMono-Regular', Consolas, monospace; }
.text-upper   { text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.72em; }
.text-center  { text-align: center; }
.text-right   { text-align: right; }

/* Spacing */
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-4 { margin-top: 2rem; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 2rem; }

/* Display */
.hidden  { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* Empty / loading state */
.empty-state {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 3rem 1rem;
  letter-spacing: 0.05em;
}

/* Sticky bar (e.g. bottom status bar) */
.sticky-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  padding: 0.6rem 1.75rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.72rem;
  color: var(--text-muted);
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   20. RESPONSIVE BREAKPOINTS
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   Breakpoints:
     ≥1200px   large desktop   — larger base font
     ≤800px    tablet          — collapse two-column layouts
     ≤600px    phone           — tighten spacing, 16px inputs (iOS)
     ≤380px    small phone     — extra compression
*/

/* ── Large desktop ───────────────────── */
@media (min-width: 1200px) {
  html { font-size: 16px; }

  .gallery { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
  .gallery img { height: 180px; }
}

/* ── Tablet ───────────────────────────── */
@media (max-width: 800px) {
  .grid-2   { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }

  .site-header { padding: 1.25rem 1.25rem 1rem; }
}

/* ── Phone ───────────────────────────── */
@media (max-width: 600px) {
  html { font-size: 14px; }

  /* iOS Safari anti-zoom: inputs need ≥16px font */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="search"],
  input[type="url"],
  input[type="number"],
  input[type="tel"],
  input[type="date"],
  textarea,
  select { font-size: 16px; }

  .container { padding: 0 1rem; }

  .site-header { padding: 1rem 1rem 0.875rem; }

  /* Bigger touch targets */
  .theme-toggle { width: 28px; height: 28px; }

  /* Modals go full-width */
  .modal { width: 96vw; max-height: 90vh; }
  .modal-body   { padding: 1rem; }
  .modal-footer { padding: 0.6rem 1rem; flex-wrap: wrap; }

  /* Gallery — smaller tiles */
  .gallery { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
  .gallery img { height: 100px; }

  /* Lightbox */
  .lightbox { padding: 1rem; }
  .lightbox-img { max-width: 95vw; max-height: 80vh; }

  /* Toast */
  .toast { right: 1rem; left: 1rem; text-align: center; }

  /* Code */
  pre { padding: 0.875rem 1rem; }
  pre code { font-size: 0.78rem; }

  /* Table: scroll */
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* ── Small phone ─────────────────────── */
@media (max-width: 380px) {
  .nav-link { letter-spacing: 0.1em; }
  .btn--sm  { padding: 0.25em 0.5em; font-size: 0.68rem; }
}
