/* ===========================================================
   Franklin weather, /weather (src/pages/weather/index.astro).
   Loaded after monocle.css. Every class here starts wxp- so nothing
   meets the homepage's seven-day card (.wx-*, in monocle.css).

   Colour, per DESIGN.md's Accent rule: the chart's bars and the hourly
   rain bars are Blue Slate; an active warning takes a 4px Alert Red
   rule at its left, a watch or advisory a black one. Everything else
   is ink. The "now" box is the background photograph size: white words
   over a black gradient, darkest where they are.
   =========================================================== */

.wxp-sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.wxp-foot { font: 400 13px/1.55 var(--sans); color: var(--dispatch-grey); margin-top: 12px; max-width: 70ch; }
.wxp-foot a, .wxp-source a, .wxp-fallback a, .wxp-alerts-clear a, .wxp-sources a {
  color: inherit; text-decoration: underline; text-underline-offset: 2px; text-decoration-color: var(--gallery-border);
}
.wxp-foot a:hover, .wxp-source a:hover, .wxp-fallback a:hover, .wxp-alerts-clear a:hover, .wxp-sources a:hover { text-decoration-color: var(--blue-slate); }
.wxp-fallback { font: 400 14px/1.5 var(--sans); color: var(--ink-charcoal); padding: 18px 0; }
.wxp-icon { display: inline-flex; width: 32px; height: 32px; color: var(--press-black); }
.wxp-icon svg { width: 100%; height: 100%; }

/* ---------- Watches and warnings ---------- */
.wxp-alerts { padding-top: 20px; }
.wxp-alerts-clear {
  font: 400 14px/1.5 var(--sans); color: var(--ink-charcoal);
  padding-bottom: 14px; border-bottom: 1px solid var(--gallery-border);
}
.wxp-alerts-clear strong { color: var(--press-black); }
.wxp-alert {
  border-left: 4px solid var(--press-black);
  padding: 4px 0 4px 20px;
  margin-bottom: 24px;
}
.wxp-alert[data-level="warning"] { border-left-color: var(--alert-red); }
.wxp-alert h2 { font: 700 28px/1.15 var(--serif); letter-spacing: -.01em; margin-top: 6px; }
.wxp-alert-when { font: 700 15px/1.4 var(--sans); margin-top: 8px; }
.wxp-alert-area { font: 400 13px/1.5 var(--sans); color: var(--dispatch-grey); margin-top: 4px; max-width: 80ch; }
.wxp-alert-text { margin-top: 12px; }
.wxp-alert-text summary {
  cursor: pointer; width: fit-content;
  font: 700 11px var(--sans); letter-spacing: .06em; text-transform: uppercase;
}
.wxp-alert-text h3 { font: 700 16px var(--serif); margin-top: 16px; }
.wxp-alert-text p { font: 400 16px/1.55 var(--serif); color: var(--ink-charcoal); margin-top: 10px; max-width: 68ch; }
.wxp-alert-links { display: flex; flex-wrap: wrap; gap: 6px 20px; margin-top: 14px; }
.wxp-alert-links a { font: 700 13px var(--sans); color: var(--press-black); text-decoration: none; border-bottom: 1px solid var(--gallery-border); }
.wxp-alert-links a:hover { border-color: var(--blue-slate); }

