/* Sauna Finder. The interface is cold (plunge water, slate stones); the data is
   heat: how booked a session is runs from pale ember to deep ember. */
:root {
  color-scheme: light;
  --mist: #e8edee;      /* page */
  --paper: #f8fafa;     /* raised surfaces */
  --sunk: #dde4e6;      /* empty vessel, wells */
  --rule: #cfd8db;
  --stone: #22292d;     /* ink */
  --stone-2: #4d585e;
  --stone-3: #6e7a80;
  --plunge: #0f5566;    /* actions, selection, now */
  --plunge-ink: #ffffff;
  --plunge-wash: #d3e6ea;
  /* Heat ramp, quiet → busy, one hue. Ink flips to white from h3. */
  --h0: #fbe6d3; --h1: #f7c59b; --h2: #ef9a5c; --h3: #d4662a; --h4: #a3401a;
  --on-h-light: #22292d; --on-h-dark: #ffffff;
  --hatch: #9aa6ab;
  --radius-s: 5px;
  --radius-m: 10px;
  --label-w: 168px;
  --lane: 40px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --mist: #111719; --paper: #182023; --sunk: #222b2f; --rule: #2c373b;
    --stone: #e4eaeb; --stone-2: #b1bcc0; --stone-3: #85939a;
    --plunge: #2f8f99; --plunge-ink: #ffffff; --plunge-wash: #19343b;
    /* At night busier sessions glow brighter, like embers. */
    --h0: #5a2c14; --h1: #85401a; --h2: #b9531d; --h3: #e8691f; --h4: #ff8a3d;
    --on-h-light: #f4ece6; --on-h-dark: #1a0f09;
    --hatch: #4f5d63;
  }
  :root:not([data-theme="light"]) .slot.hot4 .fill { box-shadow: 0 0 10px color-mix(in oklab, var(--h4) 60%, transparent); }
}
:root[data-theme="dark"] .slot.hot4 .fill { box-shadow: 0 0 10px color-mix(in oklab, var(--h4) 60%, transparent); }
:root[data-theme="dark"] {
  color-scheme: dark;
  --mist: #111719; --paper: #182023; --sunk: #222b2f; --rule: #2c373b;
  --stone: #e4eaeb; --stone-2: #b1bcc0; --stone-3: #85939a;
  --plunge: #2f8f99; --plunge-ink: #ffffff; --plunge-wash: #19343b;
  --h0: #5a2c14; --h1: #85401a; --h2: #b9531d; --h3: #e8691f; --h4: #ff8a3d;
  --on-h-light: #f4ece6; --on-h-dark: #1a0f09;
  --hatch: #4f5d63;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--mist);
  color: var(--stone);
  font: 400 15px/1.5 "Schibsted Grotesk", system-ui, sans-serif;
}
/* Tabular figures only where numbers line up; they also widen punctuation. */
.axis, .days, .stepper output { font-variant-numeric: tabular-nums; }
button, input, output { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--plunge); outline-offset: 2px; }
a { color: inherit; }

.masthead, .lede, .controls, .stage, .foot { max-width: 1440px; margin: 0 auto; padding-inline: 28px; }

/* Masthead ------------------------------------------------------------- */
.masthead { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 18px; }
.wordmark { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 800; font-size: 17px; letter-spacing: -0.01em; }
.wordmark svg { width: 30px; height: 30px; overflow: visible; }
.wordmark .s3 { fill: var(--stone); }
.wordmark .s2 { fill: var(--stone-2); }
.wordmark .s1 { fill: var(--h3); }
.wordmark .steam { fill: none; stroke: var(--stone-3); stroke-width: 1.4; stroke-linecap: round; }
.fresh { margin: 0; color: var(--stone-3); font-size: 13px; display: inline-flex; align-items: center; gap: 7px; }
.fresh.live { color: var(--stone-2); }
.fresh i { width: 8px; height: 8px; border-radius: 50%; background: var(--h3); box-shadow: 0 0 0 0 color-mix(in oklab, var(--h3) 60%, transparent); animation: pulse 2s ease-out infinite; }
@keyframes pulse { to { box-shadow: 0 0 0 7px transparent; } }
@media (prefers-reduced-motion: reduce) { .fresh i { animation: none; } }

