/* book-base.css :: structural rules + :root variables (T104.5 split).
 *
 * Holds everything that is theme-agnostic: layout, typography, form
 * shapes, slot grid, modal positioning, animations.
 *
 * Two companion files swap the palette at runtime:
 *   * book-theme-night.css :: the default Tron-grid + magenta gaming skin
 *   * book-theme-day.css   :: the Win97 silver day-mode skin
 *
 * The active theme is selected by a body class:
 *   body.night → Tron palette (default; class added by no-flicker init)
 *   body.day   → Win97 palette
 *
 * Both files override the 5 named tokens declared in :root below
 * (--text-primary / --text-secondary / --text-muted / --bg-page / --bg-card)
 * and carry their own !important-chain skin overrides.
 */

:root {
  /* T104.4 :: WCAG AA contrast layer (body 4.5:1, large text 3:1).
   * Default values match the night/Tron palette. body.day overrides
   * these via book-theme-day.css. */
  --text-primary: #e8f4fa;
  --text-secondary: #9fb6c8;
  --text-muted: #7a93a8;
  --bg-page: #050810;
  --bg-card: #0a1018;

  /* Legacy aliases :: kept so existing rules + theme overrides keep
   * resolving. New rules should reference --text-* / --bg-* above. */
  --bg: var(--bg-page);
  --card: var(--bg-card);
  --surface-2: #0e1620;
  --pcb-green: #1a4d2a;
  --pcb-green-bright: #4a9d5e;
  --brand: #00d4ff;
  --magenta: #ff2e88;
  --silk: #ffd700;
  --text: var(--text-primary);
  --muted: var(--text-muted);
  --border: #1a2332;
  --danger: #ff3366;
  --ok: #00ff88;
}

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

html, body {
  background: var(--bg-page);
  color: var(--text-primary);
  font-family: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--bg-page);
  position: relative;
  overflow-x: hidden;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 48px 16px;
}

/* ── Card ────────────────────────────────────────────────── */
.card {
  width: 100%;
  max-width: 520px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 32px 28px;
  position: relative;
  z-index: 1;
}

/* ── Status bar ─────────────────────────────────────────── */
.status-bar {
  display: flex; align-items: center; gap: 8px;
  font-size: 10px; color: var(--text-muted);
  margin-bottom: 18px; padding-bottom: 12px;
  border-bottom: 1px dashed var(--border);
  letter-spacing: 0.04em;
}
.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--ok);
}
.status-bar .right { margin-left: auto; color: var(--pcb-green-bright); }

/* ── Silkscreen tags ─────────────────────────────────────── */
.silk-tag {
  display: inline-block;
  font-family: inherit;
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--silk);
  border: 1px solid var(--silk);
  padding: 3px 8px;
  text-transform: uppercase;
  background: rgba(255, 215, 0, 0.04);
}
.silk-tag.muted {
  color: var(--pcb-green-bright);
  border-color: var(--pcb-green);
  background: rgba(26, 77, 42, 0.15);
}
.silk-tag.clickable {
  cursor: pointer;
  transition: all 0.15s;
}

/* ── Header ──────────────────────────────────────────────── */
.header { margin-bottom: 28px; }
.header-tags { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }

h1 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-primary);
  line-height: 1.15;
}
h1 .accent { color: var(--brand); }
.sub, .subtitle {
  margin-top: 10px;
  color: var(--text-secondary);
  font-size: 12px;
  letter-spacing: 0.02em;
}
.sub.spam-warning {
  margin-top: 18px;
  padding: 10px 12px;
  border-left: 2px solid var(--silk);
  background: rgba(255, 215, 0, 0.04);
  color: var(--text-primary);
  line-height: 1.5;
}

/* ── PCB-green dividers ──────────────────────────────────── */
.divider {
  display: flex; align-items: center; gap: 10px;
  margin: 28px 0 18px;
  color: var(--pcb-green-bright);
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.divider::before, .divider::after {
  content: ''; flex: 1; height: 1px; background: var(--pcb-green);
}
.divider span { color: var(--silk); padding: 0 4px; }
.divider .bracket { color: var(--pcb-green-bright); }

/* ── Form fields ─────────────────────────────────────────── */
label {
  display: block;
  font-family: inherit;
  font-size: 11px;
  color: var(--brand);
  margin: 16px 0 6px 0;
  letter-spacing: 0.05em;
  position: relative;
}
.field { margin-bottom: 18px; }

/* ── Meeting-type radio fieldset (T102.6) ────────────────── */
fieldset.meeting-type-group {
  border: 1px dashed var(--border);
  border-radius: 0;
  padding: 12px 14px 8px 14px;
  margin: 0 0 18px 0;
  background: rgba(0, 212, 255, 0.02);
}
fieldset.meeting-type-group legend {
  color: var(--brand);
  font-size: 11px;
  font-family: inherit;
  letter-spacing: 0.05em;
  padding: 0 6px;
}
.meeting-type-option {
  display: block;
  color: var(--text-primary);
  font-size: 12px;
  margin: 6px 0;
  cursor: pointer;
  padding: 4px 2px;
}
.meeting-type-option input[type="radio"] {
  accent-color: var(--brand);
  margin-right: 8px;
  vertical-align: -1px;
}

select, input[type=date], input[type=text], input[type=email], input[type=tel], textarea {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 0;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  -webkit-appearance: none;
  appearance: none;
}
textarea { resize: vertical; min-height: 84px; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: var(--text-muted); opacity: 0.85; }

select { cursor: pointer; padding-right: 32px; }
select option { background: var(--surface-2); color: var(--text-primary); }

/* ── Slot grid (preserves existing class names) ──────────── */
.slot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
  margin: .5rem 0 1rem 0;
  min-height: 2.75rem;
}
.slot-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 10px 6px;
  font-family: inherit;
  font-size: 12px;
  border-radius: 0;
  cursor: pointer;
  text-align: center;
  transition: all 0.18s;
  position: relative;
}
.slot-btn.unavailable, .slot-btn.unavailable:hover {
  background: var(--surface-2);
  color: var(--text-muted);
  border-color: var(--border);
  cursor: default; opacity: 0.55;
  text-decoration: line-through;
  box-shadow: none;
}

