/* Geographic Core — layout shell beyond a classic header/footer stack */
:root {
  --ink: #0a1224;
  --slate: #121c33;
  --mist: #8ba3c4;
  --teal: #2dd4bf;
  --amber: #d4a853;
  --coral: #f97366;
  --paper: #f4f1ea;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: "DM Sans", system-ui, sans-serif;
  min-height: 100vh;
}

.font-serif-display {
  font-family: "Fraunces", Georgia, serif;
}

/* Subtle topographic noise */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.35'/%3E%3C/svg%3E");
  z-index: 0;
}

.shell {
  position: relative;
  z-index: 1;
  display: grid;
  min-height: 100vh;
  grid-template-columns: 4.5rem 1fr;
}

@media (min-width: 1024px) {
  .shell {
    grid-template-columns: 5.5rem 1fr;
  }
}

.rail {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem 0.35rem;
  background: linear-gradient(180deg, #0e1a32 0%, #0a1224 55%, #071018 100%);
  border-right: 1px solid rgba(45, 212, 191, 0.12);
  z-index: 40;
}

.rail-brand {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  letter-spacing: 0.35em;
  text-transform: uppercase;
  font-size: 0.65rem;
  color: var(--mist);
  margin-bottom: auto;
  padding-top: 0.5rem;
}

.rail-nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: auto;
}

.rail-link {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--mist);
  text-decoration: none;
  font-size: 0.7rem;
  font-weight: 600;
  border: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.rail-link:hover,
.rail-link:focus-visible,
.rail-link.is-active {
  color: var(--ink);
  background: var(--teal);
  border-color: rgba(255, 255, 255, 0.2);
  outline: none;
}

.main-flow {
  min-width: 0;
}

.mobile-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  background: rgba(10, 18, 36, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(45, 212, 191, 0.15);
  position: sticky;
  top: 0;
  z-index: 30;
}

@media (min-width: 768px) {
  .mobile-bar {
    display: none;
  }
}

.mobile-menu-panel {
  display: none;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.75rem 1rem 1rem;
  background: rgba(14, 26, 50, 0.98);
  border-bottom: 1px solid rgba(45, 212, 191, 0.12);
}

.mobile-menu-panel.is-open {
  display: flex;
}

.mobile-menu-panel a {
  color: var(--paper);
  text-decoration: none;
  padding: 0.6rem 0;
  border-bottom: 1px solid rgba(139, 163, 196, 0.12);
  font-size: 0.95rem;
}

.mobile-menu-panel a:last-child {
  border-bottom: none;
}

@media (min-width: 768px) {
  .rail {
    display: flex;
  }
  .mobile-menu-panel {
    display: none !important;
  }
}

@media (max-width: 767px) {
  .shell {
    grid-template-columns: 1fr;
  }
  .rail {
    display: none;
  }
}

/* Hero skew panel */
.hero-panel {
  position: relative;
  padding: clamp(2rem, 6vw, 5rem) clamp(1.25rem, 4vw, 3rem);
  background: linear-gradient(135deg, #132447 0%, #0a1c2e 45%, #062a2a 100%);
  clip-path: polygon(0 0, 100% 0, 100% 92%, 0 100%);
  margin-bottom: -2rem;
}

.hero-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 50% at 70% 20%, rgba(45, 212, 191, 0.18), transparent 55%);
  pointer-events: none;
}

/* Bento tiles */
.bento {
  display: grid;
  gap: 1rem;
  padding: 0 1rem 3rem;
  max-width: 72rem;
  margin: 0 auto;
}

@media (min-width: 768px) {
  .bento {
    grid-template-columns: 1.1fr 0.9fr;
    padding: 0 1.5rem 4rem;
  }
}

.tile {
  background: rgba(18, 28, 51, 0.85);
  border: 1px solid rgba(139, 163, 196, 0.18);
  border-radius: 1.25rem;
  padding: 1.35rem 1.35rem 1.5rem;
  position: relative;
  overflow: hidden;
}

.tile::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 40%;
  height: 100%;
  background: linear-gradient(105deg, transparent 30%, rgba(45, 212, 191, 0.06));
  pointer-events: none;
}

.tile-wide {
  grid-column: 1 / -1;
}

.tile.tile-link-wrap {
  padding: 0;
}

.tile.tile-link-wrap > .tile-card-hit {
  position: relative;
  z-index: 1;
  display: block;
  height: 100%;
  padding: 1.35rem 1.35rem 1.5rem;
  text-decoration: none;
  color: inherit;
  border-radius: 1.25rem;
  outline-offset: 3px;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.tile.tile-link-wrap > .tile-card-hit:hover {
  background: rgba(45, 212, 191, 0.06);
  box-shadow: 0 0 0 1px rgba(45, 212, 191, 0.22);
}

.tile.tile-link-wrap > .tile-card-hit:focus-visible {
  outline: 2px solid var(--teal);
}

.tile-link-wrap .read-cue {
  margin-top: 1rem;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--teal);
  font-weight: 600;
}

