:root {
  --paper: #f4e1c6;
  --noto-stone: #e3c9a4;
  --surface: #fff7ea;
  --ink: #1b2820;
  --ink-soft: #4a594e;
  --fig-leaf: #244a35;
  --olive-leaf: #4c5c38;
  --terracotta-tile: #c86a49;
  --terracotta-ink: #934930;
  --sicilian-sea: #0d7886;
  --sicilian-ink: #086570;
  --warm-ochre: #87501f;
  --line: #cfb78f;
  --line-dark: #aa8c66;
  --unknown: #59625c;
  --urgent: #a73f39;
  --needs-help: #92501c;
  --in-progress: #086570;
  --to-upgrade: #2f6298;
  --chillin: #244a35;
  --shadow: 0 18px 55px rgba(36, 74, 53, 0.12);
  --shadow-hover: 0 24px 70px rgba(36, 74, 53, 0.2);
  --radius-large: 28px;
  --radius-medium: 18px;
  --serif: Georgia, 'Times New Roman', serif;
  --sans: 'Segoe UI', Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 14% 2%, rgba(36, 74, 53, 0.1), transparent 28rem),
    linear-gradient(rgba(36, 74, 53, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(36, 74, 53, 0.028) 1px, transparent 1px),
    var(--paper);
  background-size: auto, 32px 32px, 32px 32px, auto;
  color: var(--ink);
  font-family: var(--sans);
  font-size: clamp(16px, 0.45vw + 13px, 20px);
  line-height: 1.55;
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.7rem 1rem;
  border-radius: 10px;
  background: var(--ink);
  color: var(--surface);
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-shell {
  width: min(1680px, calc(100% - clamp(28px, 6vw, 120px)));
  margin: 0 auto;
}

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  min-height: 112px;
  border-bottom: 1px solid var(--line);
}

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

.brand-mark {
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
}

.brand-mark svg {
  width: 42px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1;
}

.brand-mark .needle {
  fill: var(--terracotta-tile);
  stroke: var(--terracotta-tile);
}