/* ---------- Now, over the photograph ---------- */
.wxp-now-wrap { padding-top: 20px; }
.wxp-now {
  border-radius: var(--radius-cards);
  min-height: 380px;
  padding: 32px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 24px 48px;
}
/* The words sit at the foot of the box, so the gradient is darkest there. */
.wxp-now::before { background: linear-gradient(180deg, rgba(0,0,0,.05) 0%, rgba(0,0,0,.35) 38%, rgba(0,0,0,.8) 100%); }
.wxp-now .kicker { color: var(--text-inverse-soft); }
.wxp-now-temp { font: 700 112px/.9 var(--sans); letter-spacing: -.04em; margin-top: 10px; }
.wxp-deg { font-weight: 400; }
.wxp-now-label { font: 700 22px/1.2 var(--serif); margin-top: 10px; }
.wxp-now-noscript a { color: var(--editorial-white); font: 400 14px var(--sans); }
.wxp-now-facts { display: grid; grid-template-columns: auto auto; gap: 8px 28px; }
.wxp-now-facts div { display: contents; }
.wxp-now-facts dt { font: 700 10px/1.9 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--text-inverse-soft); }
.wxp-now-facts dd { margin: 0; font: 700 16px/1.25 var(--sans); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.wxp-today {
  grid-column: 1 / -1;
  border-top: 1px solid var(--rule-inverse);
  padding-top: 14px;
  font: 400 14px/1.5 var(--sans);
  color: var(--text-inverse-soft);
}
.wxp-today[hidden] { display: none; }
.wxp-source { font: 400 11px/1.5 var(--sans); color: var(--dispatch-grey); margin-top: 8px; }

/* ---------- The seven days ---------- */
.wxp-days { list-style: none; margin: 20px 0 0; padding: 0; border-top: 1px solid var(--gallery-border); }
.wxp-day {
  display: grid;
  grid-template-columns: 132px 36px 104px 76px minmax(0, 1fr);
  gap: 0 20px;
  align-items: start;
  padding: 18px 0;
  border-bottom: 1px solid var(--gallery-border);
}
.wxp-day-name { display: block; font: 700 17px/1.25 var(--serif); }
.wxp-day-date { display: block; font: 400 11px/1.6 var(--sans); letter-spacing: .05em; text-transform: uppercase; color: var(--dispatch-grey); }
.wxp-day-temps { display: flex; align-items: baseline; gap: 10px; font-variant-numeric: tabular-nums; }
.wxp-hi { font: 700 24px/1.1 var(--sans); }
.wxp-lo { font: 400 18px/1.1 var(--sans); color: var(--dispatch-grey); }
.wxp-day-pop { font: 700 12px/2 var(--sans); color: var(--ink-charcoal); }
.wxp-day-short { font: 700 15px/1.35 var(--sans); }
.wxp-day-detail { font: 400 14px/1.5 var(--sans); color: var(--ink-charcoal); margin-top: 6px; max-width: 72ch; }
.wxp-day-detail strong { color: var(--press-black); }

/* ---------- The next 24 hours: a strip that scrolls inside itself ---------- */
.wxp-hours {
  list-style: none; margin: 20px 0 0; padding: 0;
  display: flex;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  border-top: 1px solid var(--gallery-border);
  border-bottom: 1px solid var(--gallery-border);
}
.wxp-hours .wxp-fallback { flex: 1; }
/* Positioned, so each hour's hidden spoken line stays inside the strip's
   scroll box instead of widening the page. */
.wxp-hours, .wxp-hour { position: relative; }
.wxp-hour { flex: 0 0 68px; scroll-snap-align: start; border-right: 1px solid var(--gallery-border); }
.wxp-hour:last-child { border-right: 0; }
.wxp-hour-vis { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 0 12px; }
.wxp-hour-time { font: 700 11px var(--sans); letter-spacing: .03em; color: var(--dispatch-grey); white-space: nowrap; }
.wxp-hour .wxp-icon { width: 26px; height: 26px; }
.wxp-hour-temp { font: 700 17px var(--sans); font-variant-numeric: tabular-nums; }
/* The chance of rain as a column on its own baseline: Blue Slate, 12px
   wide, rounded at the top and square at the foot. */
.wxp-hour-bar { position: relative; display: block; width: 12px; height: 44px; border-bottom: 1px solid var(--gallery-border); }
.wxp-hour-bar::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0;
  height: var(--pop, 0%);
  background: var(--blue-slate);
  border-radius: 4px 4px 0 0;
}
.wxp-hour-pop { font: 700 11px var(--sans); min-height: 14px; }
.wxp-hour-wind { font: 400 11px var(--sans); color: var(--dispatch-grey); white-space: nowrap; }

/* ---------- Radar ---------- */
.wxp-radar { margin: 20px 0 0; }
.wxp-radar img { display: block; width: 100%; max-width: 600px; height: auto; border: 1px solid var(--gallery-border); border-radius: var(--radius-cards); }
.wxp-radar figcaption { font: 400 13px/1.55 var(--sans); color: var(--dispatch-grey); margin-top: 10px; max-width: 600px; }