/* The headline is generated from the data and changes with the filters. */
.lede { padding-top: 18px; padding-bottom: 6px; }
.lede h1 {
  min-height: 2.04em;
  margin: 0; max-width: 22ch; font-size: clamp(30px, 4.6vw, 54px); line-height: 1.02; font-weight: 800;
  letter-spacing: -0.035em; text-wrap: balance;
}
.subline { margin: 12px 0 0; color: var(--stone-2); font-size: 16px; max-width: 64ch; min-height: 1.5em; }
.subline b { color: var(--stone); font-weight: 600; }
.linkish { border: 0; background: none; padding: 0; color: var(--plunge); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* Controls ------------------------------------------------------------- */
.controls { padding-top: 22px; padding-bottom: 14px; display: grid; gap: 12px; }
.days { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; margin-inline: -4px; padding: 2px 4px; }
.days::-webkit-scrollbar { display: none; }
.days button {
  flex: 0 0 auto; display: grid; justify-items: start; gap: 0; min-width: 64px;
  border: 0; background: transparent; border-radius: var(--radius-m); padding: 7px 12px 8px; cursor: pointer; text-align: left;
}
.days button small { font-size: 12.5px; color: var(--stone-3); }
.days button span { font-size: 17px; font-weight: 700; line-height: 1.15; }
.days button:hover { background: var(--sunk); }
.days button[aria-selected="true"] { background: var(--stone); color: var(--mist); }
.days button[aria-selected="true"] small { color: inherit; opacity: .75; }

.control-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; }
.seg { display: inline-flex; background: var(--sunk); border-radius: 999px; padding: 3px; }
.seg button { border: 0; background: none; border-radius: 999px; padding: 5px 13px; cursor: pointer; color: var(--stone-2); }
.seg button[aria-pressed="true"] { background: var(--paper); color: var(--stone); font-weight: 600; box-shadow: 0 1px 2px rgb(0 0 0 / 12%); }

.stepper { display: inline-flex; align-items: center; background: var(--sunk); border-radius: 999px; padding: 3px; }
.stepper button {
  width: 30px; height: 30px; border: 0; border-radius: 999px; background: var(--paper); cursor: pointer;
  font-size: 17px; line-height: 1; box-shadow: 0 1px 2px rgb(0 0 0 / 12%);
}
.stepper button:disabled { opacity: .4; cursor: default; }
.stepper output { min-width: 82px; text-align: center; font-weight: 600; }

.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; color: var(--stone-2); }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track-ui {
  position: relative; width: 36px; height: 22px; border-radius: 999px; background: var(--rule); transition: background .15s;
}
.switch .track-ui::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--paper); box-shadow: 0 1px 2px rgb(0 0 0 / 25%); transition: transform .15s;
}
.switch input:checked + .track-ui { background: var(--plunge); }
.switch input:checked + .track-ui::after { transform: translateX(14px); }
.switch input:focus-visible + .track-ui { outline: 2px solid var(--plunge); outline-offset: 2px; }

/* Layout ---------------------------------------------------------------- */
.stage {
  display: grid; grid-template-columns: minmax(0, 1fr) clamp(300px, 30vw, 440px); gap: 24px; align-items: start;
  padding-bottom: 28px;
}
.timetable { min-width: 0; background: var(--paper); border-radius: 16px; padding: 14px 0 6px; }
.mapcol { position: sticky; top: 16px; }
#map { height: calc(100vh - 32px); max-height: 760px; min-height: 380px; border-radius: 16px; background: var(--sunk); }

.key {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 0 18px 12px;
  font-size: 12.5px; color: var(--stone-3);
}
.ramp { display: inline-flex; gap: 2px; }
.ramp i { width: 18px; height: 10px; background: var(--h); border-radius: 2px; }
.full-key { display: inline-flex; align-items: center; gap: 6px; margin-left: 6px; }
.full-key i { width: 18px; height: 10px; border-radius: 2px; background: var(--full-bg); }

/* Timetable board -------------------------------------------------------- */
:root { --full-bg: repeating-linear-gradient(135deg, var(--hatch) 0 1.5px, transparent 1.5px 5px), var(--sunk); }

.board-scroll { overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; }
.board { position: relative; min-width: 100%; width: max-content; }
.empty { padding: 30px 18px; color: var(--stone-2); }

.axis, .vrow { display: grid; grid-template-columns: var(--label-w) var(--track-w); }
.axis { position: relative; height: 22px; }
.axis .pad, .vlabel { position: sticky; left: 0; z-index: 3; background: var(--paper); }
.axis .ticks { position: relative; }
.axis .ticks span {
  position: absolute; bottom: 4px; transform: translateX(-50%); font-size: 11.5px; color: var(--stone-3); white-space: nowrap;
}

.vrow { border-top: 1px solid var(--rule); }
.vrow:hover .vlabel, .vrow.hot .vlabel { background: color-mix(in srgb, var(--plunge-wash) 55%, var(--paper)); }
.vlabel {
  display: grid; align-content: center; gap: 1px; text-align: left; border: 0; cursor: pointer;
  padding: 8px 10px 8px 18px; min-height: 56px;
}
.vlabel .n { font-weight: 700; font-size: 14.5px; line-height: 1.2; }
.vlabel .s { font-size: 12.5px; color: var(--stone-3); line-height: 1.25; }
.vlabel .warn { font-size: 11.5px; color: var(--h4); }
.vrow.open .vlabel .n { color: var(--plunge); }
.vlabel .n::after { content: "\00a0\00a0+"; color: var(--stone-3); font-weight: 500; }
.vrow.open .vlabel .n::after { content: "\00a0\00a0\2212"; color: var(--plunge); }

