/* ==========================================================================
   lowball.dev — midnight observatory for deliberate underestimation
   Palette (midnight-blue, 7-step):
     #070C1A abyssal      — page background
     #0F1A33 cobalt-floor — primary surface tone
     #1A2A4D night-cobalt — glassmorphic card base
     #3A4A6E sextant-rule — hairline borders, dotted spine
     #7BA8D6 phosphor     — instrument readouts, mono numerals
     #A6C0E8 moon-glass   — primary display type, line art
     #F4F1E6 paper-warm   — body serif color (warm cream)
   Accent (used at most twice per viewport):
     #E8B96B amber-tumbler — hover, blinking record dot
   Easing: cubic-bezier(0.22, 0.61, 0.36, 1)  "soft cabin"
   ========================================================================== */

:root {
  --abyssal:        #070C1A;
  --cobalt-floor:   #0F1A33;
  --night-cobalt:   #1A2A4D;
  --sextant-rule:   #3A4A6E;
  --phosphor:       #7BA8D6;
  --moon-glass:     #A6C0E8;
  --paper-warm:     #F4F1E6;
  --amber-tumbler:  #E8B96B;

  --soft-cabin: cubic-bezier(0.22, 0.61, 0.36, 1);

  --display: 'Major Mono Display', 'Space Mono', monospace;
  --serif:   'Cormorant Garamond', 'Cormorant', serif;
  --grotesk: 'Space Grotesk', 'Space', sans-serif;
  --plex:    'IBM Plex Mono', 'Inter', monospace;

  --max-text: 720px;
}

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

html, body {
  background: var(--abyssal);
  color: var(--paper-warm);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body {
  position: relative;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 50% 0%,    rgba(26, 42, 77, 0.55) 0%, transparent 55%),
    radial-gradient(ellipse at 80% 100%,  rgba(15, 26, 51, 0.65) 0%, transparent 60%),
    var(--abyssal);
}

img, svg { display: block; max-width: 100%; }

/* ==========================================================================
   Bubble field — ambient drift, scroll-independent
   ========================================================================== */

.bubble-field {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.bubble {
  position: absolute;
  bottom: -120px;
  left: var(--x);
  width: calc(72px * var(--s, 1));
  height: calc(72px * var(--s, 1));
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 25%, rgba(244, 241, 230, 0.18) 0%, rgba(244, 241, 230, 0.05) 22%, transparent 38%),
    rgba(166, 192, 232, 0.06);
  border: 1px solid rgba(166, 192, 232, 0.20);
  box-shadow:
    inset 0 0 24px rgba(123, 168, 214, 0.10),
    0 0 28px rgba(166, 192, 232, 0.05);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  animation-name: bubble-rise;
  animation-iteration-count: infinite;
  animation-timing-function: linear;
  animation-delay: var(--d, 0s);
  will-change: transform, opacity;
  opacity: 0.0;
}

.bubble--slow { animation-duration: 110s; }
.bubble--med  { animation-duration: 70s; }
.bubble--fast { animation-duration: 40s; }

@keyframes bubble-rise {
  0%   { transform: translate3d(0, 0,        0) translateX(0);    opacity: 0; }
  8%   { opacity: 0.55; }
  50%  { transform: translate3d(0, -55vh,    0) translateX(18px); opacity: 0.65; }
  92%  { opacity: 0.40; }
  100% { transform: translate3d(0, -120vh,   0) translateX(-12px); opacity: 0; }
}

/* ==========================================================================
   Constellation spine — vertical hand-placed dotted column at ~col 3
   ========================================================================== */

.spine {
  position: absolute;
  top: 0;
  left: 14%;
  width: 1px;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

.spine__marks {
  list-style: none;
  position: relative;
  width: 1px;
  height: 100%;
  margin: 0;
  padding: 0;
}

.spine__marks li {
  position: absolute;
  top: var(--y);
  left: -1px;
  width: 2px;
  height: 2px;
  background: var(--sextant-rule);
  border-radius: 50%;
}

.spine__marks .dot--circle {
  width: 6px;
  height: 6px;
  background: transparent;
  border: 1px solid var(--sextant-rule);
  left: -3px;
}

@media (max-width: 780px) {
  .spine { left: 6%; }
}

/* ==========================================================================
   Document layout
   ========================================================================== */

.log {
  position: relative;
  z-index: 2;
}

.movement {
  position: relative;
  padding: 96px 6vw 96px 16%;
  min-height: 60vh;
}

.movement__head {
  margin-bottom: 64px;
}

.movement__title {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.4rem, 6.4vw, 6.4rem);
  line-height: 0.92;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--moon-glass);
  margin-top: 12px;
}

