/**
 * The Green Anchor — Illustrated Agent Roster
 * Theme: Editorial Atlas & Storybook Technology
 */

/* ==========================================================================
   CSS CUSTOM PROPERTIES / DESIGN SYSTEM
   ========================================================================== */
:root {
  /* Dark Atlas Theme (Default) */
  --bg-deep: #070c0e;
  --bg-canvas: #0b1216;
  --bg-surface: #10191e;
  --bg-surface-hover: #152229;
  --bg-surface-active: #1b2b34;
  --bg-card: rgba(16, 25, 30, 0.92);
  --bg-card-border: rgba(16, 185, 129, 0.16);
  --bg-modal: #0d151a;
  --bg-overlay: rgba(4, 7, 9, 0.85);

  /* Borders & Accents */
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-medium: rgba(255, 255, 255, 0.14);
  --border-gilded: rgba(212, 175, 55, 0.28);
  --border-emerald: rgba(16, 185, 129, 0.35);

  /* Brand Emerald & Verdigris */
  --emerald-300: #6ee7b7;
  --emerald-400: #34d399;
  --emerald-500: #10b981;
  --emerald-600: #059669;
  --emerald-glow: rgba(16, 185, 129, 0.15);
  --emerald-badge-bg: rgba(16, 185, 129, 0.12);

  /* Antique Brass / Gold */
  --gold-300: #fde047;
  --gold-400: #e5c158;
  --gold-500: #d4af37;
  --gold-600: #b48c1e;
  --gold-badge-bg: rgba(212, 175, 55, 0.12);

  /* Guild Color Coding */
  --guild-ops-color: #38bdf8;
  --guild-ops-bg: rgba(56, 189, 248, 0.12);
  --guild-ops-border: rgba(56, 189, 248, 0.28);

  --guild-eng-color: #34d399;
  --guild-eng-bg: rgba(52, 211, 153, 0.12);
  --guild-eng-border: rgba(52, 211, 153, 0.28);

  --guild-res-color: #a78bfa;
  --guild-res-bg: rgba(167, 139, 250, 0.12);
  --guild-res-border: rgba(167, 139, 250, 0.28);

  --guild-rev-color: #fb923c;
  --guild-rev-bg: rgba(251, 146, 60, 0.12);
  --guild-rev-border: rgba(251, 146, 60, 0.28);

  --guild-cre-color: #f472b6;
  --guild-cre-bg: rgba(244, 114, 182, 0.12);
  --guild-cre-border: rgba(244, 114, 182, 0.28);

  /* Typography Colors */
  --text-pure: #ffffff;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-faint: #64748b;
  --text-inverse: #070c0e;

  /* Typography Stacks */
  --font-serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Spacing & Radii */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 18px;
  --radius-full: 9999px;

  /* Shadows & Illuminations */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.25);
  --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.5), 0 0 1px 1px var(--border-subtle);
  --shadow-card-hover: 0 20px 40px -12px rgba(0, 0, 0, 0.7), 0 0 20px -2px var(--emerald-glow), 0 0 1px 1px var(--emerald-500);
  --shadow-modal: 0 25px 60px -15px rgba(0, 0, 0, 0.8), 0 0 30px rgba(16, 185, 129, 0.15);

  /* Layout */
  --max-width: 1280px;
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-slow: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Light Theme: Antiquarian Vellum & Printer's Ink */
[data-theme="light"] {
  --bg-deep: #f2ede4;
  --bg-canvas: #fbf8f3;
  --bg-surface: #ffffff;
  --bg-surface-hover: #f7f3ec;
  --bg-surface-active: #eee8dc;
  --bg-card: rgba(255, 255, 255, 0.94);
  --bg-card-border: rgba(13, 105, 85, 0.18);
  --bg-modal: #faf7f2;
  --bg-overlay: rgba(25, 20, 15, 0.6);

  --border-subtle: rgba(40, 30, 20, 0.08);
  --border-medium: rgba(40, 30, 20, 0.16);
  --border-gilded: rgba(160, 110, 25, 0.3);
  --border-emerald: rgba(13, 105, 85, 0.3);

  --emerald-300: #0f766e;
  --emerald-400: #0d6955;
  --emerald-500: #047857;
  --emerald-600: #065f46;
  --emerald-glow: rgba(4, 120, 87, 0.12);
  --emerald-badge-bg: rgba(4, 120, 87, 0.08);

  --gold-300: #a16207;
  --gold-400: #854d0e;
  --gold-500: #92400e;
  --gold-600: #713f12;
  --gold-badge-bg: rgba(146, 64, 14, 0.08);

  --guild-ops-color: #0369a1;
  --guild-ops-bg: rgba(3, 105, 161, 0.08);
  --guild-ops-border: rgba(3, 105, 161, 0.25);

  --guild-eng-color: #047857;
  --guild-eng-bg: rgba(4, 120, 87, 0.08);
  --guild-eng-border: rgba(4, 120, 87, 0.25);

  --guild-res-color: #6d28d9;
  --guild-res-bg: rgba(109, 40, 217, 0.08);
  --guild-res-border: rgba(109, 40, 217, 0.25);

  --guild-rev-color: #c2410c;
  --guild-rev-bg: rgba(194, 65, 12, 0.08);
  --guild-rev-border: rgba(194, 65, 12, 0.25);

  --guild-cre-color: #be185d;
  --guild-cre-bg: rgba(190, 24, 93, 0.08);
  --guild-cre-border: rgba(190, 24, 93, 0.25);

  --text-pure: #111827;
  --text-main: #1e293b;
  --text-muted: #475569;
  --text-faint: #64748b;
  --text-inverse: #fbf8f3;

  --shadow-sm: 0 2px 4px rgba(40, 30, 20, 0.05);
  --shadow-card: 0 6px 18px -4px rgba(40, 30, 20, 0.08), 0 0 1px 1px var(--border-subtle);
  --shadow-card-hover: 0 16px 32px -8px rgba(40, 30, 20, 0.14), 0 0 16px -2px var(--emerald-glow), 0 0 1px 1px var(--emerald-500);
  --shadow-modal: 0 25px 50px -12px rgba(25, 20, 15, 0.3), 0 0 25px rgba(4, 120, 87, 0.1);
}