.eyebrow,
.section-kicker,
.edition,
.plate-number,
.card-type {
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.eyebrow {
  display: block;
  color: var(--sicilian-ink);
}

.brand-name {
  display: block;
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 700;
}

.masthead-tools {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.sync-status {
  display: inline-flex;
  align-items: center;
  min-height: 2.3rem;
  padding: 0.35rem 0.8rem;
  border: 1px solid var(--line-dark);
  border-radius: 999px;
  color: var(--ink-soft);
  background: var(--surface);
  font-size: 0.7rem;
  font-weight: 750;
  white-space: nowrap;
}

.sync-live { color: var(--fig-leaf); border-color: var(--olive-leaf); }
.sync-error { color: var(--urgent); border-color: var(--urgent); }

.edition {
  color: var(--ink-soft);
  white-space: nowrap;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: min(30vw, 390px);
  padding: 0.65rem 0.75rem 0.65rem 1rem;
  border: 1px solid var(--line-dark);
  border-radius: 999px;
  background: rgba(255, 247, 234, 0.78);
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.search-box:focus-within {
  border-color: var(--olive-leaf);
  background: var(--surface);
  box-shadow: 0 0 0 4px rgba(76, 92, 56, 0.16);
}

.search-icon {
  width: 0.85rem;
  height: 0.85rem;
  border: 2px solid var(--olive-leaf);
  border-radius: 50%;
  position: relative;
}

.search-icon::after {
  content: '';
  position: absolute;
  width: 0.45rem;
  height: 2px;
  right: -0.38rem;
  bottom: -0.18rem;
  background: var(--olive-leaf);
  transform: rotate(45deg);
}

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.search-box input::placeholder {
  color: #687269;
}

kbd {
  min-width: 1.65rem;
  padding: 0.05rem 0.4rem;
  border: 1px solid var(--line);
  border-bottom-color: var(--line-dark);
  border-radius: 7px;
  background: var(--noto-stone);
  color: var(--ink-soft);
  font-size: 0.75rem;
  text-align: center;
}

.atlas-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(390px, 0.85fr);
  gap: clamp(2rem, 7vw, 8rem);
  align-items: center;
  min-height: min(680px, calc(100vh - 112px));
  padding: clamp(3.5rem, 8vh, 7rem) 0;
}

.breadcrumbs {
  min-height: 1.6rem;
  margin-bottom: clamp(2rem, 6vh, 4.5rem);
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.breadcrumbs li:not(:last-child)::after {
  content: ' /';
  color: var(--line-dark);
  margin-left: 0.5rem;
}

.breadcrumbs a {
  text-decoration-color: transparent;
  text-underline-offset: 0.25em;
}

.breadcrumbs a:hover {
  text-decoration-color: currentColor;
}

.section-kicker {
  margin: 0 0 0.85rem;
  color: var(--terracotta-ink);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  font-family: var(--serif);
  line-height: 1.02;
}

h1 {
  max-width: 14ch;
  margin-bottom: 1.4rem;
  font-size: clamp(3.4rem, 7.2vw, 8.4rem);
  font-weight: 500;
  letter-spacing: -0.055em;
}

.hero-summary {
  max-width: 48rem;
  margin-bottom: 2rem;
  color: var(--ink-soft);
  font-family: var(--serif);
  font-size: clamp(1.15rem, 1.2vw, 1.55rem);
  line-height: 1.55;
}

.node-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  align-items: center;
}

.action-link,
.status-chip,
.deadline-chip,
.protection-chip {
  display: inline-flex;
  align-items: center;
  min-height: 2.2rem;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}

.action-link {
  gap: 0.45rem;
  border: 1px solid var(--olive-leaf);
  background: transparent;
  color: var(--olive-leaf);
  cursor: pointer;
  text-decoration: none;
}

.action-link:hover {
  background: var(--olive-leaf);
  color: var(--surface);
}

.status-chip {
  border: 1px solid color-mix(in srgb, var(--status-colour) 45%, transparent);
  background: color-mix(in srgb, var(--status-colour) 10%, transparent);
  color: var(--status-colour);
}

.status-chip::before {
  content: '';
  width: 0.5rem;
  height: 0.5rem;
  margin-right: 0.45rem;
  border-radius: 50%;
  background: currentColor;
}

.status-urgent { --status-colour: var(--urgent); }
.status-needs-help { --status-colour: var(--needs-help); }
.status-in-progress { --status-colour: var(--in-progress); }
.status-to-upgrade { --status-colour: var(--to-upgrade); }
.status-chillin { --status-colour: var(--chillin); }
.status-unknown { --status-colour: var(--unknown); }

.deadline-chip {
  border: 1px solid var(--line-dark);
  color: var(--ink-soft);
}

.protection-chip {
  border: 1px solid var(--terracotta-tile);
  background: rgba(200, 106, 73, 0.1);
  color: var(--terracotta-ink);
}

.atlas-plate {
  position: relative;
  isolation: isolate;
  min-height: 480px;
  padding: clamp(2rem, 4vw, 4rem);
  overflow: hidden;
  border-radius: var(--radius-large);
  background: var(--olive-leaf);
  box-shadow: var(--shadow);
  color: var(--surface);
}

.plate-grid,
.plate-grid::before,
.plate-grid::after {
  position: absolute;
  inset: 0;
  z-index: -1;
  content: '';
}

.plate-grid {
  opacity: 0.6;
  background:
    repeating-radial-gradient(ellipse at 92% 18%, transparent 0 24px, rgba(244, 225, 198, 0.17) 25px 27px, transparent 28px 48px),
    linear-gradient(rgba(244, 225, 198, 0.09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(244, 225, 198, 0.09) 1px, transparent 1px);
  background-size: auto, 42px 42px, 42px 42px;
}

.plate-grid::after {
  background: linear-gradient(145deg, transparent 34%, rgba(36, 74, 53, 0.9));
}

.plate-number {
  opacity: 0.75;
}

.plate-title {
  max-width: 9ch;
  margin: clamp(3rem, 8vh, 6rem) 0 2.5rem;
  font-family: var(--serif);
  font-size: clamp(2.2rem, 4vw, 4.8rem);
  line-height: 1.02;
}

.plate-compass {
  position: absolute;
  top: 2.2rem;
  right: 2.2rem;
  display: grid;
  width: 74px;
  height: 74px;
  place-items: center;
  border: 1px solid rgba(244, 225, 198, 0.48);
  border-radius: 50%;
  font-size: 0.65rem;
  font-weight: 800;
}

.plate-compass span {
  position: absolute;
  top: 0.35rem;
}

.plate-compass i {
  width: 1px;
  height: 42px;
  background: var(--surface);
  transform: rotate(24deg);
}

.plate-compass i::before {
  position: absolute;
  top: 0;
  left: -4px;
  width: 0;
  height: 0;
  border-right: 4px solid transparent;
  border-bottom: 10px solid var(--terracotta-tile);
  border-left: 4px solid transparent;
  content: '';
  transform: translateY(-3px);
}

.atlas-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin: 0;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(244, 225, 198, 0.34);
}

.atlas-stats div {
  min-width: 0;
}

.atlas-stats dt {
  margin-bottom: 0.2rem;
  opacity: 0.7;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.atlas-stats dd {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.5rem;
}

.orbit-section {
  padding: clamp(3rem, 7vw, 6rem) 0;
  border-top: 1px solid var(--line);
}

.orbit-section[hidden] { display: none; }

.orbit-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 2rem;
}

.orbit-heading h2 {
  margin: 0;
  font-size: clamp(2.3rem, 4vw, 4.8rem);
  font-weight: 500;
  letter-spacing: -0.035em;
}

.orbit-heading > p {
  max-width: 36rem;
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.88rem;
}

.orbit-frame {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-large);
  background: radial-gradient(circle at 50% 50%, #fff9ee, var(--noto-stone));
  box-shadow: var(--shadow);
}

.orbit-map {
  width: min(100%, 1000px);
  min-width: 680px;
  margin: 0 auto;
}

.orbit-map svg {
  display: block;
  width: 100%;
  height: auto;
  font-family: var(--sans);
}

.orbit-guides circle {
  fill: none;
  stroke: rgba(76, 92, 56, 0.15);
  stroke-width: 1.5;
  stroke-dasharray: 4 9;
}

.orbit-point,
.orbit-line { --orbit-colour: var(--fig-leaf); }
.branch-0 { --orbit-colour: var(--olive-leaf); }
.branch-1 { --orbit-colour: var(--sicilian-ink); }
.branch-2 { --orbit-colour: var(--terracotta-ink); }
.branch-3 { --orbit-colour: var(--warm-ochre); }

.orbit-line {
  stroke: var(--orbit-colour);
  stroke-opacity: 0.46;
  stroke-width: 2;
}

.orbit-point { cursor: pointer; }

.orbit-dot {
  fill: var(--orbit-colour);
  stroke: var(--surface);
  stroke-width: 3;
  transition: r 150ms ease, stroke-width 150ms ease;
}

.orbit-point.depth-0 .orbit-dot { fill: var(--fig-leaf); }
.orbit-point:hover .orbit-dot,
.orbit-point:focus-visible .orbit-dot { stroke-width: 6; }

.orbit-hit { fill: transparent; }

.orbit-status-ring {
  fill: none;
  stroke: var(--status-colour);
  stroke-width: 4;
}

.orbit-label {
  fill: var(--ink);
  font-size: 18px;
  font-weight: 750;
  text-anchor: middle;
  paint-order: stroke;
  stroke: var(--surface);
  stroke-width: 4;
  stroke-linejoin: round;
}

.orbit-point.depth-0 .orbit-label {
  font-family: var(--serif);
  font-size: 25px;
  font-weight: 700;
}

.orbit-point:focus-visible { outline: none; }
.orbit-point:focus-visible .orbit-hit {
  fill: none;
  stroke: var(--ink);
  stroke-width: 3;
}

.orbit-detail {
  min-height: 3.4rem;
  margin: 0;
  padding: 0.9rem 1.5rem;
  border-top: 1px solid var(--line);
  color: var(--fig-leaf);
  font-size: 0.86rem;
  font-weight: 700;
  text-align: center;
}

.gallery-section {
  padding: clamp(4rem, 9vw, 8rem) 0;
  border-top: 1px solid var(--line);
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: clamp(2rem, 5vw, 4rem);
}

.section-heading h2,
.status-ledger h2 {
  margin-bottom: 0;
  font-size: clamp(2.3rem, 4vw, 4.8rem);
  font-weight: 500;
  letter-spacing: -0.035em;
}

.result-note {
  margin: 0;
  color: var(--ink-soft);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 310px), 1fr));
  gap: clamp(1rem, 2vw, 1.8rem);
}