.micro-label {
  display: inline-block;
  font-family: var(--grotesk);
  font-weight: 500;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--phosphor);
}

.plex {
  font-family: var(--plex);
  font-weight: 400;
  font-size: 0.84rem;
  color: var(--phosphor);
  letter-spacing: 0.02em;
}

@media (max-width: 780px) {
  .movement { padding: 72px 8vw 72px 14%; }
}

/* ==========================================================================
   Movement I — STILL
   Full-bleed cabin window. Resolves (no fade) over 1.4s.
   ========================================================================== */

.movement--still {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6vh 6vw 12vh;
  background:
    radial-gradient(ellipse at 50% 50%, rgba(26, 42, 77, 0.65) 0%, transparent 70%),
    var(--abyssal);
}

.still__resolve {
  text-align: center;
  max-width: 920px;
  filter: blur(8px);
  opacity: 0;
  animation: still-resolve 1.4s var(--soft-cabin) 0.2s forwards;
}

@keyframes still-resolve {
  0%   { filter: blur(14px); opacity: 0; }
  60%  { filter: blur(4px);  opacity: 0.9; }
  100% { filter: blur(0);    opacity: 1; }
}

.still__glass {
  width: clamp(160px, 18vw, 260px);
  margin: 0 auto 56px;
}

.glass {
  width: 100%;
  height: auto;
}

.ice {
  transform-origin: center;
  animation: ice-drift 18s ease-in-out infinite;
  transform-box: fill-box;
}

.ice--a { animation-delay: 0s; }
.ice--b { animation-delay: -7s; animation-duration: 22s; }
.ice--single { animation-duration: 26s; animation-delay: -3s; }

@keyframes ice-drift {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  25%      { transform: translate(2px, -3px) rotate(1deg); }
  50%      { transform: translate(-1px, 2px) rotate(-1.2deg); }
  75%      { transform: translate(3px, 1px) rotate(0.8deg); }
}

.still__title {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(3.6rem, 7.2vw, 9rem);
  line-height: 0.92;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--moon-glass);
  margin-bottom: 24px;
}

.still__sub {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.15rem, 1.6vw, 1.6rem);
  color: var(--paper-warm);
  letter-spacing: 0.01em;
  margin-bottom: 56px;
  opacity: 0.92;
}

.still__meta {
  display: inline-flex;
  align-items: center;
  gap: 18px;
  padding: 8px 18px;
  border: 1px solid var(--sextant-rule);
  border-radius: 1px;
}

/* ==========================================================================
   Movement II — THE THESIS
   ========================================================================== */

.movement--thesis {
  padding-top: 14vh;
  padding-bottom: 14vh;
}

.logbook {
  max-width: var(--max-text);
  position: relative;
}

.logbook p {
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--paper-warm);
  margin-bottom: 1.4em;
  font-feature-settings: "liga" 1, "onum" 1;
}

.logbook p em {
  font-style: italic;
  color: var(--moon-glass);
}

.pull {
  position: relative;
  margin: 64px 0 64px -24px;
  padding: 8px 0 8px 24px;
  border-left: 1px solid var(--sextant-rule);
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.6rem, 2.2vw, 2.4rem);
  line-height: 1.32;
  color: var(--moon-glass);
  font-feature-settings: "liga" 1, "onum" 1;
}

.pull::before {
  content: "";
  position: absolute;
  left: -3px;
  top: -8px;
  width: 5px;
  height: 5px;
  background: var(--moon-glass);
  border-radius: 50%;
  opacity: 0.6;
}

/* ==========================================================================
   Movement III — THE WORK, IN PORTHOLES
   Hand-placed coordinates, not a grid.
   ========================================================================== */

.movement--portholes {
  min-height: 1100px;
  padding-bottom: 18vh;
}

.portholes {
  position: relative;
  height: 920px;
  margin-top: 24px;
}

.porthole {
  position: absolute;
  top: var(--top);
  left: var(--left);
  width: var(--size);
  cursor: default;
  transition: transform 1.2s var(--soft-cabin);
}

.porthole__bezel {
  position: relative;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 30%, rgba(26, 42, 77, 0.85), rgba(15, 26, 51, 0.95)),
    var(--night-cobalt);
  border: 1px solid var(--sextant-rule);
  box-shadow:
    inset 0 0 0 6px rgba(15, 26, 51, 0.85),
    inset 0 0 0 7px var(--sextant-rule),
    0 30px 60px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  transition: box-shadow 1.2s var(--soft-cabin), border-color 1.2s var(--soft-cabin);
}