/* ==========================================================================
   RESET & BASE STYLES
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-canvas);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 50% 0%, var(--emerald-glow) 0%, transparent 45%),
    linear-gradient(to right, var(--border-subtle) 1px, transparent 1px),
    linear-gradient(to bottom, var(--border-subtle) 1px, transparent 1px);
  background-size: 100% 100%, 72px 72px, 72px 72px;
  background-position: 0 0, center top, center top;
}

body.modal-open {
  overflow: hidden;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--emerald-400);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--emerald-300);
}

button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

/* Accessible utility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.is-hidden {
  display: none !important;
}

/* ==========================================================================
   LAYOUT CONTAINER
   ========================================================================== */
.site-wrapper {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem 4rem 1.5rem;
}

@media (max-width: 640px) {
  .site-wrapper {
    padding: 0 1rem 3rem 1rem;
  }
}

/* ==========================================================================
   TOP MASTHEAD & NAVIGATION
   ========================================================================== */
.top-masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 2.5rem;
  position: relative;
}

.masthead-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  text-decoration: none;
}

.brand-icon-wrap {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-emerald);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 12px var(--emerald-glow);
  color: var(--emerald-400);
  transition: transform var(--transition-fast);
}

.masthead-brand:hover .brand-icon-wrap {
  transform: rotate(-8deg) scale(1.05);
}

.brand-title-group {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-pure);
  text-transform: uppercase;
}

.brand-name span {
  color: var(--emerald-400);
}

.brand-tagline {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.masthead-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-right: 0.5rem;
}

.top-nav-link {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

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

@media (max-width: 768px) {
  .top-nav {
    display: none;
  }
}

/* Theme Toggle Button */
.theme-toggle-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold-400);
  transition: all var(--transition-fast);
}

.theme-toggle-btn:hover {
  background: var(--bg-surface-hover);
  border-color: var(--gold-500);
  transform: translateY(-1px);
}

