/* ======================================================
   Pulse — Pacesetter Well Companion
   Light mode only. Pacesetter red on warm off-white.
   Wellbore-as-spine, depth-scrubber-driven UI.
   ====================================================== */

:root{
  /* surfaces */
  --bg:        #faf7f2;
  --bg-2:      #f4efe6;
  --bg-3:      #ece5d6;
  --card:      #ffffff;
  --line:      #e3dccd;
  --line-2:    #cfc4ad;

  /* ink */
  --ink:       #1c1a17;
  --ink-2:     #3a352e;
  --ink-3:     #6b6354;
  --ink-mute:  #8e8674;

  /* brand */
  --red:       #be3c2b;
  --red-hot:   #ff5a3c;
  --red-deep:  #8a2a1d;
  --red-ink:   #5a1a11;
  --red-tint:  #fbe7e2;

  /* type */
  --display: 'Anton', 'Arial Narrow', sans-serif;
  --body:    'Open Sans', system-ui, sans-serif;
  --mono:    'JetBrains Mono', 'SF Mono', monospace;

  /* layout */
  --max:     1200px;
  --gutter:  clamp(16px, 4vw, 40px);
  --radius:  14px;
  --radius-sm: 8px;
}

*,*::before,*::after{ box-sizing:border-box; }
html,body{ margin:0; padding:0; }
html{ -webkit-text-size-adjust:100%; }
body{
  font-family: var(--body);
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}