.porthole__bezel::before {
  /* breathing-ring around active porthole — Lottie #4 substitute */
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 1px solid rgba(166, 192, 232, 0.0);
  animation: breathing-ring 4s var(--soft-cabin) infinite;
  pointer-events: none;
}

@keyframes breathing-ring {
  0%, 100% { transform: scale(1.0);  border-color: rgba(166, 192, 232, 0.05); }
  50%      { transform: scale(1.04); border-color: rgba(166, 192, 232, 0.18); }
}

.rivet {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--sextant-rule);
  box-shadow: 0 0 0 1px rgba(123, 168, 214, 0.18);
  transform:
    translate(-50%, -50%)
    rotate(var(--a))
    translate(0, calc(var(--size, 280px) / -2 + 14px));
}

.porthole__pane {
  position: absolute;
  inset: 14px;
  border-radius: 50%;
  background: rgba(15, 26, 51, 0.55);
  backdrop-filter: blur(24px) saturate(1.2);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
  border: 1px solid rgba(166, 192, 232, 0.12);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 14px;
}

.porthole__index {
  position: absolute;
  top: 12%;
  left: 50%;
  transform: translateX(-50%);
  color: var(--phosphor);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
}

.porthole__pinpoint {
  position: absolute;
  top: 22%;
  right: 18%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: transparent;
  outline: 1px solid rgba(232, 185, 107, 0.0);
  transition: outline-color 1.2s var(--soft-cabin), background 1.2s var(--soft-cabin);
}

.porthole__name {
  font-family: var(--display);
  font-size: clamp(0.92rem, 1.2vw, 1.2rem);
  letter-spacing: 0.06em;
  color: var(--moon-glass);
  text-transform: uppercase;
  line-height: 1;
}

.porthole__caption {
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.96rem;
  line-height: 1.5;
  color: var(--paper-warm);
  margin-top: 18px;
  padding-left: 6px;
  max-width: var(--size);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 1.4s var(--soft-cabin), transform 1.4s var(--soft-cabin);
}

.porthole.is-hover {
  transform: rotate(1deg);
}
.porthole.is-hover .porthole__bezel {
  border-color: var(--phosphor);
  box-shadow:
    inset 0 0 0 6px rgba(15, 26, 51, 0.85),
    inset 0 0 0 7px var(--phosphor),
    0 30px 60px rgba(0, 0, 0, 0.45);
}
.porthole.is-hover .porthole__pinpoint {
  background: var(--amber-tumbler);
  outline-color: var(--amber-tumbler);
  box-shadow: 0 0 8px rgba(232, 185, 107, 0.6);
}
.porthole.is-hover .porthole__caption {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 980px) {
  .movement--portholes { min-height: auto; }
  .portholes {
    position: static;
    height: auto;
    display: flex;
    flex-direction: column;
    gap: 80px;
    align-items: center;
  }
  .porthole {
    position: static;
    width: min(80vw, 320px);
  }
  .porthole__bezel {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
  }
  .rivet {
    transform:
      translate(-50%, -50%)
      rotate(var(--a))
      translate(0, calc(min(80vw, 320px) / -2 + 14px));
  }
}

/* ==========================================================================
   Movement IV — OBSERVATORY
   Full-bleed cabin window. 60vh of held silence.
   ========================================================================== */

.movement--observatory {
  padding: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 60%, rgba(26, 42, 77, 0.55), transparent 70%),
    linear-gradient(180deg, var(--abyssal) 0%, var(--cobalt-floor) 60%, var(--abyssal) 100%);
}

.observatory {
  position: relative;
  width: 100%;
  max-width: 1200px;
  padding: 14vh 6vw;
  text-align: center;
}

.observatory__sextant {
  width: clamp(200px, 22vw, 320px);
  margin: 0 auto 64px;
  animation: sextant-rotate 12s linear infinite;
  transform-origin: center;
}

@keyframes sextant-rotate {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.observatory__caption {
  margin-bottom: 24px;
}

.observatory__line {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(1.4rem, 2.6vw, 2.6rem);
  line-height: 1.4;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--moon-glass);
  max-width: 1100px;
  margin: 0 auto;
}

.moon {
  position: absolute;
  bottom: -90px;
  right: -90px;
  width: clamp(220px, 28vw, 380px);
  pointer-events: none;
  opacity: 0.92;
}

/* ==========================================================================
   Movement V — BELL-JARS
   Three vertical 2x3 bell-jars, side-by-side at desktop, stacked on mobile.
   ========================================================================== */