.theme-toggle-btn .icon-moon {
  display: none;
}

[data-theme="light"] .theme-toggle-btn .icon-sun {
  display: none;
}

[data-theme="light"] .theme-toggle-btn .icon-moon {
  display: block;
  color: var(--emerald-500);
}

/* Random Astrolabe Button */
.astrolabe-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.95rem;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-gilded);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--gold-400);
  letter-spacing: 0.04em;
  transition: all var(--transition-fast);
}

.astrolabe-btn:hover {
  background: var(--bg-surface-hover);
  border-color: var(--gold-500);
  color: var(--gold-300);
  transform: translateY(-1px);
}

@media (max-width: 640px) {
  .astrolabe-btn span {
    display: none;
  }
  .astrolabe-btn {
    padding: 0.55rem;
    width: 40px;
    height: 40px;
    justify-content: center;
  }
}

/* ==========================================================================
   HERO / EDITORIAL PROLOGUE
   ========================================================================== */
.hero-editorial {
  position: relative;
  padding: 2rem 0 3.5rem 0;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 3rem;
}

.hero-foliomark {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--emerald-400);
  background: var(--emerald-badge-bg);
  border: 1px solid var(--border-emerald);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  margin-bottom: 1.25rem;
}

.hero-foliomark svg {
  color: var(--gold-400);
}

.hero-title {
  font-family: var(--font-serif);
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.01em;
  color: var(--text-pure);
  margin-bottom: 1.25rem;
  max-width: 900px;
}

.hero-title em {
  font-style: italic;
  font-weight: 400;
  color: var(--emerald-400);
}

.hero-standfirst {
  font-size: clamp(1.05rem, 1.8vw, 1.25rem);
  color: var(--text-muted);
  max-width: 780px;
  line-height: 1.65;
  margin-bottom: 2rem;
}

/* Operational Matrix Badges (No fake telemetry) */
.hero-parameters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  padding: 1.25rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.param-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding-left: 0.75rem;
  border-left: 2px solid var(--emerald-500);
}

.param-item:nth-child(2) {
  border-left-color: var(--guild-ops-color);
}
.param-item:nth-child(3) {
  border-left-color: var(--guild-res-color);
}
.param-item:nth-child(4) {
  border-left-color: var(--gold-400);
}

.param-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
}

.param-value {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-pure);
}

/* ==========================================================================
   ROSTER TOOLBAR: FILTERS, SEARCH & VIEW TOGGLE
   ========================================================================== */
.roster-toolbar {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-bottom: 2.25rem;
}

.toolbar-top-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

/* Filter Pills Group */
.filter-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.filter-btn {
  padding: 0.45rem 0.95rem;
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.03em;
  background: var(--bg-surface);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  transition: all var(--transition-fast);
}

.filter-btn:hover {
  background: var(--bg-surface-hover);
  color: var(--text-pure);
  border-color: var(--border-medium);
}

.filter-btn.is-active {
  background: var(--emerald-badge-bg);
  color: var(--emerald-400);
  border-color: var(--emerald-500);
  box-shadow: 0 0 10px var(--emerald-glow);
}

.filter-btn .count-badge {
  font-size: 0.72rem;
  opacity: 0.7;
  margin-left: 0.35rem;
}

/* Search & View Controls */
.toolbar-controls-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.search-box-wrap {
  position: relative;
  flex: 1;
  max-width: 440px;
  min-width: 260px;
}

.search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 0.6rem 2.2rem 0.6rem 2.5rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  color: var(--text-pure);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.search-input::placeholder {
  color: var(--text-faint);
}

.search-input:focus {
  outline: none;
  border-color: var(--emerald-500);
  box-shadow: 0 0 12px var(--emerald-glow);
}

.search-clear-btn {
  position: absolute;
  right: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--border-subtle);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  line-height: 1;
  transition: background var(--transition-fast);
}

.search-clear-btn:hover {
  background: var(--border-medium);
  color: var(--text-pure);
}

