/* Command Deck · Field Notes · Lore Chronicle · Server Atlas · Scan mode */

/* ── Site chrome: edition ribbon + sticky nav (no overlap) ── */
:root {
  --tmf-ribbon-h: 38px;
  --tmf-nav-sections-h: 46px;
  --tmf-nav-utilities-h: 44px;
  --tmf-chrome-stack: calc(var(--tmf-ribbon-h) + var(--tmf-nav-sections-h) + var(--tmf-nav-utilities-h));
}

body:not(.tmf-locked) .edition-ribbon {
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  max-width: 100%;
  transform: none;
  justify-content: center;
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-top: none;
  min-height: var(--tmf-ribbon-h);
  padding: 8px 14px;
  box-sizing: border-box;
}

body:not(.tmf-locked) .tmf-counter-pair--archive {
  z-index: 170;
}

body:not(.tmf-locked) .site-chrome {
  position: sticky;
  top: var(--tmf-ribbon-h);
  z-index: 140;
}

body:not(.tmf-locked) .realm-nav {
  position: relative;
  top: auto;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 0;
  max-width: 100%;
}

.realm-nav-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  padding: 8px clamp(10px, 2.5vw, 18px);
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(201, 162, 39, 0.35) transparent;
}

.realm-nav-sections {
  min-height: var(--tmf-nav-sections-h);
  border-bottom: 1px solid rgba(201, 162, 39, 0.08);
}

.realm-nav-utilities {
  min-height: var(--tmf-nav-utilities-h);
  flex-wrap: wrap;
  justify-content: center;
  row-gap: 8px;
}

.realm-nav-utilities .nav-divider {
  display: none;
}

@media (min-width: 900px) {
  .realm-nav-utilities {
    flex-wrap: nowrap;
    justify-content: center;
  }
  .realm-nav-utilities .nav-divider {
    display: block;
  }
}

body:not(.tmf-locked) .section {
  scroll-margin-top: calc(var(--tmf-chrome-stack) + 16px);
}

body:not(.tmf-locked) .hero {
  scroll-margin-top: calc(var(--tmf-chrome-stack) + 8px);
}

/* ── Night scan (phosphor dossier mode) ── */
body.tmf-scan-mode {
  filter: saturate(0.85) contrast(1.08) hue-rotate(8deg);
}
body.tmf-scan-mode .hero,
body.tmf-scan-mode .wrapper,
body.tmf-scan-mode .realm-nav {
  box-shadow: inset 0 0 120px rgba(74, 200, 120, 0.04);
}
body.tmf-scan-mode .node.open,
body.tmf-scan-mode .cv-card.is-selected,
body.tmf-scan-mode .map-node-group.map-active .lore-node-circle {
  box-shadow: 0 0 24px rgba(120, 220, 160, 0.25);
}
body.tmf-scan-mode .command-deck,
body.tmf-scan-mode .field-notes,
body.tmf-scan-mode .lore-chronicle,
body.tmf-scan-mode .server-atlas {
  border-color: rgba(120, 200, 150, 0.2);
}

