/* ===========================================================
   monopole.city — midnight municipal observatory
   Navy-metallic dark-mode · vertical timeline descent
   =========================================================== */

:root {
  --abyssal-navy: #0b1020;
  --bedrock-navy: #070a14;
  --drafting-navy: #11182e;
  --lamplight-bone: #dfe4ee;
  --cold-pewter: #9aa4ba;
  --cold-pewter-2: #8893a8;
  --silver-bright: #c7ccd6;
  --silver-mid: #7c8497;
  --silver-deep: #3a4358;
  --tarnished-brass: #b9842f;
  --service-teal: #5b7a8c;

  --bg: #0b1020;

  --ease-descent: cubic-bezier(0.22, 0.61, 0.36, 1);

  --font-display: "Big Shoulders Display", "Arial Narrow", sans-serif;
  --font-mono: "Space Mono", "SFMono-Regular", Consolas, monospace;
  --font-body: "Spectral", Georgia, "Times New Roman", serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: auto; }

body {
  background-color: var(--bg);
  color: var(--lamplight-bone);
  font-family: var(--font-body);
  font-weight: 300;
  line-height: 1.78;
  overflow-x: hidden;
  transition: background-color 1.2s linear;
  position: relative;
  min-height: 100vh;
}

/* ---- noise / paper film ---- */
.noise-layer {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9000;
  opacity: 0.025;
  mix-blend-mode: overlay;
}

/* ===========================================================
   PLUMB LINE
   =========================================================== */
.plumb-line {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 1px;
  height: 100vh;
  background: linear-gradient(to bottom,
    var(--silver-bright) 0%,
    var(--cold-pewter-2) 40%,
    var(--silver-mid) 70%,
    var(--silver-deep) 100%);
  z-index: 50;
  pointer-events: none;
}

.plumb-progress {
  position: absolute;
  top: 0;
  left: -1px;
  width: 3px;
  height: 0%;
  background: linear-gradient(to bottom,
    rgba(185, 132, 47, 0) 0%,
    rgba(185, 132, 47, 0.65) 60%,
    var(--tarnished-brass) 100%);
  transition: height 0.25s linear;
}

/* ===========================================================
   STATION MARKERS
   =========================================================== */
.stations {
  position: absolute;
  top: 0;
  left: 50%;
  width: 0;
  height: 100%;
  z-index: 60;
  pointer-events: none;
}

.station {
  position: absolute;
  left: 0;
  transform: translateX(-50%);
}

.station-diamond {
  display: block;
  width: 12px;
  height: 12px;
  transform: rotate(45deg);
  background: var(--abyssal-navy);
  border: 1px solid var(--cold-pewter-2);
  box-shadow: 0 0 0 2px var(--bg);
  transition: border-color 0.7s var(--ease-descent),
              background-color 0.7s var(--ease-descent),
              box-shadow 0.7s var(--ease-descent);
}

.station.active .station-diamond {
  border-color: var(--tarnished-brass);
  background: rgba(185, 132, 47, 0.15);
}

/* ===========================================================
   HEADER — INSTRUMENT BAR
   =========================================================== */
.instrument-bar {
  position: sticky;
  top: 0;
  height: 56px;
  background: var(--drafting-navy);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  z-index: 200;
  border-bottom: 1px solid transparent;
  position: -webkit-sticky;
}

.instrument-bar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: linear-gradient(to right,
    var(--silver-deep) 0%,
    var(--cold-pewter-2) 50%,
    var(--silver-deep) 100%);
}

.wordmark {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.22em;
  color: var(--lamplight-bone);
  text-transform: uppercase;
}

.depth-readout {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.depth-label { color: var(--cold-pewter); }

.depth-value {
  color: var(--tarnished-brass);
  font-weight: 700;
  display: inline-flex;
  align-items: baseline;
  letter-spacing: 0.06em;
}

.depth-digit {
  display: inline-block;
  position: relative;
  overflow: hidden;
  height: 1.05em;
  line-height: 1.05em;
  vertical-align: bottom;
}

.depth-digit .digit-inner {
  display: block;
  transition: transform 0.18s var(--ease-descent);
}

.depth-digit.flip .digit-inner {
  animation: digitSlide 0.18s var(--ease-descent);
}

@keyframes digitSlide {
  0%   { transform: translateY(100%); }
  100% { transform: translateY(0); }
}

/* ===========================================================
   STRATA
   =========================================================== */
#descent { position: relative; z-index: 10; }

.stratum {
  position: relative;
  min-height: 100vh;
  padding: 92px 0 80px;
  overflow: hidden;
}

.stratum-boundary {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 18px 28px 0;
}

.stratum-boundary::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(to right,
    var(--silver-deep) 0%,
    var(--cold-pewter-2) 18%,
    var(--cold-pewter-2) 82%,
    var(--silver-deep) 100%);
  opacity: 0.55;
}

.depth-coord {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--cold-pewter);
  transition: color 0.7s var(--ease-descent);
}

.stratum.active .depth-coord { color: var(--tarnished-brass); }

