/**
 * public/css/weather.css
 * The Meteorological Almanack Stylesheet
 * Calm, tactile typography in the tradition of classical maritime logs & agricultural compendiums.
 */

/* Override grid columns on parent magazineSpread container */
.magazine-spread.weather-mode,
.magazine-spread:has(.weather-almanack-spread) {
  display: block !important;
  grid-template-columns: 1fr !important;
  max-width: 100% !important;
  height: 100% !important;
  overflow: hidden !important;
  box-shadow: none !important;
}

.magazine-spread.weather-mode::after,
.magazine-spread:has(.weather-almanack-spread)::after {
  display: none !important;
}

.weather-almanack-spread {
  display: flex;
  flex-direction: row;
  width: 100%;
  height: 100%;
  min-height: 100%;
  box-sizing: border-box;
  background-color: var(--paper-bg, #f7f3eb);
  color: var(--ink-primary, #171513);
  font-family: var(--font-serif, 'Literata', Georgia, serif);
  overflow: hidden;
}

/* Loading & Error States */
.weather-almanack-spread.is-loading,
.weather-almanack-spread.is-error {
  align-items: center;
  justify-content: center;
  display: flex;
  padding: 40px;
}

.weather-loading-box,
.weather-empty-box {
  text-align: center;
  max-width: 480px;
  margin: auto;
  padding: 40px;
  background: var(--paper-bg-alt, #efeae0);
  border: 1px solid var(--rule-hairline, rgba(30,27,24,0.18));
  border-radius: 4px;
}

.weather-loading-icon,
.weather-empty-icon {
  font-size: 42px;
  margin-bottom: 12px;
}

.weather-loading-title,
.weather-empty-title {
  font-family: var(--font-display, 'Fraunces', serif);
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 8px 0;
  color: var(--ink-primary, #171513);
}

.weather-loading-sub,
.weather-empty-sub {
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-secondary, #3b3732);
  margin: 0 0 16px 0;
}

/* Calm Notice Pill */
.weather-notice-pill {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink-primary, #171513);
  color: var(--paper-bg, #f7f3eb);
  padding: 8px 18px;
  border-radius: 20px;
  font-family: var(--font-sans, sans-serif);
  font-size: 12px;
  font-weight: 500;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 99999;
}

.weather-notice-pill.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Two Page Spread Columns */
.weather-page-verso {
  flex: 0 0 46%;
  width: 46%;
  max-width: 46%;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  padding: 24px 28px;
  background-color: var(--paper-bg, #f7f3eb);
  border-right: 1px solid var(--rule-hairline, rgba(30, 27, 24, 0.18));
  overflow-y: auto;
  scrollbar-width: thin;
}

.weather-page-recto {
  flex: 1 1 54%;
  width: 54%;
  max-width: 54%;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  padding: 24px 28px;
  background-color: var(--paper-bg-alt, #efeae0);
  overflow-y: auto;
  scrollbar-width: thin;
}

/* Headers & Kickers */
.weather-section-header {
  border-bottom: 2px solid var(--rule-strong, #1e1b18);
  padding-bottom: 12px;
  margin-bottom: 16px;
}

.weather-kicker-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}

.weather-kicker {
  font-family: var(--font-sans, sans-serif);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-crimson, #8f2424);
}

.weather-folio-date {
  font-family: var(--font-serif, serif);
  font-size: 11px;
  color: var(--ink-muted, #6b645c);
  font-style: italic;
}

.weather-section-title {
  font-family: var(--font-display, 'Fraunces', serif);
  font-size: 26px;
  font-weight: 600;
  line-height: 1.15;
  margin: 4px 0 6px 0;
  letter-spacing: -0.01em;
}

.weather-section-sub {
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--ink-secondary, #3b3732);
  margin: 0;
}

.weather-sub-kicker {
  font-family: var(--font-sans, sans-serif);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted, #6b645c);
}

/* Search Ledger */
.weather-search-ledger {
  margin-bottom: 16px;
}

.weather-search-form {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.weather-search-input {
  flex: 1;
  font-family: var(--font-serif, serif);
  font-size: 13px;
  padding: 7px 12px;
  background: var(--paper-warm, #ece7dc);
  border: 1px solid var(--rule-hairline, rgba(30, 27, 24, 0.2));
  border-radius: 3px;
  color: var(--ink-primary, #171513);
  outline: none;
}

.weather-search-input:focus {
  border-color: var(--ink-primary, #171513);
  box-shadow: 0 0 0 1px var(--ink-primary, #171513);
}

.weather-search-btn,
.weather-geoloc-btn,
.weather-btn {
  font-family: var(--font-sans, sans-serif);
  font-size: 11px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 3px;
  cursor: pointer;
  border: 1px solid var(--rule-hairline, rgba(30, 27, 24, 0.2));
  background: var(--paper-bg, #f7f3eb);
  color: var(--ink-primary, #171513);
  white-space: nowrap;
  transition: all 0.15s ease;
}

.weather-search-btn:hover,
.weather-geoloc-btn:hover {
  background: var(--ink-primary, #171513);
  color: var(--paper-bg, #f7f3eb);
}

.weather-station-chips-scroll {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.weather-station-chips-scroll::-webkit-scrollbar {
  display: none;
}

.weather-station-chip {
  font-family: var(--font-sans, sans-serif);
  font-size: 10.5px;
  padding: 3px 8px;
  border-radius: 12px;
  border: 1px solid var(--rule-hairline, rgba(30, 27, 24, 0.15));
  background: var(--paper-warm, #ece7dc);
  color: var(--ink-secondary, #3b3732);
  cursor: pointer;
  white-space: nowrap;
}

.weather-station-chip:hover {
  border-color: var(--ink-primary, #171513);
  color: var(--ink-primary, #171513);
}

.weather-station-chip.is-active {
  background: var(--ink-primary, #171513);
  color: var(--paper-bg, #f7f3eb);
  border-color: var(--ink-primary, #171513);
}

/* Celestial Ephemeris Card */
.weather-ephemeris-card {
  background: var(--paper-warm, #ece7dc);
  border: 1px solid var(--rule-hairline, rgba(30, 27, 24, 0.18));
  border-radius: 4px;
  padding: 14px 16px;
  margin-bottom: 16px;
}

.weather-ephemeris-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.weather-lunar-head,
.weather-solar-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.weather-lunar-icon,
.weather-solar-icon {
  font-size: 20px;
}

.weather-lunar-name {
  font-family: var(--font-display, serif);
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 2px;
}

.weather-lunar-pct {
  font-family: var(--font-sans, sans-serif);
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-crimson, #8f2424);
}

.weather-lunar-age {
  font-size: 11px;
  color: var(--ink-muted, #6b645c);
  margin-bottom: 6px;
}

.weather-lunar-lore {
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--ink-secondary, #3b3732);
  margin: 0;
}

.weather-solar-table {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.weather-solar-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  border-bottom: 1px dashed var(--rule-soft, rgba(30, 27, 24, 0.1));
  padding-bottom: 3px;
}

.weather-solar-label {
  color: var(--ink-secondary, #3b3732);
}

.weather-solar-val {
  font-family: var(--font-sans, sans-serif);
  font-weight: 600;
}

/* 7-Day Outlook Table */
.weather-forecast-section {
  flex: 1;
  margin-bottom: 12px;
}

.weather-table-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px solid var(--rule-strong, #1e1b18);
  padding-bottom: 4px;
  margin-bottom: 8px;
}

.weather-forecast-table {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.weather-forecast-row {
  display: flex;
  align-items: center;
  padding: 6px 8px;
  border-radius: 3px;
  border-bottom: 1px solid var(--rule-soft, rgba(30, 27, 24, 0.08));
  font-size: 12.5px;
  transition: background 0.15s ease;
}

.weather-forecast-row:hover {
  background: var(--paper-warm, #ece7dc);
}

.weather-forecast-row.is-today {
  background: rgba(143, 36, 36, 0.06);
  font-weight: 600;
}

.weather-forecast-day {
  width: 90px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.weather-day-name {
  font-weight: 600;
}

.weather-day-date {
  font-size: 10px;
  color: var(--ink-muted, #6b645c);
}

.weather-forecast-cond {
  width: 120px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.weather-cond-icon {
  font-size: 16px;
}

.weather-cond-label {
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.weather-forecast-pop {
  width: 65px;
  flex-shrink: 0;
  font-family: var(--font-sans, sans-serif);
  font-size: 10.5px;
}

.weather-pop-badge {
  color: #1b6b66;
  font-weight: 700;
}

.weather-pop-dry {
  color: var(--ink-muted, #6b645c);
  opacity: 0.6;
}

.weather-forecast-bar-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-sans, sans-serif);
  font-size: 11px;
}

.weather-min-t {
  color: var(--ink-muted, #6b645c);
  width: 24px;
  text-align: right;
}

.weather-max-t {
  font-weight: 700;
  width: 24px;
}

.weather-temp-range-track {
  flex: 1;
  height: 4px;
  background: rgba(30, 27, 24, 0.1);
  border-radius: 2px;
  position: relative;
}

.weather-temp-range-bar {
  position: absolute;
  top: 0;
  bottom: 0;
  background: linear-gradient(90deg, #327599, #cc5533);
  border-radius: 2px;
}

.weather-forecast-wind {
  width: 70px;
  flex-shrink: 0;
  text-align: right;
  font-family: var(--font-sans, sans-serif);
  font-size: 10.5px;
  color: var(--ink-secondary, #3b3732);
}

.weather-verso-footer,
.weather-recto-footer {
  border-top: 1px solid var(--rule-soft, rgba(30, 27, 24, 0.15));
  padding-top: 8px;
  margin-top: auto;
  font-size: 10px;
  font-style: italic;
  color: var(--ink-muted, #6b645c);
  display: flex;
  justify-content: space-between;
}

/* RECTO: Station Masthead & Instruments Canvas */
.weather-station-masthead {
  border-bottom: 2px solid var(--rule-strong, #1e1b18);
  padding-bottom: 12px;
  margin-bottom: 18px;
}

.weather-station-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.weather-station-coords {
  font-family: var(--font-sans, sans-serif);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--ink-muted, #6b645c);
}

.weather-masthead-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.weather-units-toggle {
  display: flex;
  border: 1px solid var(--rule-hairline, rgba(30, 27, 24, 0.2));
  border-radius: 3px;
  overflow: hidden;
}

.weather-unit-btn {
  font-family: var(--font-sans, sans-serif);
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 8px;
  background: var(--paper-warm, #ece7dc);
  border: none;
  cursor: pointer;
  color: var(--ink-secondary, #3b3732);
}

.weather-unit-btn.is-active {
  background: var(--ink-primary, #171513);
  color: var(--paper-bg, #f7f3eb);
}

.weather-control-btn {
  font-family: var(--font-sans, sans-serif);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 3px;
  border: 1px solid var(--rule-hairline, rgba(30, 27, 24, 0.2));
  background: var(--paper-warm, #ece7dc);
  color: var(--ink-primary, #171513);
  cursor: pointer;
}

.weather-control-btn:hover {
  background: var(--ink-primary, #171513);
  color: var(--paper-bg, #f7f3eb);
}

.weather-close-btn {
  color: var(--accent-crimson, #8f2424);
}

.weather-station-name {
  font-family: var(--font-display, 'Fraunces', serif);
  font-size: 32px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0 0 4px 0;
}

.weather-station-subbar {
  display: flex;
  gap: 8px;
  font-size: 11.5px;
  color: var(--ink-muted, #6b645c);
  font-style: italic;
}

/* Primary Thermal Hero */
.weather-thermal-hero {
  border-bottom: 1px solid var(--rule-hairline, rgba(30, 27, 24, 0.18));
  padding-bottom: 18px;
  margin-bottom: 18px;
}

.weather-temp-num-wrap {
  display: flex;
  align-items: baseline;
  gap: 20px;
}

.weather-temp-large {
  font-family: var(--font-display, 'Fraunces', serif);
  font-size: 82px;
  font-weight: 400;
  line-height: 0.9;
  letter-spacing: -0.04em;
  color: var(--ink-primary, #171513);
}

.weather-condition-bracket {
  display: flex;
  flex-direction: column;
}

.weather-hero-icon {
  font-size: 28px;
  margin-bottom: 4px;
}

.weather-condition-headline {
  font-family: var(--font-display, serif);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 4px;
}

.weather-condition-sub {
  font-size: 13px;
  color: var(--ink-secondary, #3b3732);
}

/* Meteorological Instruments Quad */
.weather-instruments-quad {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.weather-instrument-card {
  background: var(--paper-warm, #ece7dc);
  border: 1px solid var(--rule-hairline, rgba(30, 27, 24, 0.18));
  border-radius: 4px;
  padding: 12px 14px;
}

.weather-inst-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.weather-inst-kicker {
  font-family: var(--font-sans, sans-serif);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted, #6b645c);
}

.weather-inst-badge {
  font-family: var(--font-sans, sans-serif);
  font-size: 9.5px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  background: rgba(30, 27, 24, 0.08);
  color: var(--ink-primary, #171513);
}

.weather-inst-val {
  font-family: var(--font-display, 'Fraunces', serif);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.1;
  color: var(--ink-primary, #171513);
  margin-bottom: 2px;
}

.weather-inst-unit {
  font-family: var(--font-sans, sans-serif);
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-muted, #6b645c);
}

.weather-inst-alt {
  font-family: var(--font-sans, sans-serif);
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-crimson, #8f2424);
  margin-bottom: 4px;
}

.weather-inst-desc {
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--ink-secondary, #3b3732);
  margin: 0;
}

/* 24-Hour Chronological Barograph */
.weather-barograph-section {
  margin-bottom: 18px;
}

.weather-header-note {
  font-size: 10.5px;
  color: var(--ink-muted, #6b645c);
  font-style: italic;
}

.weather-hourly-timeline {
  display: flex;
  justify-content: space-between;
  gap: 2px;
  overflow-x: auto;
  padding: 10px 4px 12px 4px;
  background: var(--paper-warm, #ece7dc);
  border: 1px solid var(--rule-hairline, rgba(30, 27, 24, 0.18));
  border-radius: 4px;
  scrollbar-width: thin;
}

.weather-hourly-col {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  font-family: var(--font-sans, sans-serif);
}

.weather-hourly-time {
  font-size: 10px;
  color: var(--ink-muted, #6b645c);
  margin-bottom: 4px;
}

.weather-hourly-icon {
  font-size: 16px;
  margin-bottom: 3px;
}

.weather-hourly-temp {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 3px;
}

.weather-hourly-pop {
  font-size: 9.5px;
  color: var(--ink-muted, #6b645c);
  margin-bottom: 3px;
}

.weather-hourly-pop.has-pop {
  color: #1b6b66;
  font-weight: 700;
}

.weather-hourly-wind {
  font-size: 9px;
  color: var(--ink-secondary, #3b3732);
}

/* Naturalist Lore Epilogue */
.weather-naturalist-lore {
  background: rgba(143, 36, 36, 0.04);
  border-left: 3px solid var(--accent-crimson, #8f2424);
  padding: 12px 16px;
  margin-bottom: 16px;
  border-radius: 0 4px 4px 0;
}

.weather-lore-kicker {
  font-family: var(--font-sans, sans-serif);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--accent-crimson, #8f2424);
  margin-bottom: 6px;
}

.weather-lore-body {
  font-family: var(--font-serif, serif);
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--ink-secondary, #3b3732);
  font-style: italic;
  margin: 0;
}

/* Responsive Single-Column Mobile Stacking */
@media (max-width: 900px) {
  .weather-almanack-spread {
    flex-direction: column;
    overflow-y: auto;
    height: auto;
    min-height: 100%;
  }

  .weather-page-verso,
  .weather-page-recto {
    flex: 1 1 auto;
    width: 100%;
    max-width: 100%;
    border-right: none;
    padding: 18px 16px;
    overflow-y: visible;
  }

  .weather-page-recto {
    order: -1; /* Display primary weather reading first on mobile! */
    border-bottom: 2px solid var(--rule-strong, #1e1b18);
  }

  .weather-temp-large {
    font-size: 64px;
  }

  .weather-instruments-quad {
    grid-template-columns: 1fr;
  }

  .weather-ephemeris-grid {
    grid-template-columns: 1fr;
  }
}
