/* Theme: near-black space with Lego yellow as the primary colour and Lego
   blue as the secondary. Overrides Bootstrap's dark-mode variables. */
:root,
[data-bs-theme="dark"] {
  --sts-black: #07080c;
  --sts-panel: #11131b;
  --sts-border: #232737;
  --sts-yellow: #ffcf00;
  --sts-yellow-rgb: 255, 207, 0;
  --sts-blue: #006cb7;
  --sts-blue-light: #3d9be9;
  --sts-text: #e6e8ef;
  --sts-muted: #8a90a6;

  --bs-body-bg: var(--sts-black);
  --bs-body-color: var(--sts-text);
  --bs-body-font-family: "Lato", system-ui, sans-serif;
  --bs-secondary-color: var(--sts-muted);
  --bs-border-color: var(--sts-border);
  --bs-primary: var(--sts-yellow);
  --bs-primary-rgb: var(--sts-yellow-rgb);
  --bs-link-color: var(--sts-yellow);
  --bs-link-color-rgb: var(--sts-yellow-rgb);
  --bs-link-hover-color: #fff;
  --bs-link-hover-color-rgb: 255, 255, 255;
  --bs-heading-color: #fff;
}

html,
body {
  min-height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background-color: var(--sts-black);
}

/* Static starfield on its own fixed layer, so scrolling doesn't repaint it
   (background-attachment: fixed repaints the whole page on every frame). */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    radial-gradient(1px 1px at 12% 18%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 68% 32%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 38% 72%, #cfe3ff 50%, transparent 51%),
    radial-gradient(1px 1px at 86% 84%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 24% 52%, #fff6cc 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 92% 12%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 52% 8%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 4% 90%, #cfe3ff 50%, transparent 51%);
  background-size: 420px 420px;
}

main {
  flex: 1 0 auto;
}

h1,
h2,
h3,
.sts-brand {
  font-family: "Orbitron", "Lato", sans-serif;
  letter-spacing: 0.04em;
}

/* Navbar */
.sts-navbar {
  background: rgba(7, 8, 12, 0.85);
  backdrop-filter: blur(6px);
  border-bottom: 2px solid var(--sts-blue);
}

.sts-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--sts-yellow) !important;
  font-weight: 800;
  text-transform: uppercase;
}

.sts-navbar .nav-link {
  color: var(--sts-text);
}

.sts-navbar .nav-link:hover,
.sts-navbar .nav-link:focus {
  color: var(--sts-yellow);
}

.sts-navbar .nav-link.active {
  color: var(--sts-yellow);
  box-shadow: inset 0 -2px 0 var(--sts-yellow);
}

/* Home */
.sts-hero {
  padding: 18vh 0 12vh;
  text-align: center;
}

.sts-title {
  font-size: clamp(2.5rem, 8vw, 5.5rem);
  font-weight: 800;
  color: var(--sts-yellow);
  text-transform: uppercase;
  text-shadow: 0 0 24px rgba(var(--sts-yellow-rgb), 0.35);
}

.sts-hero .lead {
  color: var(--sts-blue-light);
}

/* Content pages */
.sts-page {
  padding-top: 3rem;
  padding-bottom: 3rem;
}

.sts-page h1 {
  color: var(--sts-yellow);
  margin-bottom: 1.5rem;
}

/* Footer */
.sts-footer {
  flex-shrink: 0;
  padding: 1.25rem 0;
  border-top: 1px solid var(--sts-border);
  color: var(--sts-muted);
  font-size: 0.875rem;
}

/* Star map: map and journey panel side by side on wide screens, stacked
   (map first) on narrow ones. */
.starmap-layout {
  display: grid;
  grid-template-columns: 1fr;
}

.starmap {
  position: relative;
  height: 65svh;
  min-height: 360px;
}

@media (min-width: 992px) {
  .starmap-layout {
    grid-template-columns: minmax(0, 1fr) 360px;
    height: calc(100svh - 7.5rem);
    min-height: 520px;
  }

  .starmap {
    height: 100%;
  }

  .journey-panel {
    overflow-y: auto;
    border-left: 1px solid var(--sts-border);
  }
}

.starmap-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none; /* let drags rotate the map instead of scrolling */
  user-select: none;
}

.starmap-hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0.75rem;
  text-align: center;
  color: var(--sts-muted);
  font-size: 0.8rem;
  pointer-events: none;
}

.star-modal {
  background: var(--sts-panel);
  border: 1px solid var(--sts-blue);
}