/* ---------- The year: figures, chart, table ---------- */
.wxp-stats {
  list-style: none; margin: 24px 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--gallery-border);
}
.wxp-stats li { padding: 18px 24px 18px 0; border-bottom: 1px solid var(--gallery-border); }
.wxp-stats b { display: block; font: 700 30px/1.1 var(--sans); letter-spacing: -.01em; }
.wxp-stats small { font: 700 15px var(--sans); }
.wxp-stats span { display: block; font: 400 13px/1.45 var(--sans); color: var(--ink-charcoal); margin-top: 6px; max-width: 34ch; }

.wxp-chart { margin: 36px 0 0; }
.wxp-chart-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; font: 400 13px/1.5 var(--sans); color: var(--dispatch-grey); }
/* The plot: month names in the 28px under it, the degree scale in the
   36px to its left. --lo, --hi and --y are fractions of its height. */
.wxp-plot { position: relative; height: 280px; margin-top: 18px; }
.wxp-grid { position: absolute; inset: 0 0 28px 36px; }
.wxp-grid span { position: absolute; left: 0; right: 0; bottom: calc(var(--y) * 100%); border-top: 1px solid var(--gallery-border); }
.wxp-grid i { position: absolute; right: calc(100% + 8px); top: -8px; font: 400 11px var(--sans); font-style: normal; color: var(--dispatch-grey); white-space: nowrap; }
.wxp-cols { position: absolute; inset: 0 0 0 36px; list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); }
.wxp-cols li { position: relative; outline: none; cursor: default; }
.wxp-bar {
  position: absolute; left: 50%; transform: translateX(-50%);
  width: min(24px, 56%);
  bottom: calc(28px + (100% - 28px) * var(--lo));
  height: calc((100% - 28px) * (var(--hi) - var(--lo)));
  background: var(--blue-slate);
  border-radius: 4px;
  transition: background var(--t-default);
}
.wxp-cols li:hover .wxp-bar, .wxp-cols li:focus-visible .wxp-bar { background: var(--press-black); }
.wxp-cols li:focus-visible .wxp-col-name { color: var(--press-black); text-decoration: underline; }
.wxp-end-hi, .wxp-end-lo { position: absolute; left: 50%; transform: translateX(-50%); font: 700 12px var(--sans); color: var(--press-black); white-space: nowrap; }
.wxp-end-hi { bottom: calc(100% + 4px); }
.wxp-end-lo { top: calc(100% + 4px); }
.wxp-col-name { position: absolute; left: 0; right: 0; bottom: 0; text-align: center; font: 400 11px/28px var(--sans); color: var(--dispatch-grey); }
.wxp-tip {
  display: none; position: absolute; z-index: 2; top: 0; left: 50%; transform: translateX(-50%);
  font: 400 12px/1.4 var(--sans); color: var(--editorial-white); background: var(--press-black);
  padding: 6px 9px; border-radius: 4px; white-space: nowrap; pointer-events: none;
}
.wxp-cols li:hover .wxp-tip, .wxp-cols li:focus-visible .wxp-tip { display: block; }
/* The outer months' tips open inward, so none crosses the page edge. */
.wxp-cols li:nth-child(-n+2) .wxp-tip { left: 0; transform: none; }
.wxp-cols li:nth-child(n+11) .wxp-tip { left: auto; right: 0; transform: none; }

