/* Wind for beginners: the wind card (wind.js windCard) and the wind-flow map layer (canvas pane + legend). */

/* ---------- Tokens (light; dark below) ---------- */
.wind-card,
.rg-wind-legend {
  --wc-calm: #5b7790;
  --wc-light: #0b5e8e;
  --wc-moderate: #0a7fa8;
  --wc-strong: #b45309;
  --wc-vstrong: #c62828;
  --wc-storm: #7b1fa2;
  --wc-water: #cfe6f4;
  --wc-water-ink: #1d5f86;
  --wc-land: #ede4cf;
  --wc-coast: #7d8d9b;
  --wc-face: #f4f7fa;
  --wc-tree: #2f7d32;
  --wc-land-ink: #8a6a3a;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .wind-card,
  :root:not([data-theme="light"]) .rg-wind-legend {
    --wc-calm: #9fb4c8;
    --wc-light: #5cb8e6;
    --wc-moderate: #6fd0f2;
    --wc-strong: #fbbf24;
    --wc-vstrong: #ff8a80;
    --wc-storm: #e1a6ff;
    --wc-water: #133b55;
    --wc-water-ink: #9fd3f2;
    --wc-land: #2f2c22;
    --wc-coast: #8a9db0;
    --wc-face: #15232f;
    --wc-tree: #7fd483;
    --wc-land-ink: #c9a66b;
  }
}
:root[data-theme="dark"] .wind-card,
:root[data-theme="dark"] .rg-wind-legend {
  --wc-calm: #9fb4c8;
  --wc-light: #5cb8e6;
  --wc-moderate: #6fd0f2;
  --wc-strong: #fbbf24;
  --wc-vstrong: #ff8a80;
  --wc-storm: #e1a6ff;
  --wc-water: #133b55;
  --wc-water-ink: #9fd3f2;
  --wc-land: #2f2c22;
  --wc-coast: #8a9db0;
  --wc-face: #15232f;
  --wc-tree: #7fd483;
  --wc-land-ink: #c9a66b;
}