.chapter-mark {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 14px;
  color: var(--silver-mid);
  letter-spacing: 0.05em;
}

/* ---- blob field cells ---- */
.blob-field {
  position: absolute;
  top: -12vh;
  width: 96vw;
  height: 124vh;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1;
  pointer-events: none;
  will-change: transform;
}

.blob-field svg {
  width: 100%;
  height: 100%;
  display: block;
}

.field-cell {
  opacity: 0.13;
  transform-box: fill-box;
  transform-origin: center;
  animation: blobWobble 56s ease-in-out infinite alternate;
}

#stratum-1 .field-cell { animation-duration: 62s; animation-delay: -8s; }
#stratum-2 .field-cell { animation-duration: 48s; animation-delay: -16s; }
#stratum-3 .field-cell { animation-duration: 68s; animation-delay: -4s; }
#stratum-4 .field-cell { animation-duration: 44s; animation-delay: -22s; opacity: 0.18; }

@keyframes blobWobble {
  0%   { transform: translate(0, 0) scale(1) rotate(0deg); }
  50%  { transform: translate(8px, -6px) scale(1.018) rotate(0.6deg); }
  100% { transform: translate(-7px, 5px) scale(0.985) rotate(-0.5deg); }
}

.blob-monopole .field-cell {
  filter: drop-shadow(0 0 60px rgba(185, 132, 47, 0.12));
}

/* ---- nature line-drawings ---- */
.line-drawing {
  position: absolute;
  z-index: 2;
  pointer-events: none;
  overflow: visible;
}

.line-drawing path {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  pathLength: 1;
}

.line-drawing[data-draw].drawn path {
  animation: pathDraw 1.4s var(--ease-descent) forwards;
}

.line-drawing[data-draw].drawn path[data-sub="1"] { animation-delay: 0.10s; }
.line-drawing[data-draw].drawn path[data-sub="2"] { animation-delay: 0.24s; }
.line-drawing[data-draw].drawn path[data-sub="3"] { animation-delay: 0.38s; }

@keyframes pathDraw {
  to { stroke-dashoffset: 0; }
}

/* ghost dashed outline before drawn (skeleton hint) */
.line-drawing path {
  opacity: 0.85;
}
body.loading .line-drawing path {
  stroke: var(--silver-deep);
  stroke-dasharray: 4 5;
  stroke-dashoffset: 0;
  opacity: 0.35;
  animation: none !important;
}

/* placements per stratum */
#stratum-0 .line-fern  { right: 9vw;  top: 24vh; width: 110px; height: 188px; }
#stratum-1 .line-root   { left: 11vw;  bottom: 16vh; width: 150px; height: 122px; }
#stratum-2 .line-reed   { right: 12vw; top: 28vh; width: 92px;  height: 188px; }
#stratum-3 .line-moth   { left: 13vw;  top: 20vh; width: 150px; height: 112px; }
#stratum-3 .line-moss   { left: 9vw;   bottom: 14vh; width: 112px; height: 84px; }
#stratum-4 .line-lichen { right: 11vw; top: 26vh; width: 124px; height: 124px; }

/* ===========================================================
   STRATUM CONTENT
   =========================================================== */
.stratum-content {
  position: relative;
  z-index: 5;
  width: min(40%, 480px);
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.7s var(--ease-descent), transform 0.7s var(--ease-descent);
}

.stratum.in-view .stratum-content { opacity: 1; transform: translateY(0); }

.side-left .stratum-content {
  margin-left: 7vw;
  margin-right: auto;
  padding-right: 4vw;
}

.side-right .stratum-content {
  margin-left: auto;
  margin-right: 7vw;
  padding-left: 4vw;
  text-align: left;
}

/* connector tick from content toward the spine */
.stratum-content::after {
  content: "";
  position: absolute;
  top: 1.2em;
  height: 1px;
  width: 3vw;
  background: var(--silver-deep);
  transition: background-color 0.7s var(--ease-descent), width 0.7s var(--ease-descent);
}

.side-left .stratum-content::after { left: 100%; }
.side-right .stratum-content::after { right: 100%; }

.stratum.active .stratum-content::after {
  background: var(--tarnished-brass);
}

.stratum-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.4rem, 6vw, 5.5rem);
  line-height: 0.96;
  letter-spacing: 0.02em;
  color: var(--lamplight-bone);
  margin-bottom: 1.4rem;
}

.stratum-body {
  font-family: var(--font-body);
  font-weight: 300;
  font-size: clamp(1.05rem, 1.25vw, 1.2rem);
  line-height: 1.78;
  color: var(--lamplight-bone);
  max-width: 62ch;
  margin-bottom: 1.6rem;
}

.stratum-body em,
.stratum-body strong {
  font-weight: 500;
  font-style: normal;
  color: var(--silver-bright);
}

.caption {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cold-pewter);
}

/* ===========================================================
   SKELETON-LOADING (scaffolding netting)
   =========================================================== */
.stratum-content .skeleton-bars {
  display: none;
}

body.loading .stratum-content {
  opacity: 1;
  transform: none;
}