.gallery-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 350px;
  padding: clamp(1.5rem, 2.6vw, 2.4rem);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-medium);
  background: rgba(255, 247, 234, 0.92);
  box-shadow: 0 8px 24px rgba(36, 74, 53, 0.07);
  text-decoration: none;
  transform: translateY(0);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.gallery-card::before {
  position: absolute;
  top: -20%;
  right: -22%;
  width: 70%;
  aspect-ratio: 1;
  border: 1px solid color-mix(in srgb, var(--card-accent) 24%, transparent);
  border-radius: 42% 58% 61% 39% / 43% 38% 62% 57%;
  box-shadow:
    0 0 0 18px color-mix(in srgb, var(--card-accent) 6%, transparent),
    0 0 0 38px color-mix(in srgb, var(--card-accent) 5%, transparent),
    0 0 0 62px color-mix(in srgb, var(--card-accent) 4%, transparent);
  content: '';
  transform: rotate(17deg);
}

.gallery-card:nth-child(4n + 1) { --card-accent: var(--olive-leaf); }
.gallery-card:nth-child(4n + 2) { --card-accent: var(--sicilian-ink); }
.gallery-card:nth-child(4n + 3) { --card-accent: var(--terracotta-ink); }
.gallery-card:nth-child(4n) { --card-accent: var(--warm-ochre); }