/* ---------- Wind card ---------- */
.wind-card {
  --wc-accent: var(--wc-light);
  --wc-chip-bg: var(--brand-soft, #e2eff8);
  --wc-chip-ink: var(--brand-ink, #0b5e8e);
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: var(--radius, 16px);
  background: var(--surface, #fff);
  border: 1px solid var(--line, #dde5ec);
  color: var(--ink, #0e1a24);
  font-family: var(--font, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);
  min-width: 0;
}
.wind-card p { margin: 0; }
.wind-card[data-level="calm"] { --wc-accent: var(--wc-calm); --wc-chip-bg: var(--surface-2, #f4f7fa); --wc-chip-ink: var(--ink-2, #445566); }
.wind-card[data-level="moderate"] { --wc-accent: var(--wc-moderate); }
.wind-card[data-level="strong"] { --wc-accent: var(--wc-strong); --wc-chip-bg: var(--caution-bg, #fff3d6); --wc-chip-ink: var(--caution-ink, #8a5a00); }
.wind-card[data-level="vstrong"] { --wc-accent: var(--wc-vstrong); --wc-chip-bg: var(--danger-bg, #fde9e9); --wc-chip-ink: var(--danger-ink, #a12424); }
.wind-card[data-level="storm"] { --wc-accent: var(--wc-storm); --wc-chip-bg: var(--danger-bg, #fde9e9); --wc-chip-ink: var(--danger-ink, #a12424); }

.wc-top { display: grid; grid-template-columns: 116px minmax(0, 1fr); gap: 14px; align-items: center; }
.wc-compass { width: 116px; height: 116px; }
.wc-dial { display: block; width: 100%; height: 100%; overflow: visible; }
.wc-face { fill: var(--wc-face); }
.wc-water { fill: var(--wc-water); }
.wc-land { fill: var(--wc-land); }
.wc-coast { fill: none; stroke: var(--wc-coast); stroke-width: 1.4; stroke-dasharray: 3 3; }
.wc-rim { fill: none; stroke: var(--line, #dde5ec); stroke-width: 1.5; }
.wc-tick { stroke: var(--muted, #6b7c8c); stroke-width: 1; opacity: 0.7; }
.wc-tick-major { stroke: var(--ink-2, #445566); stroke-width: 2; opacity: 1; }
.wc-card { font: 800 11px/1 var(--font, system-ui, sans-serif); fill: var(--ink-2, #445566); }
.wc-zone { font: 700 8.5px/1 var(--font, system-ui, sans-serif); fill: var(--wc-water-ink); letter-spacing: 0.06em; text-transform: uppercase; }
.wc-zone + .wc-zone { fill: var(--ink-3, #566778); }
.wc-shaft { fill: none; stroke: var(--wc-accent); stroke-width: 6; stroke-linecap: round; }
.wc-head { fill: var(--wc-accent); stroke: var(--wc-accent); stroke-width: 2; stroke-linejoin: round; }
.wc-tail { fill: var(--wc-face); stroke: var(--wc-accent); stroke-width: 2.5; }
.wc-flow {
  fill: none; stroke: var(--wc-accent); stroke-width: 3; stroke-linecap: round; stroke-opacity: 0.5;
  stroke-dasharray: 7 13; animation: wc-flow var(--wc-flow-dur, 1.6s) linear infinite;
}
.wc-flow-2 { animation-delay: calc(var(--wc-flow-dur, 1.6s) * -0.5); }
@keyframes wc-flow { to { stroke-dashoffset: -20; } }
.wc-you { fill: var(--ink, #0e1a24); stroke: var(--wc-face); stroke-width: 2.5; }
.wind-card[data-still] .wc-you { fill: var(--wc-calm); }

.wc-main { min-width: 0; }
.wc-kicker { font-size: 0.72rem; font-weight: 750; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-3, #566778); }
.wc-name { font-size: 1.4rem; font-weight: 800; line-height: 1.1; margin-top: 2px; overflow-wrap: anywhere; }
.wc-fromto { font-size: 0.9rem; line-height: 1.3; color: var(--ink-2, #445566); margin-top: 2px; }
.wc-speed { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 5px; row-gap: 2px; margin-top: 8px; }
.wc-num { font-size: 1.8rem; font-weight: 800; line-height: 1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.wc-unit { font-size: 0.95rem; font-weight: 650; color: var(--ink-2, #445566); }
.wc-gust-inline { margin-left: 4px; font-size: 0.85rem; color: var(--ink-3, #566778); white-space: nowrap; }
.wc-gust-inline b { font-weight: 800; color: var(--ink-2, #445566); font-variant-numeric: tabular-nums; }
.wc-gust-inline[data-gust="caution"] b { color: var(--caution-ink, #8a5a00); }
.wc-gust-inline[data-gust="danger"] b { color: var(--danger-ink, #a12424); }
.wc-level-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 7px; }
.wc-level {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px;
  border-radius: var(--pill, 999px); background: var(--wc-chip-bg); color: var(--wc-chip-ink);
  font-size: 0.8rem; font-weight: 750; line-height: 1.3; white-space: nowrap;
}
.wc-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--wc-accent); flex: none; }
.wc-bft { font-size: 0.8rem; font-weight: 650; line-height: 1.3; color: var(--ink-3, #566778); white-space: nowrap; }

.wc-signs { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.wc-sign, .wc-tip { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 10px; align-items: start; font-size: 0.9rem; line-height: 1.4; color: var(--ink-2, #445566); }
.wc-sign b, .wc-tip b { color: var(--ink, #0e1a24); font-weight: 750; }
.wc-ic { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2, #f4f7fa); color: var(--ink-2, #445566); }
.wc-ic svg { width: 18px; height: 18px; }
.wc-sign-wave .wc-ic, .wc-sign-lake .wc-ic { background: var(--brand-soft, #e2eff8); color: var(--brand-ink, #0b5e8e); }
.wc-sign-tree .wc-ic { background: var(--ok-bg, #e5f5e5); color: var(--wc-tree); }
.wc-gust[data-gust="caution"] .wc-ic { background: var(--caution-bg, #fff3d6); color: var(--caution-ink, #8a5a00); }
.wc-gust[data-gust="danger"] .wc-ic { background: var(--danger-bg, #fde9e9); color: var(--danger-ink, #a12424); }
.wc-gust[data-gust="danger"] .wc-txt { color: var(--danger-ink, #a12424); }

.wc-shore {
  display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 10px; align-items: start;
  padding: 10px 12px; border-radius: var(--radius-sm, 12px); background: var(--info-bg, #e6f1f8);
}
.wc-shore-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--surface, #fff); color: var(--brand-ink, #0b5e8e); }
.wc-rel-water { stroke: var(--brand-2, #0a7fa8); }
.wc-rel-land { stroke: var(--wc-land-ink); }
.wc-shore-short { font-size: 0.95rem; font-weight: 750; line-height: 1.3; color: var(--ink, #0e1a24); }
.wc-shore-text { font-size: 0.88rem; line-height: 1.4; color: var(--ink-2, #445566); margin-top: 3px; }
.wind-card[data-mode="boat"] .wc-shore[data-rel="offshore"] { background: var(--caution-bg, #fff3d6); box-shadow: inset 0 0 0 1px var(--caution-line, #f2c35a); }
.wind-card[data-mode="boat"] .wc-shore[data-rel="offshore"] .wc-shore-ic { color: var(--caution-ink, #8a5a00); }

.wc-tip { padding-top: 12px; border-top: 1px solid var(--line, #dde5ec); color: var(--ink, #0e1a24); }
.wc-tip .wc-ic { background: var(--caution-bg, #fff3d6); color: var(--caution-ink, #8a5a00); }

@media (max-width: 359px) {
  .wc-top { grid-template-columns: 96px minmax(0, 1fr); gap: 10px; }
  .wc-compass { width: 96px; height: 96px; }
  .wc-name { font-size: 1.22rem; }
  .wc-num { font-size: 1.55rem; }
}

/* ---------- Wind-flow map layer ---------- */
.rg-wind-pane { pointer-events: none; }
.rg-wind-canvas { position: absolute; left: 0; top: 0; pointer-events: none; transition: opacity 0.3s ease; }

.leaflet-control.rg-wind-legend { margin: 0 0 22px 10px; clear: none; }
.rg-wind-legend {
  --wl-bg: rgba(255, 255, 255, 0.92);
  --wl-ink: #0e1a24;
  --wl-ink-2: #3c4d5c;
  --wl-shadow: 0 1px 2px rgba(14, 26, 36, 0.12), 0 2px 10px rgba(14, 26, 36, 0.16);
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  font: 12px/1.25 var(--font, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);
  max-width: calc(100vw - 32px);
  transition: opacity 0.2s ease, visibility 0.2s;
}
.rg-wind-legend.is-cramped { opacity: 0; visibility: hidden; }
.rg-wind-legend[data-pal="dark"] {
  --wl-bg: rgba(9, 19, 28, 0.82);
  --wl-ink: #f2f7fb;
  --wl-ink-2: #c9d6e1;
  --wl-shadow: 0 2px 12px rgba(0, 0, 0, 0.45);
}
.wl-btn {
  position: relative; display: inline-flex; align-items: center; gap: 8px; min-height: 32px; margin: 0;
  padding: 5px 8px 5px 11px; border: 0; border-radius: var(--pill, 999px);
  background: var(--wl-bg); color: var(--wl-ink); box-shadow: var(--wl-shadow); font: inherit; text-align: left;
  cursor: pointer; white-space: nowrap; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  -webkit-tap-highlight-color: transparent;
}
.wl-btn::after { content: ""; position: absolute; inset: -6px -4px; } /* bigger touch target */
.wl-btn:focus-visible { outline: 3px solid var(--brand-2, #0a7fa8); outline-offset: 2px; }
.wl-title { font-weight: 800; }
.wl-when { font-weight: 650; color: var(--wl-ink-2); margin-left: -4px; }
.wl-when::before { content: "· "; }
.wl-when[hidden] { display: none; }
.rg-wind-legend.is-busy .wl-title::after {
  content: ""; display: inline-block; width: 6px; height: 6px; margin-left: 5px; border-radius: 50%;
  background: currentColor; opacity: 0.6; vertical-align: 1px; animation: wl-pulse 1s ease-in-out infinite alternate;
}
@keyframes wl-pulse { from { opacity: 0.2; } to { opacity: 0.8; } }
.wl-scale { display: inline-flex; align-items: center; gap: 7px; font-size: 11px; color: var(--wl-ink-2); }
.wl-item { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.wl-item[hidden] { display: none; }
.wl-sw { display: inline-block; width: 13px; height: 3px; border-radius: 2px; }
.rg-wind-legend[data-pal="light"] .wl-sw { box-shadow: 0 0 0 0.5px rgba(255, 255, 255, 0.7); }
.wl-num { font-weight: 750; font-variant-numeric: tabular-nums; color: var(--wl-ink); }
.wl-unit { font-weight: 650; }
.wl-q {
  display: inline-grid; place-items: center; width: 17px; height: 17px; border-radius: 50%;
  font-size: 10.5px; font-weight: 800; line-height: 1; background: rgba(127, 146, 163, 0.22); color: var(--wl-ink);
}
.wl-btn[aria-expanded="true"] .wl-q { background: var(--brand-2, #0a7fa8); color: #fff; }
.rg-wind-legend:not([data-state="ready"]) .wl-scale { opacity: 0.45; }
.wl-help {
  max-width: min(290px, calc(100vw - 32px)); padding: 9px 12px; border-radius: 14px;
  background: var(--wl-bg); color: var(--wl-ink); box-shadow: var(--wl-shadow); font-size: 12px; line-height: 1.4;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.wl-help[hidden] { display: none; }
.wl-help-scale { display: flex; flex-wrap: wrap; gap: 4px 10px; margin: 0 0 6px; font-weight: 650; }
.wl-help-scale .wl-item { gap: 4px; }
.wl-help-scale .wl-num { font-weight: 650; color: var(--wl-ink-2); }
.wl-help-text { margin: 0; color: var(--wl-ink-2); }

@media (prefers-reduced-motion: reduce) {
  .wc-flow { animation: none; stroke-dasharray: none; stroke-opacity: 0.25; }
  .rg-wind-canvas { transition: none; }
  .rg-wind-legend.is-busy .wl-title::after { animation: none; }
}
