/* ═══════════════════════════════════════════════════════════
   Nothing-Inspired Design System — Learning Vault
   Fonts: Doto (hero logo), Space Grotesk (body/UI),
          Space Mono (labels, badges, buttons, captions)
   Themes: white (default) · gray · dark
   ═══════════════════════════════════════════════════════════ */

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

button {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-visible);
  font-family: var(--font-sans);
  cursor: pointer;
}

/* ─── Nothing Design Tokens ─────────────────────────────── */
:root {
  /* ── WHITE theme (default) ───────────────────────────── */
  --bg:             #FFFFFF;
  --surface:        #FFFFFF;
  --surface-raised: #F5F5F5;
  --border:         #E8E8E8;
  --border-visible: #D0D0D0;
  --text-disabled:  #BBBBBB;
  --text-secondary: #777777;
  --text-primary:   #1A1A1A;
  --text-display:   #000000;
  --muted:          #777777;
  --interactive:    #0060CC;

  /* Fixed — same across all themes */
  --black:         #000000;
  --accent:        #D71921;
  --accent-subtle: rgba(215, 25, 33, 0.08);
  --success:       #4A9E5C;
  --warning:       #D4A843;

  /* Spacing (8px base grid) */
  --space-2xs: 2px;
  --space-xs:  4px;
  --space-sm:  8px;
  --space-md:  16px;
  --space-lg:  24px;
  --space-xl:  32px;
  --space-2xl: 48px;
  --space-3xl: 64px;
  --space-4xl: 96px;

  /* Radius */
  --radius-sm:   4px;
  --radius:      12px;
  --radius-pill: 999px;

  /* Motion — subtle ease-out, no spring */
  --ease:     cubic-bezier(0.25, 0.1, 0.25, 1);
  --dur-fast: 150ms;
  --dur:      250ms;

  /* Font stacks */
  --font-sans: 'Space Grotesk', 'DM Sans', system-ui, sans-serif;
  --font-mono: 'Space Mono', 'JetBrains Mono', 'SF Mono', monospace;
  --font-dot:  'Doto', 'Space Mono', monospace;

  /* Aliases used in auth/setup/account templates */
  --fg:     #000000;
  --bg-inv: #FFFFFF;
}

/* ─── GRAY theme ─────────────────────────────────────────── */
/* Cards = white on off-white page — subtle elevation, no shadows */
html[data-theme="gray"] {
  --bg:             #F5F5F5;
  --surface:        #FFFFFF;
  --surface-raised: #ECECEC;
  --border:         #E0E0E0;
  --border-visible: #CCCCCC;
  --text-disabled:  #BBBBBB;
  --text-secondary: #777777;
  --text-primary:   #1A1A1A;
  --text-display:   #000000;
  --muted:          #777777;
  --interactive:    #0060CC;
}

/* ─── DARK theme ─────────────────────────────────────────── */
/* OLED black — instrument panel in a dark room */
html[data-theme="dark"] {
  --bg:             #000000;
  --surface:        #111111;
  --surface-raised: #1A1A1A;
  --border:         #222222;
  --border-visible: #333333;
  --text-disabled:  #666666;
  --text-secondary: #999999;
  --text-primary:   #E8E8E8;
  --text-display:   #FFFFFF;
  --muted:          #999999;
  --interactive:    #5B9BF6;
  --fg:             #FFFFFF;
}

/* ─── Base ──────────────────────────────────────────────── */
html { font-size: 16px; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--interactive); text-decoration: none; }
a:hover { color: var(--text-display); }

h1, h2, h3, h4 {
  line-height: 1.25;
  color: var(--text-display);
  font-family: var(--font-sans);
}

code {
  font-family: var(--font-mono);
  font-size: 0.83em;
  color: var(--text-secondary);
  background: var(--surface-raised);
  border: 1px solid var(--border-visible);
  border-radius: var(--radius-sm);
  padding: 0.1em 0.45em;
}

/* ─── Layout ────────────────────────────────────────────── */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

/* ─── Header ────────────────────────────────────────────── */
.site-header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  /* Subtle dot-grid texture — the Nothing "instrument panel" feel */
  background-image: radial-gradient(circle, var(--border-visible) 0.5px, transparent 0.5px);
  background-size: 12px 12px;
}