.movement--belljars {
  padding-bottom: 14vh;
}

.belljars {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 56px;
  max-width: 1200px;
  margin-top: 24px;
}

.belljar {
  position: relative;
  background: rgba(26, 42, 77, 0.45);
  backdrop-filter: blur(24px) saturate(1.2);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
  border: 1px solid var(--sextant-rule);
  border-radius: 140px 140px 8px 8px;
  padding: 56px 32px 40px;
  min-height: 420px;
  overflow: hidden;
}

.belljar::before {
  /* dome rim curve */
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  height: 30%;
  border: 1px solid rgba(166, 192, 232, 0.18);
  border-bottom: none;
  border-radius: 140px 140px 0 0;
  pointer-events: none;
}

.belljar__index {
  display: block;
  text-align: center;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: var(--phosphor);
  margin-bottom: 32px;
}

.belljar__glass p {
  font-family: var(--serif);
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--paper-warm);
  text-align: left;
  font-feature-settings: "liga" 1, "onum" 1;
}

.belljar__seal {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: 64px;
  height: 4px;
  background: var(--sextant-rule);
  border-radius: 2px;
}

@media (max-width: 980px) {
  .belljars { grid-template-columns: 1fr; gap: 44px; }
  .belljar  { min-height: 320px; }
}

/* ==========================================================================
   Movement VI — THE LOG
   IBM Plex Mono log entries on abyssal, blinking amber cursor.
   ========================================================================== */

.movement--log {
  background: var(--abyssal);
  padding-bottom: 14vh;
}

.log-readout {
  background: rgba(7, 12, 26, 0.6);
  border: 1px solid var(--sextant-rule);
  border-radius: 2px;
  padding: 36px 40px;
  max-width: 820px;
}

.log-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-family: var(--plex);
  font-size: 0.84rem;
  line-height: 2;
  color: var(--phosphor);
}

.log-list li {
  display: block;
  padding: 2px 0;
  border-bottom: 1px dashed rgba(58, 74, 110, 0.45);
  letter-spacing: 0.02em;
}

.log-list li:last-child { border-bottom: none; }

.log-date {
  color: var(--moon-glass);
  margin-right: 6px;
}

.log-list__current {
  color: var(--paper-warm);
}

.cursor {
  display: inline-block;
  width: 7px;
  height: 14px;
  background: var(--amber-tumbler);
  margin-left: 6px;
  vertical-align: -2px;
  animation: cursor-blink 1.6s steps(1, end) infinite;
}

@keyframes cursor-blink {
  0%, 49%   { opacity: 1; }
  50%, 100% { opacity: 0; }
}

@media (max-width: 600px) {
  .log-readout { padding: 24px 22px; }
  .log-list { font-size: 0.78rem; line-height: 1.9; }
}

/* ==========================================================================
   Movement VII — CLOSING TUMBLER
   Return to the glass, half empty, single ice cube. No CTA. Just floor.
   ========================================================================== */

.movement--closing {
  padding-top: 14vh;
  padding-bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.closing {
  max-width: 520px;
  margin: 0 auto 0;
  text-align: center;
  padding-bottom: 12vh;
}

.closing__glass {
  width: clamp(140px, 16vw, 220px);
  margin: 0 auto 40px;
}

.closing__line {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.2rem, 1.8vw, 1.7rem);
  color: var(--paper-warm);
  margin-bottom: 28px;
  line-height: 1.5;
}

.closing__signoff {
  display: inline-block;
  padding: 8px 16px;
  border: 1px solid var(--sextant-rule);
  color: var(--sextant-rule);
  letter-spacing: 0.16em;
}

.cobalt-floor {
  width: 100%;
  height: 240px;
  background:
    linear-gradient(180deg, var(--abyssal) 0%, #04080F 100%);
}

/* ==========================================================================
   Page-tone darkening across scroll  (set via JS as --tone-shift)
   ========================================================================== */

body {
  transition: filter 0.6s var(--soft-cabin);
}

body.is-deep {
  filter: brightness(0.94);
}

body.is-deeper {
  filter: brightness(0.90);
}

/* ==========================================================================
   Reduced motion: halts bubbles, freezes sextant, removes cursor blink.
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  .bubble,
  .ice,
  .observatory__sextant,
  .cursor,
  .porthole__bezel::before,
  .still__resolve {
    animation: none !important;
  }

  .still__resolve {
    filter: none;
    opacity: 1;
  }

  .cursor {
    background: var(--phosphor);
    opacity: 0.6;
  }
}
