/* ──────────────────────────────────────────────────────────────────────────
   Kathy's Weather Almanac — web edition.
   Ports the Flutter app's Almanac design system (see
   WeatherApp/lib/src/ui/theme/almanac_theme.dart): ink on paper, editorial
   serifs, hairline rules. Deliberately not glassmorphism.
   ────────────────────────────────────────────────────────────────────────── */

:root {
  --paper: #F6F1E7;
  --paper-shade: #EDE6D8;
  --ink: #1C1A16;
  --ink-faded: #6B655A;
  --rule: #9A9284;
  --accent: #9E3B2F;

  --serif: "Playfair Display", Georgia, serif;
  --sans: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
}

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

/* Author display rules (e.g. .centered-view's flex) must never override the
   hidden attribute — view switching relies on it. */
[hidden] { display: none !important; }

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

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

main, .centered-view {
  max-width: 680px;
  margin: 0 auto;
  padding: 28px 24px 40px;
}

/* ── Type system ── */

.masthead {
  font-family: var(--serif);
  font-weight: 800;
  font-size: clamp(26px, 5.5vw, 34px);
  letter-spacing: 1.5px;
  text-align: center;
  color: var(--ink);
}

/* Kathy's portrait beside the masthead, cropped round like a columnist
   headshot, sized relative to the masthead type so it scales with it. */
.masthead-icon {
  height: 1.15em;
  width: 1.15em;
  border-radius: 50%;
  border: 1px solid var(--rule);
  object-fit: cover;
  vertical-align: -0.22em;
  margin-right: 12px;
}

.overline {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 2.2px;
  text-transform: uppercase;
  color: var(--ink-faded);
}

.overline.centered, .centered { text-align: center; }

.hero-temp {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(96px, 26vw, 148px);
  line-height: 0.95;
  text-align: center;
  color: var(--ink);
}

.hero-temp .degree { font-size: 0.49em; vertical-align: 0.55em; }

.hero-condition {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 600;
  font-size: 24px;
  color: var(--ink);
}

.body-text { font-size: 14px; line-height: 1.5; color: var(--ink); }

.day-name {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 18px;
  color: var(--ink);
}

.data-label, .datum-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-faded);
}

.data-value {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}

/* ── Rules (newspaper section dividers) ── */

.rule { height: 1px; background: var(--rule); }
.rule.doubled {
  height: auto;
  background: none;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding-top: 2px;
}

/* ── Page head ── */

.page-head { padding-top: 4px; }

.dateline {
  display: block;
  width: 100%;
  margin: 8px 0 10px;
  background: none;
  border: none;
  cursor: pointer;
  text-align: center;
}
.dateline:hover { color: var(--accent); }

.bulletin {
  margin-top: 10px;
  padding: 8px 12px;
  background: var(--accent);
  color: var(--paper);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  text-align: center;
}

/* ── Hero ── */

.hero { padding: 12px 0 18px; }

.datum-row {
  display: flex;
  flex-wrap: wrap; /* five datums (with AIR + POLLEN) wrap on narrow phones */
  justify-content: center;
  align-items: center;
  row-gap: 10px;
  margin-top: 14px;
}

.datum {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.datum-label { font-size: 9px; font-weight: 600; letter-spacing: 2.2px; }

.datum-divider {
  width: 1px;
  height: 26px;
  background: var(--rule);
  margin: 0 18px;
}

/* ── Sections ── */

section > .section-title { margin: 10px 0 6px; }

.ink-chart { display: block; width: 100%; height: 150px; }

/* ── The weather map ── */

.weather-map {
  height: 320px;
  border: 1px solid var(--rule);
  background: var(--paper-shade);
}

/* Pull the base tiles toward the paper palette. Radar tiles are in their own
   pane (see app.js) so precipitation keeps its color. */
.weather-map .leaflet-tile-pane {
  filter: grayscale(1) sepia(0.18) contrast(0.92) brightness(1.05);
}

.weather-map .leaflet-control-attribution {
  background: rgba(246, 241, 231, 0.85);
  color: var(--ink-faded);
  font-family: var(--sans);
  font-size: 9px;
}
.weather-map .leaflet-control-attribution a { color: var(--ink-faded); }

.weather-map .leaflet-bar { border: 1px solid var(--rule); box-shadow: none; border-radius: 0; }
.weather-map .leaflet-bar a {
  background: var(--paper);
  color: var(--ink);
  border-bottom-color: var(--rule);
  border-radius: 0;
}
.weather-map .leaflet-bar a:hover { background: var(--paper-shade); }

.map-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
}