.star-modal .modal-header {
  border-bottom-color: var(--sts-border);
  align-items: flex-start;
}

.star-modal .modal-title {
  color: var(--sts-yellow);
  font-weight: 800;
  text-transform: uppercase;
  font-size: clamp(1.25rem, 4vw, 1.75rem);
}

.star-modal-subtitle {
  color: var(--sts-blue-light);
  margin-top: 0.25rem;
}

.star-section-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--sts-muted);
  margin-bottom: 0.75rem;
}

.star-schematic {
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--sts-border);
}

.star-schematic-svg {
  display: block;
  width: 100%;
  height: auto;
  font-family: "Lato", sans-serif;
}

.sch-orbit-line { stroke: var(--sts-border); stroke-width: 1; }
.sch-axis { stroke: var(--sts-muted); stroke-width: 1; }
.sch-tick { fill: var(--sts-muted); font-size: 11px; text-anchor: middle; }
.sch-hz { fill: rgba(60, 200, 120, 0.22); stroke: rgba(60, 200, 120, 0.7); stroke-width: 1; }
.sch-planet { fill: #d8deec; }
.sch-planet-candidate { fill: none; stroke: #d8deec; stroke-width: 1.25; stroke-dasharray: 2 2; }
.sch-planet-label { fill: var(--sts-text); font-size: 11px; text-anchor: middle; }
.sch-star-label { fill: #fff; font-size: 13px; font-weight: 700; }
.sch-star-type { fill: var(--sts-muted); font-size: 11px; }
.sch-note { fill: var(--sts-muted); font-size: 11px; font-style: italic; }

.star-schematic-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--sts-muted);
}

.star-schematic-legend .lg {
  display: inline-block;
  vertical-align: -1px;
  margin-right: 0.4rem;
}

.lg-hz { width: 18px; height: 10px; border-radius: 2px; background: rgba(60, 200, 120, 0.22); border: 1px solid rgba(60, 200, 120, 0.7); }
.lg-planet { width: 10px; height: 10px; border-radius: 50%; background: #d8deec; }
.lg-candidate { width: 10px; height: 10px; border-radius: 50%; border: 1.25px dashed #d8deec; }

.star-schematic-empty {
  margin: 0.75rem 0 0;
  color: var(--sts-yellow);
  font-family: "Orbitron", sans-serif;
  font-size: 0.9rem;
}

.star-props-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.star-props-grid > div {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--sts-border);
  border-radius: 6px;
  padding: 0.6rem 0.75rem;
}

.star-modal dt {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--sts-blue-light);
}

.star-modal dd {
  margin: 0.2rem 0 0;
}

.star-props-long > div {
  padding: 0.75rem 0;
  border-top: 1px solid var(--sts-border);
}

.hint-touch { display: none; }

@media (hover: none) {
  .hint-mouse { display: none; }
  .hint-touch { display: inline; }
}

.starmap-legend {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  max-width: calc(100% - 1.5rem);
  background: rgba(17, 19, 27, 0.85);
  border: 1px solid var(--sts-border);
  border-radius: 6px;
  padding: 0.35rem 0.7rem;
  font-size: 0.8rem;
}

.starmap-legend summary {
  cursor: pointer;
  color: var(--sts-blue-light);
}

.starmap-legend ul {
  list-style: none;
  margin: 0.4rem 0 0.2rem;
  padding: 0;
}

.starmap-legend li {
  margin: 0.2rem 0;
}

.starmap-legend .lg {
  display: inline-block;
  width: 18px;
  margin-right: 0.5rem;
  vertical-align: middle;
}

.lg-stalk { height: 10px; border-left: 1px solid #fff; width: 1px !important; margin-left: 8px; margin-right: 17px !important; }
.lg-cloud { height: 12px; border-radius: 50%; background: radial-gradient(rgba(120, 170, 255, 0.6), transparent 70%); }
.lg-disk { height: 8px; border-radius: 50%; border: 1px dotted rgb(214, 180, 130); }
.lg-heat { height: 3px; background: linear-gradient(90deg, rgb(120, 30, 20), rgb(255, 110, 20), rgb(255, 250, 220)); }
.lg-fuel { height: 8px; background: #006cb7; clip-path: polygon(0 0, 100% 35%, 100% 65%, 0 100%); }
.lg-fix { width: 7px !important; height: 7px; background: #e6e8ef; transform: rotate(45deg); margin-left: 5px; margin-right: 14px !important; }
.lg-heatstop { width: 9px !important; height: 9px; border-radius: 50%; background: #ff5a1f; border: 1px solid #fff; margin-left: 4px; margin-right: 13px !important; }
.lg-refuel { width: 14px !important; height: 14px; border-radius: 50%; border: 2px solid var(--sts-yellow); margin-left: 2px; margin-right: 10px !important; }

/* Journey planner */
.journey-panel {
  background: var(--sts-panel);
  padding: 1.25rem;
}

.journey-panel h2 {
  font-size: 1.05rem;
  color: var(--sts-yellow);
  text-transform: uppercase;
  margin-bottom: 1rem;
}

#journeyForm,
#ipForm {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

@media (min-width: 576px) and (max-width: 991.98px) {
  #journeyForm,
  #ipForm {
    grid-template-columns: 1fr 1fr;
  }

  .journey-stats,
  .journey-buttons {
    grid-column: 1 / -1;
  }
}

.journey-row label {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--sts-blue-light);
  margin-bottom: 0.25rem;
}

.journey-row output {
  color: var(--sts-text);
  font-weight: 400;
}

.journey-row small {
  display: block;
  color: var(--sts-muted);
  font-size: 0.75rem;
  margin-top: 0.2rem;
}

.journey-stats dl,
.journey-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem 0.75rem;
  margin: 0;
  font-size: 0.8rem;
}

.journey-stats {
  border: 1px solid var(--sts-border);
  border-radius: 6px;
  padding: 0.6rem 0.75rem;
}

.journey-panel dt {
  color: var(--sts-muted);
  font-weight: 400;
}

.journey-panel dd {
  margin: 0;
}

.journey-buttons {
  display: flex;
  gap: 0.5rem;
}

.journey-buttons .btn-warning {
  flex: 1;
  font-family: "Orbitron", sans-serif;
  font-weight: 800;
  text-transform: uppercase;
  background: var(--sts-yellow);
  border-color: var(--sts-yellow);
}

.journey-error {
  color: #ff8a65;
  font-size: 0.85rem;
  margin: 0;
}

#journeyResult {
  margin-top: 1.25rem;
}

.journey-subtitle {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--sts-muted);
  margin: 1rem 0 0.5rem;
}

