/* Styling for the generated per-resort pages (src/wsis/pages.py).
 *
 * Deliberately its own file rather than a section of style.css: the app is one
 * document that rewrites itself, these are hundreds of documents that never
 * change after they are written, and the only thing they share is the palette.
 * Keeping them apart means a change to the quiz cannot reflow 235 pages. */

:root {
  --ink: #1c2733;
  --muted: #5b6b7a;
  --paper: #f6f8fa;
  --card: #ffffff;
  --accent: #2563a8;
  --line: #dde5ec;
  --route: #c2410c;
  /* Below / near / above normal. A diverging scale — two hues around a
     genuinely neutral grey — because the reader's question is which SIDE of
     normal, not how much of something there is. */
  --below: #b3542e;
  --near:  #b0b0b0;
  --above: #1c5cab;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.55;
}

a { color: var(--accent); }

/* ---- masthead ---- */

.top {
  background: linear-gradient(160deg, #1d3a5f 0%, #2b5d8a 55%, #4a86b4 100%);
  color: #fff;
  padding: 1rem 1.25rem 2.2rem;
}
.top-inner { max-width: 46rem; margin: 0 auto; }
.crumb { font-size: .82rem; opacity: .85; }
.crumb a { color: #fff; text-decoration: none; border-bottom: 1px solid rgba(255,255,255,.4); }
.top h1 { margin: .9rem 0 .3rem; font-size: 2.1rem; letter-spacing: -.02em; }
.where { margin: 0; opacity: .92; font-size: .96rem; }
.verdict {
  margin: 1rem 0 0; max-width: 34rem; font-size: 1.02rem; line-height: 1.5;
  border-left: 3px solid rgba(255,255,255,.5); padding-left: .8rem;
}

main { max-width: 46rem; margin: -1.4rem auto 3rem; padding: 0 1rem; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.3rem 1.5rem;
  margin-bottom: 1.1rem;
  box-shadow: 0 2px 10px rgba(29, 58, 95, .06);
}
.card > h2 { font-size: 1.05rem; margin: 0 0 .2rem; }
.card > .sub { margin: 0 0 1rem; color: var(--muted); font-size: .86rem; }

/* ---- key facts strip ---- */

.facts { display: flex; flex-wrap: wrap; gap: .1rem 0; list-style: none; margin: 0; padding: 0; }
.facts li { flex: 1 1 33%; min-width: 8.5rem; padding: .55rem 0; }
.facts dt, .facts .k {
  font-size: .7rem; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); display: block;
}
.facts .v { font-size: 1.12rem; font-variant-numeric: tabular-nums; }
.facts .v small { font-size: .74rem; color: var(--muted); font-variant-numeric: normal; }

/* ---- month outlook ---- */

.months { display: grid; gap: .55rem; }
.mo {
  display: grid;
  grid-template-columns: 5.4rem 1fr 9.6rem;
  align-items: center;
  gap: .9rem;
  padding: .55rem .1rem;
  border-top: 1px solid var(--line);
}
.mo:first-child { border-top: 0; }
.mo .name { font-weight: 600; font-size: .93rem; }
.mo .name small { display: block; font-weight: 400; font-size: .72rem; color: var(--muted); }
.mo .figure { text-align: right; font-variant-numeric: tabular-nums; font-size: .93rem; }
.mo .figure small { display: block; font-size: .72rem; color: var(--muted); font-variant-numeric: normal; }

/* The same five-band scale and the same marker the ranking uses, so a reader
   arriving here from a result card is reading one instrument, not two. Equal
   band widths with the value placed inside its band: widths carrying the
   value range made every row a different ruler. */
.segbar { position: relative; padding: 9px 0 3px; }
.segs { display: flex; height: 10px; border-radius: 4px; overflow: hidden; }
/* Every band shown, the live band inked, the rest washed out — the same .2
   opacity the ranking uses, so the two read as one instrument. */
.segs .seg { display: block; width: 20%; height: 100%; opacity: .2; }
.segs .seg.on { opacity: 1; }
.segbar .mark {
  position: absolute;
  top: 0;
  width: 0; height: 0;
  margin-left: -6px;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 9px solid var(--ink);
  filter: drop-shadow(0 0 1.5px #fff);
}
.mo .figure .word { display: inline-flex; align-items: center; gap: .3rem; font-weight: 600; }
.mo .figure .word i { width: .55rem; height: .55rem; border-radius: 50%; flex: none; }

/* Beyond the model horizon there is no split to draw. An empty hatched track
   keeps the row's rhythm without inventing a probability — a full grey bar
   read as "100% near normal", which is a claim we are not making. */
.terc.empty {
  height: 10px;
  margin: 9px 0 3px;
  border-radius: 3px;
  background: repeating-linear-gradient(45deg,
    var(--line) 0 4px, transparent 4px 8px);
  border: 1px solid var(--line);
}
.mo.clim .name small { font-style: italic; }

/* ---- terrain by difficulty ----
   Green/blue/black, because that is what the signs on the hill say and this
   section is reporting the hill rather than rating it. Deliberately NOT the
   score palette: those five colours mean "how good is this for you", and a
   black diamond is not a bad forecast. */
.terrain { margin: .2rem 0 .3rem; }
/* One block per mountain when a resort is several on one ticket. */
.tarea + .tarea { margin-top: .9rem; padding-top: .8rem; border-top: 1px solid var(--line); }
.tname { font-weight: 600; font-size: .9rem; margin-bottom: .35rem; }
.tname small { font-weight: 400; color: var(--muted); margin-left: .45rem; }
.tbar {
  display: flex;
  height: 12px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--line);
}
.tbar span + span { box-shadow: -2px 0 0 var(--card); }
.t-beg { background: #3f8f57; }
.t-int { background: #2f6fae; }
.t-adv { background: #3b4149; }
.tkey {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem 1.4rem;
  margin: .6rem 0 0;
  padding: 0;
  list-style: none;
  font-size: .86rem;
}
.tkey li { display: flex; align-items: baseline; gap: .4rem; }
.tkey .sw {
  width: .62rem; height: .62rem;
  border-radius: 3px;
  align-self: center;
  flex: none;
}
.tkey b { font-variant-numeric: tabular-nums; }
.tkey small { color: var(--muted); }

/* ---- generic table ---- */

.tbl-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .87rem; }
/* A CSS tooltip rather than a title attribute: the browser's own tooltip
   waits a second or so before appearing, which reads as nothing happening.
   Hover OR keyboard focus, and it disappears for anyone who has asked for
   reduced motion nothing — it never moves. */
.hint {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.05rem; height: 1.05rem;
  margin-left: .15rem;
  vertical-align: 1px;
  font-size: .72rem;
  font-weight: 700;
  color: var(--card);
  background: var(--muted);
  border-radius: 50%;
  cursor: help;
}
.hint::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  width: max-content;
  max-width: min(22rem, 80vw);
  white-space: normal;
  padding: .5rem .65rem;
  font-size: .78rem;
  font-weight: 400;
  line-height: 1.45;
  text-align: left;
  /* The hint can sit inside a <th>, which is uppercase and letter-spaced.
     A tooltip is a sentence, not a column label. */
  text-transform: none;
  letter-spacing: normal;
  color: var(--card);
  background: var(--ink);
  border-radius: 7px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .18);
  opacity: 0;
  visibility: hidden;
  z-index: 5;
}
.hint:hover::after, .hint:focus::after, .hint:focus-visible::after {
  opacity: 1;
  visibility: visible;
}
.hint:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Opens DOWNWARD, for a hint that lives inside .tbl-wrap. That wrapper
   scrolls, and CSS computes overflow-y to auto whenever overflow-x is not
   visible, so a tooltip opening upward is clipped by the container that makes
   the table readable on a phone. Down, it stays inside the wrapper's own box.
   Anchored left rather than centred so a mid-table column cannot push it off
   the right-hand edge. */
.hint.down::after {
  bottom: auto;
  top: calc(100% + 6px);
  left: auto;
  right: -.25rem;
  transform: none;
  max-width: min(20rem, 66vw);
}
/* Header cells are nowrap; the hint's own text must not inherit that, and the
   label must not break away from its marker. */
th .nw { white-space: nowrap; }

th, td { text-align: right; padding: .42rem .5rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
thead th { font-size: .7rem; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
tbody td { font-variant-numeric: tabular-nums; }
tbody tr:last-child td { border-bottom: 0; }

/* ---- travel ---- */

.trip { display: grid; gap: .5rem; }
.leg {
  display: grid; grid-template-columns: 3.1rem 1fr auto; gap: .8rem; align-items: baseline;
  padding: .5rem .1rem; border-top: 1px solid var(--line);
}
.leg:first-child { border-top: 0; }
.leg .code { font-weight: 700; font-size: .95rem; letter-spacing: .02em; }
.leg .how { font-size: .88rem; }
.leg .how small { display: block; color: var(--muted); font-size: .74rem; }
.leg .time { font-variant-numeric: tabular-nums; font-weight: 600; }
.leg .time small { display: block; font-weight: 400; font-size: .74rem; color: var(--muted); text-align: right; }
.note {
  margin: .9rem 0 0; padding: .6rem .8rem; font-size: .84rem;
  border-left: 3px solid var(--route); background: #fdf5f1; border-radius: 0 6px 6px 0;
}

/* ---- attribute bars ---- */

.attrs { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: .55rem 1.4rem; }
.attr { display: grid; grid-template-columns: 1fr auto; gap: .2rem .6rem; align-items: baseline; }
.attr .lab { font-size: .88rem; }
.attr .word { font-size: .78rem; color: var(--muted); }
.attr .track { grid-column: 1 / -1; height: 4px; border-radius: 2px; background: var(--line); }
.attr .track i { display: block; height: 100%; border-radius: 2px; background: var(--accent); }

/* ---- call to action ---- */

.cta { text-align: center; }
.cta a.btn {
  display: inline-block; margin-top: .3rem; padding: .7rem 1.4rem;
  background: var(--accent); color: #fff; text-decoration: none;
  border-radius: 8px; font-weight: 600;
}
.cta p { color: var(--muted); font-size: .87rem; margin: .8rem 0 0; }

footer {
  max-width: 46rem; margin: 0 auto; padding: 0 1rem 3rem;
  font-size: .78rem; color: var(--muted);
}
footer p { margin: .5rem 0; }

@media (max-width: 34rem) {
  .top h1 { font-size: 1.7rem; }
  .mo { grid-template-columns: 4.6rem 1fr; }
  .mo .figure { grid-column: 1 / -1; text-align: left; }
  .mo .figure small { display: inline; margin-left: .4rem; }
}