.header-inner {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  padding-top: 13px;
  padding-bottom: 13px;
  /* Solid bg for readability over dot grid */
  background: var(--bg);
}

/* ── Logo — Doto is the ONE hero moment on every screen ── */
.logo {
  display: flex;
  align-items: baseline;
  gap: 7px;
  text-decoration: none;
  flex-shrink: 0;
}

.logo-dot {
  font-family: var(--font-dot);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-display);
  letter-spacing: -0.02em;
  line-height: 1;
}

.logo-word {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 400;
  color: var(--text-disabled);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  line-height: 1;
  padding-bottom: 1px;
}

.logo:hover .logo-word { color: var(--text-secondary); }
.logo:hover .logo-dot  { color: var(--text-primary); }

/* ── Navigation ─────────────────────────────────────────── */
.header-nav {
  display: flex;
  align-items: center;
  gap: var(--space-xl);
  flex: 1;
}

/* Search — underline input, no border box */
.search-form {
  display: flex;
  gap: 0;
  flex: 1;
  max-width: 340px;
  border-bottom: 1px solid var(--border-visible);
  transition: border-color var(--dur-fast) var(--ease);
}

.search-form:focus-within { border-bottom-color: var(--text-secondary); }

.search-form input[type="search"] {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  padding: 6px var(--space-sm) 6px 0;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--text-primary);
  -webkit-appearance: none;
}

.search-form input[type="search"]::placeholder {
  color: var(--text-disabled);
}

.search-form button {
  background: transparent;
  border: none;
  color: var(--text-disabled);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 6px 0 6px var(--space-sm);
  transition: color var(--dur-fast) var(--ease);
  white-space: nowrap;
}

.search-form button:hover { color: var(--text-display); }

/* Nav links — Space Mono ALL CAPS, tertiary level */
.nav-link {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-disabled);
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--dur-fast) var(--ease);
  position: relative;
}

.nav-link:hover { color: var(--text-primary); }

.nav-link.active {
  color: var(--text-display);
}

/* Active indicator: small accent dot below the label */
.nav-link.active::after {
  content: '';
  display: block;
  width: 3px;
  height: 3px;
  background: var(--accent);
  border-radius: 50%;
  margin: 3px auto 0;
}

/* ─── Main content area ─────────────────────────────────── */
.main-content {
  padding-top: var(--space-xl);
  padding-bottom: var(--space-4xl);
}

/* ─── Category filter tabs ───────────────────────────────── */
.filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-bottom: var(--space-lg);
}

/* Nothing chip component */
.pill {
  display: inline-block;
  padding: 5px 14px;
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 0.63rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid var(--border-visible);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  text-decoration: none;
  transition: border-color var(--dur-fast) var(--ease),
              color var(--dur-fast) var(--ease),
              background var(--dur-fast) var(--ease);
}

.pill:hover {
  border-color: var(--text-secondary);
  color: var(--text-primary);
  text-decoration: none;
}

.pill.active {
  background: var(--text-display);
  border-color: var(--text-display);
  color: var(--bg);
}

.pill.active:hover { text-decoration: none; }

/* ─── Item grid ─────────────────────────────────────────── */
.item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-md);
}

/* ─── Base card surface ──────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

/* ─── Item cards ─────────────────────────────────────────── */
.item-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  transition: border-color var(--dur-fast) var(--ease);
}

.item-card:hover { border-color: var(--border-visible); }

/* Learned: subtle success left accent, not a colored fill */
.item-card.is-learned { border-left: 2px solid var(--success); }

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-sm);
}

.card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

/* Primary layer — item title */
.item-title {
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.4;
}

.item-title a {
  color: var(--text-display);
  text-decoration: none;
}

.item-title a:hover { color: var(--text-primary); }

/* Secondary layer — preview text */
.item-preview {
  font-size: 0.84rem;
  color: var(--text-secondary);
  line-height: 1.65;
  flex: 1;
}

/* Tertiary layer — date */
.item-date {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  color: var(--text-disabled);
  letter-spacing: 0.04em;
  white-space: nowrap;
  flex-shrink: 0;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.card-actions {
  display: flex;
  gap: var(--space-xs);
  align-items: center;
}

/* ─── Badges — Nothing chip style ───────────────────────── */
/* Border only, Space Mono ALL CAPS, color = type signal */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  line-height: 1.8;
  border: 1px solid var(--border-visible);
  color: var(--text-disabled);
  background: transparent;
}

