/* ============================================================================
 * Pocket Plumes — app.css
 * Design tokens + frame + chrome. Data-driven bits (category colours, bar
 * heights) are set inline by app.js; everything structural lives here.
 * ==========================================================================*/

:root {
  --bg-page: radial-gradient(120% 90% at 70% 0%, #11161f 0%, #070a10 55%, #04060a 100%);
  --screen: #06090f;
  --map-base: linear-gradient(160deg, #0a0f17 0%, #0b1018 50%, #070b12 100%);
  --panel: rgba(255,255,255,.04);
  --panel-border: rgba(255,255,255,.07);
  --hair: rgba(255,255,255,.05);
  --glass: rgba(13,17,24,.62);
  --tabglass: rgba(14,18,26,.72);
  --text-1: #f3f5f8;
  --text-2: rgba(255,255,255,.5);
  --text-3: rgba(255,255,255,.4);
  --accent: #ff8a00;
  --teal: #6fe3d2;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

* { -webkit-font-smoothing: antialiased; box-sizing: border-box; }
::-webkit-scrollbar { width: 0; height: 0; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: transparent;   /* lets the deck's sheet show around the phone */
  overflow: hidden;          /* no scrollbars in the embed */
  font-family: var(--font);
  color: var(--text-1);
}

/* keyframes (from the v2 spec) */
@keyframes ppDrift { 0%,100% { transform: translate(0,0); } 50% { transform: translate(6px,-4px); } }
@keyframes ppRing { 0% { transform: translate(-50%,-50%) scale(.7); opacity: .8; } 100% { transform: translate(-50%,-50%) scale(2.4); opacity: 0; } }
@keyframes ppLive { 0%,100% { opacity: .35; } 50% { opacity: 1; } }
@keyframes ppSheet { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes ppFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes ppSpin { to { transform: rotate(360deg); } }

/* ---- page layout --------------------------------------------------------- */
.page {
  display: flex; flex-direction: column; align-items: center; gap: 22px;
  padding: 40px 24px 64px; max-width: 100%;
}
/* solo phone (embed): fill the viewport, centre the bezel, transparent around it.
   The phone keeps its native 402×858 px layout and is scaled to fit by JS
   (transform: scale) so the internal pixel-perfect layout stays intact. */
.page--solo { justify-content: center; align-items: center; height: 100vh; width: 100vw; padding: 0; gap: 0; background: transparent; overflow: hidden; }
.page--solo .phone { transform-origin: center center; }
.masthead { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; max-width: 560px; }
.brandline { display: flex; align-items: center; gap: 9px; }
.brand-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px 2px rgba(255,138,0,.7); }
.brand-eyebrow { font-size: 13px; letter-spacing: .32em; text-transform: uppercase; color: var(--text-2); font-weight: 600; }
.masthead h1 { font-size: 30px; font-weight: 680; color: var(--text-1); letter-spacing: -.01em; line-height: 1.15; margin: 0; }
.masthead p { font-size: 14.5px; line-height: 1.55; color: rgba(235,240,248,.58); max-width: 480px; margin: 0; }

.layout-switch { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.layout-switch .lbl { font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase; color: rgba(255,255,255,.34); }
.seg { display: flex; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08); border-radius: 11px; padding: 3px; gap: 2px; }
.seg button { font-size: 11.5px; font-weight: 600; padding: 6px 11px; border-radius: 8px; border: none; cursor: pointer; background: transparent; color: rgba(255,255,255,.55); transition: all .15s; }
.seg button.on { background: rgba(255,255,255,.92); color: #0a0d12; }

.hint { font-size: 12px; color: rgba(255,255,255,.32); text-align: center; max-width: 420px; }

/* ---- phone frame --------------------------------------------------------- */
.phone {
  position: relative; width: 402px; height: 858px; flex: none;
  border-radius: 54px; padding: 12px;
  background: linear-gradient(160deg, #23272f, #0c0e12 60%);
  box-shadow: 0 40px 90px rgba(0,0,0,.6), inset 0 0 0 2px rgba(255,255,255,.05), 0 0 0 1px #000;
}
.screen {
  position: relative; width: 100%; height: 100%; border-radius: 44px; overflow: hidden;
  background: var(--screen); color: #fff;
}
.notch {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  width: 116px; height: 30px; border-radius: 99px; background: #000; z-index: 50;
}
.notch::after { content: ''; position: absolute; right: 14px; top: 11px; width: 8px; height: 8px; border-radius: 50%; background: #1b2330; }

/* ---- map layers ---------------------------------------------------------- */
.map-layer { position: absolute; inset: 0; }
#map { position: absolute; inset: 0; z-index: 0; background: #06090f; }
#map-base { position: absolute; inset: 0; z-index: 1; pointer-events: none; } /* fallback visual only — never intercept map drag */
.map-grad { position: absolute; inset: 0; background: var(--map-base); }
#plume { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none;
  filter: blur(3px) saturate(150%); opacity: .95; z-index: 2; }
#map-fx { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
#map-fx .src, #map-fx button, #map-fx .home-c-sheet, #map-fx input { pointer-events: auto; }

/* MapLibre chrome — keep it subtle inside the phone */
.maplibregl-ctrl-attrib { font-size: 9px; background: rgba(6,9,15,.5) !important; }
.maplibregl-ctrl-attrib a { color: rgba(255,255,255,.45) !important; }
.maplibregl-ctrl-bottom-right { bottom: 96px; opacity: .55; }
.maplibregl-ctrl-logo { display: none !important; }
.map-layer canvas.maplibregl-canvas { outline: none; }
/* cooperative-gesture hint ("use ⌘ + scroll") — keep it subtle, away from chrome */
.maplibregl-cooperative-gesture-screen { font-family: var(--font); font-size: 13px; }

/* custom zoom / recenter controls */
.map-ctrls { position: absolute; right: 12px; top: 196px; z-index: 9; display: flex; flex-direction: column; gap: 6px; }
.map-ctrls button {
  width: 34px; height: 34px; border-radius: 11px; display: flex; align-items: center; justify-content: center;
  background: var(--glass); border: 1px solid rgba(255,255,255,.12); color: rgba(255,255,255,.78); cursor: pointer;
  backdrop-filter: blur(20px) saturate(160%); -webkit-backdrop-filter: blur(20px) saturate(160%);
  box-shadow: 0 8px 20px rgba(0,0,0,.4); transition: background .15s, color .15s;
}
.map-ctrls button:hover { background: rgba(28,34,46,.8); color: #fff; }
.map-ctrls button:active { transform: scale(.94); }
.map-ctrls .recenter-sep { margin-top: 2px; }

.tile { position: absolute; }
.sea { position: absolute; inset: 0; }
.map-label { position: absolute; transform: translate(-50%,-50%); font-size: 13px; font-weight: 600; color: rgba(255,255,255,.5); letter-spacing: .04em; text-shadow: 0 1px 6px #000; }
.river-label { position: absolute; font-size: 8.5px; color: rgba(150,190,230,.55); font-style: italic; text-shadow: 0 1px 4px #000; }

.scrim-top { position: absolute; top: 0; left: 0; right: 0; height: 210px; background: linear-gradient(180deg, rgba(5,8,14,.82) 0%, rgba(5,8,14,.45) 45%, transparent 100%); pointer-events: none; }
.scrim-bot { position: absolute; bottom: 0; left: 0; right: 0; height: 360px; background: linear-gradient(0deg, rgba(5,8,14,.92) 6%, rgba(5,8,14,.55) 50%, transparent 100%); pointer-events: none; }

/* source markers */
.src { position: absolute; transform: translate(-50%,-50%); cursor: pointer; width: 14px; height: 14px; z-index: 8; }
.src .ring { position: absolute; left: 50%; top: 50%; width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid #fff; transform: translate(-50%,-50%); animation: ppRing 2.6s ease-out infinite; }
.src .core { position: absolute; left: 50%; top: 50%; width: 7px; height: 7px; border-radius: 50%; background: #fff; transform: translate(-50%,-50%); }
.src .lbl { position: absolute; top: -5px; white-space: nowrap; font-size: 8.5px; font-weight: 600; color: rgba(255,255,255,.74); text-shadow: 0 1px 4px #000; }
.src .lbl.right { right: 13px; text-align: right; }
.src .lbl.left { left: 13px; }

/* ---- home overlays ------------------------------------------------------- */
.home-a { position: absolute; top: 64px; left: 0; right: 0; padding: 0 22px; z-index: 6; }
.citybtn { display: flex; align-items: center; gap: 6px; background: none; border: none; padding: 0; cursor: pointer; color: #fff; }
.cityname-lg { font-size: 19px; font-weight: 600; letter-spacing: -.01em; }
.live-pill { margin-left: 6px; display: flex; align-items: center; gap: 4px; font-size: 10.5px; color: rgba(255,255,255,.5); }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--teal); animation: ppLive 2s ease-in-out infinite; }
.hero-num { font-size: 84px; font-weight: 300; line-height: .92; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.hero-row { display: flex; align-items: flex-start; gap: 8px; margin-top: 6px; }
.hero-unit { margin-top: 12px; }
.hero-unit .u1 { font-size: 15px; font-weight: 600; color: rgba(255,255,255,.82); }
.hero-unit .u2 { font-size: 11px; color: rgba(255,255,255,.45); letter-spacing: .06em; }
.hero-cat { display: flex; align-items: center; gap: 10px; margin-top: 4px; }

.home-b { position: absolute; top: 66px; left: 18px; z-index: 6; }
.chip { display: flex; align-items: center; gap: 9px; padding: 9px 13px 9px 11px; border-radius: 18px; border: 1px solid rgba(255,255,255,.12); background: rgba(16,20,28,.5); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); cursor: pointer; color: #fff; }
.chip .sq { width: 34px; height: 34px; border-radius: 11px; display: flex; align-items: center; justify-content: center; font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.chip .nm { display: block; font-size: 14px; font-weight: 600; line-height: 1.1; text-align: left; }
.chip .sub { display: block; font-size: 11px; font-weight: 500; }

.home-c-top { position: absolute; top: 64px; left: 0; right: 0; padding: 0 20px; z-index: 6; display: flex; align-items: center; justify-content: space-between; }
.home-c-sheet { position: absolute; left: 0; right: 0; bottom: 0; top: 308px; background: linear-gradient(180deg, rgba(9,12,18,.4) 0%, #090c12 14%); border-radius: 26px 26px 0 0; overflow-y: auto; z-index: 12; padding: 18px 16px 130px; }
.grabber { width: 38px; height: 4px; border-radius: 99px; background: rgba(255,255,255,.2); margin: 0 auto 16px; }
.glance-row { display: flex; gap: 9px; overflow-x: auto; padding: 0 16px 4px; margin: 0 -16px; }
.glance { flex: none; width: 96px; border-radius: 18px; padding: 14px 12px; background: rgba(255,255,255,.05); border: 1px solid var(--panel-border); }
.glance .w { font-size: 11px; color: var(--text-2); font-weight: 500; }
.glance .v { font-size: 26px; font-weight: 400; margin-top: 8px; font-variant-numeric: tabular-nums; }
.glance .u { font-size: 10px; color: var(--text-3); }
.glance .c { font-size: 10.5px; margin-top: 7px; font-weight: 600; }
.healthcard { margin-top: 16px; border-radius: 18px; padding: 15px 16px; display: flex; gap: 12px; align-items: flex-start; }
.healthcard .ic { width: 30px; height: 30px; flex: none; border-radius: 9px; background: rgba(0,0,0,.22); display: flex; align-items: center; justify-content: center; }
.eyebrow { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); font-weight: 600; }
.contrib-list { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.contrib { display: flex; align-items: center; gap: 12px; padding: 11px 13px; border-radius: 14px; background: var(--panel); border: 1px solid rgba(255,255,255,.06); cursor: pointer; text-align: left; width: 100%; color: #fff; }
.contrib .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.contrib .nm { display: block; font-size: 13.5px; font-weight: 500; }
.contrib .ty { display: block; font-size: 11px; color: rgba(255,255,255,.45); }
.contrib .amt { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---- scrubber ------------------------------------------------------------ */
.scrubber { position: absolute; left: 14px; right: 14px; bottom: 104px; z-index: 7; border-radius: 24px; padding: 14px 15px 13px;
  background: var(--glass); backdrop-filter: blur(20px) saturate(160%); -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid rgba(255,255,255,.1); box-shadow: 0 18px 40px rgba(0,0,0,.45); }
.scrub-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 11px; }
.wind-compass { width: 26px; height: 26px; border-radius: 50%; border: 1px solid rgba(255,255,255,.18); display: flex; align-items: center; justify-content: center; }
.wind-lbl { font-size: 12.5px; font-weight: 600; }
.wind-sub { font-size: 10px; color: rgba(255,255,255,.45); }
.health-pill { font-size: 11px; font-weight: 600; padding: 5px 10px; border-radius: 99px; }
.scrub-read { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.scrub-read .l { font-size: 13px; color: rgba(255,255,255,.6); font-variant-numeric: tabular-nums; }
.scrub-read .r { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.strip { position: relative; height: 54px; }
.strip .bars { position: absolute; inset: 0; display: flex; align-items: flex-end; pointer-events: none; }
.strip .col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.strip .bar { border-radius: 99px; transition: all .25s; }
.strip .tk { font-size: 8.5px; height: 10px; }
.strip .playhead { position: absolute; top: -2px; bottom: 14px; width: 1px; background: rgba(255,255,255,.25); transition: left .25s; pointer-events: none; }
.strip input[type=range] { position: absolute; left: 0; top: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; -webkit-appearance: none; appearance: none; background: transparent; }

/* ---- generic screens (forecast/saved/settings) --------------------------- */
.screen-page { position: absolute; inset: 0; overflow-y: auto; background: #080b11; padding: 64px 0 120px; }
.screen-title { font-size: 28px; font-weight: 680; letter-spacing: -.01em; }
.card { border-radius: 22px; background: var(--panel); border: 1px solid var(--panel-border); }
.card.pad { padding: 16px 14px 12px; }
.list-card { border-radius: 18px; background: var(--panel); border: 1px solid var(--panel-border); overflow: hidden; }
.row { display: flex; align-items: center; padding: 14px 16px; }
.row + .row { border-top: 1px solid var(--hair); }
.row .grow { flex: 1; }
.row .r-title { font-size: 15px; }
.row .r-sub { font-size: 11.5px; color: rgba(255,255,255,.45); margin-top: 1px; }

/* toggles */
.toggle { width: 46px; height: 28px; border-radius: 99px; border: none; cursor: pointer; position: relative; transition: background .2s; }
.toggle .knob { position: absolute; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: left .2s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.unitseg { display: flex; background: rgba(255,255,255,.06); border-radius: 9px; padding: 2px; }
.unitseg button { font-size: 12px; font-weight: 600; padding: 6px 12px; border-radius: 7px; border: none; cursor: pointer; background: transparent; color: rgba(255,255,255,.55); }
.unitseg button.on { background: var(--teal); color: #06231f; }

/* saved */
.saved-card { text-align: left; width: 100%; cursor: pointer; border-radius: 20px; padding: 15px 17px; color: #fff; }
.saved-spark { display: flex; align-items: flex-end; gap: 3px; height: 30px; margin-top: 12px; }
.saved-spark span { flex: 1; border-radius: 99px; }
.tag-pill { font-size: 9px; font-weight: 600; padding: 2px 7px; border-radius: 99px; background: rgba(111,227,210,.16); color: var(--teal); letter-spacing: .04em; }
.add-loc { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 15px; border-radius: 18px; border: 1px dashed rgba(255,255,255,.16); color: var(--text-2); font-size: 14px; font-weight: 500; }

/* ---- source detail sheet ------------------------------------------------- */
.sheet-scrim { position: absolute; inset: 0; z-index: 30; background: rgba(3,5,9,.55); animation: ppFade .2s ease; }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; z-index: 31; background: #0e131b; border-radius: 28px 28px 0 0; border-top: 1px solid rgba(255,255,255,.1); padding: 14px 20px 38px; box-shadow: 0 -20px 50px rgba(0,0,0,.5); animation: ppSheet .32s cubic-bezier(.32,.72,0,1); }
.sheet-head { display: flex; align-items: flex-start; gap: 13px; }
.sheet-ic { width: 46px; height: 46px; flex: none; border-radius: 13px; display: flex; align-items: center; justify-content: center; }
.sheet-ic span { width: 14px; height: 14px; border-radius: 50%; }
.sheet-x { width: 30px; height: 30px; border-radius: 50%; border: none; background: rgba(255,255,255,.08); color: rgba(255,255,255,.6); font-size: 15px; cursor: pointer; line-height: 1; }
.stat-tiles { display: flex; gap: 10px; margin-top: 18px; }
.stat { flex: 1; border-radius: 14px; background: var(--panel); border: 1px solid rgba(255,255,255,.06); padding: 13px; }
.stat .k { font-size: 11px; color: rgba(255,255,255,.45); }
.stat .v { font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 3px; }
.detail-card { margin-top: 12px; border-radius: 14px; background: var(--panel); border: 1px solid rgba(255,255,255,.06); padding: 13px 14px; }
.detail-card .dr { display: flex; justify-content: space-between; font-size: 12.5px; }
.detail-card .dr + .dr { margin-top: 9px; }
.sheet-note { margin-top: 12px; font-size: 12.5px; line-height: 1.55; color: rgba(255,255,255,.62); padding: 0 2px; }

/* ---- tab bar ------------------------------------------------------------- */
.tabbar { position: absolute; left: 14px; right: 14px; bottom: 30px; z-index: 20; height: 62px; border-radius: 24px;
  background: var(--tabglass); backdrop-filter: blur(22px) saturate(170%); -webkit-backdrop-filter: blur(22px) saturate(170%);
  border: 1px solid rgba(255,255,255,.1); box-shadow: 0 14px 36px rgba(0,0,0,.45); display: flex; align-items: center; padding: 0 6px; }
.tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; background: none; border: none; cursor: pointer; padding: 8px 0; }
.tabbar button span { font-size: 10px; font-weight: 600; }

/* forecast 7-day */
.day-row { display: flex; align-items: center; gap: 12px; padding: 13px 16px; }
.day-row + .day-row { border-top: 1px solid var(--hair); }
.day-row .day { width: 42px; font-size: 14px; font-weight: 600; color: rgba(255,255,255,.85); }
.day-row .mn { width: 34px; text-align: right; font-size: 12.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.day-row .track { flex: 1; height: 6px; border-radius: 99px; position: relative; background: rgba(255,255,255,.08); }
.day-row .track span { position: absolute; top: 0; bottom: 0; border-radius: 99px; }
.day-row .mx { width: 34px; font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---- provenance banner --------------------------------------------------- */
.prov { position: absolute; top: 58px; right: 12px; z-index: 19; display: flex; flex-direction: column; gap: 5px; align-items: flex-end; pointer-events: none; max-width: 60%; }
.prov .badge { font-size: 9.5px; font-weight: 600; letter-spacing: .02em; padding: 4px 9px; border-radius: 99px; background: rgba(8,11,17,.7); border: 1px solid rgba(255,255,255,.1); color: rgba(255,255,255,.7); backdrop-filter: blur(8px); display: flex; align-items: center; gap: 5px; }
.prov .badge .d { width: 6px; height: 6px; border-radius: 50%; }
.prov .badge.live .d { background: var(--teal); box-shadow: 0 0 6px 1px var(--teal); }
.prov .badge.model .d { background: rgba(255,255,255,.4); }
.prov .badge.ct .d { background: var(--accent); box-shadow: 0 0 6px 1px rgba(255,138,0,.6); }

/* loading spinner overlay for first paint */
.boot { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; background: var(--screen); z-index: 60; }
.boot .ring { width: 34px; height: 34px; border-radius: 50%; border: 2px solid rgba(255,255,255,.15); border-top-color: var(--teal); animation: ppSpin .9s linear infinite; }
.boot .t { font-size: 12px; color: var(--text-2); letter-spacing: .04em; }

@media (max-width: 480px) {
  .page { padding: 20px 8px 40px; }
}