.track {
  position: relative; padding: 8px 0;
  background-image: repeating-linear-gradient(90deg, var(--rule) 0 1px, transparent 1px var(--hour));
  background-size: var(--track-w) 100%; background-repeat: no-repeat;
}
.track .none { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--stone-3); font-size: 13px; background: var(--paper); padding: 2px 6px; border-radius: 4px; }
.now {
  position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--plunge); z-index: 2; pointer-events: none;
}
.now-tag {
  position: absolute; top: 2px; transform: translateX(-50%); z-index: 4; font-size: 11px; font-weight: 700;
  background: var(--plunge); color: var(--plunge-ink); padding: 0 6px; border-radius: 999px; line-height: 17px;
}

/* A session is a vessel that fills from the bottom as it books up. */
.slot {
  position: absolute; height: calc(var(--lane) - 4px); display: block; overflow: hidden;
  border-radius: var(--radius-s); background: var(--sunk); text-decoration: none; color: var(--stone);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--stone) 10%, transparent);
}
.slot .fill {
  position: absolute; inset: auto 0 0 0; height: var(--f); background: var(--h); transform-origin: bottom;
}
.slot .lbl {
  position: relative; display: flex; flex-direction: column; justify-content: center; height: 100%;
  padding: 0 6px; line-height: 1.05; white-space: nowrap;
}
.slot .lbl { text-shadow: 0 0 2px var(--paper), 0 0 4px var(--paper), 0 0 6px var(--paper); }
.slot .t { font-size: 11px; font-weight: 500; color: var(--stone-2); }
.slot .k { font-size: 13.5px; font-weight: 700; }
.slot.narrow .lbl { align-items: center; padding: 0; }
.slot.narrow .t { display: none; }
.slot.full { background: var(--full-bg); color: var(--stone-2); }
.slot.full .k { font-size: 12px; font-weight: 600; }
.slot.full .fill { display: none; }
.slot.short { opacity: .55; }
.slot.past { opacity: .32; }
.slot:hover, .slot:focus-visible { z-index: 5; box-shadow: 0 0 0 2px var(--stone); outline: none; }

.board.rise .slot .fill { animation: rise .7s cubic-bezier(.2, .7, .2, 1) both; animation-delay: calc(var(--row) * 45ms); }
@keyframes rise { from { transform: scaleY(0); } }
@media (prefers-reduced-motion: reduce) { .board.rise .slot .fill { animation: none; } }

/* Expanded venue detail; pinned to the visible width while the board scrolls. */
.detail {
  position: sticky; left: 0; z-index: 3; width: var(--view-w, 100%); padding: 6px 18px 22px; background: var(--paper);
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 18px 28px;
}
.detail .addr { margin: 0 0 12px; color: var(--stone-2); font-size: 14px; max-width: 30ch; }
/* The column grows to fit the button; on narrow screens the label may wrap. */
.detail .btn { max-width: 100%; white-space: normal; }
.btn {
  white-space: nowrap;
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 999px;
  background: var(--plunge); color: var(--plunge-ink); font-weight: 600; text-decoration: none;
}
.btn:hover { filter: brightness(1.08); }
.detail h3 { margin: 0 0 4px; font-size: 14px; font-weight: 700; }
.detail .note { margin: 0 0 10px; color: var(--stone-3); font-size: 13px; max-width: 60ch; }
.heat { display: grid; grid-template-columns: 34px repeat(var(--cols), minmax(14px, 1fr)); gap: 2px; font-size: 11px; max-width: 640px; }
.heat .lab { color: var(--stone-3); display: flex; align-items: center; }
.heat .hl { color: var(--stone-3); text-align: left; }
.heat .c { height: 20px; border-radius: 3px; background: var(--sunk); }

/* Tooltip ---------------------------------------------------------------- */
.tip {
  position: fixed; z-index: 1000; pointer-events: none; background: var(--stone); color: var(--mist);
  padding: 8px 11px; border-radius: 8px; font-size: 13px; line-height: 1.4; max-width: 260px;
  box-shadow: 0 6px 20px rgb(0 0 0 / 22%);
}
.tip b { display: block; font-weight: 700; margin-bottom: 2px; }
.tip .dim { opacity: .75; }