.gallery-card:hover {
  z-index: 1;
  border-color: var(--card-accent);
  box-shadow: var(--shadow-hover);
  transform: translateY(-7px);
}

.gallery-card:focus-visible,
.action-link:focus-visible,
.brand:focus-visible,
.breadcrumbs a:focus-visible {
  outline: 4px solid color-mix(in srgb, var(--olive-leaf) 38%, transparent);
  outline-offset: 4px;
}

.card-topline,
.card-footer {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.card-type {
  color: var(--card-accent);
}

.card-mark {
  position: relative;
  z-index: 1;
  display: grid;
  width: 2.8rem;
  height: 2.8rem;
  margin: clamp(2.5rem, 5vw, 4rem) 0 1.25rem;
  place-items: center;
  border: 1px solid var(--card-accent);
  border-radius: 50%;
  color: var(--card-accent);
  font-family: var(--serif);
  font-size: 1.3rem;
}

.gallery-card h3 {
  position: relative;
  z-index: 1;
  max-width: 15ch;
  margin-bottom: 0.85rem;
  font-size: clamp(1.7rem, 2.2vw, 2.45rem);
  font-weight: 500;
}

.card-summary {
  position: relative;
  z-index: 1;
  flex: 1;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.card-footer {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.75rem;
}

.card-arrow {
  color: var(--card-accent);
  font-size: 1.3rem;
}

.inherited-note {
  display: block;
  margin-top: 0.28rem;
  color: var(--ink-soft);
  font-size: 0.68rem;
  font-weight: 600;
}

.map-notice {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  margin: -1rem 0 2rem;
  padding: 1rem 1.15rem;
  border-left: 4px solid var(--terracotta-tile);
  border-radius: 0 12px 12px 0;
  background: rgba(200, 106, 73, 0.1);
  color: var(--terracotta-ink);
}

.map-notice strong {
  display: block;
}

.empty-state {
  padding: 5rem 2rem;
  border: 1px dashed var(--line-dark);
  border-radius: var(--radius-medium);
  color: var(--ink-soft);
  text-align: center;
}

.empty-state span {
  display: block;
  color: var(--sicilian-ink);
  font-family: var(--serif);
  font-size: 4rem;
}

.empty-state h2 {
  color: var(--ink);
  font-size: 2rem;
}

.status-ledger {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(460px, 1.2fr);
  gap: clamp(2rem, 8vw, 8rem);
  align-items: start;
  padding: clamp(4rem, 8vw, 7rem) 0;
  border-top: 1px solid var(--line);
}

.status-ledger p:not(.section-kicker) {
  max-width: 46rem;
  margin-top: 1.4rem;
  color: var(--ink-soft);
}

.status-legend {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 247, 234, 0.68);
  font-size: 0.85rem;
  font-weight: 700;
}

.legend-dot {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  background: var(--status-colour);
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  padding: 2rem 0 3rem;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.8rem;
}

.site-footer p {
  margin: 0;
}

.noscript-message {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  left: 1rem;
  z-index: 10;
  padding: 1rem;
  border-radius: 12px;
  background: var(--urgent);
  color: white;
  text-align: center;
}

@media (max-width: 1000px) {
  .masthead {
    align-items: flex-start;
    padding: 1.5rem 0;
  }

  .masthead-tools {
    align-items: flex-end;
    flex-direction: column-reverse;
  }

  .atlas-hero,
  .status-ledger {
    grid-template-columns: 1fr;
  }

  .atlas-hero {
    min-height: 0;
  }

  .atlas-plate {
    min-height: 410px;
  }

  .status-ledger {
    gap: 2.5rem;
  }
}

@media (max-width: 680px) {
  .site-shell {
    width: min(100% - 30px, 1680px);
  }

  .masthead,
  .masthead-tools,
  .section-heading,
  .site-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .masthead {
    gap: 1.25rem;
  }

  .search-box {
    min-width: 0;
  }

  .edition,
  kbd {
    display: none;
  }

  h1 {
    font-size: clamp(3rem, 16vw, 5.6rem);
  }

  .breadcrumbs {
    margin-bottom: 2.5rem;
  }

  .atlas-plate {
    min-height: 370px;
  }

  .atlas-stats,
  .status-legend {
    grid-template-columns: 1fr;
  }

  .gallery-card {
    min-height: 320px;
  }

  .orbit-heading { align-items: start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  body {
    background: white;
  }

  .masthead-tools,
  .node-actions,
  .status-ledger {
    display: none;
  }

  .gallery-card,
  .atlas-plate,
  .orbit-frame {
    break-inside: avoid;
    box-shadow: none;
  }
}
