@import url('https://fonts.googleapis.com/css2?family=League+Gothic&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700&display=swap');

:root{
    /* palette */
    --primary-color:#20242e;
    --ink:#1b1e27;
    --ink-2:#2e3340;
    --accent:#ff6b4a;
    --accent-deep:#e8472a;
    --page-bg:#faf8f5;
    --card-background:#ffffff;
    --text-muted:#7b8290;
    --header-text-color:#fff;

    /* fonts */
    --main-font:'Montserrat', sans-serif;
    --secondary-font:'Montserrat', sans-serif;
    --title-font:'League Gothic', sans-serif;
    --font-size-subtitles: 1.9rem;
    --font-size-main-text: 1.05rem;

    /* d3 chart colors */
    --fill-color-main:#2e3340;
    --main-line-color:#ff6b4a;
    --main-line-color-2:#7b8290;
    --fill-color-2:#7b8290;
    --fill-color-3:#c2a878;

    /* surfaces */
    --card-shadow: 0 4px 20px rgba(27, 30, 39, 0.07);
    --card-shadow-hover: 0 12px 34px rgba(27, 30, 39, 0.13);
    --border-radius: 14px;
    --radius-sm: 10px;
    --grid:#ece8e2;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body{
    font-family: var(--main-font);
    background: var(--page-bg);
    margin: 0;
    padding: 0;
    color: var(--primary-color);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* ===================== HERO ===================== */
.hero{
    position: relative;
    background: linear-gradient(135deg, #1b1e27 0%, #2e3340 60%, #3a2f3d 100%);
    color: var(--header-text-color);
    overflow: hidden;
    padding: 4.5rem 1.5rem;
}

.hero::before{
    /* soft accent glow */
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 75% 15%, rgba(255, 107, 74, 0.22), transparent 55%);
    pointer-events: none;
}

.hero-inner{
    position: relative;
    max-width: 900px;
    margin: 0 auto;
    text-align: center;
    z-index: 1;
}

.hero-eyebrow{
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.5rem;
    text-transform: uppercase;
    margin: 0 0 0.75rem;
    color: var(--accent);
}

.hero-title{
    font-family: var(--title-font);
    font-size: clamp(3.5rem, 12vw, 7rem);
    line-height: 0.95;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin: 0;
}

.hero-rule{
    display: block;
    width: 64px;
    height: 3px;
    margin: 1.25rem auto 0;
    background: var(--accent);
    border-radius: 2px;
}

.hero-tagline{
    font-weight: 300;
    font-size: clamp(0.9rem, 2.5vw, 1.15rem);
    letter-spacing: 0.04em;
    margin: 1rem auto 0;
    max-width: 32ch;
    opacity: 0.8;
}

/* ===================== LAYOUT ===================== */
.page-content{
    max-width: 1240px;
    margin: 0 auto;
    padding: 1rem 1.5rem 3rem;
}

section{
    margin-bottom: 3rem;
}

.section-head{
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin: 0 0 1.25rem;
    padding-bottom: 0.6rem;
    border-bottom: 2px solid rgba(46, 51, 64, 0.12);
}

.section-title{
    font-family: var(--title-font);
    font-size: 2.4rem;
    font-weight: 400;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink);
    margin: 0;
}

.section-meta{
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
}

/* ===================== CARDS ===================== */
.card{
    background: var(--card-background);
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    transition: box-shadow 0.25s ease, transform 0.25s ease;
}

/* ===================== SUMMARY PANEL ===================== */
.panel{
    background: var(--card-background);
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    padding: 1.75rem 2rem 2rem;
}

.panel .section-head{
    margin-top: 0;
}

.condition-summary{
    font-family: var(--main-font);
}

.spinner-container{
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 0;
}