/* Type badges — color is the signal, applied to text+border only */
.badge-youtube  { border-color: var(--accent);    color: var(--accent); }
.badge-twitter  { border-color: var(--border-visible); color: var(--text-disabled); }
.badge-reddit     { border-color: var(--warning);   color: var(--warning); }
.badge-reddit-sub { border-color: var(--warning);   color: var(--warning); opacity: 0.7; }
.badge-article  { border-color: var(--border-visible); color: var(--text-disabled); }
.badge-learned  { border-color: var(--success);   color: var(--success); }
.badge-recipe   { border-color: var(--warning);   color: var(--warning); }

/* ─── Buttons — Space Mono ALL CAPS pill style ───────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  padding: 10px var(--space-lg);
  min-height: 44px;
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease),
              color var(--dur-fast) var(--ease);
  white-space: nowrap;
  line-height: 1;
}

.btn:hover { text-decoration: none; }

/* Primary — inverted: display-color fill, bg-color text */
.btn-primary {
  background: var(--text-display);
  color: var(--bg);
  border-color: var(--text-display);
}
.btn-primary:hover {
  background: var(--text-primary);
  border-color: var(--text-primary);
  color: var(--bg);
}

/* Success — outline green */
.btn-success {
  background: transparent;
  color: var(--success);
  border-color: var(--success);
}
.btn-success:hover {
  background: var(--success);
  color: var(--black);
}

/* Secondary outline */
.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--border-visible);
}
.btn-outline:hover {
  border-color: var(--text-primary);
  color: var(--text-display);
}

/* Ghost — no border, faded text */
.btn-ghost {
  background: transparent;
  color: var(--text-disabled);
  border-color: transparent;
  padding-left: var(--space-sm);
  padding-right: var(--space-sm);
}
.btn-ghost:hover { color: var(--text-primary); }

/* Destructive */
.btn-danger {
  background: transparent;
  color: var(--accent);
  border-color: var(--accent);
}
.btn-danger:hover {
  background: var(--accent);
  color: var(--text-display);
}

.btn-sm {
  padding: 6px 14px;
  min-height: 34px;
  font-size: 0.62rem;
}

.align-end { align-self: flex-end; }

/* ─── Learn toggle (card footer) ─────────────────────────── */
.learn-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-disabled);
  user-select: none;
  transition: color var(--dur-fast) var(--ease);
}

.learn-toggle input[type="checkbox"] {
  accent-color: var(--success);
  width: 13px;
  height: 13px;
  cursor: pointer;
  flex-shrink: 0;
}

.learn-toggle:hover .learn-label { color: var(--success); }

/* ─── Modal (mark-as-learned) ────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--space-md);
}

.modal-overlay[hidden] { display: none; }

/* Nothing modal: surface + visible border, no shadow */
.modal-box {
  background: var(--surface);
  border: 1px solid var(--border-visible);
  border-radius: var(--radius);
  padding: var(--space-xl);
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.modal-box h3 {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-display);
}

/* Underline input — preferred Nothing input style */
.modal-box textarea {
  width: 100%;
  border: none;
  border-bottom: 1px solid var(--border-visible);
  background: transparent;
  padding: var(--space-sm) 0;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  color: var(--text-primary);
  resize: none;
  outline: none;
  transition: border-color var(--dur-fast) var(--ease);
  line-height: 1.55;
}

.modal-box textarea::placeholder { color: var(--text-disabled); }
.modal-box textarea:focus { border-bottom-color: var(--text-secondary); }

.modal-actions {
  display: flex;
  gap: var(--space-sm);
  justify-content: flex-end;
}

/* ─── Empty state ────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: var(--space-4xl) var(--space-md);
}

/* Dot-grid motif — the Nothing signature decoration */
.empty-state::before {
  content: '';
  display: block;
  width: 96px;
  height: 48px;
  margin: 0 auto var(--space-xl);
  background-image: radial-gradient(circle, var(--border-visible) 1px, transparent 1px);
  background-size: 12px 12px;
  opacity: 0.5;
}

