/* ===========================================================================
   BSYC – Seacliff – Race Observation  ·  styles
   Tempest-dark base melded with BSYC brand: gold #fec10d on black #231f20.
   Phone-first, scales up to a two/three-column desktop layout.
   Create: 2026-06-13  Author: Matt Colliver (MTC)
============================================================================ */

:root {
  --gold:      #fec10d;
  --gold-dim:  #c79a25;
  --bg:        #161314;   /* a touch darker than brand black for depth */
  --panel:     #231f20;   /* BSYC black */
  --panel-2:   #2c2728;
  --line:      #3a3537;
  --text:      #f5f3ef;
  --muted:     #9a948f;
  --avg:       #fec10d;   /* wind avg = brand gold */
  --gust:      #f0683c;   /* gust = warm */
  --lull:      #5fb6c9;   /* lull = cool */
  --ok:        #6fcf97;
  --bad:       #f0683c;
  --radius:    14px;
  --maxw:      1180px;
  --font:      'Archivo', Arial, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-cond: 'Archivo Narrow', 'Archivo', Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  line-height: 1.35;
}
h1, h2 { font-family: var(--font-cond); margin: 0; letter-spacing: .01em; }
em { font-style: normal; color: var(--gold); }

#app {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(.75rem, 2vw, 1.5rem);
  display: flex;
  flex-direction: column;
  gap: clamp(.75rem, 2vw, 1.25rem);
}

/* ---------- Header ---------- */
.hdr {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
  padding-bottom: .75rem; border-bottom: 1px solid var(--line);
}
.hdr-brand { display: flex; align-items: center; gap: .85rem; }
.hdr-logo { height: 42px; width: auto; display: block; }
.hdr-titles h1 { font-size: 1.45rem; font-weight: 700; text-transform: uppercase; }
.hdr-sub { margin: 0; color: var(--gold); font-size: .8rem; letter-spacing: .14em; text-transform: uppercase; }

.hdr-ctrls { display: flex; align-items: center; gap: .75rem; }
.unit-group { display: flex; gap: .4rem; }

/* segmented toggle */
.seg { display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 2px; }
.seg button {
  font: inherit; font-size: .8rem; color: var(--muted);
  background: transparent; border: 0; border-radius: 7px;
  padding: .3rem .6rem; cursor: pointer; line-height: 1;
}
.seg button.on { background: var(--gold); color: #1a1718; font-weight: 700; }

/* discreet power-mode dot */
.power-dot {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--panel); border: 1px solid var(--line);
  display: grid; place-items: center; cursor: pointer; padding: 0;
}
.pd-core { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); transition: background .2s; }
.power-dot[data-mode="fast"] .pd-core { background: var(--gold); }
.power-dot[data-mode="live"] .pd-core { background: var(--gold); animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(254,193,13,.6); } 50% { box-shadow: 0 0 0 6px rgba(254,193,13,0); } }

/* ---------- Hero ---------- */
.hero {
  display: grid; gap: clamp(.75rem, 2vw, 1.25rem);
  grid-template-columns: 1fr;
}
.hero > * {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.1rem;
}
.compass-wrap { position: relative; display: grid; place-items: center; }
#compass { width: min(64vw, 230px); height: auto; }
.compass-read { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); text-align: center; pointer-events: none; }
.dir-deg { font-family: var(--font-cond); font-size: 1.7rem; font-weight: 700; line-height: 1; }
.dir-card { color: var(--gold); font-size: .9rem; letter-spacing: .08em; font-weight: 700; }

.wind-now { display: flex; flex-direction: column; justify-content: center; gap: .6rem; }
.wn-main { display: flex; align-items: baseline; gap: .4rem; }
.wn-val { font-family: var(--font-cond); font-size: clamp(3.6rem, 16vw, 6rem); font-weight: 700; line-height: .85; color: var(--gold); }
.wn-unit { color: var(--muted); font-size: 1.1rem; text-transform: uppercase; letter-spacing: .1em; }
.wn-sub { display: flex; gap: .5rem; flex-wrap: wrap; }
.wn-chip { background: var(--panel-2); border-radius: 9px; padding: .4rem .65rem; display: flex; gap: .45rem; align-items: baseline; }
.wn-l { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; }
.wn-n { font-family: var(--font-cond); font-weight: 700; font-size: 1.15rem; }
.wn-cond { color: var(--muted); font-size: .95rem; }