.journey-route {
  color: var(--sts-yellow);
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.journey-note {
  font-size: 0.8rem;
  color: var(--sts-muted);
}

.journey-itinerary {
  font-size: 0.85rem;
  padding-left: 1.25rem;
}

.journey-itinerary li {
  margin: 0.25rem 0;
}

.journey-itinerary .it-fix { color: var(--sts-muted); }
.journey-itinerary .it-heat { color: #ff8a50; }
.journey-itinerary .it-refuel { color: var(--sts-yellow); }

.it-when {
  float: right;
  color: var(--sts-muted);
  font-size: 0.75rem;
}

/* Physics pages: article with equations, calculator alongside on wide screens */
.physics-page {
  padding-top: 2.5rem;
  padding-bottom: 3rem;
}

.physics-header h1 {
  color: var(--sts-yellow);
  font-weight: 800;
  text-transform: uppercase;
  font-size: clamp(1.6rem, 5vw, 2.4rem);
}

.physics-header .lead {
  max-width: 48rem;
}

.physics-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2rem;
  margin-top: 1.5rem;
}

@media (min-width: 992px) {
  .physics-layout {
    grid-template-columns: minmax(0, 1fr) 360px;
    align-items: start;
  }

  .physics-calculator {
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
  }
}

.physics-calculator {
  border: 1px solid var(--sts-border);
  border-radius: 8px;
  scroll-margin-top: 1rem;
}

.physics-calc-intro {
  font-size: 0.85rem;
  color: var(--sts-muted);
}

.physics-article section {
  margin-bottom: 2.25rem;
}

.physics-article h2,
.physics-profile h2 {
  font-size: 1.15rem;
  color: var(--sts-blue-light);
  margin-bottom: 0.75rem;
}

/* Long display equations scroll sideways on narrow screens rather than
   widening the page. */
.physics-article .katex-display {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.75rem 0.5rem;
  background: rgba(255, 255, 255, 0.03);
  border-left: 2px solid var(--sts-yellow);
  border-radius: 4px;
}

.physics-table {
  --bs-table-bg: transparent;
  font-size: 0.9rem;
}

.physics-figure {
  margin: 1.25rem 0 0;
}

.physics-figure figcaption {
  font-size: 0.8rem;
  color: var(--sts-muted);
  margin-top: 0.4rem;
}

.physics-profile {
  margin-top: 1rem;
}

#profileChart {
  max-width: 900px;
}