.empty-state p {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: var(--text-disabled);
  margin-bottom: var(--space-xs);
}

.empty-state p:first-of-type { color: var(--text-secondary); }

/* ─── Search results info ────────────────────────────────── */
.search-info {
  margin-bottom: var(--space-md);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.search-info strong { color: var(--text-primary); font-weight: 400; }
.search-info a { color: var(--text-secondary); text-decoration: underline; }
.search-info a:hover { color: var(--text-display); }

/* ─── Member / recipe filter row ─────────────────────────── */
.member-filter-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.member-filter-label {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-disabled);
}

.member-filter-select {
  border: none;
  border-bottom: 1px solid var(--border-visible);
  border-radius: 0;
  padding: 4px var(--space-xs) 4px 0;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-primary);
  background: transparent;
  cursor: pointer;
  outline: none;
  transition: border-color var(--dur-fast) var(--ease);
}

.member-filter-select:focus { border-bottom-color: var(--text-primary); }

/* ─── Item detail page ───────────────────────────────────── */
.item-detail { max-width: 740px; margin: 0 auto; }

.detail-meta {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
  flex-wrap: wrap;
}

/* Back button — circular, Nothing nav style */
.back-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border-visible);
  color: var(--text-secondary);
  font-size: 1.1rem;
  text-decoration: none;
  flex-shrink: 0;
  transition: border-color var(--dur-fast) var(--ease),
              color var(--dur-fast) var(--ease);
  line-height: 1;
}

.back-link:hover {
  border-color: var(--text-secondary);
  color: var(--text-display);
}

/* Primary layer — the big title */
.detail-title {
  font-family: var(--font-sans);
  font-size: 1.55rem;
  font-weight: 500;
  line-height: 1.25;
  color: var(--text-display);
  margin-bottom: var(--space-sm);
  letter-spacing: -0.01em;
}

/* Original YouTube title shown as tertiary */
.original-title {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-disabled);
  letter-spacing: 0.02em;
  margin-top: -0.3rem;
  margin-bottom: var(--space-md);
}

/* External link — tertiary, Space Mono */
.external-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-disabled);
  text-decoration: none;
  margin-bottom: var(--space-2xl);
  transition: color var(--dur-fast) var(--ease);
}

.external-link:hover { color: var(--interactive); }

/* ─── Summary body (non-recipe markdown) ─────────────────── */
.summary-body {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: var(--space-xl) var(--space-xl);
  line-height: 1.75;
  font-size: 0.95rem;
  margin-bottom: var(--space-lg);
  color: var(--text-primary);
}

.summary-body h1,
.summary-body h2,
.summary-body h3,
.summary-body h4 {
  margin: 1.4em 0 0.5em;
  line-height: 1.3;
}

.summary-body h1 {
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--text-display);
}

/* Section labels — Space Mono ALL CAPS, instrument-panel style */
.summary-body h2 {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-visible);
  padding-bottom: var(--space-sm);
}

.summary-body h3 {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-display);
}

.summary-body h4 {
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--text-secondary);
}

.summary-body p  { margin: 0.6em 0; }

.summary-body ul,
.summary-body ol {
  margin: 0.6em 0 0.6em var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.summary-body li > ul,
.summary-body li > ol { margin-top: 0.2rem; margin-bottom: 0; }

.summary-body strong { font-weight: 600; color: var(--text-display); }
.summary-body em     { font-style: italic; color: var(--text-secondary); }

.summary-body hr {
  border: none;
  border-top: 1px solid var(--border-visible);
  margin: var(--space-lg) 0;
}

.summary-body a { color: var(--interactive); }
.summary-body a:hover { color: var(--text-display); }

.summary-body pre {
  background: var(--surface-raised);
  border: 1px solid var(--border-visible);
  border-radius: var(--radius-sm);
  padding: var(--space-md);
  overflow-x: auto;
  font-size: 0.82rem;
  margin: 0.75em 0;
}

.summary-body pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--text-primary);
}

.summary-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  margin: 0.75em 0;
}

.summary-body th {
  border-bottom: 1px solid var(--border-visible);
  padding: var(--space-xs) var(--space-md);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  font-weight: 400;
  text-align: left;
}

.summary-body td {
  border-bottom: 1px solid var(--border);
  padding: var(--space-sm) var(--space-md);
  color: var(--text-primary);
}