.shift-card { display: flex; flex-direction: column; justify-content: center; gap: 1rem; }
.shift-row { display: flex; align-items: center; gap: .75rem; }
.shift-icon { font-size: 1.8rem; line-height: 1; width: 1.8rem; text-align: center; color: var(--gold); transition: transform .4s ease; }
.shift-dir { font-family: var(--font-cond); font-size: 1.25rem; font-weight: 700; }
.shift-meta { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; }

/* ---------- Charts ---------- */
.charts { display: flex; flex-direction: column; gap: .85rem; }
.chart-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.chart-head h2 { font-size: 1.15rem; text-transform: uppercase; }
.chart-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .85rem 1rem 1rem; }
.chart-cap { color: var(--muted); font-size: .82rem; margin-bottom: .5rem; }
.chart-box { position: relative; height: 230px; }
.dir-box { height: 170px; }

/* ---------- Grid ---------- */
.grid h2 { font-size: 1.15rem; text-transform: uppercase; margin-bottom: .65rem; }
.tiles { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 11px; padding: .8rem .85rem; }
.tile .t-l { color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; }
.tile .t-v { font-family: var(--font-cond); font-size: 1.5rem; font-weight: 700; margin: .15rem 0; }
.tile .t-s { color: var(--muted); font-size: .8rem; }
.tile .t-s.up { color: var(--ok); } .tile .t-s.down { color: var(--gust); }

/* ---------- Footer / states ---------- */
.ftr { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; color: var(--muted); font-size: .78rem; padding-top: .5rem; border-top: 1px solid var(--line); }
.updated::before { content: '● '; color: var(--ok); }
.error { background: #3a1d1a; border: 1px solid var(--gust); color: #ffd2c7; border-radius: 11px; padding: .75rem 1rem; font-size: .9rem; }
.loading .hero, .loading .charts, .loading .grid { opacity: .45; }

/* ---------- Responsive ---------- */
@media (min-width: 720px) {
  .hero { grid-template-columns: 1fr 1fr; }
  .shift-card { grid-column: 1 / -1; flex-direction: row; justify-content: space-around; }
}
@media (min-width: 1000px) {
  .hero { grid-template-columns: 260px 1fr 1fr; }
  .shift-card { grid-column: auto; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  .power-dot[data-mode="live"] .pd-core { animation: none; }
  .shift-icon { transition: none; }
}

/* ===========================================================================
   History page ("Show previous")
============================================================================ */
.hdr-link { color: var(--gold); text-decoration: none; font-size: .82rem; font-weight: 700;
  letter-spacing: .04em; padding: .35rem .55rem; border: 1px solid var(--line); border-radius: 8px; white-space: nowrap; }
.hdr-link:hover { background: var(--panel); }
.muted-h { color: var(--muted); font-weight: 500; font-size: .8rem; }

.sb-banner { display: flex; align-items: center; gap: .9rem;
  background: linear-gradient(90deg, rgba(254,193,13,.12), var(--panel) 55%);
  border: 1px solid var(--line); border-left: 3px solid var(--gold); border-radius: var(--radius); padding: .9rem 1.1rem; }
.sb-icon { font-size: 1.6rem; line-height: 1; }
.sb-headline { font-family: var(--font-cond); font-size: 1.2rem; font-weight: 700; }
.sb-meta { color: var(--muted); font-size: .78rem; }

.hist-sec { display: flex; flex-direction: column; gap: .65rem; }
.hist-sec .chart-head h2 { font-size: 1.15rem; text-transform: uppercase; }

/* legend */
.heat-legend { display: flex; align-items: center; gap: .4rem; color: var(--muted); font-size: .76rem; }
.hl-arrow { width: 14px; height: 14px; flex: none; fill: var(--gold); }

/* arrow grid */
.heat-scroll { overflow-x: auto; }
.heatmap { display: flex; flex-direction: column; gap: 3px; min-width: 460px; }
.heat-row { display: flex; gap: 3px; align-items: center; }
.heat-label { flex: 0 0 64px; color: var(--muted); font-size: .74rem; font-family: var(--font-cond); font-weight: 700; text-align: right; padding-right: 4px; }
.heat-cell { flex: 1 1 0; aspect-ratio: 1 / 1; border-radius: 3px; background: var(--panel-2);
  min-width: 13px; display: grid; place-items: center; overflow: hidden; }
.heat-cell.empty { background: #1d1a1b; }
.heat-cell.onset { box-shadow: inset 0 0 0 2px var(--gold); }
.warr { display: block; fill: var(--gold); }
.heat-head .heat-hl { flex: 1 1 0; min-width: 13px; text-align: left; color: var(--muted); font-size: .64rem; }
.heat-head .heat-label { flex: 0 0 64px; }