.view-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.roster-count {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.view-toggle-group {
  display: flex;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 2px;
}

.view-toggle-btn {
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.view-toggle-btn:hover {
  color: var(--text-pure);
}

.view-toggle-btn.is-active {
  background: var(--bg-surface-active);
  color: var(--emerald-400);
  box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   12 AGENT CARDS GRID (ILLUSTRATED PLATES)
   ========================================================================== */
.roster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.75rem;
  margin-bottom: 4rem;
}

@media (max-width: 420px) {
  .roster-grid {
    grid-template-columns: 1fr;
  }
}

/* Character Plate Card */
.agent-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition-normal), box-shadow var(--transition-normal), border-color var(--transition-normal);
  cursor: pointer;
  outline: none;
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.agent-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--border-gilded), transparent);
  opacity: 0.6;
  transition: opacity var(--transition-fast);
}

.agent-card:hover, .agent-card:focus-visible {
  transform: translateY(-4px);
  border-color: var(--border-emerald);
  box-shadow: var(--shadow-card-hover);
}

.agent-card:focus-visible {
  outline: 2px solid var(--emerald-400);
  outline-offset: 2px;
}

.agent-card:hover::before {
  opacity: 1;
  background: linear-gradient(90deg, transparent, var(--emerald-400), transparent);
}

/* Card Header Strip */
.card-meta-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.plate-tag {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold-400);
}

.guild-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  text-transform: uppercase;
}

.guild-operations {
  background: var(--guild-ops-bg);
  color: var(--guild-ops-color);
  border: 1px solid var(--guild-ops-border);
}

.guild-engineering {
  background: var(--guild-eng-bg);
  color: var(--guild-eng-color);
  border: 1px solid var(--guild-eng-border);
}

.guild-research {
  background: var(--guild-res-bg);
  color: var(--guild-res-color);
  border: 1px solid var(--guild-res-border);
}

.guild-review {
  background: var(--guild-rev-bg);
  color: var(--guild-rev-color);
  border: 1px solid var(--guild-rev-border);
}

.guild-creative {
  background: var(--guild-cre-bg);
  color: var(--guild-cre-color);
  border: 1px solid var(--guild-cre-border);
}

/* Portrait Frame Container */
.portrait-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 1.15rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.4);
}

.portrait-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

.agent-card:hover .portrait-frame img {
  transform: scale(1.04);
}

/* Ornate corner marks on illustration */
.portrait-frame::after {
  content: '';
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  pointer-events: none;
  border-radius: calc(var(--radius-md) - 4px);
}

/* Card Body */
.card-content {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.agent-name-title {
  margin-bottom: 0.5rem;
}

.agent-name {
  font-family: var(--font-serif);
  font-size: 1.65rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-pure);
  margin-bottom: 0.2rem;
}

.agent-role {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--emerald-400);
}

.agent-station-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  background: var(--bg-surface-active);
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.85rem;
  align-self: flex-start;
}

.agent-station-pill svg {
  color: var(--gold-400);
  flex-shrink: 0;
}

.agent-concise {
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--text-muted);
  margin-bottom: 1.15rem;
  flex: 1;
}

/* Capabilities list chips */
.card-capabilities {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1.25rem;
}

.cap-chip {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-faint);
}

/* Inspect Action Footer */
.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border-subtle);
  margin-top: auto;
}

.inspect-cue {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-pure);
  transition: color var(--transition-fast), gap var(--transition-fast);
}

.agent-card:hover .inspect-cue {
  color: var(--emerald-400);
  gap: 0.6rem;
}

.card-touchpoint-count {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-faint);
}

/* ==========================================================================
   LEDGER / FIELD DIRECTORY VIEW
   ========================================================================== */
.ledger-view {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  margin-bottom: 4rem;
}

.ledger-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.ledger-table th {
  padding: 0.95rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  background: var(--bg-surface-active);
  border-bottom: 1px solid var(--border-subtle);
}

.ledger-row {
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--transition-fast);
}

.ledger-row:hover {
  background: var(--bg-surface-hover);
}

.ledger-cell {
  padding: 0.95rem 1rem;
  vertical-align: middle;
}

.ledger-plate-code {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--gold-400);
  font-weight: 600;
}