/* ─── Learned notes box ──────────────────────────────────── */
.learned-notes-box {
  background: var(--surface);
  border: 1px solid var(--border-visible);
  border-left: 3px solid var(--success);
  border-radius: var(--radius);
  padding: var(--space-md) var(--space-lg);
  margin-bottom: var(--space-lg);
}

.learned-notes-box h4 {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--success);
  margin-bottom: var(--space-xs);
}

.learned-notes-box p {
  font-size: 0.9rem;
  color: var(--text-primary);
}

/* ─── Detail action bar ──────────────────────────────────── */
.detail-actions {
  display: flex;
  gap: var(--space-md);
  align-items: center;
  flex-wrap: wrap;
  margin-top: var(--space-xl);
  padding-top: var(--space-xl);
  border-top: 1px solid var(--border);
}

/* ─── Pages: Categories & Household ─────────────────────── */
.page-header { margin-bottom: var(--space-2xl); }

.page-header h1 {
  font-size: 1.4rem;
  font-weight: 500;
  color: var(--text-display);
  margin-bottom: var(--space-sm);
}

.page-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.65;
}

.form-card {
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
}

.form-card h3 {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
  margin-bottom: var(--space-lg);
}

.category-form .form-row {
  display: flex;
  gap: var(--space-md);
  align-items: flex-end;
  flex-wrap: wrap;
}

.form-group { display: flex; flex-direction: column; gap: var(--space-xs); }

.form-group label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 400;
  color: var(--text-disabled);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.form-group small {
  font-weight: 400;
  text-transform: none;
  color: var(--text-disabled);
  font-family: var(--font-sans);
  letter-spacing: 0;
}

/* Underline input style — Nothing preferred */
.form-group input[type="text"] {
  border: none;
  border-bottom: 1px solid var(--border-visible);
  border-radius: 0;
  padding: var(--space-sm) 0;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  color: var(--text-primary);
  background: transparent;
  outline: none;
  transition: border-color var(--dur-fast) var(--ease);
  min-width: 160px;
}

.form-group input[type="text"]:focus {
  border-bottom-color: var(--text-primary);
  color: var(--text-display);
}

.form-group input[type="text"]::placeholder { color: var(--text-disabled); }

.form-group-color { flex-shrink: 0; }

.form-group input[type="color"] {
  width: 44px;
  height: 34px;
  border: 1px solid var(--border-visible);
  border-radius: var(--radius-sm);
  padding: 3px;
  cursor: pointer;
  background: var(--surface-raised);
}

.category-list { display: flex; flex-direction: column; gap: var(--space-sm); }

.category-row {
  padding: var(--space-md) var(--space-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.category-info {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  font-size: 0.875rem;
  color: var(--text-primary);
}

/* Category color swatch — data visualization dot */
.cat-swatch {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Prefix monospace chip */
.cat-prefix {
  margin-left: var(--space-xs);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-secondary);
  background: var(--surface-raised);
  border: 1px solid var(--border-visible);
  border-radius: var(--radius-sm);
  padding: 2px 8px;
}

.category-row-actions {
  display: flex;
  gap: var(--space-xs);
  align-items: center;
}

.edit-form-row {
  width: 100%;
  padding-top: var(--space-md);
  margin-top: var(--space-sm);
  border-top: 1px solid var(--border);
}

.muted { color: var(--text-secondary); font-size: 0.875rem; }

/* ─── YouTube sticky player ─────────────────────────────── */
.yt-sticky-wrapper {
  position: sticky;
  top: 57px;   /* just below the sticky header */
  z-index: 90;
  background: #000;
  margin: 0 calc(-1 * var(--space-lg)) var(--space-xl);
  border-bottom: 1px solid var(--border);
}

.yt-player-container {
  position: relative;
  width: 100%;
  max-width: 740px;
  margin: 0 auto;
  aspect-ratio: 16 / 9;
}

.yt-player-container iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* ─── Timestamp buttons ──────────────────────────────────── */
.timestamp-btn {
  display: inline;
  background: none;
  border: none;
  padding: 0 2px;
  font-family: var(--font-mono);
  font-size: 0.82em;
  color: var(--interactive);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color var(--dur-fast) var(--ease);
}

.timestamp-btn:hover { color: var(--text-display); }

/* ─── Markdown in card previews ──────────────────────────── */
.item-preview p  { margin: 0; }
.item-preview ul,
.item-preview ol { margin: 0; padding-left: 1.1rem; }
.item-preview h1,
.item-preview h2,
.item-preview h3 { font-size: inherit; font-weight: 500; display: inline; color: inherit; }

/* ─── Recipe section cards ───────────────────────────────── */
/* Each ## section rendered as a distinct surface card */
.recipe-section {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border-visible);
  padding: var(--space-lg) var(--space-xl);
  margin-bottom: var(--space-sm);
  line-height: 1.75;
  font-size: 0.95rem;
  color: var(--text-primary);
}

/* Section heading: Space Mono ALL CAPS label — instrument panel */
.recipe-section h2 {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-secondary);
  margin: 0 0 var(--space-lg) 0;
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--border);
}