/* summary bars rendered by JS */
.bar-holder{
    position: relative;
    width: 100%;
    max-width: 640px;
    margin: 0 auto 1.6rem;
    padding: 0 130px 1.4rem 0; /* reserve right space for the compass */
    border-bottom: 1px solid rgba(0,0,0,0.07);
}
.bar-holder:last-child{
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.bar-title{
    font-family: var(--title-font);
    font-size: var(--font-size-subtitles);
    letter-spacing: 0.1rem;
    text-transform: uppercase;
    color: var(--ink);
    margin-bottom: 0.5rem;
}

.bar-meter-row{
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.7rem;
}
.bar-value{
    flex: 0 0 auto;
    min-width: 88px;
    display: flex;
    align-items: baseline;
    gap: 0.2rem;
    line-height: 0.9;
}
.bar-value-num{
    font-family: var(--title-font);
    font-size: 2.6rem;
    color: var(--ink);
}
.bar-value-unit{
    font-family: var(--title-font);
    font-size: 1.2rem;
    color: var(--text-muted);
}
.bar-meter{
    position: relative;
    flex: 1 1 auto;
    height: 10px;
    background: var(--grid, #ece8e2);
    border-radius: 3px;
    overflow: hidden;
}
.bar-meter-fill{
    height: 100%;
    border-radius: 3px;
    transition: width 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.bar-meter-wrap{
    flex: 1 1 auto;
}
.bar-tick{
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: rgba(27, 30, 39, 0.18);
}
.bar-scale{
    position: relative;
    height: 1rem;
    margin-top: 0.3rem;
}
.bar-tick-label{
    position: absolute;
    transform: translateX(-50%);
    font-family: var(--main-font);
    font-size: 0.65rem;
    font-weight: 500;
    letter-spacing: 0.03em;
    color: var(--text-muted);
    white-space: nowrap;
}
.bar-tick-label:first-child{ transform: none; }
.bar-tick-label:last-child{ transform: translateX(-100%); }

.main-text{
    font-size: var(--font-size-main-text);
    font-family: var(--main-font);
    font-weight: 300;
    letter-spacing: 0.02rem;
    text-transform: uppercase;
    color: var(--text-muted);
    line-height: 1.6;
}

/* ===================== TEMPERATURE ===================== */
.temp-grid{
    display: flex;
    flex-wrap: wrap;
    margin-top: 0.6rem;
}
.temp-item{
    display: flex;
    flex-direction: column;
    padding: 0 2rem;
}
.temp-item:first-child{
    padding-left: 0;
}
.temp-item + .temp-item{
    border-left: 1px solid rgba(27, 30, 39, 0.1);
}
.temp-label{
    font-family: var(--main-font);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
}
.temp-value{
    font-family: var(--title-font);
    font-size: 2.4rem;
    line-height: 0.95;
    letter-spacing: 0.02em;
    color: var(--ink);
}
.temp-meta{
    font-family: var(--main-font);
    font-size: 0.74rem;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-top: 0.4rem;
}

/* ===================== CHART GRID ===================== */
.chart-grid{
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
    gap: 1.5rem;
}

.buoy-chart{
    position: relative;
    width: 100%;
    height: 32vw;
    min-height: 30rem;
    max-height: 40rem;
    overflow: hidden;
    padding: 1.25rem;
    background: var(--card-background);
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    transition: box-shadow 0.25s ease, transform 0.25s ease;
    cursor: pointer;
}

.buoy-chart:hover{
    box-shadow: var(--card-shadow-hover);
    transform: translateY(-3px);
}

/* expanded (double-click) state spans the full grid row */
.buoy-chart-large{
    position: relative;
    width: 100%;
    grid-column: 1 / -1;
    height: 60vw;
    min-height: 40rem;
    overflow: hidden;
    padding: 1.5rem;
    background: var(--card-background);
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow-hover);
    cursor: pointer;
}

.heatmap-container{
    min-height: 34rem;
}

.chart-title{
    font-size: var(--font-size-subtitles);
    font-family: var(--main-font);
    font-weight: 600;
    letter-spacing: 0.18rem;
}

/* ===================== SVG / D3 STYLES ===================== */
.bar{ fill: var(--fill-color-main); }

.main-line{ stroke: var(--main-line-color); stroke-width: 1.75; }
.main-line-raw{ stroke: var(--main-line-color); stroke-width: .5; opacity: .5; }
.main-line-2{ stroke: var(--main-line-color-2); stroke-width: 1.75; }
.main-line-heavy{ stroke-width: 2.75; }
.raw-line-2{ stroke: var(--fill-color-2); stroke-width: .5; opacity: .5; }
.raw-line-3{ stroke: var(--fill-color-3); stroke-width: .5; opacity: .5; }

.annotation-note-bg{ fill: rgba(255,255,255,1); fill-opacity: 1; }
.domain{ stroke: gray; opacity: .3; }

.wave-height{ font-size: 38px; }
.wave-summary-text{ font-size: var(--font-size-main-text); font-family: var(--main-font); }

.svg-container{
    display: inline-block;
    position: relative;
    width: 80%;
    padding-bottom: 100%;
    vertical-align: top;
    overflow: hidden;
}
.svg-content-responsive{
    display: inline-block;
    position: absolute;
    top: 10px;
    left: 0;
}
.svg-wave-overall{ height: 172px; width: 235px; top: 22px; left: 185px; }
.svg-bar-generic{ height: 172px; width: 407px; top: 48px; left: 218px; }

.compass-holder{
    position: absolute;
    right: 6px;
    top: 8px;
    margin: 0;
}
.compass-svg{ display: block; }

/* ===================== BUOY CHART V2 ===================== */
.buoy-chart-v2-svg{
    width: 100%;
    height: 100%;
}
.v2-overlay{ cursor: crosshair; }
.v2-chip{ -webkit-user-select: none; user-select: none; }
.v2-chip:hover .chip-bg{ fill: rgba(27, 30, 39, 0.05); }

/* height-mode toggle (Wave vs Buoy) */
.chart-toolbar{
    display: flex;
    justify-content: flex-end;
    padding: 0.35rem 0.5rem 0;
    /* The chart SVG (.svg-content-responsive) is position:absolute and would
       otherwise render on top of this toolbar and swallow its clicks. Lift the
       toolbar into its own stacking context above the SVG. */
    position: relative;
    z-index: 2;
}
.height-mode-toggle .hmt-btn{
    /* ensure the button itself is the click target above any overlay */
    position: relative;
    z-index: 2;
}
.height-mode-toggle{
    display: inline-flex;
    background: rgba(27, 30, 39, 0.05);
    border: 1px solid var(--grid, #ece8e2);
    border-radius: 999px;
    padding: 2px;
    gap: 2px;
}
.height-mode-toggle .hmt-btn{
    appearance: none;
    border: none;
    background: transparent;
    cursor: pointer;
    font-family: var(--main-font);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.2px;
    color: var(--text-muted);
    padding: 0.28rem 0.7rem;
    border-radius: 999px;
    line-height: 1;
    transition: background 0.15s ease, color 0.15s ease;
}
.height-mode-toggle .hmt-btn:hover{
    color: var(--ink);
}
.height-mode-toggle .hmt-btn.active{
    background: var(--accent);
    color: #fff;
    box-shadow: 0 1px 3px rgba(232, 71, 42, 0.35);
}

/* ===================== HEATMAP V2 ===================== */
.heatmap-v2-svg{
    width: 100%;
    height: 100%;
}
.heatmap-v2-tip,
.chart-v2-tip{
    position: absolute;
    pointer-events: none;
    z-index: 20;
    background: #fff;
    border: 1px solid var(--grid);
    border-radius: 8px;
    padding: 0.5rem 0.7rem;
    box-shadow: 0 4px 14px rgba(27, 30, 39, 0.14);
    font-family: var(--main-font);
    font-size: 0.78rem;
    color: var(--ink);
    transition: opacity 0.12s ease;
    white-space: nowrap;
}
.heatmap-v2-tip .tip-date,
.chart-v2-tip .tip-date{
    font-weight: 600;
    margin-bottom: 0.3rem;
}
.heatmap-v2-tip .tip-row,
.chart-v2-tip .tip-row{
    display: flex;
    justify-content: space-between;
    gap: 1.2rem;
    color: var(--text-muted);
}
.heatmap-v2-tip .tip-row b,
.chart-v2-tip .tip-row b{ color: var(--ink); }

.wind-v2-svg{
    width: 100%;
    height: 100%;
}

/* ===================== FOOTER ===================== */
.site-footer{
    text-align: center;
    padding: 2rem 1.5rem 2.5rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}
.site-footer p{ margin: 0; }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 760px){
    .hero{ padding: 3rem 1.25rem; }
    .page-content{ padding: 0.5rem 1rem 2rem; }
    .panel{ padding: 1.25rem; }
    .section-title{ font-size: 2rem; }

    .chart-grid{
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .buoy-chart{
        height: 70vw;
        min-height: 26rem;
        padding: 0.85rem;
    }
    .buoy-chart:hover{ transform: none; }
    .heatmap-container{ min-height: 28rem; }
    .bar-title{ font-size: 1.6rem; }
}

@media (max-width: 460px){
    :root{
        --font-size-subtitles: 1.5rem;
        --font-size-main-text: 0.92rem;
    }
}

/* ===================== DROPDOWN WIDGET (unchanged) ===================== */
.dropdown-css{
    max-width: 200px;
    margin: 80px auto 0;
    height: 600px;
    position: relative;
    width: 100%;
}
.dropdown-btn-css{
    background: #1d1f24;
    font-size: 18px;
    width: 100%;
    border: none;
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.7em 0.5em;
    border-radius: 0.5em;
    cursor: pointer;
}
.arrow-css{
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid #fff;
    transition: transform ease-in-out 0.3s;
}
.dropdown-content-css{
    list-style: none;
    position: absolute;
    top: 3.2em;
    width: 100%;
    visibility: hidden;
    overflow: hidden;
}
.dropdown-content-css li{
    background: #2f3238;
    border-radius: 0.5em;
    position: relative;
    left: 100%;
    transition: 0.5s;
    transition-delay: calc(60ms * var(--delay));
    cursor: pointer;
}
.dropdown-btn-css:focus + .dropdown-content-css li{ left: 0; }
.dropdown-btn-css:focus + .dropdown-content-css{ visibility: visible; }
.dropdown-btn-css:focus > .arrow{ transform: rotate(180deg); }
.dropdown-content-css li:hover{ background: #1d1f24; }
.dropdown-content-css li a{
    display: block;
    padding: 0.7em 0.5em;
    color: #fff;
    margin: 0.1em 0;
    text-decoration: none;
    cursor: pointer;
}
