:root {
    color-scheme: light;
    --ink: #092f33;
    --paper: #faf9f4;
    --lime: #c7f34a;
    --signal: #f15f47;
    --sea: #b9dde2;
    --sea-deep: #0b545c;
    --line: rgba(9, 47, 51, .22);
    font-family: Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { width: 100%; height: 100%; }

body.surf-map-page {
    margin: 0;
    overflow: hidden;
    color: var(--ink);
    background: var(--ink);
}

button, input { font: inherit; }

/* The map deliberately shares the same site header as every other page. */
.map-site-header { z-index: 1000; }
.map-shell { position: relative; height: calc(100dvh - var(--site-header-height, 98px)); min-height: 480px; }
.forecast-card__title:focus-visible { outline: 3px solid var(--lime); outline-offset: 3px; }
.surf-map { position: relative; width: 100%; height: 100%; background: var(--sea); }
/* Keep spot markers usable when the optional vendor stylesheet is delayed or unavailable. */
.maplibregl-canvas-container,
.maplibregl-canvas { position: absolute; inset: 0; }
.maplibregl-canvas { width: 100%; height: 100%; }
.maplibregl-marker { position: absolute; top: 0; left: 0; will-change: transform; }
.maplibregl-map { color: var(--ink); font: inherit; }
.maplibregl-ctrl-top-left { top: 8px; left: 8px; }
.maplibregl-ctrl-group { border: 1px solid var(--ink); border-radius: 0; box-shadow: 4px 4px 0 rgba(9, 47, 51, .18); }
.maplibregl-ctrl-group button { width: 31px; height: 31px; background-color: var(--paper); border-color: var(--line); border-radius: 0; }
.maplibregl-ctrl-group button:hover,
.maplibregl-ctrl-group button:focus-visible { background-color: var(--lime); }
.maplibregl-ctrl-bottom-right { right: 5px; bottom: 112px; }
.maplibregl-ctrl-attrib { padding: 2px 5px; color: #40565a; background: rgba(250, 249, 244, .92); font-size: 10px; }
.maplibregl-ctrl-attrib a { color: #075f69; }

.map-status {
    position: absolute;
    z-index: 750;
    top: 50%;
    left: 50%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    color: #fff;
    background: var(--ink);
    border: 1px solid rgba(255, 255, 255, .35);
    box-shadow: 6px 6px 0 var(--lime);
    font-size: .82rem;
    font-weight: 800;
    transform: translate(-50%, -50%);
}
.map-status[hidden] { display: none; }
.map-status.is-error { color: var(--ink); background: var(--paper); border-color: var(--signal); box-shadow: 6px 6px 0 var(--signal); }
.map-status__spinner { width: 15px; height: 15px; border: 2px solid rgba(255,255,255,.35); border-top-color: var(--lime); border-radius: 50%; animation: map-spin .8s linear infinite; }
.map-status.is-error .map-status__spinner { display: none; }
@keyframes map-spin { to { transform: rotate(360deg); } }

.map-legend {
    position: absolute;
    z-index: 600;
    top: 18px;
    right: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: rgba(250, 249, 244, .94);
    border: 1px solid var(--ink);
    box-shadow: 4px 4px 0 rgba(9, 47, 51, .16);
    font-size: .66rem;
}
.map-legend strong { margin-right: 2px; text-transform: uppercase; letter-spacing: .08em; }
.map-legend span { display: inline-flex; align-items: center; gap: 3px; }
.map-legend i { width: 10px; height: 10px; background: var(--legend); border: 1px solid rgba(9, 47, 51, .32); border-radius: 50%; }
.map-legend i.is-metal { box-shadow: inset 2px 2px 2px rgba(255,255,255,.75); }

.surf-rating-icon,
.surf-cluster-icon { background: transparent; border: 0; outline: 0; overflow: visible; cursor: pointer; }
.surf-rating-icon { width: 58px; height: 58px; }
.surf-cluster-icon { width: 68px; height: 68px; }
.surf-rating-icon:focus-visible .surf-marker__rating,
.surf-cluster-icon:focus-visible .surf-cluster { outline: 4px solid #fff; outline-offset: 4px; }

.surf-marker {
    position: relative;
    width: 58px;
    height: 58px;
    overflow: visible;
    filter: drop-shadow(0 3px 4px rgba(9, 47, 51, .3));
}

.surf-marker__rating {
    position: absolute;
    z-index: 3;
    inset: 4px;
    display: grid;
    place-items: center;
    color: var(--ink);
    background: rgba(250, 249, 244, .96);
    border: 5px solid var(--rating-color, #87989d);
    border-radius: 50%;
    box-shadow: inset 0 0 0 2px #fff;
    font-size: 1rem;
    font-weight: 900;
    line-height: 1;
}

.surf-marker.is-selected .surf-marker__rating {
    inset: 1px;
    border-width: 6px;
    box-shadow: 0 0 0 3px var(--ink), inset 0 0 0 2px #fff;
    transform: scale(1.08);
}

.direction-vector {
    position: absolute;
    z-index: 2;
    top: 50%;
    left: 50%;
    width: 112px;
    height: 28px;
    pointer-events: none;
    transform-origin: 0 50%;
    /* The vector points inward: its arrowhead ends on the rating circle,
       while its band extends back towards the wind/wave source. */
    transform: rotate(var(--angle)) translate(0, var(--lane, 0px));
}

.direction-vector__band {
    position: absolute;
    top: 50%;
    /* 112px band + 29px rating radius: the pointed end touches the circle. */
    left: -141px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 112px;
    height: 26px;
    padding: 0 20px 0 10px;
    border: 1px solid;
    clip-path: polygon(0 0, 84% 0, 100% 50%, 84% 100%, 0 100%);
    transform: translateY(-50%);
}
.direction-vector--wave .direction-vector__band { color: #0a3d52; background: #54bee9; border-color: #0e789f; }
.direction-vector--wind .direction-vector__band { color: #123f29; background: #7dd678; border-color: #2b8c4a; }
.direction-vector__text { display: block; font-size: 10px; font-weight: 900; line-height: 1; white-space: nowrap; }
.direction-vector.is-flipped .direction-vector__text { transform: rotate(180deg); }

.surf-cluster {
    position: relative;
    display: grid;
    display: flex;
    flex-direction: column;
    width: 68px;
    height: 68px;
    gap: 0;
    justify-content: center;
    place-items: center;
    color: #fff;
    background: var(--ink);
    border: 3px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 0 3px var(--cluster-color, var(--lime)), 0 5px 12px rgba(9,47,51,.3);
    font-size: 1rem;
    font-weight: 900;
}
.surf-cluster::after { content: ''; position: absolute; inset: 7px; border: 1px solid rgba(255,255,255,.28); border-radius: inherit; }
.surf-cluster small { position: static; margin-top: -2px; font-size: 8px; font-weight: 800; letter-spacing: .08em; line-height: 1; text-transform: uppercase; }
.spider-leg { stroke: var(--ink); stroke-width: 1.5; stroke-dasharray: 3 4; opacity: .58; }

.forecast-card {
    position: absolute;
    z-index: 700;
    bottom: 126px;
    left: 50%;
    width: min(760px, calc(100% - 32px));
    padding: 15px 17px 11px;
    background: rgba(250, 249, 244, .97);
    border: 1px solid var(--ink);
    box-shadow: 9px 9px 0 rgba(9, 47, 51, .24);
    backdrop-filter: blur(12px);
    transform: translateX(-50%);
}
.forecast-card[hidden] { display: none; }
.forecast-card__topline { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding-bottom: 9px; border-bottom: 1px solid var(--line); }
.forecast-card__eyebrow { margin: 0 0 1px; color: #607479; font-size: .64rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.forecast-card__title { color: var(--ink); font: 400 clamp(1.25rem, 3vw, 1.65rem)/1.1 Georgia, 'Times New Roman', serif; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.forecast-card__close { width: 31px; min-width: 31px; height: 31px; padding: 0; color: var(--ink); background: transparent; border: 1px solid var(--line); border-radius: 50%; font-size: 1.25rem; cursor: pointer; }
.forecast-card__close:hover,
.forecast-card__close:focus-visible { color: #fff; background: var(--ink); outline: 2px solid var(--lime); outline-offset: 2px; }
.forecast-card__content { display: grid; grid-template-columns: 82px minmax(0, 1fr) minmax(140px, .7fr); align-items: center; gap: 14px; padding-top: 10px; }
.forecast-card__rating { display: grid; width: 68px; height: 68px; place-items: center; align-content: center; background: #fff; border: 6px solid var(--rating-color, #87989d); border-radius: 50%; box-shadow: inset 0 0 0 2px #fff; }
.forecast-card__rating strong { font-size: 1.42rem; line-height: 1; }
.forecast-card__rating span { margin-top: 2px; color: #607479; font-size: .55rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.forecast-card__metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; }
.forecast-card__metrics div { min-width: 0; padding: 1px 12px; border-left: 1px solid var(--line); }
.forecast-card__metrics dt,
.forecast-card__perks > span { color: #607479; font-size: .58rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.forecast-card__metrics dd { margin: 2px 0 0; font-size: .87rem; font-weight: 900; white-space: nowrap; }
.forecast-card__metrics small { display: block; margin-top: 1px; color: #607479; font-size: .68rem; white-space: nowrap; }
.forecast-card__perks { min-width: 0; padding-left: 14px; border-left: 1px solid var(--line); }
#forecast-card-perks { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.forecast-perk { padding: 4px 6px; color: var(--ink); background: #e9eddf; border: 1px solid rgba(9,47,51,.2); border-radius: 999px; font-size: .64rem; font-weight: 800; cursor: help; }
.forecast-card__hint { margin: 8px 0 0; color: #607479; font-size: .66rem; text-align: right; }

.timeline {
    position: absolute;
    z-index: 800;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr) 46px;
    align-items: center;
    gap: 11px;
    min-height: 108px;
    padding: 11px max(18px, calc((100vw - 1040px) / 2));
    color: #fff;
    background: rgba(9, 47, 51, .96);
    border-top: 1px solid rgba(255,255,255,.25);
    backdrop-filter: blur(12px);
}
.timeline__step { width: 42px; height: 42px; padding: 0; color: #fff; background: transparent; border: 1px solid rgba(255,255,255,.42); border-radius: 50%; font-size: 1.65rem; cursor: pointer; }
.timeline__step:hover,
.timeline__step:focus-visible { color: var(--ink); background: var(--lime); border-color: var(--lime); outline: 2px solid #fff; outline-offset: 2px; }
.timeline__step:disabled { opacity: .3; cursor: default; }
.timeline__main { min-width: 0; }
.timeline__labels { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; margin-bottom: 4px; }
.timeline__labels span { color: #a8c0c2; font-size: .6rem; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.timeline__labels strong { font: 400 .95rem/1.2 Georgia, 'Times New Roman', serif; }
#timeline-slider { width: 100%; height: 18px; margin: 0; accent-color: var(--lime); cursor: ew-resize; }
.timeline__days { position: relative; height: 27px; margin-top: 1px; overflow: visible; }
.timeline__days::-webkit-scrollbar { display: none; }
.timeline__day { position: absolute; top: 0; left: calc(var(--timeline-position) * 1%); min-height: 24px; padding: 3px 8px; color: #bcd0d2; background: transparent; border: 0; border-radius: 0; font-size: .62rem; font-weight: 800; cursor: pointer; transform: translateX(-50%); white-space: nowrap; }
.timeline__day::before { position: absolute; top: -5px; left: 50%; width: 1px; height: 4px; background: rgba(255,255,255,.42); content: ''; }
.timeline__day.is-first { transform: none; }
.timeline__day.is-first::before { left: 8px; }
.timeline__day.is-last { transform: translateX(-100%); }
.timeline__day.is-last::before { left: calc(100% - 8px); }
.timeline__day:hover,
.timeline__day:focus-visible { color: #fff; background: rgba(255,255,255,.12); outline: 1px solid var(--lime); }
.timeline__day.is-active { color: var(--ink); background: var(--lime); }

@media (max-width: 760px) {
    .map-legend { top: 10px; right: 10px; gap: 5px; padding: 6px 7px; }
    .map-legend strong { display: none; }
    .maplibregl-ctrl-top-left { top: 2px; left: 2px; }
    .forecast-card { bottom: 120px; width: calc(100% - 20px); padding: 12px 12px 9px; box-shadow: 5px 5px 0 rgba(9,47,51,.24); }
    .forecast-card__content { grid-template-columns: 64px minmax(0, 1fr); gap: 9px; }
    .forecast-card__rating { width: 58px; height: 58px; border-width: 5px; }
    .forecast-card__metrics div { padding-inline: 7px; }
    .forecast-card__metrics div:first-child { border-left: 0; }
    .forecast-card__metrics dd { font-size: .76rem; }
    .forecast-card__perks { grid-column: 1 / -1; padding: 7px 0 0; border-top: 1px solid var(--line); border-left: 0; }
    .forecast-card__perks > span { display: none; }
    #forecast-card-perks { margin-top: 0; }
    .forecast-card__hint { display: none; }
    .timeline { grid-template-columns: 36px minmax(0, 1fr) 36px; gap: 7px; min-height: 112px; padding: 9px 10px max(9px, env(safe-area-inset-bottom)); }
    .timeline__step { width: 34px; height: 34px; font-size: 1.35rem; }
    .timeline__labels strong { font-size: .84rem; }
    .timeline__day { padding-inline: 5px; font-size: .56rem; }
}

@media (max-width: 430px) {
    .forecast-card__metrics small { max-width: 80px; overflow: hidden; text-overflow: ellipsis; }
    .direction-vector { width: 100px; }
    .direction-vector__band { width: 100px; font-size: 9px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