/* Line charts (src/assets/js/line-chart.js) */
.lc-wrap {
  position: relative;
}

.lc-svg {
  display: block;
  width: 100%;
  height: auto;
  font-family: "Lato", sans-serif;
  touch-action: pan-y;
}

.lc-grid { stroke: var(--sts-border); stroke-width: 1; }
.lc-axis { stroke: var(--sts-muted); stroke-width: 1; }
.lc-tick { fill: var(--sts-muted); font-size: 12px; }
.lc-label { fill: var(--sts-text); font-size: 12px; }
.lc-ref { stroke: var(--sts-yellow); stroke-width: 1.5; stroke-dasharray: 5 4; }
.lc-ref-label { fill: var(--sts-yellow); font-size: 12px; }
.lc-marker { fill: var(--sts-yellow); stroke: var(--sts-black); stroke-width: 2; }
.lc-marker-label { fill: var(--sts-text); font-size: 12px; }
.lc-direct { fill: var(--sts-text); font-size: 12px; }
.lc-cross { stroke: var(--sts-muted); stroke-width: 1; }
.lc-dot { stroke: var(--sts-black); stroke-width: 2; }

.lc-legend {
  display: flex;
  gap: 1rem;
  font-size: 0.8rem;
  margin-bottom: 0.4rem;
}

.lc-legend i,
.lc-tooltip i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 0.35rem;
}

.lc-tooltip {
  position: absolute;
  top: 0.5rem;
  pointer-events: none;
  background: rgba(17, 19, 27, 0.95);
  border: 1px solid var(--sts-border);
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  font-size: 0.8rem;
  white-space: nowrap;
}

.lc-tip-x {
  color: var(--sts-muted);
}

/* Shipyard index */
.shipyard-grid {
  list-style: none;
  padding: 0;
  margin: 2rem 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}

.shipyard-card {
  display: block;
  height: 100%;
  background: var(--sts-panel);
  border: 1px solid var(--sts-border);
  border-radius: 8px;
  overflow: hidden;
  color: var(--sts-text);
  text-decoration: none;
  transition: border-color 0.15s, transform 0.15s;
}

.shipyard-card:hover,
.shipyard-card:focus-visible {
  border-color: var(--sts-yellow);
  color: var(--sts-text);
  transform: translateY(-2px);
}

.shipyard-card img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.shipyard-card-body {
  padding: 0.9rem 1rem 1rem;
}

.shipyard-card h2 {
  font-size: 1.1rem;
  color: var(--sts-yellow);
  margin-bottom: 0.2rem;
}

.shipyard-card-reg {
  font-family: "Orbitron", sans-serif;
  font-size: 0.8rem;
  color: var(--sts-blue-light);
  margin-bottom: 0.5rem;
}

.shipyard-card-meta {
  font-size: 0.85rem;
  color: var(--sts-muted);
  margin: 0;
}

.shipyard-level {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.1rem 0.45rem;
  border-radius: 3px;
  margin-right: 0.35rem;
}

.shipyard-level-1 { background: rgba(61, 155, 233, 0.2); color: var(--sts-blue-light); }
.shipyard-level-2 { background: rgba(255, 207, 0, 0.18); color: var(--sts-yellow); }

/* Ship pages */
.ship-page {
  padding-top: 1.5rem;
  padding-bottom: 3rem;
}

.ship-breadcrumb {
  font-size: 0.85rem;
  color: var(--sts-muted);
  margin-bottom: 1rem;
}

.ship-header h1 {
  color: var(--sts-yellow);
  font-weight: 800;
  text-transform: uppercase;
  font-size: clamp(1.6rem, 5vw, 2.6rem);
  margin-bottom: 1.25rem;
}

.ship-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .ship-intro {
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    align-items: start;
  }
}

.ship-photo {
  margin: 0;
}

.ship-photo img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--sts-border);
}

.ship-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin: 0 0 1rem;
}

.ship-facts > div {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--sts-border);
  border-radius: 6px;
  padding: 0.6rem 0.75rem;
}

.ship-facts dt {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--sts-blue-light);
}

.ship-facts dd {
  margin: 0.2rem 0 0;
  font-size: 1.05rem;
}

.ship-section {
  margin-top: 2.5rem;
}

.ship-section h2 {
  font-size: 1.15rem;
  color: var(--sts-blue-light);
  margin-bottom: 1rem;
}