.ledger-profile-cell {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.ledger-avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  border: 1px solid var(--border-medium);
}

.ledger-name {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-pure);
}

.ledger-role {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--emerald-400);
}

.ledger-station {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.ledger-concise {
  font-size: 0.84rem;
  color: var(--text-muted);
  max-width: 320px;
}

.ledger-inspect-btn {
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-md);
  background: var(--bg-surface-active);
  border: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-pure);
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.ledger-inspect-btn:hover {
  background: var(--emerald-badge-bg);
  border-color: var(--emerald-500);
  color: var(--emerald-400);
}

@media (max-width: 860px) {
  .ledger-concise-header,
  .ledger-concise-cell {
    display: none;
  }
}

@media (max-width: 640px) {
  .ledger-station-header,
  .ledger-station-cell {
    display: none;
  }
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 4rem 1.5rem;
  background: var(--bg-surface);
  border: 1px dashed var(--border-medium);
  border-radius: var(--radius-lg);
  margin-bottom: 4rem;
}

.empty-icon {
  color: var(--gold-400);
  margin-bottom: 1rem;
}

.empty-title {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  color: var(--text-pure);
  margin-bottom: 0.5rem;
}

.empty-desc {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
}

.reset-btn {
  padding: 0.55rem 1.25rem;
  background: var(--emerald-badge-bg);
  border: 1px solid var(--emerald-500);
  color: var(--emerald-400);
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  transition: all var(--transition-fast);
}

.reset-btn:hover {
  background: var(--emerald-500);
  color: var(--text-inverse);
}

/* ==========================================================================
   TOPOLOGY & GUILDS ("THE FIVE CIRCLES")
   ========================================================================== */
.topology-section {
  padding: 3rem 0;
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 4rem;
}

.section-head {
  margin-bottom: 2rem;
}

.section-kicker {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--emerald-400);
  margin-bottom: 0.5rem;
}

.section-title {
  font-family: var(--font-serif);
  font-size: 2.2rem;
  color: var(--text-pure);
  margin-bottom: 0.75rem;
}

.section-standfirst {
  font-size: 1rem;
  color: var(--text-muted);
  max-width: 680px;
}

.guilds-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
}

.guild-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  transition: all var(--transition-fast);
}

.guild-card:hover {
  border-color: var(--border-emerald);
  transform: translateY(-2px);
  background: var(--bg-surface-hover);
}

.guild-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.guild-badge {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
}

.guild-card-title {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  color: var(--text-pure);
  margin-bottom: 0.35rem;
}

.guild-card-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: 1rem;
  flex: 1;
}

.guild-agents-list {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--emerald-400);
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-subtle);
}

/* ==========================================================================
   COLOPHON & ETHOS SECTION
   ========================================================================== */
.colophon-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-gilded);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  margin-bottom: 4rem;
  position: relative;
  overflow: hidden;
}

.colophon-section::before {
  content: '⚓';
  position: absolute;
  right: -20px;
  bottom: -30px;
  font-size: 14rem;
  opacity: 0.03;
  pointer-events: none;
}

.colophon-title {
  font-family: var(--font-serif);
  font-size: 1.85rem;
  color: var(--text-pure);
  margin-bottom: 1rem;
}

.colophon-content {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 2.5rem;
}

@media (max-width: 768px) {
  .colophon-content {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

.colophon-text p {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 1rem;
}

.colophon-rules {
  background: var(--bg-canvas);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.colophon-rules-title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold-400);
  margin-bottom: 0.85rem;
}

.colophon-rules-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.colophon-rules-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.colophon-rules-list span.check {
  color: var(--emerald-400);
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-faint);
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.footer-nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.footer-nav a {
  color: var(--text-muted);
}

.footer-nav a:hover {
  color: var(--emerald-400);
}

/* ==========================================================================
   CHARACTER DOSSIER / INSPECTOR DIALOG
   ========================================================================== */
dialog.folio-modal {
  position: fixed;
  inset: 0;
  margin: auto;
  max-width: 960px;
  width: 92%;
  max-height: 90vh;
  background: var(--bg-modal);
  border: 1px solid var(--border-emerald);
  border-radius: var(--radius-xl);
  color: var(--text-main);
  box-shadow: var(--shadow-modal);
  padding: 0;
  overflow: hidden;
  z-index: 9999;
}

dialog.folio-modal::backdrop {
  background: var(--bg-overlay);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.modal-dialog-inner {
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  overflow: hidden;
}

/* Modal Top Bar */
.modal-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
}

.modal-plate-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.modal-plate-code {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gold-400);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.modal-close-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-active);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.modal-close-btn:hover {
  background: var(--emerald-badge-bg);
  border-color: var(--emerald-500);
  color: var(--emerald-400);
}

