/* ============================================================
   bostonai.io — a quiet almanac over Boston
   One palette: deep ink and harbor light. The sky above does
   the changing; the page below stays still.
   ============================================================ */

:root {
  --ink-0: #070b16;      /* deepest page ground */
  --ink-1: #0b1020;      /* section ground */
  --ink-2: #111a30;      /* card ground */
  --ink-3: #1a2440;      /* raised */
  --hairline: rgba(214, 216, 232, 0.11);
  --hairline-strong: rgba(214, 216, 232, 0.22);

  --cream: #e9e4d8;      /* primary text */
  --cream-dim: #b0aa9c;  /* secondary text */
  --cream-faint: #7d7a70;/* tertiary */

  --gold: #d9a662;       /* harbor light */
  --gold-soft: #b98d55;
  --rose: #c98a7c;       /* dawn */
  --sky: #8fb4d9;        /* day accent, sparse */
  --wax: #7c2d2d;

  --serif: "Fraunces", Georgia, serif;
  --sans: "Inter", -apple-system, system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;

  --col: 42rem;
  --col-wide: 66rem;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--ink-0);
  color: var(--cream);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.75;
  font-weight: 400;
  overflow-x: hidden;
}

::selection { background: rgba(217, 166, 98, 0.28); }

a { color: var(--gold); text-decoration: none; border-bottom: 1px solid rgba(217, 166, 98, 0.35); transition: border-color 160ms ease, color 160ms ease; }
a:hover { color: #ecc286; border-bottom-color: rgba(236, 194, 134, 0.7); }

.col { max-width: var(--col); margin: 0 auto; padding: 0 1.5rem; }
.col-wide { max-width: var(--col-wide); margin: 0 auto; padding: 0 1.5rem; }

.skip-link {
  position: absolute; left: -999px; top: 0.75rem; z-index: 50;
  background: var(--ink-3); color: var(--cream);
  padding: 0.5rem 1rem; border-radius: 4px; border-bottom: none;
}
.skip-link:focus { left: 0.75rem; }

/* ============ THE SKY (hero) ============ */

.scene {
  position: relative;
  height: 100vh;
  height: 100svh;
  min-height: 540px;
  overflow: hidden;
  background: #0b1020; /* until the canvas paints */
}

.scene__canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  display: block;
}

.scene__mast {
  position: absolute; top: 0; left: 0; right: 0; z-index: 3;
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 1.4rem 1.75rem;
  pointer-events: none;
}

.scene__wordmark,
.scene__coords,
.scene__date,
.scene__clock,
.scene__status { transition: color 2.5s ease, text-shadow 2.5s ease; }

.scene__wordmark {
  font-family: var(--serif);
  font-weight: 420;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  color: rgba(233, 228, 216, 0.92);
  text-shadow: 0 1px 12px rgba(5, 8, 18, 0.6);
}

.scene__coords {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: rgba(233, 228, 216, 0.55);
  text-shadow: 0 1px 10px rgba(5, 8, 18, 0.6);
}

.scene__overlay {
  position: absolute; inset: 0; z-index: 2;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
  padding: 0 1.25rem;
  pointer-events: none;
  transform: translateY(-6vh);
}

.scene__date {
  font-family: var(--mono);
  font-size: clamp(0.72rem, 1.6vw, 0.85rem);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(233, 228, 216, 0.66);
  text-shadow: 0 1px 14px rgba(5, 8, 18, 0.75);
}

.scene__clock {
  font-family: var(--serif);
  font-weight: 340;
  font-size: clamp(3.4rem, 12vw, 7.5rem);
  line-height: 1.05;
  letter-spacing: 0.01em;
  color: rgba(240, 236, 226, 0.97);
  text-shadow: 0 2px 34px rgba(5, 8, 18, 0.8);
  font-variant-numeric: tabular-nums;
  margin: 0.35rem 0 0.55rem;
}

.scene__clock .clock-sec {
  font-size: 0.32em;
  vertical-align: 0.9em;
  letter-spacing: 0.1em;
  color: rgba(240, 236, 226, 0.6);
  margin-left: 0.22em;
}

