/* Estética inspirada en skbs.com.ar/viento: azul noche, tarjetas oscuras, acento cian */
:root {
  --page: #10171c; --surface: #1b242b; --surface-2: #0f171c; --border: #29333b; --border-2: #40515d;
  --ink: #f5fbff; --ink-2: #a0aeb8; --ink-3: #7d8c97; --grid: #232e36;
  --cyan: #00cae9; --s1: #00cae9; --s2: #f5fbff;
  --tide: #5b9dff; --tide-bg: rgba(91, 157, 255, .16);  /* marea: azul agua, distinto del cian de la ráfaga */
  --tide-txt: #a9b6c2; --tide-baja: #e0b45a;  /* pie de marea de las tarjetas: gris neutro; ámbar con poca agua (≤ 0,5 m) */
  --band: rgba(144, 133, 233, .20); --band-line: #9085e9;
  --noche: rgba(2, 6, 10, .42); --atardecer: rgba(250, 178, 25, .55);  /* sombra de la noche y línea del atardecer en los gráficos */
  --good: #19c37d; --warn: #fab219; --crit: #e5484d; --none: #4a5863;
  --good-bg: #12301f; --warn-bg: #3a2e0e; --crit-bg: #3b1a1c; --none-bg: #222c33;
  color-scheme: dark;
}
* { box-sizing: border-box; }
/* sin agrandado automático de texto en el celular (Chrome Android / Safari iOS): dentro de bloques más anchos que la
   pantalla, como la tira del pronóstico, agrandaba solo una parte del título («Marea en Norden» chico y «pleamar» grande) */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--page); color: var(--ink);
  font: 15px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--cyan); }
main { max-width: 1120px; margin: 0 auto; padding: clamp(20px, 4vw, 48px) 16px 48px; }
h1, h2, .display { font-family: "Poppins", "Inter", sans-serif; }
h1 { font-size: clamp(34px, 6vw, 60px); line-height: 1.05; font-weight: 800; letter-spacing: -.045em; margin: 4px 0 10px; }
h1 span { color: var(--cyan); }
h2 { font-size: clamp(17px, 2vw, 21px); font-weight: 700; margin: 0 0 12px; color: var(--ink); letter-spacing: -.01em; }
.kicker { color: var(--cyan); letter-spacing: .15em; font-size: 11px; font-weight: 800; text-transform: uppercase; }
.top { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 14px; margin-bottom: 22px; }
.top p { margin: 0; color: var(--ink-2); }