/* Modal Scrollable Body */
.modal-body-scroll {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 2rem;
  padding: 1.75rem;
  overflow-y: auto;
  flex: 1;
}

@media (max-width: 768px) {
  .modal-body-scroll {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding: 1.25rem;
  }
}

/* Modal Left Column: Art Plate */
.modal-left-col {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.modal-portrait-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-surface);
  border: 2px solid var(--border-gilded);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

.modal-portrait-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.modal-station-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.modal-station-badge svg {
  color: var(--gold-400);
  flex-shrink: 0;
}

/* Prev / Next Plate Stepper */
.modal-nav-stepper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.stepper-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.stepper-btn:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-medium);
  color: var(--text-pure);
}

/* Modal Right Column: Dossier Details */
.modal-right-col {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.modal-header-block {
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 1rem;
}

.modal-agent-name {
  font-family: var(--font-serif);
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1.15;
  color: var(--text-pure);
  margin-bottom: 0.25rem;
}

.modal-agent-role {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--emerald-400);
}

.modal-ethos-quote {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.05rem;
  line-height: 1.5;
  color: var(--gold-400);
  background: var(--gold-badge-bg);
  border-left: 3px solid var(--gold-500);
  padding: 0.75rem 1rem;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.modal-summary-block {
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--text-main);
}

/* Responsibilities List */
.dossier-section-title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  margin-bottom: 0.65rem;
}

.responsibilities-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.responsibilities-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--text-muted);
}

.responsibilities-list .bullet-marker {
  color: var(--emerald-400);
  font-size: 0.75rem;
  line-height: 1.8;
  flex-shrink: 0;
}

/* Capability Tags */
.modal-capabilities-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.cap-tag {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
}

/* Touchpoint Chips (Clickable Bridges) */
.touchpoints-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.touchpoint-chip {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 0.4rem 0.75rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  text-align: left;
}

.touchpoint-chip:hover {
  background: var(--bg-surface-active);
  border-color: var(--emerald-500);
  transform: translateY(-1px);
}

.tp-name {
  font-family: var(--font-serif);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-pure);
}

.tp-role {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--emerald-400);
}

/* Modal Bottom Strip: Miniature Character Jumper */
.modal-bottom-strip {
  padding: 0.75rem 1.5rem;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.strip-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  color: var(--text-faint);
  white-space: nowrap;
}

.thumb-scroll-track {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0.2rem 0;
  scrollbar-width: thin;
}

.thumb-scroll-track::-webkit-scrollbar {
  height: 4px;
}
.thumb-scroll-track::-webkit-scrollbar-thumb {
  background: var(--border-medium);
  border-radius: 4px;
}

.thumb-nav-btn {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.thumb-nav-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb-nav-btn:hover {
  transform: scale(1.1);
  border-color: var(--emerald-400);
}

.thumb-nav-btn.is-active {
  border: 2px solid var(--emerald-400);
  box-shadow: 0 0 8px var(--emerald-glow);
}

.thumb-nav-tooltip {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-deep);
  color: var(--text-pure);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  padding: 0.2rem 0.4rem;
  border-radius: var(--radius-sm);
  pointer-events: none;
  opacity: 0;
  white-space: nowrap;
  transition: opacity var(--transition-fast);
  margin-bottom: 4px;
  border: 1px solid var(--border-subtle);
}

.thumb-nav-btn:hover .thumb-nav-tooltip {
  opacity: 1;
}

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