/* ── Command deck ── */
.command-deck {
  margin: 2rem 0 2.5rem;
  padding: 1.25rem 1.35rem 1.5rem;
  border: 1px solid rgba(201, 162, 39, 0.22);
  background: linear-gradient(145deg, rgba(12, 10, 8, 0.92), rgba(20, 16, 12, 0.75));
  position: relative;
}
.command-deck::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 3px,
    rgba(201, 162, 39, 0.03) 3px,
    rgba(201, 162, 39, 0.03) 4px
  );
  pointer-events: none;
}
.command-deck-lead {
  font-size: 0.95rem;
  color: var(--text-dim);
  margin: 0 0 1.1rem;
  max-width: 52rem;
}
.deck-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 10px;
  position: relative;
  z-index: 1;
}
.deck-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 4px;
  min-height: 72px;
  padding: 12px 14px;
  border: 1px solid rgba(201, 162, 39, 0.2);
  background: rgba(0, 0, 0, 0.35);
  font-family: 'Cinzel', serif;
  text-align: left;
  cursor: default;
}
.deck-tile-action {
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
}
.deck-tile-action:hover,
.deck-tile-action:focus-visible {
  border-color: rgba(201, 162, 39, 0.5);
  background: rgba(201, 162, 39, 0.1);
  transform: translateY(-1px);
}
.deck-tile-action.active {
  border-color: rgba(120, 200, 150, 0.55);
  background: rgba(80, 160, 110, 0.12);
}
.deck-tile-label {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text);
}
.deck-tile-value {
  font-family: 'Special Elite', monospace;
  font-size: 1.05rem;
  color: var(--accent);
}
.deck-tile-hint {
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.deck-fab {
  position: fixed;
  right: 18px;
  bottom: 88px;
  z-index: 900;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(201, 162, 39, 0.45);
  background: rgba(8, 6, 4, 0.92);
  color: var(--accent);
  font-size: 1.1rem;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
  transition: transform 0.2s, border-color 0.2s;
}
.deck-fab:hover {
  transform: scale(1.06);
  border-color: rgba(201, 162, 39, 0.75);
}
body.tmf-locked .deck-fab {
  display: none;
}

/* ── Folio pin ── */
.node-top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.folio-pin {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 0.85rem;
  opacity: 0.35;
  padding: 2px 4px;
  line-height: 1;
  transition: opacity 0.2s, transform 0.15s;
}
.folio-pin:hover,
.folio-pin:focus-visible {
  opacity: 0.85;
  transform: scale(1.1);
}
.folio-pin.is-pinned {
  opacity: 1;
  filter: drop-shadow(0 0 6px rgba(201, 162, 39, 0.5));
}

/* ── Field notes ── */
.field-notes .fn-lead,
.lore-chronicle .lc-lead,
.server-atlas .sa-lead {
  max-width: 52rem;
  color: var(--text-dim);
  margin-bottom: 1.25rem;
}
.fn-panels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}
.fn-panel {
  border: 1px solid rgba(201, 162, 39, 0.15);
  padding: 1rem 1.1rem 1.2rem;
  background: rgba(0, 0, 0, 0.28);
}
.fn-panel-title {
  font-family: 'Cinzel Decorative', serif;
  font-size: 0.78rem;
  letter-spacing: 0.2em;
  color: var(--accent);
  margin: 0 0 0.75rem;
}
.fn-count {
  color: var(--text-muted);
  font-family: 'Special Elite', monospace;
}
.fn-fragment-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.fn-fragment-row {
  display: flex;
  align-items: stretch;
  gap: 4px;
}
.fn-fragment-btn {
  flex: 1;
  text-align: left;
  padding: 8px 10px;
  border: 1px solid rgba(201, 162, 39, 0.12);
  background: rgba(201, 162, 39, 0.04);
  color: var(--text);
  font-family: 'EB Garamond', serif;
  font-size: 0.92rem;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.fn-fragment-btn:hover {
  border-color: rgba(201, 162, 39, 0.35);
  background: rgba(201, 162, 39, 0.1);
}
.fn-unpin {
  width: 32px;
  border: 1px solid rgba(139, 48, 56, 0.25);
  background: rgba(139, 48, 56, 0.08);
  color: #c9a227;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
}
.fn-empty {
  font-size: 0.88rem;
  color: var(--text-muted);
  font-style: italic;
  margin: 0;
}
.fn-clear {
  margin-top: 0.75rem;
  font-family: 'Cinzel', serif;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: 1px solid rgba(201, 162, 39, 0.2);
  background: transparent;
  color: var(--text-muted);
  padding: 6px 10px;
  cursor: pointer;
}
.fn-clear:hover {
  color: var(--text);
  border-color: rgba(201, 162, 39, 0.4);
}

/* ── Lore chronicle ── */
.lc-track {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 2px;
  padding: 1rem 0 0.5rem;
  overflow-x: auto;
  scrollbar-width: thin;
}
.lc-event {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 88px;
  padding: 10px 12px;
  border: 1px solid rgba(201, 162, 39, 0.18);
  background: rgba(0, 0, 0, 0.3);
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s;
}
.lc-event:hover {
  border-color: rgba(201, 162, 39, 0.45);
  transform: translateY(-2px);
}
.lc-year {
  font-family: 'Special Elite', monospace;
  font-size: 1rem;
  color: var(--accent);
}
.lc-label {
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: center;
  max-width: 100px;
  line-height: 1.25;
}
.lc-connector {
  color: rgba(201, 162, 39, 0.25);
  font-size: 0.75rem;
  padding: 0 2px;
  user-select: none;
}

/* ── Server atlas ── */
.sa-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.sa-card {
  padding: 1.1rem 1.15rem 1.2rem;
  border: 1px solid rgba(201, 162, 39, 0.18);
  background: rgba(0, 0, 0, 0.32);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.sa-card:hover {
  border-color: rgba(201, 162, 39, 0.38);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}
.sa-icon {
  font-size: 1.5rem;
  display: block;
  margin-bottom: 0.5rem;
}
.sa-title {
  font-family: 'Cinzel', serif;
  font-size: 0.95rem;
  margin: 0 0 0.45rem;
  color: var(--text);
}
.sa-desc {
  font-size: 0.88rem;
  color: var(--text-dim);
  margin: 0 0 0.85rem;
  line-height: 1.45;
}
.sa-open {
  font-family: 'Cinzel', serif;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: none;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  padding: 0;
}
.sa-open:hover {
  text-decoration: underline;
}
.sa-tone-amber { border-left: 3px solid rgba(201, 162, 39, 0.5); }
.sa-tone-teal { border-left: 3px solid rgba(90, 122, 106, 0.55); }
.sa-tone-blue { border-left: 3px solid rgba(74, 106, 138, 0.55); }
.sa-tone-red { border-left: 3px solid rgba(139, 48, 56, 0.55); }
.sa-tone-gray { border-left: 3px solid rgba(90, 85, 80, 0.55); }
.sa-tone-coral { border-left: 3px solid rgba(139, 90, 66, 0.55); }

@media (max-width: 720px) {
  .deck-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .deck-fab {
    bottom: 72px;
    right: 12px;
  }
}