.ship-specs {
  --bs-table-bg: transparent;
  max-width: 40rem;
}

.ship-specs .ship-specs-group {
  color: var(--sts-yellow);
  font-family: "Orbitron", sans-serif;
  font-size: 0.85rem;
  padding-top: 1.25rem;
  border-bottom-color: var(--sts-yellow);
}

.ship-specs tbody:first-child .ship-specs-group {
  padding-top: 0.5rem;
}

.ship-specs th[scope="row"] {
  width: 55%;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--sts-blue-light);
  vertical-align: middle;
}

.ship-specs td {
  font-variant-numeric: tabular-nums;
}

.ship-specs-note {
  display: block;
  font-size: 0.7rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--sts-muted);
}

.ship-crew {
  width: 100%;
  border-collapse: collapse;
}

.ship-crew td {
  padding: 1rem 0;
  border-top: 1px solid var(--sts-border);
  vertical-align: top;
}

.ship-crew-photo {
  width: 32%;
  max-width: 320px;
  padding-right: 1.5rem !important;
}

.ship-crew-photo img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 6px;
}

.ship-crew-text h3 {
  font-size: 1rem;
  color: var(--sts-yellow);
}

.ship-crew-text p {
  margin: 0;
}

.ship-crew-details {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
}

.ship-crew-details > div {
  display: flex;
  gap: 0.4rem;
}

.ship-crew-details dt {
  font-weight: 700;
  color: var(--sts-blue-light);
}

.ship-crew-details dd {
  margin: 0;
}

/* On phones each crew row stacks: photo above its text. */
@media (max-width: 575.98px) {
  .ship-crew tr,
  .ship-crew td {
    display: block;
    width: 100%;
  }

  .ship-crew-photo {
    padding: 1rem 0 0.75rem !important;
  }

  .ship-crew-text {
    border-top: 0 !important;
    padding-top: 0 !important;
  }
}

/* Worlds (the index reuses the Shipyard card grid; world pages reuse the
   ship page layout and statistics table) */
.world-card-img,
.world-photo img {
  object-fit: contain !important;
  background: radial-gradient(circle at 50% 50%, #10131d, #05060a 70%);
}

.world-card-type {
  font-size: 0.85rem;
  margin-bottom: 0.4rem;
}

.world-tagline {
  font-size: 1.15rem;
  color: var(--sts-blue-light);
  margin-top: -0.75rem;
  margin-bottom: 1.25rem;
}

.world-summary {
  font-size: 1.1rem;
  margin-bottom: 1.25rem;
}

.world-details {
  max-width: 48rem;
}

.world-details h2 {
  font-size: 1.15rem;
  color: var(--sts-blue-light);
  margin: 2rem 0 0.75rem;
}

.world-details li {
  margin-bottom: 0.4rem;
}

.world-table {
  --bs-table-bg: transparent;
  max-width: 48rem;
  font-size: 0.95rem;
}

.world-table td:first-child {
  color: var(--sts-yellow);
}

.world-note {
  max-width: 48rem;
  color: var(--sts-muted);
  font-size: 0.9rem;
}

/* World statistics are mostly prose, so give the values more room. */
.world-page .ship-specs {
  max-width: 52rem;
}

.world-page .ship-specs th[scope="row"] {
  width: 30%;
}

.world-system-button {
  margin-bottom: 1.25rem;
}

.world-ground {
  margin: 0;
}

.world-ground img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--sts-border);
}

.world-ground figcaption {
  font-size: 0.8rem;
  color: var(--sts-muted);
  margin-top: 0.35rem;
}

/* Worlds of the setting in the system schematic */
.sch-world { fill: none; stroke: var(--sts-yellow); stroke-width: 1.5; }
.sch-world-current { stroke-width: 2.5; }
.sch-world-label { fill: var(--sts-yellow); font-size: 11px; font-weight: 700; text-anchor: middle; }
.star-schematic-svg a:hover .sch-world-label { text-decoration: underline; }
.lg-world { width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid var(--sts-yellow); }

.star-worlds {
  margin: 0.75rem 0 0;
  font-size: 0.9rem;
}

/* Factions: colour scheme bricks (src/_includes/colour-scheme.njk). Each
   colour is a 2x2 brick seen from above; the transparent one shows a
   checkerboard through it, with a glossy highlight like a canopy. */
.colour-scheme {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.75rem;
}