.muted-row { color: var(--text-secondary); font-size: .875rem; padding: .5rem 0; }

/* ── Primary button (CTA) ─────────────────────────────────── */
button.primary, button.danger {
  width: 100%;
  background: var(--surface-2);
  color: var(--brand);
  border: 1px solid var(--brand);
  border-radius: 0;
  padding: 14px 16px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
  margin-top: 12px;
  text-align: left;
  transition: all 0.25s;
  position: relative; overflow: hidden;
}
button.primary:disabled, button.danger:disabled { opacity: .5; cursor: not-allowed; }
button.danger {
  border-color: var(--danger); color: var(--danger);
}

.hidden { display: none; }
.error { color: var(--danger); font-size: .875rem; margin-top: .75rem; }
.success { color: var(--ok); }

/* T104.4 :: pricing + manage-link legibility bumps. */
#service-price {
  color: var(--text-primary);
  font-weight: 600;
  letter-spacing: 0.02em;
}
#manage-link, [data-testid="manage-link"] {
  color: var(--text-secondary);
  font-weight: 600;
  word-break: break-all;
}

/* ── Footnote ────────────────────────────────────────────── */
.footnote {
  margin-top: 18px;
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.6;
  letter-spacing: 0.02em;
}
.footnote a {
  color: var(--pcb-green-bright);
  text-decoration: none;
  border-bottom: 1px dotted var(--pcb-green);
}
.footnote .dot { color: var(--text-muted); margin: 0 6px; }

/* ── Lore panel (silkscreen-tag click reveal) ────────────── */
.lore-panel {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  width: min(440px, 90vw);
  background: var(--bg-card);
  border: 1px solid var(--brand);
  padding: 24px 26px;
  font-size: 12px;
  line-height: 1.7;
  color: var(--text-primary);
  opacity: 0; pointer-events: none;
  z-index: 10002;
  transition: opacity 0.18s, transform 0.18s;
}
.lore-panel.open { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%) scale(1); }
.lore-panel h3 {
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--silk);
  font-weight: 700;
  margin-bottom: 14px;
  text-transform: uppercase;
}
.lore-panel p { margin-bottom: 10px; color: var(--text-primary); }
.lore-panel p.dim { color: var(--text-secondary); margin-top: 14px; font-size: 11px; }
.lore-panel .close-x {
  position: absolute; top: 8px; right: 12px;
  background: transparent; border: none;
  color: var(--text-muted); cursor: pointer;
  font-family: inherit; font-size: 14px;
  padding: 4px 6px;
}

.lore-backdrop {
  position: fixed; inset: 0;
  background: rgba(5, 8, 16, 0.7);
  z-index: 10001;
  opacity: 0; pointer-events: none;
  transition: opacity 0.18s;
}
.lore-backdrop.open { opacity: 1; pointer-events: auto; }

/* ── Theme toggle button (T104.5) ─────────────────────────── */
.theme-toggle {
  position: fixed; top: 16px; left: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  padding: 6px;
  background: var(--card);
  border: 1px solid var(--brand);
  color: var(--brand);
  cursor: pointer;
  z-index: 10001;
}
.theme-toggle:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
.theme-toggle svg { width: 22px; height: 22px; display: block; }
/* Toggle pattern: show the icon for the OPPOSITE mode, signaling what
 * clicking will switch you TO. Night shows sun (click to switch to day),
 * day shows moon (click to switch to night). */
.theme-toggle .icon-sun { display: block; }
.theme-toggle .icon-moon { display: none; }
body.day .theme-toggle .icon-sun { display: none; }
body.day .theme-toggle .icon-moon { display: block; }

/* ── Built by paircoder badge (T105.7). Fixed corner overlay so it
 * never adds to layout height. Wrapper pointer-events:none keeps it
 * from intercepting clicks; the inner anchor re-enables them. */
.bbpc-footer {
  position: fixed; right: 12px; bottom: 12px; z-index: 5;
  margin: 0; pointer-events: none;
}
.bbpc-badge {
  display: inline-block; margin: 0; pointer-events: auto;
  opacity: 0.35; transition: opacity 150ms ease;
}
.bbpc-badge:hover, .bbpc-badge:focus { opacity: 1; }
.bbpc-badge img { display: block; height: 24px; }

/* ── Mobile ──────────────────────────────────────────────── */
@media (max-width: 480px) {
  .card { padding: 24px 18px; }
  h1 { font-size: 22px; }
  .slot-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
  .theme-toggle { width: 32px; height: 32px; }
}