.sub { color: var(--ink-2); font-size: 13px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 22px; margin: 0 0 16px; min-width: 0; }
.label { color: var(--ink-2); font-size: 13px; font-weight: 650; margin: 0 0 10px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.now-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.now-grid .card { margin: 0; display: flex; flex-direction: column; }
.st-body { display: flex; flex-direction: column; flex: 1; }
.st-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.st-dir { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.station .hero-num { font-size: clamp(64px, 8vw, 112px); }
.station .unit { margin: 4px 0 14px; }
.compass.sm { width: 140px; height: 140px; margin: 0; }
.compass.sm::before { inset: 16px; }
.compass.sm .needle { width: 90px; height: 90px; margin: -45px 0 0 -45px; font-size: 78px; }
.station .details { margin-top: auto; display: grid; grid-template-columns: repeat(3, auto); justify-content: start; align-items: start; gap: 12px 40px; }
.station .details span { white-space: nowrap; }
.station .details strong { font-size: 21px; }
.station .details strong { white-space: nowrap; }
/* Reserva siempre la línea chica («+2,3 kn», «ráf. +8 kn») para que la tarjeta no cambie de alto cuando aparece */
.station .details strong { line-height: 1.2; min-height: calc(1.2em + 19px); }
.station .details strong small { display: block; margin-top: 2px; line-height: 17px; }
@media (max-width: 400px) { .station .details { gap: 8px 16px; } .station .details strong { font-size: 15px; } .station .details span { font-size: 11px; } }
.st-foot { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; margin-top: 10px; }
.primary { background: linear-gradient(125deg, #1c353f, #172229 65%); }
.hero-num { font-family: "Poppins", sans-serif; font-size: clamp(76px, 12vw, 136px); line-height: 1; font-weight: 800;
  letter-spacing: -.07em; font-variant-numeric: tabular-nums; color: #f7ffff; }
.unit { color: var(--cyan); letter-spacing: .2em; font-size: 13px; font-weight: 800; margin: 6px 0 18px; }
.details { display: flex; flex-wrap: wrap; gap: 28px; border-top: 1px solid var(--border-2); padding-top: 14px; align-items: flex-end; }
.details div { display: flex; flex-direction: column; gap: 4px; }
.details span { color: var(--ink-2); font-size: 12px; }
.details strong { font-size: 24px; font-variant-numeric: tabular-nums; }

.compass { position: relative; width: 180px; height: 180px; border: 1.5px solid #42515c; border-radius: 50%;
  margin: 2px auto 10px; background: radial-gradient(circle, #17252d 20%, #1b242b 80%); }
.compass::before { content: ""; position: absolute; inset: 22px; border: 1px dashed #3b505c; border-radius: 50%; }
.compass .c { position: absolute; font-weight: 800; font-size: 12px; color: #9eb3be; }
.compass .n { top: 6px; left: calc(50% - 5px); } .compass .s { bottom: 6px; left: calc(50% - 4px); }
.compass .e { right: 9px; top: calc(50% - 9px); } .compass .o { left: 9px; top: calc(50% - 9px); }
.needle { position: absolute; left: 50%; top: 50%; width: 120px; height: 120px; margin: -60px 0 0 -60px;
  display: flex; align-items: center; justify-content: center; transition: transform .6s ease;
  font: 400 104px/1 "Inter", system-ui, sans-serif; color: var(--cyan); }
.dir-val { font-family: "Poppins", sans-serif; font-size: 24px; font-weight: 800; }
.dir-val { white-space: nowrap; line-height: 1.15; }
.dir-val .dir-hacia { color: var(--cyan); }
.dir-grados { color: var(--ink-2); font-family: "Poppins", sans-serif; font-size: 18px; font-weight: 600; line-height: 1.15; margin-top: -2px; }
.dir-val .dir-flecha { color: var(--ink-2); font-weight: 400; }
.pill { display: inline-flex; gap: 6px; align-items: center; padding: 4px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; border: 1px solid transparent; }
.st-good { background: var(--good-bg); border-color: #0b956e; color: #8cffe0; }
.st-warn { background: var(--warn-bg); border-color: #b87b24; color: #ffdda4; }
.st-crit { background: var(--crit-bg); border-color: #a3363a; color: #ffc2c4; }
.st-none { background: var(--none-bg); border-color: #56616b; color: #d1dde5; }

.day { margin-top: 16px; }
.day-title { font-family: "Poppins", sans-serif; font-weight: 700; margin-bottom: 8px; }
.strip { display: grid; grid-template-columns: repeat(var(--n, 13), minmax(0, 1fr)); gap: 4px; }
.cell { border-radius: 8px; padding: 6px 2px; text-align: center; font-size: 12px; cursor: default;
  border-top: 3px solid var(--none); background: var(--none-bg); font-variant-numeric: tabular-nums; }
.cell.good { border-top-color: var(--good); background: var(--good-bg); }
.cell.warn { border-top-color: var(--warn); background: var(--warn-bg); }
.cell.crit { border-top-color: var(--crit); background: var(--crit-bg); }
.cell .h { color: var(--ink-2); } .cell .k { font-weight: 800; font-size: 15px; }
.cell .a { display: inline-block; color: var(--cyan); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); margin-top: 10px; }
.sw { display: inline-block; width: 12px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: 3px; }
.sw.dash { width: 16px; height: 0; background: none !important; border-top: 2px dashed var(--ink-3); border-radius: 0; }
.sw.box { height: 10px; width: 10px; vertical-align: -1px; }
.chart { position: relative; height: 260px; }
.chart.small { height: 160px; }
form { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
label { font-size: 12px; color: var(--ink-2); display: flex; flex-direction: column; gap: 5px; font-weight: 600; }
input, select, button { font: inherit; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--ink); }
input:focus, select:focus { outline: 2px solid var(--cyan); outline-offset: 1px; }
button { cursor: pointer; background: var(--cyan); color: #0d1920; border: 0; font-weight: 800; }
button:hover { filter: brightness(1.08); }
button.ghost { background: transparent; color: #becbd3; border: 1px solid var(--border-2); font-weight: 600; }
button.ghost:hover { border-color: var(--cyan); color: var(--ink); }
button:disabled, button:disabled:hover { opacity: .45; cursor: default; filter: none; border-color: var(--border-2); color: var(--ink-2); }
fieldset { border: 1px solid var(--border) !important; border-radius: 10px !important; }
details summary { cursor: pointer; color: var(--ink-2); }
code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
td, th { text-align: left; padding: 7px 6px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--ink-2); font-weight: 600; }
.rep-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.kpi { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.kpi span { color: var(--ink-2); font-size: 12px; display: block; }
.kpi strong { font-family: "Poppins", sans-serif; font-size: 24px; font-variant-numeric: tabular-nums; }
.kpi em { color: var(--ink-3); font-size: 12px; font-style: normal; display: block; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.best { color: var(--cyan); font-weight: 700; }
#cal-form { display: block; }
h3.cal-h { font-family: "Poppins", sans-serif; font-size: 14px; color: var(--cyan); margin: 18px 0 4px; letter-spacing: .02em; }
#cal-form .row { display: flex; flex-wrap: wrap; }
table.cal { min-width: 560px; }
table.cal input { width: 78px; padding: 5px 6px; text-align: right; font-variant-numeric: tabular-nums; }
table.cal input.mod { outline: 2px solid var(--warn); }
table.cal .sugb { padding: 4px 8px; font-size: 12px; font-weight: 600; }
table.cal th.lugar { text-align: center; border-bottom: 2px solid var(--border-2); }
.grid2 { display: grid; grid-template-columns: 1fr; gap: 16px; }
.grid2 > .card { margin: 0; }
.foot { color: var(--ink-3); font-size: 12px; margin-top: 8px; }
@media (min-width: 860px) { .grid2 { grid-template-columns: 2fr 1fr; } }
@media (max-width: 860px) { .now-grid { grid-template-columns: 1fr; } }
@media (max-width: 420px) { .compass.sm { width: 112px; height: 112px; } .compass.sm .needle { font-size: 62px; } }
@media (max-width: 600px) { .strip { grid-template-columns: repeat(6, minmax(0, 1fr)); } }

/* --- navegación --- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }

.nav { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.nav a { color: #becbd3; text-decoration: none; padding: 7px 12px; border-radius: 99px; font-size: 13px; font-weight: 600; border: 1px solid transparent; }
.nav a:hover { border-color: var(--border-2); }
.nav a.on { background: #1d272e; border-color: var(--border-2); color: var(--ink); }
.page-title { margin-bottom: 18px; }
/* --- tabla común: íconos de disciplina --- */
.deps { display: flex; gap: 2px; justify-content: center; flex-wrap: wrap; margin-top: 3px; min-height: 16px; }
.dep { font-size: 9px; font-weight: 800; letter-spacing: .02em; padding: 1px 4px; border-radius: 4px; background: rgba(0,202,233,.16); color: var(--cyan); }
.leg-dep { display: inline-flex; gap: 6px; align-items: center; }

/* Vista pública /viento y embebida (?embed=1) */
body.embed { background: transparent; }
body.embed main { padding-top: 4px; padding-bottom: 4px; }
body.embed .topbar, body.embed .page-title { display: none; }
body.embed #status, body.embed #status-card { display: none; }

/* selector de período (botones segmentados) */
.seg { display: inline-flex; border: 1px solid var(--border-2); border-radius: 8px; overflow: hidden; flex: none; }
.seg button { background: transparent; color: var(--ink-2); border: 0; border-radius: 0; font-weight: 600;
  padding: 6px 12px; font-size: 13px; white-space: nowrap; }
.seg button + button { border-left: 1px solid var(--border-2); }
.seg button:hover { color: var(--ink); filter: none; }
.seg button[aria-pressed="true"] { background: var(--cyan); color: #0d1920; font-weight: 800; }
/* hora del pronóstico ajustada con Norden en vivo */
.cell.aj { outline: 1px dashed var(--cyan); outline-offset: -1px; }
.cell .aj-ic { font-size: 10px; margin-right: 1px; }

/* ⓘ: ayuda de cada componente (texto del backend), globo flotante: hover en compu, toque en celular */
.ay { width: 17px; height: 17px; min-width: 17px; padding: 0; border-radius: 50%; border: 1px solid var(--border-2); background: transparent;
  color: var(--ink-2); font: 700 11px/15px Inter, sans-serif; font-style: italic; cursor: help; display: inline-flex; align-items: center; justify-content: center; vertical-align: middle; }
.ay:hover, .ay[aria-expanded="true"] { border-color: var(--cyan); color: var(--cyan); filter: none; }
#ay-pop { position: fixed; z-index: 50; max-width: min(320px, calc(100vw - 32px)); background: var(--surface); color: var(--ink);
  border: 1px solid var(--border-2); border-radius: 10px; padding: 10px 12px; font-size: 13px; line-height: 1.45;
  box-shadow: 0 8px 24px rgba(0,0,0,.45); pointer-events: none; }