.colour-swatch {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brick {
  --stud-hi: color-mix(in srgb, var(--brick) 68%, white);
  --stud-lo: color-mix(in srgb, var(--brick) 70%, black);
  --stud: radial-gradient(circle, var(--stud-hi) 0 42%, var(--stud-lo) 46% 56%, transparent 60%);
  flex: none;
  width: 64px;
  height: 64px;
  border-radius: 6px;
  background-color: var(--brick);
  background-image:
    linear-gradient(145deg, rgba(255, 255, 255, 0.16), rgba(0, 0, 0, 0.28)),
    var(--stud), var(--stud), var(--stud), var(--stud);
  background-size: 100% 100%, 50% 50%, 50% 50%, 50% 50%, 50% 50%;
  background-position: 0 0, 0 0, 100% 0, 0 100%, 100% 100%;
  background-repeat: no-repeat;
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.55), inset 0 -3px 0 rgba(0, 0, 0, 0.25);
}

.brick-trans {
  --tint: color-mix(in srgb, var(--brick) 62%, transparent);
  --stud-hi: color-mix(in srgb, var(--brick) 45%, rgba(255, 255, 255, 0.6));
  --stud-lo: color-mix(in srgb, var(--brick) 80%, transparent);
  background-color: transparent;
  background-image:
    linear-gradient(135deg, rgba(255, 255, 255, 0.6) 0%, rgba(255, 255, 255, 0.12) 30%, transparent 46%),
    var(--stud), var(--stud), var(--stud), var(--stud),
    linear-gradient(var(--tint), var(--tint)),
    conic-gradient(#e4e4e4 25%, #7d7d7d 0 50%, #e4e4e4 0 75%, #7d7d7d 0);
  background-size: 100% 100%, 50% 50%, 50% 50%, 50% 50%, 50% 50%, 100% 100%, 12px 12px;
  background-position: 0 0, 0 0, 100% 0, 0 100%, 100% 100%, 0 0, 0 0;
  background-repeat: no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, repeat;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.45), inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.colour-swatch-text {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.colour-swatch-role {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--sts-blue-light);
}

.colour-swatch-name {
  font-weight: 700;
}

.colour-swatch-note {
  font-size: 0.75rem;
  color: var(--sts-muted);
}

/* Compact version for the index cards: bricks in a row, names below. */
.colour-scheme-small {
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.colour-scheme-small .colour-swatch {
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
}

.colour-scheme-small .brick {
  width: 40px;
  height: 40px;
  border-radius: 4px;
}

.colour-scheme-small .colour-swatch-name {
  font-size: 0.75rem;
  font-weight: 400;
}

.colour-scheme-small .colour-swatch-note {
  display: none;
}

/* A stripe in the faction's three colours, under page titles and on cards. */
.faction-stripe {
  display: flex;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  max-width: 22rem;
  margin: -0.5rem 0 1rem;
}

.faction-stripe span:nth-child(1) { flex: 6; background: var(--faction-base); }
.faction-stripe span:nth-child(2) { flex: 3; background: var(--faction-accent); }
.faction-stripe span:nth-child(3) {
  flex: 2;
  background: linear-gradient(color-mix(in srgb, var(--faction-trans) 65%, transparent), color-mix(in srgb, var(--faction-trans) 65%, transparent)),
    conic-gradient(#e4e4e4 25%, #7d7d7d 0 50%, #e4e4e4 0 75%, #7d7d7d 0) 0 0 / 8px 8px;
}

/* Black-based factions need an outline to show against the page. */
.faction-stripe {
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.faction-card .faction-stripe {
  max-width: none;
  margin: 0;
  border-radius: 0;
  height: 10px;
  box-shadow: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.faction-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2rem;
}

@media (min-width: 992px) {
  .faction-intro {
    grid-template-columns: minmax(0, 1fr) 320px;
    align-items: start;
  }
}

.faction-description > :first-child {
  margin-top: 0;
}

.faction-panel {
  background: var(--sts-panel);
  border: 1px solid var(--sts-border);
  border-radius: 8px;
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
}

.faction-panel h2 {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--sts-muted);
  margin-bottom: 0.6rem;
}

.faction-panel p:last-child {
  margin-bottom: 0;
}

.faction-scheme-text {
  font-size: 0.9rem;
}

.faction-fan {
  color: var(--sts-muted);
  font-style: italic;
}

.faction-photos {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}

.faction-photos figure {
  margin: 0;
}

.faction-photos img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  background: radial-gradient(circle at 50% 50%, #10131d, #05060a 70%);
  border: 1px solid var(--sts-border);
  border-radius: 8px;
}