/* Map --------------------------------------------------------------------- */
.leaflet-container { font: inherit; background: var(--sunk); }
.tiles { filter: grayscale(1) contrast(.9) brightness(1.04) sepia(.08) hue-rotate(160deg) saturate(1.4); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tiles { filter: grayscale(1) invert(1) brightness(.78) contrast(.92) sepia(.12) hue-rotate(160deg) saturate(1.6); }
}
:root[data-theme="dark"] .tiles { filter: grayscale(1) invert(1) brightness(.78) contrast(.92) sepia(.12) hue-rotate(160deg) saturate(1.6); }
.leaflet-control-attribution { font-size: 10px; background: color-mix(in srgb, var(--paper) 80%, transparent) !important; color: var(--stone-3); }
.leaflet-control-attribution a { color: var(--stone-2); }
.leaflet-bar a { background: var(--paper); color: var(--stone); border-color: var(--rule); }

.pin {
  display: grid; place-items: center; width: 100%; height: 100%; border-radius: 50%;
  background: var(--h); color: var(--ink); font-weight: 800; font-size: 13px;
  box-shadow: 0 0 0 2.5px var(--paper), 0 2px 6px rgb(0 0 0 / 30%);
  transition: transform .15s;
}
.pin.zero { background: var(--full-bg); color: var(--stone-3); }
.pin.hot { transform: scale(1.25); box-shadow: 0 0 0 2.5px var(--paper), 0 0 0 5px var(--plunge), 0 2px 8px rgb(0 0 0 / 30%); }
.leaflet-marker-icon.on-top { z-index: 9999 !important; }
.leaflet-tooltip { background: var(--stone); color: var(--mist); border: 0; border-radius: 8px; font: inherit; font-size: 13px; box-shadow: 0 6px 20px rgb(0 0 0 / 22%); }
.leaflet-tooltip-top::before { border-top-color: var(--stone); }

.mapkey {
  position: absolute; z-index: 500; left: 10px; bottom: 10px; max-width: calc(100% - 20px);
  background: color-mix(in srgb, var(--paper) 92%, transparent); color: var(--stone-2);
  font-size: 12px; line-height: 1.35; padding: 6px 9px; border-radius: 8px; pointer-events: none;
}

/* Footer ------------------------------------------------------------------- */
.foot { padding-top: 6px; padding-bottom: 40px; color: var(--stone-3); font-size: 13px; }
.foot p { margin: 0 0 6px; max-width: 78ch; }

/* Small screens: map above the board, board scrolls sideways under pinned names. */
@media (max-width: 1000px) {
  .stage { grid-template-columns: 1fr; }
  .mapcol { position: relative; top: 0; order: -1; }
  #map { height: 260px; min-height: 0; }
}
@media (max-width: 640px) {
  .masthead, .lede, .controls, .stage, .foot { padding-inline: 16px; }
  .lede { padding-top: 22px; }
  :root { --label-w: 116px; }
  .vlabel { padding-left: 12px; }
  .vlabel .n { font-size: 13.5px; }
  .timetable { margin-inline: -16px; border-radius: 0; }
  #map { height: 240px; border-radius: 12px; }
  .mapkey { position: static; max-width: none; background: none; padding: 6px 2px 0; }
  .detail { grid-template-columns: 1fr; padding-inline: 12px; }
  .key { padding-inline: 12px; }
}

/* Crawlable links to the per-sauna and area pages (added server-side on /). */
.sitelinks { padding-bottom: 10px; margin-bottom: 10px; border-bottom: 1px solid var(--rule); }
.sitelinks a, .foot nav a { color: var(--stone-2); text-underline-offset: 3px; }
.sitelinks b, .foot nav b { color: var(--stone-2); font-weight: 600; }

/* Region switcher above the headline (filled in server-side). */
.regions { max-width: 1440px; margin: 0 auto; padding: 18px 28px 0; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.regions::-webkit-scrollbar { display: none; }
.regions a { flex: none; padding: 6px 13px; border-radius: 999px; color: var(--stone-2); text-decoration: none; font-weight: 500; white-space: nowrap; }
.regions a:hover { background: var(--sunk); }
.regions a[aria-current="page"] { background: var(--stone); color: var(--mist); font-weight: 600; }
.regions .home-link { color: var(--stone-3); padding-inline: 10px; }
.seo.page { max-width: 1440px; padding: 8px 28px 10px; }
.seo h2 { font-size: 20px; margin: 18px 0 6px; }
.seo .cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; padding: 0; list-style: none; }
.seo .cards li { background: var(--paper); border-radius: 12px; padding: 14px 16px; }
.seo .cards a.name { font-weight: 700; color: var(--stone); text-decoration: none; }
.seo .cards p { margin: 4px 0 0; color: var(--stone-2); font-size: 14px; }
.seo a { color: var(--plunge); }
.seo .muted { color: var(--stone-3); font-size: 13.5px; }
@media (max-width: 640px) { .regions, .seo.page { padding-inline: 16px; } }