/* in full daylight the pale sky needs ink, not cream */
[data-skyphase="daylight"] .scene__wordmark,
[data-skyphase="daylight"] .scene__clock { color: rgba(24, 32, 52, 0.88); text-shadow: 0 1px 18px rgba(235, 240, 248, 0.45); }
[data-skyphase="daylight"] .scene__clock .clock-sec { color: rgba(24, 32, 52, 0.55); }
[data-skyphase="daylight"] .scene__coords,
[data-skyphase="daylight"] .scene__date { color: rgba(24, 32, 52, 0.55); text-shadow: 0 1px 14px rgba(235, 240, 248, 0.4); }
[data-skyphase="daylight"] .scene__status { color: rgba(24, 32, 52, 0.75); text-shadow: 0 1px 16px rgba(235, 240, 248, 0.5); }
[data-skyphase="daylight"] .scene__scroll-line { background: linear-gradient(to bottom, rgba(24,32,52,0), rgba(24,32,52,0.6)); }

.scene__status {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 340;
  font-size: clamp(0.95rem, 2.4vw, 1.2rem);
  color: rgba(233, 228, 216, 0.82);
  text-shadow: 0 1px 16px rgba(5, 8, 18, 0.8);
  max-width: 34em;
}

.scene__scroll {
  position: absolute; bottom: 1.4rem; left: 50%; transform: translateX(-50%);
  z-index: 3; border-bottom: none; padding: 0.6rem;
}

.scene__scroll-line {
  display: block; width: 1px; height: 44px;
  background: linear-gradient(to bottom, rgba(233,228,216,0), rgba(233,228,216,0.75));
  animation: scroll-hint 2.6s ease-in-out infinite;
}

@keyframes scroll-hint {
  0%, 100% { transform: scaleY(0.55); transform-origin: top; opacity: 0.4; }
  50% { transform: scaleY(1); opacity: 1; }
}

/* ============ SECTION SCAFFOLDING ============ */

main { position: relative; z-index: 1; background: var(--ink-0); }

section { padding: 7.5rem 0; }
section + section { border-top: 1px solid var(--hairline); }

.section-title {
  font-family: var(--serif);
  font-weight: 420;
  font-size: clamp(1.7rem, 4.2vw, 2.4rem);
  letter-spacing: 0.005em;
  margin-bottom: 0.9rem;
  display: flex; align-items: baseline; gap: 1rem;
}

.section-num {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  color: var(--gold-soft);
  border: 1px solid rgba(217, 166, 98, 0.3);
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
  transform: translateY(-0.35rem);
  white-space: nowrap;
}

.section-sub {
  color: var(--cream-dim);
  max-width: 44em;
  margin-bottom: 3rem;
}

/* ============ ABOUT ============ */

.about { padding-top: 6.5rem; }

.about__lede {
  font-family: var(--serif);
  font-weight: 340;
  font-size: clamp(1.6rem, 4.5vw, 2.5rem);
  line-height: 1.3;
  margin-bottom: 2.25rem;
}

.about__body p { color: var(--cream-dim); margin-bottom: 1.4rem; }
.about__body em { color: var(--cream); font-family: var(--serif); font-style: italic; }
.about__body strong { color: var(--cream); font-weight: 500; }

.about__hint {
  color: var(--cream) !important;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 340;
  font-size: 1.15rem;
  border-left: 2px solid var(--gold-soft);
  padding-left: 1.2rem;
}

/* ============ ALMANAC ============ */

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

.card {
  background: linear-gradient(180deg, var(--ink-2), var(--ink-1));
  border: 1px solid var(--hairline);
  border-radius: 10px;
  padding: 1.6rem 1.7rem 1.4rem;
  display: flex; flex-direction: column;
}

.card__title {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold-soft);
  margin-bottom: 1.2rem;
}

.card__rows { display: flex; flex-direction: column; gap: 0.45rem; }

.card__row {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 1rem;
  border-bottom: 1px dotted var(--hairline);
  padding-bottom: 0.4rem;
}
.card__row dt { color: var(--cream-faint); font-size: 0.85rem; }
.card__row dd {
  font-family: var(--mono);
  font-size: 0.95rem;
  color: var(--cream);
  font-variant-numeric: tabular-nums;
}

.card__moon { display: flex; align-items: center; gap: 1.3rem; }
.card__moon canvas { width: 88px; height: 88px; flex: 0 0 auto; }
.card__moon .card__rows { flex: 1; }

.card__big {
  font-family: var(--serif);
  font-weight: 420;
  font-size: 2rem;
  line-height: 1.15;
  margin-bottom: 1.1rem;
}

.card__note {
  margin-top: auto;
  padding-top: 1.1rem;
  color: var(--cream-faint);
  font-size: 0.85rem;
  line-height: 1.6;
}

.meter {
  height: 4px;
  background: rgba(214, 216, 232, 0.08);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.9rem;
}

.meter__fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--gold-soft), var(--gold));
  border-radius: 999px;
  transition: width 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ============ THE LINE ============ */

.line__figure { margin-top: 1rem; }