body.loading .stratum-title,
body.loading .stratum-body,
body.loading .caption {
  color: transparent !important;
  position: relative;
  border-radius: 0;
  background: var(--drafting-navy);
  background-image: linear-gradient(
    180deg,
    rgba(199, 204, 214, 0) 0%,
    rgba(199, 204, 214, 0.10) 45%,
    rgba(199, 204, 214, 0.22) 50%,
    rgba(199, 204, 214, 0.10) 55%,
    rgba(199, 204, 214, 0) 100%);
  background-size: 100% 220%;
  background-repeat: no-repeat;
  animation: shimmerDown 1.5s linear infinite;
  overflow: hidden;
}

body.loading .stratum-title { min-height: clamp(2.4rem, 6vw, 5.5rem); }
body.loading .stratum-body { min-height: 8.2em; }
body.loading .caption { min-height: 1.4em; max-width: 24ch; }

@keyframes shimmerDown {
  0%   { background-position: 0 -120%; }
  100% { background-position: 0 120%; }
}

body.loading .stratum-content::after { background: var(--silver-deep); }

/* fade-in once loaded (skeleton -> content cross-fade ~0.4s) */
body.loaded-fade .stratum-title,
body.loaded-fade .stratum-body,
body.loaded-fade .caption,
body.loaded-fade .colophon {
  animation: contentFadeIn 0.4s var(--ease-descent);
}

@keyframes contentFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ===========================================================
   BEDROCK / FOOTER
   =========================================================== */
.bedrock {
  position: relative;
  background: var(--bedrock-navy);
  min-height: 70vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 24vh;
  padding-bottom: 22vh;
  text-align: center;
  z-index: 10;
}

.bedrock-diamond {
  width: 16px;
  height: 16px;
  transform: rotate(45deg);
  background: var(--tarnished-brass);
  box-shadow: 0 0 24px rgba(185, 132, 47, 0.4), 0 0 0 3px var(--bedrock-navy);
  margin-bottom: 3.4rem;
}

.colophon {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--cold-pewter);
  max-width: 60ch;
  line-height: 2.2;
}

body.loading .bedrock-diamond { background: var(--silver-deep); box-shadow: none; }
body.loading .colophon {
  color: transparent;
  background: var(--drafting-navy);
  min-height: 4em;
  max-width: 36ch;
  background-image: linear-gradient(180deg,
    rgba(199, 204, 214, 0) 0%, rgba(199, 204, 214, 0.18) 50%, rgba(199, 204, 214, 0) 100%);
  background-size: 100% 220%;
  background-repeat: no-repeat;
  animation: shimmerDown 1.5s linear infinite;
}

/* ===========================================================
   RESPONSIVE — narrow viewports
   =========================================================== */
@media (max-width: 720px) {
  .plumb-line { left: 40px; transform: none; }
  .plumb-progress { left: -1px; }
  .stations { left: 40px; }

  .stratum-boundary { padding: 16px 18px 0 56px; }

  .blob-field { left: 40px; transform: none; width: 130vw; }

  .stratum-content,
  .side-left .stratum-content,
  .side-right .stratum-content {
    width: auto;
    margin-left: 56px;
    margin-right: 22px;
    padding-left: 0;
    padding-right: 0;
    text-align: left;
  }

  .stratum-content::after,
  .side-left .stratum-content::after,
  .side-right .stratum-content::after {
    left: auto;
    right: 100%;
    width: 16px;
  }

  #stratum-0 .line-fern  { right: 4vw;  top: auto; bottom: 8vh; }
  #stratum-1 .line-root   { left: auto; right: 6vw; bottom: 8vh; }
  #stratum-2 .line-reed   { right: 4vw; top: auto; bottom: 6vh; }
  #stratum-3 .line-moth   { left: auto; right: 6vw; top: auto; bottom: 24vh; }
  #stratum-3 .line-moss   { left: auto; right: 4vw; bottom: 6vh; }
  #stratum-4 .line-lichen { right: 4vw; top: auto; bottom: 10vh; }

  .stratum { padding-top: 84px; }

  .wordmark { font-size: 10px; letter-spacing: 0.16em; }
  .depth-readout { font-size: 10px; gap: 6px; }
}

@media (max-width: 460px) {
  .wordmark { letter-spacing: 0.10em; }
}

/* ===========================================================
   REDUCED MOTION
   =========================================================== */
@media (prefers-reduced-motion: reduce) {
  body { transition: none; }
  .field-cell { animation: none !important; }
  .blob-field { transform: translateX(-50%) !important; }
  .line-drawing[data-draw] path,
  .line-drawing[data-draw].drawn path {
    stroke-dashoffset: 0 !important;
    animation: none !important;
  }
  .stratum-content { opacity: 1 !important; transform: none !important; }
  .depth-digit .digit-inner { transition: none !important; animation: none !important; }
  .plumb-progress { transition: none; }
  body.loading .stratum-title,
  body.loading .stratum-body,
  body.loading .caption,
  body.loading .colophon { animation: none !important; }
}