/* Summary — neutral, plain surface */
.recipe-section-summary {
  border-left-color: var(--border-visible);
}

/* Ingredients — raised surface + accent left stripe (the interrupt) */
.recipe-section-ingredients {
  background: var(--surface-raised);
  border-left-color: var(--accent);
}

.recipe-section-ingredients h2 {
  color: var(--accent);
  border-bottom-color: var(--accent-subtle);
}

/* Steps — standard, warm border */
.recipe-section-steps {
  border-left-color: var(--border-visible);
}

/* Notable Moments — interactive blue */
.recipe-section-moments {
  border-left-color: var(--interactive);
}

.recipe-section-moments h2 {
  color: var(--interactive);
}

/* Markdown inside recipe sections */
.recipe-section p  { margin: 0.6em 0; }

.recipe-section ul,
.recipe-section ol {
  margin: 0.6em 0 0.6em var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.recipe-section li > ul,
.recipe-section li > ol { margin-top: 0.2rem; margin-bottom: 0; }

.recipe-section strong { font-weight: 600; color: var(--text-display); }
.recipe-section em     { font-style: italic; color: var(--text-secondary); }
.recipe-section a      { color: var(--interactive); }
.recipe-section a:hover { color: var(--text-display); }

.recipe-section h3,
.recipe-section h4 {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-display);
  margin: 0.85em 0 0.35em;
}

/* ─── Ingredient checkboxes ──────────────────────────────── */
/* JS replaces [ ] list items with these interactive labels */
.ingredient-item {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
  padding: 5px 0;
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1.5;
  user-select: none;
  list-style: none;
}

.ingredient-checkbox {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  accent-color: var(--accent);
  cursor: pointer;
  margin-top: 0.2em;
}

.ingredient-item span {
  color: var(--text-primary);
  transition: color var(--dur-fast) var(--ease);
}

.ingredient-item.checked span {
  text-decoration: line-through;
  color: var(--text-disabled);
}

/* ─── "Ready to cook" indicator ─────────────────────────── */
/* Nothing style: outline pill with success color, Space Mono ALL CAPS */
.prep-ready-badge {
  display: none;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) var(--space-md);
  background: transparent;
  border: 1px solid var(--success);
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--success);
  margin-bottom: var(--space-md);
}

.prep-ready-icon { font-size: 0.85rem; }

/* ─── "Who likes this?" section ─────────────────────────── */
.who-likes {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: var(--space-lg) var(--space-xl);
  margin-bottom: var(--space-lg);
}

.who-likes-title {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
}

.member-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

/* Member toggle — Nothing chip style, inverts on active */
.member-toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 5px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-visible);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease);
  user-select: none;
}

.member-toggle input[type="checkbox"] { display: none; }

.member-toggle:hover {
  border-color: var(--text-secondary);
  color: var(--text-primary);
}

/* Liked: inverted — display fill, bg text */
.member-toggle.liked {
  background: var(--text-display);
  border-color: var(--text-display);
  color: var(--bg);
}

.member-toggle.liked::before { content: "✓ "; }

/* ─── Member avatar (household page) ────────────────────── */
.member-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface-raised);
  border: 1px solid var(--border-visible);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0;
  flex-shrink: 0;
}