.wxp-table-wrap { margin-top: 36px; }
.wxp-table { width: 100%; border-collapse: collapse; font: 400 14px/1.45 var(--sans); }
.wxp-table thead th {
  text-align: left; vertical-align: bottom;
  font: 700 10px/1.4 var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--dispatch-grey);
  padding: 0 16px 10px 0; border-bottom: 1px solid var(--press-black);
}
.wxp-table tbody th { text-align: left; font: 700 15px/1.4 var(--serif); padding: 11px 16px 11px 0; border-bottom: 1px solid var(--gallery-border); }
.wxp-table td { padding: 11px 16px 11px 0; border-bottom: 1px solid var(--gallery-border); color: var(--ink-charcoal); vertical-align: top; }
.wxp-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.wxp-table th:last-child, .wxp-table td:last-child { padding-right: 0; }
.wxp-table td strong { font: 700 15px/1.4 var(--sans); color: var(--press-black); font-variant-numeric: tabular-nums; }
.wxp-table .sub { font: 400 12px/1.4 var(--sans); color: var(--dispatch-grey); }
.wxp-year-row th, .wxp-year-row td { border-top: 1px solid var(--press-black); border-bottom: 0; color: var(--press-black); font-weight: 700; }

/* ---------- The record book ---------- */
.wxp-records { margin: 20px 0 0; border-top: 1px solid var(--gallery-border); }
.wxp-records > div { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 4px 24px; padding: 16px 0; border-bottom: 1px solid var(--gallery-border); }
.wxp-records dt { font: 700 10px/2.2 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--dispatch-grey); }
.wxp-records dd { margin: 0; font: 400 16px/1.55 var(--serif); color: var(--ink-charcoal); max-width: 68ch; }
.wxp-records dd b { font: 700 20px var(--sans); color: var(--press-black); margin-right: 4px; }
.wxp-note { margin-top: 28px; max-width: 68ch; }
.wxp-note h3 { font: 700 18px/1.3 var(--serif); }
.wxp-note p { font: 400 15px/1.6 var(--serif); color: var(--ink-charcoal); margin-top: 10px; }

/* ---------- Sources ---------- */
.wxp-sources ul { margin: 16px 0 0; padding-left: 18px; font: 400 14px/1.55 var(--sans); color: var(--ink-charcoal); max-width: 80ch; }
.wxp-sources li + li { margin-top: 8px; }
.wxp-sources b { color: var(--press-black); }
.wxp-sources code { font-size: 13px; }

/* ---------- Phones ---------- */
@media (max-width: 900px) {
  .wxp-day { grid-template-columns: 112px 32px 92px minmax(0, 1fr); }
  .wxp-day-text { grid-column: 2 / -1; margin-top: 8px; }
  .wxp-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .wxp-now { grid-template-columns: 1fr; min-height: 0; padding: 120px 20px 20px; gap: 20px; }
  .wxp-now-temp { font-size: 84px; }
  .wxp-now-facts { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 16px; }
  .wxp-now-facts div { display: block; }
  .wxp-now-facts dd { text-align: left; }
  .wxp-day { grid-template-columns: minmax(0, 1fr) 30px auto; gap: 0 14px; }
  .wxp-day-head { grid-column: 1; }
  .wxp-day .wxp-icon { grid-column: 2; width: 28px; height: 28px; }
  .wxp-day-temps { grid-column: 3; justify-self: end; }
  .wxp-day-pop { grid-column: 1 / -1; line-height: 1.6; }
  .wxp-day-pop:empty { display: none; }
  .wxp-day-text { grid-column: 1 / -1; }
  .wxp-stats b { font-size: 26px; }
  .wxp-plot { height: 240px; }
  .wxp-col-name { font-size: 10px; }
  .wxp-table thead { display: none; }
  .wxp-table, .wxp-table tbody { display: block; }
  .wxp-table tr { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 12px; padding: 14px 0 16px; border-bottom: 1px solid var(--gallery-border); }
  .wxp-table tbody th { grid-column: 1 / -1; padding: 0; border: 0; font-size: 17px; }
  .wxp-table td { padding: 0; border: 0; text-align: left; }
  .wxp-table td:nth-of-type(n+5) { grid-column: span 2; }
  .wxp-table td::before {
    content: attr(data-label); display: block; margin-bottom: 2px;
    font: 700 10px/1.4 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--dispatch-grey);
  }
  .wxp-table .num { text-align: left; }
  .wxp-table .sub { display: block; }
  .wxp-year-row { border-top: 1px solid var(--press-black); }
  .wxp-year-row th, .wxp-year-row td { border-top: 0; }
  .wxp-records > div { grid-template-columns: 1fr; }
}