button{ font: inherit; color: inherit; cursor: pointer; }
.mono{ font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ======================================================
   TOPBAR
   ====================================================== */
.topbar{
  position: sticky; top: 0; z-index: 50;
  background: rgba(250,247,242,0.96);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top, 0);
}
@supports not (backdrop-filter: blur(14px)){
  .topbar{ background: var(--bg); }
}
body.is-atlas .topbar{ background: rgba(247,241,230,0.96); }
@supports not (backdrop-filter: blur(14px)){
  body.is-atlas .topbar{ background: #f7f1e6; }
}
.topbar-inner{
  max-width: var(--max);
  margin: 0 auto;
  padding: 12px var(--gutter);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
.brand{ display:flex; align-items:center; gap:12px; min-width:0; }
.brand-mark{ width: 40px; height: 40px; flex: 0 0 auto; }
.brand-logo{
  width: 40px; height: 40px;
  object-fit: contain;
  display: block;
}
.brand-text{ display:flex; flex-direction: column; line-height: 1.1; min-width:0; gap: 1px; }
.brand-name{
  font-family: var(--display);
  font-size: 19px; letter-spacing: 0.08em;
  color: var(--ink);
  line-height: 1;
}
.brand-tagline{
  font-family: var(--body);
  font-size: 9.5px; letter-spacing: 0.05em;
  color: var(--ink-3);
  font-style: italic;
  font-weight: 400;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: 1px;
}
.brand-sub{
  font-size: 9.5px; letter-spacing: 0.18em; color: var(--ink-2);
  font-weight: 600; text-transform: uppercase;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: 1px;
}
.op-tag{
  display:flex; flex-direction: column; line-height: 1; padding: 4px 10px;
  border: 1px solid var(--line-2); border-radius: 6px; background: var(--bg-2);
}
.op-tag-tour{ font-family: var(--display); font-size: 13px; letter-spacing: 0.05em; color:#1f5f3a; }
.op-tag-oil{ font-family: var(--display); font-size: 9px; letter-spacing: 0.18em; color:#1d3b6b; }

/* ======================================================
   PAGE
   ====================================================== */
.page{ max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter) 80px; }

.section-head{ display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin: 56px 0 20px; }
.eyebrow{ font-size: 11px; letter-spacing: 0.22em; color: var(--red); font-weight: 700; text-transform: uppercase; margin-bottom: 8px; }
.section-title{
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(28px, 4.6vw, 44px);
  line-height: 1;
  letter-spacing: -0.005em;
  color: var(--ink);
  margin: 0;
}
.section-lede{ color: var(--ink-3); margin: 8px 0 0; max-width: 60ch; }

/* ======================================================
   HERO
   ====================================================== */
.hero{
  margin-top: 32px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(20px, 4vw, 36px);
  position: relative;
  overflow: hidden;
}
.hero::before{
  content:""; position:absolute; top:0; left:0; right:0; height: 4px;
  background: linear-gradient(90deg, var(--red-deep), var(--red), var(--red-hot));
}
.hero-grid{
  display: grid; grid-template-columns: 1.4fr 1fr; gap: 32px; align-items: center;
}
@media (max-width: 820px){ .hero-grid{ grid-template-columns: 1fr; gap: 24px; } }

.kicker{ font-size: 11px; letter-spacing: 0.22em; color: var(--ink-3); font-weight: 700; text-transform: uppercase; }
.title{
  font-family: var(--display); font-weight: 400;
  font-size: clamp(28px, 5vw, 52px);
  line-height: 0.98;
  letter-spacing: -0.01em;
  margin: 8px 0 6px;
  color: var(--ink);
}
.title-em{ color: var(--red); }
.subtitle{ color: var(--ink-2); font-size: 15px; }

.status-row{ display:flex; align-items: center; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.status-pill{
  font-family: var(--display); letter-spacing: 0.1em;
  font-size: 12px; padding: 6px 10px; border-radius: 4px;
}
.status-done{ background: var(--red); color: #fff; }
.status-meta{ font-size: 13px; color: var(--ink-3); }

.hero-stats{
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.stat{
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 14px 14px 12px;
}
.stat-cost{ background: var(--red-tint); border-color: #f0c4bb; }
.stat-num{ font-family: var(--display); font-size: clamp(24px, 3.6vw, 34px); line-height: 1; color: var(--ink); }
.stat-cost .stat-num{ color: var(--red-deep); }
.stat-unit{ font-family: var(--mono); font-size: 11px; color: var(--ink-3); margin-top: 2px; letter-spacing: 0.04em; }
.stat-label{ font-size: 11px; color: var(--ink-3); margin-top: 6px; text-transform: uppercase; letter-spacing: 0.08em; }

/* ======================================================
   SPINE (wellbore + readouts + scrubber)
   ====================================================== */
.spine-section{ margin-top: 8px; }

.spine-frame{
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}
@media (max-width: 820px){
  .spine-frame{ grid-template-columns: 140px 1fr; gap: 16px; padding: 14px; }
}
@media (max-width: 480px){
  .spine-frame{ grid-template-columns: 110px 1fr; gap: 12px; padding: 12px; }
}

.spine-bore{ position: relative; height: 720px; max-height: calc(80vh); }
@media (max-width: 820px){ .spine-bore{ height: 540px; } }
@media (max-width: 480px){ .spine-bore{ height: 480px; } }

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

.spine-readouts{ display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.readout-block{ padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.readout-eyebrow{ font-size: 10px; letter-spacing: 0.22em; color: var(--ink-3); font-weight: 700; text-transform: uppercase; }
.readout-md{ display: flex; align-items: baseline; gap: 8px; margin-top: 6px; }
.readout-md-num{
  font-family: var(--display);
  font-size: clamp(40px, 8vw, 72px);
  line-height: 0.95;
  color: var(--red);
  letter-spacing: -0.01em;
}
.readout-md-unit{ font-family: var(--mono); font-size: 14px; color: var(--ink-3); letter-spacing: 0.04em; }
.readout-formation{
  margin-top: 6px;
  font-family: var(--display);
  font-size: clamp(14px, 2.4vw, 18px);
  letter-spacing: 0.06em;
  color: var(--ink);
  display: inline-flex; align-items: center; gap: 8px;
}
.readout-formation::before{
  content: ""; width: 14px; height: 14px; border-radius: 3px;
  background: var(--formation-color, #ccc); border: 1px solid rgba(0,0,0,0.15);
}

.readout-grid{
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px;
}
@media (max-width: 480px){ .readout-grid{ grid-template-columns: 1fr 1fr; } }
.readout-cell{
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 8px 10px;
  min-width: 0;
}
.readout-cell-label{ font-size: 10px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.1em; }
.readout-cell-value{
  font-family: var(--display);
  font-size: clamp(18px, 3.2vw, 22px);
  color: var(--ink);
  margin-top: 2px;
  line-height: 1.05;
  display: flex; align-items: baseline; gap: 4px;
}
.readout-cell-value .u{ font-family: var(--mono); font-size: 10px; color: var(--ink-3); letter-spacing: 0.04em; }

.readout-bha{
  margin-top: auto;
  padding: 10px 12px;
  background: var(--bg-3);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
}
.readout-bha-label{ font-size: 10px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.18em; font-weight: 700; }
.readout-bha-name{ font-family: var(--display); font-size: 14px; letter-spacing: 0.04em; color: var(--ink); margin-top: 2px; }

/* Scrubber */
.scrubber-wrap{ margin-top: 18px; padding: 0 4px; }
.scrubber-ticks{
  position: relative; height: 22px; margin-bottom: 6px;
}
.scrubber-ticks .tick{
  position: absolute; top: 0;
  transform: translateX(-50%);
  font-family: var(--mono); font-size: 10px; color: var(--ink-3);
  letter-spacing: 0.04em;
  white-space: nowrap;
  font-weight: 600;
}
/* Anchor edge ticks so labels stay inside the rail */
.scrubber-ticks .tick-start{ transform: translateX(0); }
.scrubber-ticks .tick-end{ transform: translateX(-100%); }
.scrubber-ticks .tick::before{
  content:""; display:block; width:1px; height: 6px; background: var(--line-2);
  margin: 0 0 2px;
}
.scrubber-ticks .tick-mid::before{ margin: 0 auto 2px; }
.scrubber-ticks .tick-end::before{ margin: 0 0 2px auto; }
.scrubber{
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 6px;
  background: linear-gradient(90deg, var(--red-deep) 0%, var(--red) 50%, var(--red-hot) 100%);
  border-radius: 4px;
  outline: none;
  margin: 0;
}
.scrubber::-webkit-slider-thumb{
  -webkit-appearance: none; appearance: none;
  width: 24px; height: 24px; border-radius: 50%;
  background: #fff; border: 3px solid var(--red);
  box-shadow: 0 2px 8px rgba(190,60,43,0.35);
  cursor: grab;
}
.scrubber::-webkit-slider-thumb:active{ cursor: grabbing; }
.scrubber::-moz-range-thumb{
  width: 24px; height: 24px; border-radius: 50%;
  background: #fff; border: 3px solid var(--red);
  box-shadow: 0 2px 8px rgba(190,60,43,0.35);
  cursor: grab;
}
/* Legacy bottom legend hidden — ticks above the rail are the source of truth */
.scrubber-legend{ display: none; }

/* Stage wraps the slider so we can layer the 'drag me' hint above it */
.scrubber-stage{ position: relative; }
/* Hint sits ABOVE the thumb. Horizontal position is driven by JS
   via --hint-x (a percentage along the rail) so the arrow points
   meaningfully at the slider thumb wherever it has settled. */
.scrubber-hint{
  position: absolute;
  bottom: calc(100% + 6px);
  left: var(--hint-x, 50%);
  transform: translateX(-50%);
  font-family: var(--body); font-size: 11px; font-weight: 600;
  letter-spacing: 0.06em; color: var(--red);
  background: #fff;
  border: 1px solid rgba(190,60,43,0.35);
  padding: 4px 10px; border-radius: 999px;
  pointer-events: none;
  white-space: nowrap;
  opacity: 0; visibility: hidden;
  transition: opacity 0.4s ease, visibility 0s linear 0.4s, left 0.3s ease;
  box-shadow: 0 4px 12px rgba(190,60,43,0.18);
  z-index: 5;
}
body.spine-pulsing .scrubber-hint{
  opacity: 1; visibility: visible;
  transition: opacity 0.4s ease, visibility 0s linear 0s, left 0.3s ease;
  animation: hintFloat 1.6s ease-in-out infinite;
}
@keyframes hintFloat{
  0%,100% { transform: translateX(-50%) translateY(0); }
  50%     { transform: translateX(-50%) translateY(-4px); }
}

/* Slider-thumb pulse — ring of red fades out, repeating, only while .spine-pulsing */
body.spine-pulsing .scrubber::-webkit-slider-thumb{
  animation: thumbPulse 1.6s ease-out infinite;
}
body.spine-pulsing .scrubber::-moz-range-thumb{
  animation: thumbPulse 1.6s ease-out infinite;
}
@keyframes thumbPulse{
  0%   { box-shadow: 0 2px 8px rgba(190,60,43,0.35), 0 0 0 0 rgba(190,60,43,0.55); }
  70%  { box-shadow: 0 2px 8px rgba(190,60,43,0.35), 0 0 0 14px rgba(190,60,43,0); }
  100% { box-shadow: 0 2px 8px rgba(190,60,43,0.35), 0 0 0 0 rgba(190,60,43,0); }
}

/* Spine counter chip + replay button row — mirrors DvD pattern */
.spine-counter-row{
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin: 14px 0 10px;
  flex-wrap: wrap;
}
.spine-counter{
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 11px; font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--ink-2);
  background: rgba(190, 60, 43, 0.06);
  border: 1px solid rgba(190, 60, 43, 0.18);
  padding: 4px 10px; border-radius: 4px;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.spine-counter::before{
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: var(--red); flex: 0 0 auto;
  box-shadow: 0 0 0 0 rgba(190,60,43,0.5);
  animation: dvdPulse 1.4s ease-in-out infinite;
}
@media (max-width: 600px){
  .spine-counter{ font-size: 10px; padding: 3px 8px; letter-spacing: 0.06em; }
  .scrubber-hint{ font-size: 10px; padding: 3px 9px; }
}

/* ======================================================
   AI NARRATION
   ====================================================== */
.ai-section{ margin-top: 32px; }
.ai-card{
  background: linear-gradient(135deg, #1c1a17 0%, #2a221d 100%);
  color: #faf7f2;
  border-radius: var(--radius);
  padding: clamp(22px, 4vw, 36px);
  border: 1px solid #2a221d;
  position: relative;
  overflow: hidden;
}
.ai-card::after{
  content:""; position: absolute; right: -80px; top: -80px;
  width: 240px; height: 240px; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255,90,60,0.32), transparent 70%);
  pointer-events: none;
}
.ai-eyebrow{ font-size: 11px; letter-spacing: 0.24em; color: var(--red-hot); font-weight: 700; text-transform: uppercase; }
.ai-title{
  font-family: var(--display); font-weight: 400;
  font-size: clamp(26px, 4.4vw, 40px); line-height: 1;
  margin: 8px 0 18px; color: #fff;
}
.ai-body{ min-height: 80px; }
.ai-placeholder{ color: #b8aea0; font-style: italic; margin: 0; }
.ai-narrative{ margin: 0; font-size: 16px; line-height: 1.7; color: #ece5d6; }
.ai-narrative em{ color: var(--red-hot); font-style: normal; font-weight: 700; }
.ai-narrative + .ai-narrative{ margin-top: 12px; }
.ai-btn{
  margin-top: 22px;
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--red); color: #fff;
  border: none; border-radius: 8px;
  padding: 12px 18px;
  font-family: var(--display); letter-spacing: 0.08em;
  font-size: 14px;
  transition: background 0.15s ease, transform 0.15s ease;
}
.ai-btn:hover{ background: var(--red-hot); }
.ai-btn:active{ transform: scale(0.98); }
.ai-btn-arrow{ font-family: var(--body); font-weight: 700; }
.ai-btn[disabled]{ opacity: 0.7; cursor: progress; }

/* ======================================================
   DAYS VS DEPTH
   ====================================================== */
.dvd-frame{
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px;
  position: relative;
}
.dvd-svg{ width: 100%; height: auto; display: block; }

/* Race counter + replay button row, sits above each DvD chart */
.dvd-counter-row{
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 10px;
  min-height: 26px;
  flex-wrap: wrap;
}
.dvd-counter{
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 11px; font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--ink-2);
  background: rgba(190, 60, 43, 0.06);
  border: 1px solid rgba(190, 60, 43, 0.18);
  padding: 4px 10px; border-radius: 4px;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  transition: background 0.3s ease;
}
.dvd-counter::before{
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: var(--red); flex: 0 0 auto;
  box-shadow: 0 0 0 0 rgba(190,60,43,0.5);
  animation: dvdPulse 1.4s ease-in-out infinite;
}
@keyframes dvdPulse{
  0%,100% { box-shadow: 0 0 0 0 rgba(190,60,43,0.5); }
  50%     { box-shadow: 0 0 0 5px rgba(190,60,43,0); }
}
.dvd-replay{
  font-family: var(--body);
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-2);
  background: transparent;
  border: 1px solid var(--line-2);
  padding: 5px 12px; border-radius: 4px;
  cursor: pointer;
  opacity: 0; pointer-events: none;
  transition: opacity 0.4s ease, background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.dvd-replay.is-ready{ opacity: 1; pointer-events: auto; }
.dvd-replay:hover{
  color: var(--red); border-color: var(--red);
  background: rgba(190,60,43,0.04);
}
.dvd-replay:active{ transform: scale(0.97); }
@media (max-width: 600px){
  .dvd-counter{ font-size: 10px; padding: 3px 8px; letter-spacing: 0.06em; }
  .dvd-replay{ font-size: 10px; padding: 4px 10px; letter-spacing: 0.06em; }
  .dvd-counter-row{ margin-bottom: 8px; }
}

/* Atlas figure when used as a race frame needs the same counter row treatment */
.atlas-figure .dvd-counter-row{ margin-top: 8px; margin-bottom: 12px; }
.dvd-legend{
  display: flex; gap: 20px; flex-wrap: wrap;
  margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line);
  font-size: 12px; color: var(--ink-2);
}
.dvd-leg{ display: inline-flex; align-items: center; gap: 8px; }
.dvd-leg i{ width: 18px; height: 3px; border-radius: 2px; display: inline-block; }
.dvd-leg-current i{ background: var(--red); height: 3px; }
.dvd-leg-offset i{ background: #b8aea0; height: 2px; }

/* Caption strip listing offset wells with their colour swatches */
.dvd-offset-list{
  display: flex; flex-wrap: wrap; gap: 14px 18px;
  margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line);
  font-size: 11.5px; color: var(--ink-2); letter-spacing: 0.01em;
}
.dvd-offset-chip{ display: inline-flex; align-items: center; gap: 8px; }
.dvd-offset-chip i{
  width: 14px; height: 3px; border-radius: 2px; display: inline-block;
  background: #b8aea0;
}
.dvd-offset-chip::before{
  content: ''; width: 0;
}
.dvd-offset-chip.is-current i{ height: 4px; }
@media (max-width: 600px){
  .dvd-offset-list{ gap: 10px 14px; font-size: 11px; }
}

/* ======================================================
   BHA GRID
   ====================================================== */
.bha-grid{
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}
.bha-card{
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px;
  position: relative;
  border-left: 4px solid var(--bha-color, var(--red));
}
.bha-head{ display: flex; justify-content: space-between; align-items: flex-start; }
.bha-n{ font-family: var(--display); font-size: 12px; letter-spacing: 0.18em; color: var(--ink-3); }
.bha-section{ font-family: var(--display); font-size: 18px; letter-spacing: 0.04em; margin: 4px 0; color: var(--ink); }
.bha-depth{ font-family: var(--mono); font-size: 12px; color: var(--ink-3); }
.bha-divider{ height: 1px; background: var(--line); margin: 12px 0; }
.bha-row{ display: flex; justify-content: space-between; font-size: 13px; padding: 3px 0; }
.bha-row-label{ color: var(--ink-3); }
.bha-row-value{ font-family: var(--mono); color: var(--ink); }
.bha-bit{ margin-top: 12px; font-size: 12px; color: var(--ink-2); padding-top: 10px; border-top: 1px dashed var(--line); }
.bha-bit-label{ font-size: 10px; letter-spacing: 0.18em; color: var(--ink-mute); text-transform: uppercase; }
.bha-bit-name{ font-family: var(--mono); margin-top: 2px; }

/* ======================================================
   COST
   ====================================================== */
.cost-bars{
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px;
}
.cost-bar{ margin-bottom: 18px; }
.cost-bar:last-child{ margin-bottom: 0; }
.cost-bar-head{ display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.cost-bar-name{ font-family: var(--display); font-size: 16px; letter-spacing: 0.06em; color: var(--ink); }
.cost-bar-val{ font-family: var(--mono); font-size: 14px; color: var(--ink); }
.cost-bar-track{ height: 10px; background: var(--bg-2); border-radius: 5px; overflow: hidden; }
.cost-bar-fill{
  height: 100%; border-radius: 5px;
  transition: width 0.6s cubic-bezier(0.16,1,0.3,1);
}
.cost-bar-pct{ font-family: var(--mono); font-size: 11px; color: var(--ink-3); margin-top: 4px; }

.cost-total{
  margin-top: 16px;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 22px;
}
.cost-total-row{
  display: flex; justify-content: space-between;
  padding: 6px 0;
  font-size: 14px; color: var(--ink-2);
}
.cost-total-row.cost-total-final{
  border-top: 1px solid var(--line-2);
  padding-top: 10px; margin-top: 6px;
  font-family: var(--display); font-size: 18px; letter-spacing: 0.04em;
  color: var(--ink);
}
.cost-total-final .mono{ color: var(--red-deep); }

/* ======================================================
   FOOTER
   ====================================================== */
.foot{
  margin-top: 64px; padding: 32px 0 24px;
  border-top: 1px solid var(--line);
  text-align: center;
}
.foot-tag{ font-family: var(--display); letter-spacing: 0.18em; color: var(--red); font-size: 14px; }
.foot-sub{ color: var(--ink-3); font-size: 13px; margin-top: 6px; }
.foot-meta{ color: var(--ink-mute); font-size: 11px; font-family: var(--mono); margin-top: 14px; letter-spacing: 0.02em; }

/* ======================================================
   iPhone safe-area + standalone PWA support
   (mined from old project — no fake status bar, no phone-frame chrome)
   ====================================================== */
@media (hover: none) and (pointer: coarse){
  body{
    padding-top: 0;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  .topbar{ padding-top: env(safe-area-inset-top, 0); }
  .page{ padding-bottom: max(env(safe-area-inset-bottom, 0), 80px); }
}
@media (display-mode: standalone){
  body{
    padding-top: 0;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  .topbar{ padding-top: env(safe-area-inset-top, 0); }
  .page{ padding-bottom: max(env(safe-area-inset-bottom, 0), 80px); }
}

/* tighter mobile rhythm */
@media (max-width: 600px){
  .section-head{ margin: 40px 0 16px; }
  .hero{ padding: 18px; }
  .hero-stats{ grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat{ padding: 12px; }
  .topbar-inner{ padding: 10px var(--gutter); }
  .op-tag{ display: none; } /* keep top bar lean on phones */
}

/* ======================================================
   MODE TOGGLE — PULSE / ATLAS
   ====================================================== */
.mode-toggle{
  position: relative;
  display: inline-flex;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: 999px;
  padding: 3px;
  margin-right: 10px;
}
.mode-btn{
  position: relative; z-index: 2;
  background: transparent; border: none;
  font-family: var(--display);
  letter-spacing: 0.14em;
  font-size: 12px;
  color: var(--ink-3);
  padding: 7px 16px;
  border-radius: 999px;
  transition: color 0.25s ease;
  cursor: pointer;
}
.mode-btn.is-active{ color: #fff; }
.mode-indicator{
  position: absolute; z-index: 1;
  top: 3px; bottom: 3px;
  left: 3px;
  width: calc(50% - 3px);
  background: var(--red);
  border-radius: 999px;
  transition: transform 0.32s cubic-bezier(0.4, 0.0, 0.2, 1);
  box-shadow: 0 1px 4px rgba(190,60,43,0.35);
}
.mode-toggle[data-mode="atlas"] .mode-indicator{ transform: translateX(100%); }
@media (max-width: 600px){
  .mode-btn{ padding: 6px 12px; font-size: 11px; }
}

/* When in Atlas mode, the body gets a different background tone */
body.is-atlas{ background: #f7f1e6; }
body.is-atlas .topbar{ background: rgba(247,241,230,0.92); }

/* ======================================================
   ATLAS — calmer, editorial, scroll-driven
   ====================================================== */
.atlas{
  max-width: 920px;
  margin: 0 auto;
  padding: 0 var(--gutter) 80px;
  color: var(--ink);
}
.atlas-chapter, .atlas-cover, .atlas-end{
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.16,1,0.3,1);
}
.atlas-chapter.is-visible, .atlas-cover.is-visible, .atlas-end.is-visible{
  opacity: 1;
  transform: translateY(0);
}

/* ---- Cover ---- */
.atlas-cover{
  min-height: 92vh;
  padding: 48px 0 64px;
  position: relative;
  display: flex; align-items: center;
}
.atlas-cover-inner{
  position: relative;
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 220px;
  grid-template-rows: auto 1fr auto auto;
  gap: 32px 48px;
  align-items: start;
}
@media (max-width: 720px){
  .atlas-cover-inner{ grid-template-columns: 1fr; gap: 28px; }
}
.atlas-issue{
  grid-column: 1 / -1;
  display: flex; justify-content: space-between; align-items: center;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line-2);
  font-family: var(--mono);
  font-size: 11px; letter-spacing: 0.18em;
  color: var(--ink-3);
}
.atlas-issue-num{ font-weight: 600; }
.atlas-cover-mark{
  grid-column: 1 / 2;
  font-family: var(--display);
  letter-spacing: 0.32em;
  font-size: 14px;
  color: var(--red);
}
.atlas-cover-title{
  grid-column: 1 / 2;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(56px, 12vw, 132px);
  line-height: 0.92;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin: 0;
}
.atlas-cover-em{ color: var(--red); }
.atlas-cover-bore{
  grid-column: 2 / 3;
  grid-row: 2 / 4;
  width: 100%;
  height: 100%;
  align-self: stretch;
  max-height: 360px;
}
@media (max-width: 720px){
  .atlas-cover-bore{
    grid-column: 1 / -1;
    grid-row: auto;
    height: 220px;
  }
}
.atlas-cover-meta{
  grid-column: 1 / 2;
  display: grid;
  gap: 10px;
  margin-top: 8px;
}
.atlas-cover-meta-row{
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 16px;
  font-size: 14px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}
.atlas-cover-meta-label{
  font-family: var(--mono);
  font-size: 10px; letter-spacing: 0.16em;
  color: var(--ink-3);
  text-transform: uppercase;
  padding-top: 2px;
}
.atlas-cover-meta-val{ color: var(--ink); }
.atlas-cover-stat{
  grid-column: 1 / -1;
  display: flex; align-items: baseline; gap: 18px;
  border-top: 2px solid var(--ink);
  padding-top: 18px;
  margin-top: 12px;
}
.atlas-cover-stat-num{
  font-family: var(--display);
  font-size: clamp(64px, 11vw, 110px);
  line-height: 0.9;
  color: var(--red);
  letter-spacing: -0.02em;
}
.atlas-cover-stat-unit{
  font-family: var(--display);
  letter-spacing: 0.18em;
  font-size: clamp(14px, 2vw, 18px);
  color: var(--ink-2);
}
.atlas-cover-stat-sub{
  margin-left: auto;
  font-size: 13px; color: var(--ink-3);
  font-family: var(--mono); letter-spacing: 0.04em;
}
.atlas-cover-foot{
  grid-column: 1 / -1;
  margin-top: 28px;
  font-family: var(--mono);
  font-size: 11px; letter-spacing: 0.2em;
  color: var(--ink-3);
  text-align: right;
}

/* ---- Chapters ---- */
.atlas-chapter{
  padding: 96px 0;
  border-top: 1px solid var(--line-2);
}
.atlas-chapter-head{ margin-bottom: 40px; }
.atlas-chapter-num{
  font-family: var(--mono);
  font-size: 11px; letter-spacing: 0.32em;
  color: var(--red);
  font-weight: 600;
  margin-bottom: 12px;
}
.atlas-chapter-title{
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(40px, 7vw, 84px);
  line-height: 0.95;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0 0 16px;
}
.atlas-chapter-deck{
  font-family: var(--body);
  font-size: clamp(17px, 2vw, 21px);
  line-height: 1.5;
  color: var(--ink-2);
  max-width: 60ch;
  margin: 0;
  font-weight: 400;
}

/* Two-column spread */
.atlas-spread{
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 48px;
  align-items: start;
  margin-top: 40px;
}
@media (max-width: 720px){
  .atlas-spread{ grid-template-columns: 1fr; gap: 32px; }
}
.atlas-prose p{
  font-size: 17px;
  line-height: 1.7;
  color: var(--ink);
  margin: 0 0 16px;
  max-width: 60ch;
}
.atlas-prose em{
  font-style: normal;
  font-weight: 600;
  color: var(--red-deep);
  background: linear-gradient(180deg, transparent 65%, rgba(190,60,43,0.12) 65%);
  padding: 0 2px;
}
.atlas-drop::first-letter{
  font-family: var(--display);
  font-size: 4.5em;
  float: left;
  line-height: 0.85;
  margin: 4px 8px 0 0;
  color: var(--red);
}

/* Callouts column */
.atlas-callouts{
  display: grid;
  gap: 12px;
}
.atlas-callout{
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 3px solid var(--ink);
  padding: 14px 18px;
}
.atlas-callout-em{
  border-left-color: var(--red);
  background: var(--red-tint);
}
.atlas-callout-em .atlas-callout-num{ color: var(--red-deep); }
.atlas-callout-num{
  font-family: var(--display);
  font-size: 22px;
  letter-spacing: 0.02em;
  color: var(--ink);
}
.atlas-callout-label{
  font-family: var(--mono);
  font-size: 10px; letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-top: 4px;
}

/* Figures */
.atlas-figure{
  margin: 56px 0 0;
  background: var(--card);
  border: 1px solid var(--line);
  padding: 24px;
}
.atlas-figure-cap{
  display: flex; flex-direction: column;
  gap: 4px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.atlas-figure-num{
  font-family: var(--mono);
  font-size: 11px; letter-spacing: 0.2em;
  color: var(--red);
  font-weight: 600;
}
.atlas-figure-title{
  font-family: var(--display);
  font-size: 20px;
  letter-spacing: 0.02em;
  color: var(--ink);
}
.atlas-figure-sub{
  font-size: 13px;
  color: var(--ink-3);
  font-style: italic;
}

/* Formations grid */
.atlas-formations-grid{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 4px;
}
.atlas-formation-row{
  display: grid;
  grid-template-columns: 14px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 6px 8px;
  font-size: 12px;
  border-bottom: 1px dotted var(--line);
}
.atlas-formation-swatch{
  width: 14px; height: 14px;
  border-radius: 3px;
  border: 1px solid rgba(0,0,0,0.15);
}
.atlas-formation-name{
  color: var(--ink-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.atlas-formation-md{
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-mute);
  letter-spacing: 0.02em;
}

/* ---- Runs (BHA story beats) ---- */
.atlas-runs{
  list-style: none;
  margin: 0; padding: 0;
  counter-reset: run;
}
.atlas-run{
  display: grid;
  grid-template-columns: 100px 1fr 220px;
  gap: 32px;
  align-items: start;
  padding: 32px 0;
  border-top: 1px solid var(--line);
}
.atlas-run:first-child{ border-top: 2px solid var(--ink); }
@media (max-width: 720px){
  .atlas-run{ grid-template-columns: 1fr; gap: 14px; }
}
.atlas-run-num{
  font-family: var(--display);
  font-size: clamp(40px, 6vw, 56px);
  line-height: 1;
  color: var(--red);
  letter-spacing: 0;
}
.atlas-run-num::before{
  content: "BHA ";
  display: block;
  font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--ink-3);
  margin-bottom: 4px;
}
.atlas-run-body h3{
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(20px, 2.4vw, 26px);
  letter-spacing: 0.02em;
  margin: 0 0 6px;
  color: var(--ink);
}
.atlas-run-depth{
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-3);
  letter-spacing: 0.04em;
  margin-bottom: 10px;
}
.atlas-run-prose{
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink-2);
  margin: 0;
}
.atlas-run-prose em{
  font-style: normal;
  font-weight: 600;
  color: var(--red-deep);
}
.atlas-run-stats{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.atlas-run-stat{
  background: var(--bg-2);
  padding: 10px 12px;
  border-radius: 6px;
}
.atlas-run-stat-label{
  font-family: var(--mono);
  font-size: 9px; letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.atlas-run-stat-value{
  font-family: var(--display);
  font-size: 18px;
  color: var(--ink);
  margin-top: 2px;
  line-height: 1.05;
}

/* DvD inside Atlas */
.atlas-dvd-svg{ width: 100%; height: auto; display: block; }

/* ---- Pull quote ---- */
.atlas-pull{
  padding: 48px 0;
  text-align: center;
  border-top: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  margin: 32px 0;
}
.atlas-pull-quote{
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(28px, 4.8vw, 48px);
  line-height: 1.1;
  color: var(--ink);
  letter-spacing: -0.005em;
  max-width: 22ch;
  margin: 0 auto 12px;
}
.atlas-pull-attrib{
  font-family: var(--mono);
  font-size: 11px; letter-spacing: 0.2em;
  color: var(--ink-3);
  text-transform: uppercase;
}

/* Result stats grid */
.atlas-spread-result{ margin-top: 32px; }
.atlas-result-stats{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.atlas-result-stat{
  background: var(--card);
  border: 1px solid var(--line);
  padding: 18px 16px 14px;
}
.atlas-result-stat-em{
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}
.atlas-result-stat-em .atlas-result-stat-unit{ color: rgba(255,255,255,0.85); }
.atlas-result-stat-num{
  font-family: var(--display);
  font-size: clamp(32px, 4.4vw, 44px);
  line-height: 1;
  color: var(--ink);
}
.atlas-result-stat-em .atlas-result-stat-num{ color: #fff; }
.atlas-result-stat-pct{ font-size: 0.6em; opacity: 0.8; }
.atlas-result-stat-unit{
  font-family: var(--mono);
  font-size: 11px; letter-spacing: 0.12em;
  color: var(--ink-3);
  text-transform: uppercase;
  margin-top: 6px;
}

/* ---- Ticket ---- */
.atlas-ticket-headline{
  border-top: 2px solid var(--ink);
  padding-top: 18px;
  margin-bottom: 32px;
}
.atlas-ticket-headline-num{
  font-family: var(--display);
  font-size: clamp(40px, 6vw, 64px);
  color: var(--red-deep);
  line-height: 1;
  letter-spacing: -0.01em;
}
.atlas-ticket-headline-sub{
  font-size: 13px;
  color: var(--ink-3);
  font-family: var(--mono);
  letter-spacing: 0.04em;
  margin-top: 8px;
}
.atlas-ticket-bars{
  display: grid;
  gap: 22px;
  margin: 32px 0;
}
.atlas-ticket-bar{
  display: grid;
  grid-template-columns: 200px 1fr 120px;
  gap: 16px;
  align-items: center;
}
@media (max-width: 720px){
  .atlas-ticket-bar{
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "name val"
      "track track";
    gap: 6px 12px;
  }
  .atlas-ticket-bar-name{ grid-area: name; }
  .atlas-ticket-bar-val{ grid-area: val; text-align: right; }
  .atlas-ticket-bar-track{ grid-area: track; }
}
.atlas-ticket-bar-name{
  font-family: var(--display);
  font-size: 16px;
  letter-spacing: 0.04em;
  color: var(--ink);
}
.atlas-ticket-bar-track{
  height: 8px;
  background: var(--bg-2);
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}
.atlas-ticket-bar-fill{
  position: absolute; left: 0; top: 0; bottom: 0;
  background: var(--bar-color, var(--red));
  border-radius: 4px;
  width: 0;
  transition: width 1.2s cubic-bezier(0.16,1,0.3,1);
}
body.is-atlas .atlas-chapter.is-visible .atlas-ticket-bar-fill{
  width: var(--bar-pct, 0%);
}
.atlas-ticket-bar-val{
  font-family: var(--mono);
  font-size: 14px;
  color: var(--ink);
  text-align: right;
}
.atlas-ticket-note{
  font-size: 15px;
  line-height: 1.7;
  color: var(--ink-2);
  max-width: 65ch;
  margin: 24px 0 0;
}

/* ---- End ---- */
.atlas-end{
  text-align: center;
  padding: 80px 0 40px;
  border-top: 1px solid var(--line-2);
  margin-top: 48px;
}
.atlas-end-mark{
  font-family: var(--display);
  letter-spacing: 0.32em;
  font-size: 14px;
  color: var(--red);
}
.atlas-end-tag{
  font-family: var(--display);
  letter-spacing: 0.18em;
  font-size: 18px;
  color: var(--ink);
  margin: 12px 0 18px;
}
.atlas-end-meta{
  font-family: var(--mono);
  font-size: 11px; letter-spacing: 0.04em;
  color: var(--ink-mute);
}

/* ======================================================
   AS-OF chip (Pulse hero) + REWIND chips (above scrubber)
   ====================================================== */
.asof-chip{
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 14px;
  padding: 6px 12px 6px 10px;
  background: var(--card);
  border: 1px solid var(--line-2);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 11px; letter-spacing: 0.06em;
  color: var(--ink-2);
}
.asof-dot{
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 0 rgba(190,60,43,0.55);
  animation: asofPulse 2.2s ease-in-out infinite;
}
@keyframes asofPulse{
  0%   { box-shadow: 0 0 0 0 rgba(190,60,43,0.55); }
  60%  { box-shadow: 0 0 0 8px rgba(190,60,43,0); }
  100% { box-shadow: 0 0 0 0 rgba(190,60,43,0); }
}
.asof-label{
  font-weight: 600; color: var(--red);
  letter-spacing: 0.18em;
}
.asof-val{ color: var(--ink); }

/* Rewind row */
.rewind-row{
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.rewind-label{
  font-family: var(--mono);
  font-size: 10px; letter-spacing: 0.2em;
  color: var(--ink-3); font-weight: 600;
  text-transform: uppercase;
}
.rewind-chips{
  display: flex; gap: 6px; flex-wrap: wrap;
}
.rewind-chip{
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 11px; letter-spacing: 0.04em;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.rewind-chip:hover{
  background: var(--card);
  border-color: var(--ink);
  color: var(--ink);
}
.rewind-chip.is-active{
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}
.rewind-chip-day{ font-weight: 600; }
.rewind-chip-depth{
  opacity: 0.7;
  margin-left: 6px;
  font-size: 10px;
}
.rewind-chip.is-active .rewind-chip-depth{ opacity: 0.9; }

@media (max-width: 480px){
  .rewind-row{ gap: 8px; }
  .rewind-chip{ padding: 4px 8px; font-size: 10px; }
}

/* AI narration: framing paragraph */
.ai-narrative-frame{
  border-left: 2px solid var(--red-hot);
  padding-left: 14px;
  font-size: 14px !important;
  color: #d4c8b6 !important;
  font-style: italic;
}
.ai-narrative-frame em{
  color: var(--red-hot) !important;
  font-style: normal;
}

/* ======================================================
   STATUS RIBBON — appears for both Tour and Well
   ====================================================== */
.status-ribbon{
  background: var(--ink);
  color: #f4efe6;
  padding: 8px 0;
  border-bottom: 1px solid #000;
}
.status-ribbon-inner{
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 clamp(16px, 3vw, 32px);
  display: flex; align-items: center; gap: 12px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: #d4c8b6;
}
.status-ribbon-dot{
  width: 7px; height: 7px; border-radius: 50%;
  background: #6a7a52; flex-shrink: 0;
}
.status-ribbon.is-active .status-ribbon-dot{
  background: var(--red-hot);
  box-shadow: 0 0 0 0 rgba(255, 90, 60, 0.6);
  animation: ribbonPulse 1.8s ease-out infinite;
}
@keyframes ribbonPulse{
  0%   { box-shadow: 0 0 0 0 rgba(255,90,60,0.55); }
  70%  { box-shadow: 0 0 0 7px rgba(255,90,60,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,90,60,0); }
}
.status-ribbon-state{ color: #fff; font-weight: 600; letter-spacing: 0.16em; }
.status-ribbon-sep{ color: #5a5246; }
.status-ribbon-detail{ color: #d4c8b6; }
.status-ribbon-progress{ color: #ece5d6; margin-left: auto; }
@media (max-width: 720px){
  .status-ribbon-inner{ flex-wrap: wrap; row-gap: 4px; font-size: 10px; }
  .status-ribbon-progress{ margin-left: 0; width: 100%; }
}

/* ======================================================
   DAY SECTION — daily report cockpit (lead block of TOUR)
   ====================================================== */
.day-section{
  max-width: 1320px;
  margin: 0 auto;
  padding: clamp(24px, 4vw, 40px) clamp(16px, 3vw, 32px) 0;
}
.day-rewind{
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.day-rewind-label{
  font-family: var(--display);
  font-size: 12px;
  letter-spacing: 0.18em;
  color: var(--ink-3);
}
.day-rewind-chips{
  display: flex; gap: 6px; flex-wrap: wrap;
}
.day-chip{
  appearance: none;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 12px;
  display: inline-flex; flex-direction: column; align-items: center;
  gap: 1px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
  min-width: 64px;
}
.day-chip:hover{ background: var(--bg-3); }
.day-chip:active{ transform: scale(0.97); }
.day-chip.is-active{
  background: var(--red);
  border-color: var(--red-deep);
  color: #fff;
}
.day-chip.is-future{
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}
.day-chip-day{
  font-family: var(--display);
  font-size: 13px;
  letter-spacing: 0.06em;
  line-height: 1;
}
.day-chip-depth{
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-3);
  letter-spacing: 0;
}
.day-chip.is-active .day-chip-depth{ color: rgba(255,255,255,0.85); }
.day-chip-today{
  position: relative;
}
.day-chip-today::before{
  content: "";
  position: absolute;
  top: 4px; right: 4px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--red-hot);
  box-shadow: 0 0 0 0 rgba(255,90,60,0.55);
  animation: ribbonPulse 1.8s ease-out infinite;
}
.day-chip.is-active.day-chip-today::before{ background: #fff; box-shadow: none; animation: none; }

.day-card{
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(20px, 3.5vw, 36px);
  position: relative;
  overflow: hidden;
}
.day-card::before{
  content: "";
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--red) 0%, var(--red-hot) 100%);
}
.day-head{
  display: grid;
  grid-template-columns: auto 1fr;
  gap: clamp(20px, 4vw, 48px);
  align-items: end;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
}
.day-head-left{ min-width: 0; }
.day-num-row{
  display: flex; align-items: baseline; gap: 8px;
  font-family: var(--display);
  line-height: 1;
}
.day-num-label{
  font-size: 13px; letter-spacing: 0.22em; color: var(--ink-3);
}
.day-num-val{
  font-size: clamp(64px, 9vw, 112px);
  color: var(--ink);
  letter-spacing: -0.02em;
}
.day-of{
  font-size: 14px; color: var(--ink-3); letter-spacing: 0.14em;
}
.day-date{
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--ink-3);
  margin-top: 6px;
}
.day-head-right{ min-width: 0; }
.day-headline{
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(20px, 3vw, 30px);
  line-height: 1.15;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.day-subhead{
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 8px;
  letter-spacing: 0.04em;
}

.day-grid{
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: clamp(14px, 2vw, 22px);
}
.day-cell{
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px;
  min-width: 0;
}
.day-cell-footage{ grid-column: span 4; }
.day-cell-hours{ grid-column: span 4; }
.day-cell-cost{ grid-column: span 4; }
.day-cell-bha{ grid-column: span 5; }
.day-cell-narrative{ grid-column: span 7; }
@media (max-width: 960px){
  .day-cell-footage, .day-cell-hours, .day-cell-cost{ grid-column: span 6; }
  .day-cell-bha, .day-cell-narrative{ grid-column: span 12; }
  .day-head{ grid-template-columns: 1fr; gap: 14px; }
}
@media (max-width: 540px){
  .day-cell-footage, .day-cell-hours, .day-cell-cost{ grid-column: span 12; }
}

.day-cell-eyebrow{
  font-size: 10px; letter-spacing: 0.22em; color: var(--ink-3); font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.day-cell-big{
  font-family: var(--display);
  font-size: clamp(34px, 5vw, 52px);
  line-height: 1;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.day-cell-currency{
  font-size: 0.55em;
  color: var(--ink-3);
  margin-right: 2px;
  vertical-align: top;
  position: relative;
  top: 0.15em;
}
.day-cell-unit{
  font-family: var(--mono);
  font-size: 14px;
  color: var(--ink-3);
  margin-left: 4px;
  letter-spacing: 0.04em;
}
.day-cell-meta{
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 4px;
  letter-spacing: 0.02em;
}
.day-cell-small{
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-mute);
  margin-top: 6px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.day-footage-track, .day-cost-bar{
  margin-top: 12px;
  height: 6px;
  background: var(--bg-3);
  border-radius: 3px;
  overflow: hidden;
}
.day-footage-fill{
  height: 100%;
  background: linear-gradient(90deg, var(--red) 0%, var(--red-hot) 100%);
  border-radius: 3px;
  transition: width 0.6s ease;
}
.day-cost-fill{
  height: 100%;
  background: var(--ink-2);
  border-radius: 3px;
  transition: width 0.6s ease;
}

/* Hours donut */
.day-hours-row{
  display: flex; gap: 18px; align-items: center;
}
.day-donut{
  width: 120px; height: 120px;
  flex-shrink: 0;
}
.day-hours-legend{
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 6px;
  font-family: var(--mono); font-size: 11px;
  flex: 1;
}
.day-hours-legend li{
  display: flex; align-items: center; gap: 8px;
}
.day-hours-legend i{
  width: 9px; height: 9px; border-radius: 2px;
  flex-shrink: 0;
}
.day-hours-legend-name{ color: var(--ink-2); flex: 1; }
.day-hours-legend-val{ color: var(--ink); font-weight: 600; }

/* Active BHA */
.day-bha-row{
  display: flex; gap: 16px; align-items: flex-start;
  padding-top: 4px;
}
.day-bha-num{
  font-family: var(--display);
  font-size: 56px;
  line-height: 0.9;
  color: var(--red);
  letter-spacing: -0.04em;
  flex-shrink: 0;
}
.day-bha-body{ min-width: 0; flex: 1; }
.day-bha-section{
  font-family: var(--display);
  font-size: 18px;
  color: var(--ink);
  line-height: 1.15;
  letter-spacing: 0.01em;
}
.day-bha-bit{
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 4px;
  letter-spacing: 0.02em;
}
.day-bha-meta{
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-mute);
  margin-top: 6px;
  letter-spacing: 0.02em;
}

/* Narrative */
.day-narrative{
  margin: 0;
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink-2);
}
.day-narrative em{
  color: var(--red);
  font-style: normal;
  font-weight: 600;
}

/* Hero secondary (now lower in page) */
.hero-secondary{ margin-top: 28px; padding-top: 28px; border-top: 1px solid var(--line); }
.hero-secondary .title{ font-size: clamp(22px, 3vw, 30px); }

/* ======================================================
   WELL view — locked chapter treatment
   ====================================================== */
.atlas-locked{
  background: var(--bg-2);
  border: 1px dashed var(--line-2);
  border-radius: 12px;
  padding: clamp(28px, 5vw, 56px);
  text-align: center;
  color: var(--ink-3);
  margin: 28px 0;
}
.atlas-locked-icon{
  width: 56px; height: 56px;
  margin: 0 auto 16px;
  color: var(--ink-mute);
}
.atlas-locked-title{
  font-family: var(--display);
  font-size: clamp(20px, 3vw, 28px);
  color: var(--ink-2);
  letter-spacing: 0.01em;
  margin-bottom: 12px;
}
.atlas-locked-body{
  max-width: 56ch;
  margin: 0 auto;
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink-3);
}
.atlas-locked-progress{
  margin-top: 22px;
  display: inline-flex; gap: 10px; align-items: center;
  padding: 6px 14px;
  background: var(--bg-3);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--ink-3);
}
.atlas-locked-progress-sep{ color: var(--ink-mute); }

.atlas-locked-note{
  max-width: 52ch;
  margin: 14px auto 0;
  padding: 10px 14px;
  background: rgba(190,60,43,0.04);
  border-left: 2px solid rgba(190,60,43,0.4);
  border-radius: 2px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--ink-3);
  font-style: italic;
  text-align: left;
}

/* Mid-job Chapter II run state badges */
.atlas-run-badge{
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-left: 8px;
  vertical-align: middle;
}
.atlas-run-badge-active{
  background: var(--red);
  color: #fff;
}
.atlas-run-badge-scheduled{
  background: var(--bg-3);
  color: var(--ink-3);
  border: 1px solid var(--line);
}
.atlas-run.is-scheduled{
  opacity: 0.55;
}
.atlas-run.is-scheduled .atlas-run-prose{ font-style: italic; color: var(--ink-3); }

/* Hide the old AS-OF chip — status ribbon supersedes it */
.asof-chip{ display: none; }

/* ======================================================
   MOBILE FINESSE — phone-first refinements
   ====================================================== */

/* --- Status ribbon: compact one-line at ≤480 -------- */
@media (max-width: 480px){
  .status-ribbon{ padding: 8px 14px; }
  .status-ribbon-inner{
    flex-wrap: wrap;
    row-gap: 2px;
    column-gap: 8px;
    font-size: 10px;
    letter-spacing: 0.06em;
  }
  /* Hide the middle separators on phone — spacing alone reads cleanly */
  .status-ribbon-sep{ display: none; }
  /* Push progress (e.g. "100% · 5,853 m of 5,853 m") onto its own line, right-aligned */
  .status-ribbon-progress{
    margin-left: 0;
    width: 100%;
    text-align: right;
    margin-top: 2px;
    color: #ece5d6;
    opacity: 0.85;
  }
  .status-ribbon-detail{ font-size: 10px; }
}

/* --- Day-rewind chip strip: horizontal swipe-scroll on mobile -------- */
@media (max-width: 720px){
  .day-rewind{
    /* stack label on its own line so chips get full width */
    flex-wrap: nowrap;
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
  }
  .day-rewind-label{
    font-size: 11px;
  }
  .day-rewind-chips{
    flex-wrap: nowrap;          /* one row */
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    /* Bleed slightly beyond the section padding for a nicer edge feel */
    margin-left: calc(-1 * clamp(16px, 3vw, 32px));
    margin-right: calc(-1 * clamp(16px, 3vw, 32px));
    padding: 4px clamp(16px, 3vw, 32px);
    gap: 8px;
    /* Hide horizontal scrollbar but keep functionality */
    scrollbar-width: none;
  }
  .day-rewind-chips::-webkit-scrollbar{ display: none; }
  .day-chip{
    flex: 0 0 auto;
    scroll-snap-align: start;
    min-width: 78px;
  }
  /* Subtle right-edge fade so users feel there's more to swipe */
  .day-rewind{
    position: relative;
  }
  .day-rewind::after{
    content: "";
    position: absolute;
    top: auto; bottom: 4px; right: 0;
    width: 28px; height: 56px;
    pointer-events: none;
    background: linear-gradient(to right, rgba(250,247,242,0), var(--bg) 80%);
  }
}

/* --- Day card: tighter padding on small phones -------- */
@media (max-width: 540px){
  .day-section{
    padding: 20px 14px 0;
  }
  .day-card{
    padding: 18px 16px;
    border-radius: 10px;
  }
  .day-card-grid{ gap: 12px; }
  .day-cell{
    padding: 14px 14px;
  }
  /* Big DAY headline scales down */
  .day-head-num{
    font-size: clamp(60px, 18vw, 96px);
  }
  .day-headline{ font-size: clamp(18px, 5.2vw, 24px); }
  .day-meta{ font-size: 12px; }
  /* Cost / footage big numbers tighten */
  .day-cell-big{ font-size: clamp(30px, 8vw, 44px); }
}

/* --- Hours donut: side-by-side legend reflows below at narrow widths -------- */
@media (max-width: 420px){
  .day-donut-row{
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }
  .day-donut{ align-self: center; }
  .day-donut-legend{ width: 100%; }
}

/* --- BHA cell: number + body sometimes squashes -------- */
@media (max-width: 540px){
  .day-bha{
    gap: 14px;
  }
  .day-bha-num{
    font-size: clamp(40px, 12vw, 60px);
  }
}

/* --- WELL cover: tighter rhythm on mobile ------- */
@media (max-width: 600px){
  .atlas-cover{
    padding: 24px 14px 32px;
  }
  .atlas-cover-mast{
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    font-size: 11px;
    letter-spacing: 0.16em;
  }
  .atlas-cover-mast-right{ font-size: 11px; }
  .atlas-cover-eyebrow{ font-size: 12px; letter-spacing: 0.18em; }
  .atlas-cover-title{
    font-size: clamp(56px, 18vw, 96px);
    line-height: 0.92;
  }
  .atlas-cover-meta{
    row-gap: 10px;
    margin-top: 12px;
  }
  .atlas-cover-meta-row{
    grid-template-columns: 80px 1fr;   /* tighter label column */
    gap: 10px;
    font-size: 13px;
    padding-top: 8px;
  }
  .atlas-cover-meta-label{
    font-size: 9.5px;
    letter-spacing: 0.12em;
  }
}

/* --- WELL chapters: ease padding & headline scale on mobile ------- */
@media (max-width: 600px){
  .atlas-chapter{
    padding: 32px 14px;
  }
  .atlas-chapter-num{ font-size: 11px; }
  .atlas-chapter-title{
    font-size: clamp(44px, 12vw, 72px);
    line-height: 0.95;
  }
  .atlas-chapter-deck{
    font-size: 16px;
    line-height: 1.45;
  }
  .atlas-locked{
    padding: 28px 18px;
  }
  .atlas-locked-icon svg{ width: 44px; height: 44px; }
  .atlas-locked-title{ font-size: 18px; line-height: 1.25; }
  .atlas-locked-body{ font-size: 14px; line-height: 1.55; }
  /* Ticket bars: vendor name + bar + amount stack on phones */
  .atlas-ticket-row{
    grid-template-columns: 1fr;
    row-gap: 6px;
    padding: 12px 0;
  }
  .atlas-ticket-row-amount{
    grid-column: 1; text-align: left;
    font-size: 14px;
  }
  .atlas-ticket-headline-num{
    font-size: clamp(36px, 10vw, 56px);
  }
}

/* --- Topbar: brand-sub stays single-line readable; reduce gap ------- */
@media (max-width: 480px){
  .topbar-inner{ padding: 10px 14px; gap: 8px; }
  .brand{ gap: 9px; }
  .brand-mark, .brand-logo{ width: 34px; height: 34px; }
  .brand-name{ font-size: 16px; letter-spacing: 0.07em; }
  .brand-tagline{ font-size: 8.5px; letter-spacing: 0.04em; }
  .brand-sub{ font-size: 9px; letter-spacing: 0.14em; }
  /* The op-tag is already hidden on mobile in earlier rules */
}
@media (max-width: 380px){
  /* On the smallest phones, drop the redundant TOUR/LAMBERT line so
     the tagline survives — brand identity wins over the path crumb */
  .brand-sub{ display: none; }
}

/* --- Mode switch (TOUR/WELL): keep clean & tappable ------- */
@media (max-width: 480px){
  .mode-switch{
    padding: 3px;
  }
  .mode-btn{
    font-size: 12px;
    padding: 7px 14px;
    min-height: 38px;       /* meets 44px tap-target with padding */
  }
}

/* ========================================================================
   v22 — VIEWPORT LOCK FOR PRESENTATION
   --------------------------------------------------------------------
   On a tablet-class landscape screen (iPad 11" ≈ 1180×820), lock the
   spine fly-through and the days-vs-depth race so they each occupy a
   single screen-height with no internal scroll. The whole instrument
   reads as one frame: SVG on the left, supporting data on the right,
   counter row pinned bottom (DvD) or scrubber pinned bottom (spine).

   The lock activates only at >=900px landscape, so portrait iPad and
   any phone keep the existing stacked layout. Replay/counter chips
   continue to work identically.

   We use 100svh (small viewport height) so iPadOS Safari's URL bar
   doesn't push content off-screen during scroll. Falls back to 100vh.
   ======================================================================== */
@media (min-width: 900px) and (orientation: landscape){

  /* ---- SPINE: bore SVG left, readouts right, scrubber pinned bottom ---- */
  .spine-section{
    height: 100vh;
    height: 100svh;
    max-height: 880px;          /* never grow beyond a comfortable tall-iPad */
    margin-top: 0;
    /* Top padding clears the 98px sticky brand bar so the section title isn't
       hidden behind it. Bottom padding leaves a hair of breathing room. */
    padding: 108px 0 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-sizing: border-box;
  }
  /* Compact head — single line, eyebrow + title + lede inline to maximise
     vertical real estate available to the bore SVG and readouts */
  .spine-section .section-head{
    margin: 0;
    flex: 0 0 auto;
  }
  .spine-section .section-head > div{
    display: flex;
    align-items: baseline;
    gap: 16px;
    flex-wrap: wrap;
  }
  .spine-section .eyebrow{ font-size: 10px; }
  .spine-section .section-title{
    font-size: clamp(20px, 2.2vw, 26px);
    line-height: 1.05;
    margin: 0;
  }
  .spine-section .section-lede{
    font-size: 13px;
    margin: 0;
    max-width: 56ch;
    color: var(--ink-3);
  }

  .spine-counter-row{ margin: 0; }

  /* Frame becomes the flex-grow body */
  .spine-frame{
    flex: 1 1 0;
    min-height: 0;              /* critical for nested flex sizing */
    grid-template-columns: clamp(180px, 22%, 280px) 1fr;
    gap: 20px;
    padding: 16px;
    overflow: hidden;
  }

  /* Bore SVG must stretch to fill the frame, not 720px fixed height */
  .spine-bore{ height: 100%; max-height: none; min-height: 0; }
  .bore-svg{ height: 100%; }

  /* Readouts column: scroll only if absolutely necessary, but we want the
     whole grid visible — shrink the depth-headline a touch and tighten gaps */
  .spine-readouts{ gap: 10px; min-height: 0; overflow: hidden; }
  .spine-readouts .readout-block{ padding-bottom: 8px; }
  .spine-readouts .readout-md-num{ font-size: clamp(36px, 4.5vw, 56px); }
  .spine-readouts .readout-grid{ gap: 6px; }
  .spine-readouts .readout-cell{ padding: 6px 9px; }
  .spine-readouts .readout-cell-value{ font-size: clamp(16px, 1.6vw, 20px); }
  .spine-readouts .readout-bha{ padding: 8px 10px; }

  /* Scrubber pinned at bottom — already last child of .spine-section */
  .scrubber-wrap{
    margin-top: 0;
    padding: 8px 16px 4px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    flex: 0 0 auto;
  }
  /* Drop the legacy 'rewind day chips' row in the locked layout to save
     vertical space — the day-rewind functionality is exposed elsewhere
     (it was originally there as a redundancy with the chip row above the spine). */
  .scrubber-wrap .rewind-row{ display: none; }

  /* ---- DvD: chart left, offset list right, counter pinned bottom ---- */
  .dvd-section{
    height: 100vh;
    height: 100svh;
    max-height: 880px;
    margin-top: 0;
    padding: 108px 0 12px;       /* clears sticky brand bar */
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-sizing: border-box;
  }
  .dvd-section .section-head{ margin: 0; flex: 0 0 auto; }
  .dvd-section .section-head > div{
    display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap;
  }
  .dvd-section .section-title{
    font-size: clamp(20px, 2.2vw, 26px);
    line-height: 1.05;
    margin: 0;
  }
  .dvd-section .section-lede{
    font-size: 13px; margin: 0; max-width: 56ch; color: var(--ink-3);
  }

  .dvd-frame{
    flex: 1 1 0;
    min-height: 0;
    display: grid;
    grid-template-columns: 1fr clamp(220px, 26%, 320px);
    grid-template-rows: auto 1fr;
    grid-template-areas:
      "counter offsets"
      "chart   offsets";
    gap: 12px 18px;
    padding: 14px 18px;
    overflow: hidden;
  }
  .dvd-counter-row{ grid-area: counter; margin: 0; }
  .dvd-svg{
    grid-area: chart;
    width: 100%; height: 100%;
    min-height: 0;
  }
  .dvd-offset-list{
    grid-area: offsets;
    align-self: stretch;
    overflow-y: auto;
    padding-right: 4px;
    font-size: 12px;
  }
}

/* On wider desktop screens (>=1200px landscape), cap the locked-section
   height a touch tighter — prevents the bore SVG from looking absurdly
   tall on a 27" monitor. */
@media (min-width: 1200px) and (orientation: landscape){
  .spine-section, .dvd-section{ max-height: 820px; }
}