/* ─── Footer ─────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: var(--space-md) 0;
  text-align: center;
}

.site-footer small {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  color: var(--text-disabled);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ─── Theme toggle widget ────────────────────────────────── */
/* 3 small grouped pill buttons, Nothing industrial style */
.theme-toggle {
  display: flex;
  align-items: center;
  border: 1px solid var(--border-visible);
  border-radius: var(--radius-pill);
  overflow: hidden;
  flex-shrink: 0;
  margin-left: auto;
}

.theme-btn {
  background: transparent;
  border: none;
  border-right: 1px solid var(--border-visible);
  color: var(--text-disabled);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 5px 9px;
  min-height: 28px;
  min-width: 28px;
  transition: color var(--dur-fast) var(--ease),
              background var(--dur-fast) var(--ease);
  line-height: 1;
}

.theme-btn:last-child { border-right: none; }

.theme-btn:hover { color: var(--text-primary); }

.theme-btn.active {
  background: var(--text-display);
  color: var(--bg);
}

/* ─── Widget view toggle ─────────────────────────────────── */
/* Nothing grouped pill style — same DNA as the theme toggle */
.widget-view-toggle {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border-visible);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-bottom: var(--space-md);
}

.widget-view-btn {
  background: transparent;
  border: none;
  border-right: 1px solid var(--border-visible);
  color: var(--text-disabled);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 5px 12px;
  min-height: 28px;
  transition: color var(--dur-fast) var(--ease),
              background var(--dur-fast) var(--ease);
  line-height: 1;
  white-space: nowrap;
}

.widget-view-btn:last-child { border-right: none; }
.widget-view-btn:hover { color: var(--text-primary); }
.widget-view-btn.active {
  background: var(--text-display);
  color: var(--bg);
}

/* ─── Dashboard widget section ──────────────────────────── */
.widget-section {
  margin-bottom: var(--space-xl);
}

/* Ensure panels hidden via the HTML [hidden] attribute stay hidden */
.widget-panel[hidden] { display: none; }

/* Row label — Nothing instrument-panel section divider */
.widget-row-label {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-disabled);
  border-bottom: 1px solid var(--border);
  padding-bottom: var(--space-xs);
  margin-bottom: var(--space-sm);
}

/* Empty state inside a widget panel */
.widget-empty {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-disabled);
  letter-spacing: 0.04em;
  padding: var(--space-sm) 0;
}

/* Responsive widget grid — auto-fill, 4–5 per row on desktop */
.widget-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: var(--space-sm);
  margin-bottom: var(--space-xs);
}

/* Individual widget card */
.widget {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border-visible);
  border-radius: var(--radius-sm);
  padding: var(--space-md) var(--space-md) var(--space-sm);
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow: visible; /* allow tooltip to overflow */
}

/* Corner dot — the Nothing signature detail */
.widget::after {
  content: '';
  position: absolute;
  top: 7px;
  right: 7px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--border-visible);
  pointer-events: none;
}

/* Streak widget: accent dot when streak > 0 */
.widget-accent::after {
  background: var(--accent);
}

/* Large monospace number — primary layer */
.widget-num {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-display);
  line-height: 1;
  letter-spacing: -0.03em;
}

/* ALL CAPS label row — tertiary layer */
.widget-label {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  color: var(--text-secondary);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 3px;
}

/* ─── Widget info icon + tooltip ─────────────────────────── */
.widget-info {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: help;
  color: var(--text-disabled);
  font-size: 0.65rem;
  line-height: 1;
  vertical-align: middle;
  user-select: none;
  flex-shrink: 0;
}

.widget-info:hover,
.widget-info:focus {
  color: var(--text-secondary);
  outline: none;
}

/* Tooltip — always black/white per spec, not theme-adaptive */
.widget-tooltip {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #111;
  color: #f0f0f0;
  border: 1px solid #444;
  border-radius: 0;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  line-height: 1.6;
  letter-spacing: 0.02em;
  padding: 7px 10px;
  width: 200px;
  white-space: normal;
  z-index: 300;
  pointer-events: none;
}

/* Show on hover (desktop) or focus (keyboard) */
.widget-info:hover .widget-tooltip,
.widget-info:focus .widget-tooltip { display: block; }

/* Show on tap (mobile) via JS .show class */
.widget-info.show .widget-tooltip { display: block; }