.line__text {
  font-family: var(--serif);
  font-weight: 340;
  font-style: italic;
  font-size: clamp(1.5rem, 4.4vw, 2.35rem);
  line-height: 1.4;
  color: var(--cream);
  text-indent: -0.45em;
  quotes: "\201C" "\201D";
}
.line__text::before { content: open-quote; color: var(--gold-soft); }
.line__text::after { content: close-quote; color: var(--gold-soft); }

.line__caption {
  margin-top: 1.6rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cream-faint);
}

/* ============ THE GROVE ============ */

.grove__panel {
  background: linear-gradient(180deg, var(--ink-2), var(--ink-1));
  border: 1px solid var(--hairline);
  border-radius: 10px;
  overflow: hidden;
}

.grove__canvas {
  display: block;
  width: 100%;
  height: clamp(320px, 52vw, 460px);
}

.grove__meta {
  border-top: 1px solid var(--hairline);
  padding: 1.4rem 1.7rem 1.5rem;
}

.grove__day {
  font-family: var(--mono);
  font-size: 0.82rem;
  letter-spacing: 0.1em;
  color: var(--cream);
  margin-bottom: 0.8rem;
  font-variant-numeric: tabular-nums;
}

.meter--grove { max-width: 420px; }

.grove__note { color: var(--cream-faint); font-size: 0.9rem; }

/* ============ THE LETTER ============ */

.letter__panel {
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(217, 166, 98, 0.05), transparent 60%),
    linear-gradient(180deg, var(--ink-2), var(--ink-1));
  border: 1px solid var(--hairline);
  border-radius: 10px;
  padding: 3.4rem 2rem;
}

.letter__sealed { text-align: center; }

.letter__wax {
  display: inline-block;
  margin-bottom: 1.4rem;
  filter: drop-shadow(0 6px 18px rgba(124, 45, 45, 0.35));
  animation: wax-breathe 5s ease-in-out infinite;
}

@keyframes wax-breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.035); }
}

.letter__sealed-label {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--cream-faint);
  margin-bottom: 0.9rem;
}

.letter__countdown {
  font-family: var(--serif);
  font-weight: 340;
  font-size: clamp(1.5rem, 4.5vw, 2.5rem);
  color: var(--cream);
  font-variant-numeric: tabular-nums;
  margin-bottom: 0.7rem;
}

.letter__sealed-note {
  color: var(--cream-faint);
  font-size: 0.9rem;
}

.letter__open { max-width: 36rem; margin: 0 auto; }

.letter__salutation {
  font-family: var(--serif);
  font-weight: 420;
  font-size: 1.5rem;
  margin-bottom: 1.6rem;
}

.letter__body p {
  font-family: var(--serif);
  font-weight: 340;
  font-size: 1.1rem;
  line-height: 1.85;
  color: var(--cream);
  margin-bottom: 1.3rem;
}

.letter__body .letter__ledger {
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 2;
  color: var(--cream-dim);
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  padding: 1.1rem 0;
  margin: 1.8rem 0;
  list-style: none;
}

.letter__body .letter__sign {
  font-style: italic;
  color: var(--cream-dim);
  margin-top: 2rem;
}

/* ============ COLOPHON / FOOTER ============ */

.colophon__body p { color: var(--cream-dim); margin-bottom: 1.4rem; }

.footer {
  border-top: 1px solid var(--hairline);
  padding: 3.5rem 0 4rem;
  background: var(--ink-0);
}

.footer__line { color: var(--cream-dim); font-size: 0.95rem; margin-bottom: 0.45rem; }
.footer__line strong { color: var(--cream); font-family: var(--serif); font-weight: 420; letter-spacing: 0.03em; }
.footer__line--dim { color: var(--cream-faint); font-size: 0.83rem; margin-top: 1.4rem; font-family: var(--mono); }

.noscript {
  max-width: var(--col); margin: 0 auto; padding: 2rem 1.5rem;
  color: var(--cream-dim);
}

/* ============ REVEALS ============ */

.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 900ms ease, transform 900ms cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal.is-visible { opacity: 1; transform: none; }

/* ============ SMALL SCREENS ============ */

@media (max-width: 640px) {
  section { padding: 5rem 0; }
  .scene__mast { padding: 1.1rem 1.25rem; }
  .scene__overlay { transform: translateY(-3vh); }
  .card__moon { flex-direction: row; }
  .letter__panel { padding: 2.6rem 1.4rem; }
}

/* ============ REDUCED MOTION ============ */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .scene__scroll-line { animation: none; }
  .letter__wax { animation: none; }
  .meter__fill { transition: none; }
}