.tile-link-wrap h2 {
  transition: color 0.2s ease;
}

.tile-link-wrap > .tile-card-hit:hover h2 {
  color: var(--teal);
}

.tile-tag {
  display: inline-block;
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 0.5rem;
}

/* Legal / inner pages */
.doc-surface {
  max-width: 72rem;
  margin: 0 auto;
  padding: clamp(2rem, 5vw, 3.5rem) 1.25rem 4rem;
}

.doc-surface h1 {
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(1.75rem, 4vw, 2.35rem);
  margin-bottom: 0.5rem;
}

.doc-surface h2 {
  font-size: 1.1rem;
  margin-top: 2rem;
  margin-bottom: 0.5rem;
  color: var(--teal);
}

.doc-surface p,
.doc-surface li {
  color: rgba(244, 241, 234, 0.88);
  line-height: 1.7;
  font-size: 0.95rem;
}

.doc-surface ul {
  padding-left: 1.25rem;
}

.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* Homepage bands below bento */
.section-band {
  max-width: 72rem;
  margin: 0 auto;
  padding: 2.5rem 1rem 0;
}

@media (min-width: 768px) {
  .section-band {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

.lexicon {
  border: 1px solid rgba(139, 163, 196, 0.18);
  border-radius: 1.25rem;
  background: rgba(12, 20, 40, 0.75);
  padding: 1.25rem 1.35rem 0.25rem;
}

.lexicon dt {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1rem;
  color: var(--teal);
  margin-top: 1rem;
}

.lexicon dt:first-child {
  margin-top: 0;
}

.lexicon dd {
  margin: 0.35rem 0 0;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(139, 163, 196, 0.1);
  color: rgba(244, 241, 234, 0.85);
  font-size: 0.9rem;
  line-height: 1.65;
}

.lexicon dd:last-of-type {
  border-bottom: none;
}

.scale-step {
  position: relative;
  padding-left: 1.35rem;
  border-left: 2px solid rgba(45, 212, 191, 0.35);
  margin-bottom: 1.25rem;
}

.scale-step:last-child {
  margin-bottom: 0;
}

/* Article detail pages */
.article-surface {
  max-width: 72rem;
  margin: 0 auto;
  padding: clamp(2rem, 5vw, 3rem) 1.25rem 3.5rem;
}

.article-surface .crumb {
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--mist);
  margin-bottom: 0.75rem;
}

.article-surface .crumb a {
  color: var(--teal);
  text-decoration: none;
}

.article-surface .crumb a:hover {
  text-decoration: underline;
}

.article-surface h1 {
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(1.85rem, 4.5vw, 2.6rem);
  line-height: 1.15;
  margin: 0 0 1rem;
}

.article-surface .lead {
  font-size: 1.05rem;
  color: rgba(139, 163, 196, 0.95);
  line-height: 1.65;
  margin-bottom: 2rem;
}

.article-prose h2 {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.35rem;
  margin: 2.25rem 0 0.75rem;
  color: var(--teal);
}

.article-prose h3 {
  font-size: 1rem;
  margin: 1.5rem 0 0.5rem;
  color: rgba(244, 241, 234, 0.95);
}

.article-prose p {
  color: rgba(244, 241, 234, 0.9);
  line-height: 1.8;
  font-size: 0.98rem;
  margin: 0 0 1rem;
}

.article-prose ul {
  margin: 0 0 1rem;
  padding-left: 1.25rem;
  color: rgba(244, 241, 234, 0.88);
  line-height: 1.75;
  font-size: 0.95rem;
}

.article-prose a {
  color: var(--teal);
  text-decoration: underline;
  text-decoration-color: rgba(45, 212, 191, 0.45);
  text-underline-offset: 3px;
}

.article-prose a:hover {
  text-decoration-color: var(--teal);
}

.related-notes {
  margin-top: 3rem;
  padding: 1.35rem 1.35rem 1.25rem;
  border-radius: 1.15rem;
  border: 1px solid rgba(45, 212, 191, 0.28);
  background: rgba(12, 22, 42, 0.65);
}

.related-notes h2 {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.1rem;
  color: var(--amber);
  margin: 0 0 0.75rem;
}

.related-notes ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.related-notes li {
  border-top: 1px solid rgba(139, 163, 196, 0.12);
  padding: 0.65rem 0;
}

.related-notes li:first-of-type {
  border-top: none;
  padding-top: 0;
}

.related-notes a {
  color: var(--teal);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
}

.related-notes a:hover {
  text-decoration: underline;
}

.related-notes span {
  display: block;
  font-size: 0.8rem;
  color: var(--mist);
  font-weight: 400;
  margin-top: 0.2rem;
  line-height: 1.45;
}