/* ─── Multi-member filter block ──────────────────────────── */
.member-filter-block {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.member-filter-pills {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-xs);
}

.member-filter-label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-disabled);
  margin-right: var(--space-xs);
  white-space: nowrap;
}

/* ─── Intersection / Union mode toggle ───────────────────── */
.filter-mode-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.mode-btn {
  display: inline-block;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid var(--border-visible);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  text-decoration: none;
  transition: border-color var(--dur-fast) var(--ease),
              color var(--dur-fast) var(--ease),
              background var(--dur-fast) var(--ease);
}

.mode-btn:hover {
  color: var(--text-primary);
  border-color: var(--text-secondary);
  text-decoration: none;
}

.mode-btn.active {
  background: var(--text-display);
  border-color: var(--text-display);
  color: var(--bg);
}

/* ─── Mobile dropdown theme overrides ───────────────────────── */
[data-theme="white"] .mobile-dropdown { background: #f0f0f0 !important; }
[data-theme="gray"]  .mobile-dropdown { background: #d8d8d8 !important; }
[data-theme="dark"]  .mobile-dropdown { background: #1a1a1a !important; }

/* ─── Mobile ─────────────────────────────────────────────── */
@media (max-width: 640px) {
  .desktop-nav { display: none !important; }
  .mobile-nav  { display: block !important; }

  /* Hide all widgets on mobile by default — JS loadWidgetPrefs controls visibility */
  .stat-widget,
  #widget-saved,
  #widget-learned,
  #widget-unread,
  #widget-streak,
  #widget-accessed,
  #widget-topsource,
  #widget-learnedrate,
  #widget-thisweek,
  #widget-activity,
  #widget-sources,
  #widget-categories {
    display: none !important;
  }

  .search-form { max-width: 100%; width: 100%; }

  /* Widget rows: horizontal scroll on mobile */
  .widget-row {
    grid-template-columns: none;
    display: flex;
    overflow-x: auto;
    gap: var(--space-sm);
    padding-bottom: var(--space-xs);
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    /* Bleed to container edges for full-width scroll feel */
    margin-left: calc(-1 * var(--space-lg));
    margin-right: calc(-1 * var(--space-lg));
    padding-left: var(--space-lg);
    padding-right: var(--space-lg);
  }

  .widget-row::-webkit-scrollbar { display: none; }

  .widget {
    min-width: 82px;
    flex-shrink: 0;
    overflow: visible;
  }

  /* Tooltips: anchor to bottom of widget on mobile so they
     don't clip off the top of the screen */
  .widget-tooltip {
    top: calc(100% + 6px);
    left: 0;
    transform: none;
    width: 180px;
  }

  .item-grid { grid-template-columns: 1fr; }

  .card-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .detail-title { font-size: 1.25rem; }

  .summary-body { padding: var(--space-lg); }

  .recipe-section { padding: var(--space-md) var(--space-lg); }

  .category-form .form-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .form-group input[type="text"] { min-width: 100%; width: 100%; }

  .member-toggles { gap: var(--space-xs); }

  .who-likes { padding: var(--space-md) var(--space-lg); }

  /* Adjust YouTube player top offset for shorter mobile header */
  .yt-sticky-wrapper { top: 48px; }

  /* Shrink all video embeds on mobile */
  iframe,
  iframe[src*="youtube"],
  iframe[src*="youtu.be"],
  iframe[src*="twitter"],
  iframe[src*="twimg"],
  iframe[id="yt-player"],
  .video-embed,
  .video-container,
  .embed-container {
    max-height: 25vh !important;
    height: 25vh !important;
  }

  /* Twitter/X embed wrappers */
  [data-tweet-id],
  .twitter-tweet,
  blockquote.twitter-tweet {
    max-width: 100% !important;
  }

  /* YouTube wrapper divs */
  div[style*="padding-bottom: 56.25%"],
  div[style*="padding-bottom:56.25%"] {
    padding-bottom: 25vh !important;
  }
}

/* ── Logo visibility across themes ─────────────────────── */
.nav-logo {
  filter: brightness(0);
}
[data-theme="dark"] .nav-logo {
  filter: brightness(0) invert(1);
}
[data-theme="gray"] .nav-logo {
  filter: brightness(0);
}
[data-theme="white"] .nav-logo {
  filter: brightness(0);
}