/* ── Five-day outlook ── */

.day-row {
  border-bottom: 0.6px solid var(--rule);
  padding: 10px 0;
  cursor: pointer;
}

.day-row-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: none;
  border: none;
  width: 100%;
  padding: 0;
  cursor: pointer;
  text-align: left;
  font-family: var(--sans);
}

.day-row-main { flex: 1; min-width: 0; }

.day-title { display: flex; align-items: center; gap: 8px; }
.day-title svg { flex: none; }

.day-short { margin-top: 2px; font-size: 12px; font-weight: 500; color: var(--ink-faded); }

.day-temps { text-align: right; }
.day-high { font-size: 18px; font-weight: 600; color: var(--ink); }
.day-low { font-size: 14px; font-weight: 600; color: var(--ink-faded); }

.day-chevron {
  margin-top: 4px;
  color: var(--ink-faded);
  transition: transform 0.2s ease;
  flex: none;
}
.day-row.expanded .day-chevron { transform: rotate(180deg); }

.day-detail {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.25s cubic-bezier(0.215, 0.61, 0.355, 1);
}
.day-detail-inner { padding-top: 10px; }

.hour-title { font-size: 9px; margin-bottom: 4px; }

.hour-row {
  display: flex;
  align-items: baseline;
  padding: 3px 0;
  gap: 0;
}
.hour-time { width: 52px; flex: none; font-size: 12px; font-weight: 500; color: var(--ink-faded); }
.hour-temp { width: 40px; flex: none; font-size: 14px; font-weight: 600; }
.hour-short {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-faded);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hour-precip { flex: none; font-size: 12px; font-weight: 500; color: var(--accent); }

/* ── First run / loading / error ── */

.centered-view {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  gap: 8px;
  min-height: 100vh;
  padding-top: 0;
  padding-bottom: 10vh;
}

.firstrun-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  margin-top: 32px;
}

.zip-input {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 600;
  font-size: 24px;
  color: var(--ink);
  background: none;
  border: none;
  border-bottom: 1px solid var(--rule);
  text-align: center;
  padding: 6px 4px;
  width: min(320px, 80%);
  border-radius: 0;
}
.zip-input:focus { outline: none; border-bottom-color: var(--accent); }
.zip-input::placeholder {
  font-family: var(--sans);
  font-style: normal;
  font-weight: 400;
  font-size: 14px;
  color: var(--ink-faded);
}
.zip-input.small { font-size: 18px; width: 160px; }

.overline-button {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 2.2px;
  text-transform: uppercase;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}
.overline-button.faded { color: var(--ink-faded); }
.overline-button:hover { text-decoration: underline; }

.spinner {
  width: 28px;
  height: 28px;
  margin: 0 auto 16px;
  border: 2px solid var(--paper-shade);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Footer ── */

.page-foot {
  margin-top: 24px;
  text-align: center;
}

.footnote {
  margin-top: 12px;
  font-size: 11px;
  color: var(--ink-faded);
  text-align: center;
  line-height: 1.7;
}
.footnote a { color: var(--ink-faded); }
.footnote a:hover { color: var(--accent); }

/* ── Dialog ── */

dialog {
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--rule);
  padding: 24px 28px;
  min-width: 260px;
}
dialog::backdrop { background: rgba(28, 26, 22, 0.45); }
dialog h2 { margin-bottom: 12px; }
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 16px;
}

/* Larger canvas breathing room on desktop */
@media (min-width: 700px) {
  .ink-chart { height: 170px; }
  .weather-map { height: 380px; }
}
