/* The Cold Smoke Report — classic weather-blog restyle
   Aesthetic: hand-built 2000s blog. White content column on a gray page,
   duotone ridge masthead with a serif nameplate, honest blue links, dense
   right sidebar. Dark mode = same structure, slate night.
   Masthead photo hook: drop a real Bridger photo at static/masthead.jpg and
   add style="background-image:url({{ base }}/assets/masthead.jpg)" to
   <header class="masthead"> — the rules below already cover it. */

:root {
  --snow:        #fafbfd;   /* page plane, ice white */
  --paper:       #ffffff;   /* content column / cards */
  --ink:         #16222e;   /* primary text */
  --ink-2:       #4c5a68;   /* secondary text */
  --ink-3:       #8a939c;   /* muted / metadata */
  --hairline:    #e3e7ec;
  --ridge:       #1c3a5e;   /* masthead band, deep midnight */
  --ridge-2:     #24507f;   /* far ridge silhouette */
  --ridge-3:     #152e4d;   /* near ridge silhouette */
  --strip:       #eef3f9;   /* nav strip */
  --accent:      #1c5cab;   /* links, current-season line */
  --accent-hi:   #2a78d6;
  --alpenglow:   #eda100;   /* sparing warm accent (chart highlights) */
  --band-lo:     #dcebfb;   /* p10–p90 band */
  --band-hi:     #b7d3f6;   /* p25–p75 band */
  --grid:        #e1e0d9;
  --serif: "Source Serif 4", Georgia, serif;
  --cond: "Barlow Condensed", "Arial Narrow", sans-serif;
  --sans: system-ui, -apple-system, "Segoe UI", Verdana, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --snow:      #0d1218;
    --paper:     #131a22;
    --ink:       #e8edf2;
    --ink-2:     #a7b2bd;
    --ink-3:     #76818c;
    --hairline:  #26303b;
    --ridge:     #0a1826;
    --ridge-2:   #1c3a5e;
    --ridge-3:   #122940;
    --strip:     #16202b;
    --accent:    #5b9ce6;
    --accent-hi: #7db3f0;
    --alpenglow: #ffbe3d;
    --band-lo:   #1a2c42;
    --band-hi:   #27435f;
    --grid:      #232d38;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--snow);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.65;
}
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent-hi); }
img { max-width: 100%; height: auto; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ===== Page column ===== */
.page {
  max-width: 68rem; margin: 0 auto; background: var(--paper);
  border-left: 1px solid var(--hairline); border-right: 1px solid var(--hairline);
  min-height: 100vh;
}
@media (max-width: 68rem) { .page { border-left: none; border-right: none; } }

/* ===== Masthead ===== */
.masthead {
  position: relative; background: var(--ridge);
  background-size: cover; background-position: center;
  min-height: 120px; overflow: hidden;
}
.ridgeline { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.ridge-far  { fill: var(--ridge-2); }
.ridge-near { fill: var(--ridge-3); }
.masthead-inner {
  position: relative; padding: 1.4rem 1.5rem 1.6rem;
}
.masthead-title { margin: 0; }
.masthead-title a {
  font-family: var(--serif); font-weight: 600;
  font-size: clamp(1.7rem, 4vw, 2.2rem);
  color: #ffffff; text-decoration: none; line-height: 1.1;
  text-shadow: 0 1px 3px rgba(0,0,0,0.35);
}
.masthead-tagline {
  margin: 0.3rem 0 0; font-family: var(--sans);
  font-size: 0.8rem; color: #b9d0e6;
  text-shadow: 0 1px 2px rgba(0,0,0,0.35);
}

/* ===== Nav strip ===== */
.sitenav {
  display: flex; flex-wrap: wrap; gap: 1.1rem;
  padding: 0.45rem 1.5rem;
  background: var(--strip); border-bottom: 1px solid var(--hairline);
  font-family: var(--sans); font-size: 0.82rem;
}
.sitenav a { text-decoration: none; }
.sitenav a:hover { text-decoration: underline; }

/* ===== Layout ===== */
.layout {
  padding: 1.6rem 1.5rem 2rem;
  display: grid; grid-template-columns: minmax(0, 1fr) 16rem; gap: 2.2rem;
}
@media (max-width: 54rem) { .layout { grid-template-columns: minmax(0, 1fr); } }

/* ===== Posts ===== */
.post { margin-bottom: 2.8rem; }
.post + .post { border-top: 1px solid var(--hairline); padding-top: 2.2rem; }
.post-date {
  margin: 0; font-family: var(--sans);
  font-size: 0.78rem; color: var(--ink-3);
}
.post-title { margin: 0.2rem 0 0.8rem; font-size: 1.6rem; line-height: 1.22; font-weight: 600; }
.post-title a { color: var(--ink); text-decoration: none; }
.post-title a:hover { color: var(--accent); text-decoration: underline; }
.post-body { max-width: 44rem; }
.post-body h1, .post-body h2, .post-body h3 { line-height: 1.25; margin-top: 1.6em; }
.post-body img {
  display: block; margin: 1.2rem auto; border: 1px solid var(--hairline);
  padding: 3px; background: var(--paper);
}
.post-body blockquote {
  margin: 1rem 0; padding: 0.2rem 1.1rem; border-left: 3px solid var(--hairline);
  color: var(--ink-2);
}
.post-body table { border-collapse: collapse; font-family: var(--sans); font-size: 0.82rem;
                   border: 1px solid var(--hairline); }
.post-body th, .post-body td { padding: 0.3rem 0.8rem; text-align: left;
                               border: 1px solid var(--hairline); }
.post-body th { font-weight: 700; background: var(--strip); }
.post-body td { font-variant-numeric: tabular-nums; }
.post-tags {
  margin-top: 0.9rem; font-family: var(--sans); font-size: 0.78rem; color: var(--ink-3);
}
.tag { color: var(--accent); }
.tag span { color: var(--ink-3); }
.tag span::before { content: " ("; }
.tag span::after { content: ")"; }

.post-comment-link { margin-top: 0.5rem; font-family: var(--sans); font-size: 0.78rem; }
.post-comment-link a { color: var(--accent); text-decoration: none; }
.post-comment-link a:hover { text-decoration: underline; }

.post-comments { max-width: 44rem; margin-top: 2.4rem; }
.post-comments .sb-head { font-size: 1rem; border-bottom: 2px solid var(--ridge); }

.page-heading { font-size: 1.6rem; margin: 0 0 0.4rem; line-height: 1.2; font-weight: 600; }
.page-lede { color: var(--ink-2); margin-top: 0; max-width: 44rem; }
.page-disclaimer { color: var(--ink-2); font-size: 0.85rem; max-width: 44rem; margin: 0 0 0.9rem;
  padding: 0.45rem 0.75rem; border-left: 3px solid var(--alpenglow); background: var(--strip); }

/* ===== Sidebar ===== */
.sidebar { font-family: var(--sans); font-size: 0.8rem; line-height: 1.55; }
.sb-box { margin-bottom: 1.5rem; }
.sb-head {
  margin: 0 0 0.5rem; font-family: var(--sans); font-weight: 700; font-size: 0.85rem;
  color: var(--ink); border-bottom: 2px solid var(--ridge); padding-bottom: 0.3rem;
}
.sb-box p { margin: 0.3rem 0; }
.sb-list { list-style: none; margin: 0; padding: 0; }
.sb-list li { display: flex; justify-content: space-between; gap: 0.6rem;
              padding: 0.22rem 0; border-bottom: 1px dotted var(--hairline); }
.sb-list li:last-child { border-bottom: none; }
.sb-list a { text-decoration: none; }
.sb-list a:hover { text-decoration: underline; }
.sb-date { color: var(--ink-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.sb-tags { line-height: 1.9; }
.sb-tags .tag { margin-right: 0.6rem; text-decoration: none; }
.sb-tags .tag:hover { text-decoration: underline; }
.sb-note { color: var(--ink-3); font-size: 0.72rem; line-height: 1.5; margin: 0.4rem 0 0; }

/* Blog-archive year tree */
.arch-year summary {
  cursor: pointer; padding: 0.22rem 0; list-style: none;
}
.arch-year summary::-webkit-details-marker { display: none; }
.arch-year summary::before { content: "\25B8\00A0"; color: var(--ink-3); }
.arch-year[open] summary::before { content: "\25BE\00A0"; }
.arch-year .sb-list { margin-left: 1.1rem; }

/* ===== Archive pages ===== */
.archive-months { list-style: none; padding: 0; columns: 2; font-family: var(--sans);
                  font-size: 0.85rem; }
.archive-months li { padding: 0.2rem 0; }
.archive-list { list-style: none; padding: 0; font-family: var(--sans); font-size: 0.85rem; }
.archive-list li { padding: 0.3rem 0; border-bottom: 1px dotted var(--hairline); }
.arch-date { color: var(--ink-3); font-variant-numeric: tabular-nums; margin-right: 0.8rem; }

/* ===== Viz shared ===== */
.viz-root {
  background: var(--paper); border: 1px solid var(--hairline);
  padding: 1rem 1.1rem 0.8rem; margin: 1.4rem 0; font-family: var(--sans);
}
.viz-title { margin: 0 0 0.6rem; font-family: var(--sans); font-weight: 700;
             font-size: 0.9rem; color: var(--ink); }
.viz-controls { display: flex; gap: 0; margin-bottom: 0.7rem;
                border-bottom: 1px solid var(--hairline); }
.viz-toggle {
  font-family: var(--sans); font-weight: 700; font-size: 0.85rem; cursor: pointer;
  color: var(--ink-3); background: transparent;
  border: none; border-bottom: 3px solid transparent; padding: 0.25rem 0.9rem 0.35rem;
  margin-bottom: -1px;
}
.viz-toggle:hover { color: var(--ink); }
.viz-toggle.active { color: var(--ink); border-bottom-color: var(--accent); }
.viz-stage { position: relative; }
.viz-stage svg { display: block; width: 100%; height: auto; }
.viz-stage-sm { max-width: 46rem; }
.viz-tooltip {
  position: absolute; pointer-events: none; z-index: 5;
  background: var(--ink); color: var(--snow);
  font-size: 0.8rem; line-height: 1.45; padding: 0.4rem 0.6rem; border-radius: 4px;
  white-space: nowrap; transform: translate(-50%, calc(-100% - 10px));
}
.viz-tooltip .tt-head { font-weight: 700; }
.viz-note { color: var(--ink-3); font-size: 0.8rem; margin: 0.5rem 0 0.2rem; }
.viz-table summary { cursor: pointer; font-size: 0.85rem; color: var(--ink-2); margin-top: 0.4rem; }
.viz-table table { border-collapse: collapse; font-size: 0.8rem; margin-top: 0.5rem; }
.viz-table th, .viz-table td { padding: 0.25rem 0.7rem; border: 1px solid var(--hairline);
                               font-variant-numeric: tabular-nums; }

/* chart internals (SVG classes) */
.ax-label, .ax-tick { fill: var(--ink-3); font-family: var(--sans); font-size: 11px; }
.gridline { stroke: var(--grid); stroke-width: 1; }
.baseline { stroke: var(--ink-3); stroke-width: 1; }
.band-outer { fill: var(--band-lo); }
.band-inner { fill: var(--band-hi); }
.median-line { stroke: var(--ink-2); stroke-width: 1.6; stroke-dasharray: 5 4; fill: none; }
.current-line { stroke: var(--accent); stroke-width: 2.5; fill: none; }
.prev-line { stroke: var(--ink-3); stroke-width: 1.6; fill: none; }
.prev-dot { fill: var(--ink-3); stroke: var(--paper); stroke-width: 1.5; }
.crosshair { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 2 3; }
.end-dot { fill: var(--accent); stroke: var(--paper); stroke-width: 2; }
.end-label { fill: var(--ink); font-family: var(--sans); font-weight: 700; font-size: 13px; }
.series-label { fill: var(--ink-2); font-family: var(--sans); font-size: 11px; }
.bar { fill: var(--accent); }
.bar:hover { fill: var(--accent-hi); }
.bar-current { fill: var(--alpenglow); }
.whisker { stroke: var(--ink-2); stroke-width: 1.6; }

/* ===== Climatology page ===== */
.climo-resort { margin: 2.4rem 0; }
.climo-head {
  font-family: var(--serif); font-weight: 600; font-size: 1.4rem; margin: 0 0 0.8rem;
  border-bottom: 2px solid var(--ridge); padding-bottom: 0.3rem;
}
.climo-sub { font-family: var(--sans); font-size: 0.8rem; font-weight: 400;
             color: var(--ink-3); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
         gap: 0; margin: 1rem 0; font-family: var(--sans);
         border-top: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline); }
.tile { padding: 0.7rem 1rem 0.7rem 0; }
.tile + .tile { border-left: 1px solid var(--hairline); padding-left: 1rem; }
.tile-value { margin: 0; font-family: var(--serif); font-weight: 600; font-size: 1.8rem;
              line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile-unit { font-size: 1.1rem; color: var(--ink-3); }
.tile-label { margin: 0.15rem 0 0; font-size: 0.75rem; color: var(--ink-3); }
.table-wrap { overflow-x: auto; margin: 0.6rem 0 1.4rem; }
table.sortable { border-collapse: collapse; font-family: var(--sans); font-size: 0.8rem;
                 border: 1px solid var(--hairline); }
table.sortable td { padding: 0.28rem 0.8rem; font-variant-numeric: tabular-nums;
                    border: 1px solid var(--hairline); }
table.sortable th { padding: 0.3rem 0.8rem; border: 1px solid var(--hairline);
                    background: var(--strip); }
table.sortable th {
  font-family: var(--sans); font-weight: 700;
  cursor: pointer; user-select: none; white-space: nowrap;
}
table.sortable th::after { content: " \2195"; color: var(--ink-3); font-size: 0.75em; }
table.sortable th.sorted-asc::after { content: " \2191"; color: var(--accent); }
table.sortable th.sorted-desc::after { content: " \2193"; color: var(--accent); }
.fig-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
               gap: 1.2rem; }
.fig-card { margin: 0; background: var(--paper); border: 1px solid var(--hairline); padding: 0.7rem; }
.fig-card img { display: block; }
.fig-card figcaption { font-family: var(--sans); font-size: 0.78rem; color: var(--ink-2);
                       margin-top: 0.5rem; line-height: 1.4; }

/* ===== Footer ===== */
.sitefoot {
  border-top: 1px solid var(--hairline); margin-top: 1rem;
  padding: 1.4rem 1.5rem 2.2rem; text-align: center;
  font-family: var(--sans); font-size: 0.8rem; color: var(--ink-3);
}
.sitefoot p { max-width: 46rem; margin: 0.3rem auto; }
.foot-fine { font-size: 0.75rem; }
