/* =========================
   Theme
========================= */

:root {
    --bg: #f8f6f0;
    --panel: #ffffff;
    --panel-soft: rgba(0, 0, 0, 0.1);

    --text: #1f2933;
    --muted: #6b7280;

    --pine: #285943;
    --pine-dark: #18392b;
    --glacier: #7fb3d5;
    --trail: #d97706;
    --danger: #b91c1c;

    --border: #ded7c9;
    --shadow: 0 10px 30px rgba(31, 41, 51, 0.12);

    --radius: 16px;
    --radius-sm: 12px;
}


/* =========================
   Base
========================= */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}

button,
input {
    font: inherit;
}


/* =========================
   Navbar
========================= */

.navbar {
    height: 68px;
    padding: 0 28px;
    background: var(--pine-dark);
    color: white;

    display: flex;
    align-items: center;
    justify-content: space-between;

    border-bottom: 4px solid var(--glacier);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;

    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 50%;

    display: flex;
    align-items: center;
    justify-content: center;
}

.brand-mark img,
.brand-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
    filter: invert(1);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-links a {
    padding: 9px 12px;
    border-radius: 999px;

    color: rgba(255, 255, 255, 0.78);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;

    transition: background 0.15s ease, color 0.15s ease;
}

.nav-links a:hover,
.nav-links a.active {
    color: white;
    background: rgba(255, 255, 255, 0.12);
}


/* =========================
   Main Page Layout
========================= */

.page {
    height: calc(100vh - 124px);
    padding: 16px;
    gap: 16px;

    display: grid;
    grid-template-columns: 280px minmax(420px, 1fr) 320px;
}

.sidebar,
.parameters,
#map {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.sidebar,
.parameters {
    background: var(--panel);
    overflow-y: auto;
}


/* =========================
   Sidebar
========================= */

.sidebar {
    padding: 18px;
}

.sidebar h1 {
    margin: 0;
    font-size: 26px;
    color: var(--pine-dark);
}

.sidebar p {
    margin: 6px 0 18px;
    color: var(--muted);
}

.trail-list {
    list-style: none;
    padding: 0;
    margin: 0;

    display: grid;
    gap: 8px;
}

.trail-item {
    padding: 12px;

    background: var(--panel-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);

    cursor: pointer;

    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease,
        border-color 0.15s ease,
        background 0.15s ease;
}

.trail-item:hover {
    transform: translateY(-1px);
    border-color: var(--pine);
    background: white;
    box-shadow: 0 6px 16px rgba(31, 41, 51, 0.1);
}

.trail-item strong {
    color: var(--pine-dark);
}

.coords {
    margin-top: 5px;
    color: var(--muted);
    font-size: 12px;
}


/* =========================
   Map
========================= */

#map {
    width: 100%;
    height: 100%;
    min-height: 500px;

    overflow: hidden;
}

.leaflet-tile {
    filter: grayscale(90%) saturate(70%) brightness(1.02) contrast(0.9);
}

.leaflet-control-attribution {
    font-size: 10px;
    opacity: 0.65;
}

.leaflet-popup-content-wrapper {
    border-radius: 12px;
}

.leaflet-popup-content {
    font-size: 13px;
}


/* =========================
   Parameters Panel
========================= */

.parameters {
    padding: 18px;
}

.parameters h2 {
    margin: 18px 0 16px;
    color: var(--pine-dark);
    font-size: 20px;
}

.parameters label {
    display: grid;
    gap: 6px;

    margin-bottom: 12px;

    color: var(--muted);
    font-size: 13px;
}

.parameters input {
    width: 100%;
    padding: 9px 10px;

    background: white;
    color: var(--text);

    border: 1px solid var(--border);
    border-radius: 10px;
}

.parameters input:focus {
    outline: 2px solid rgba(127, 179, 213, 0.45);
    border-color: var(--glacier);
}

.parameters button {
    margin: 4px 4px 8px 0;
    padding: 9px 16px;

    border: none;
    border-radius: 999px;

    cursor: pointer;
    font-weight: 700;

    transition:
        background 0.15s ease,
        transform 0.15s ease;
}

.parameters button:hover {
    transform: translateY(-1px);
}

#startACOBtn {
    background: var(--pine);
    color: white;
}

#startACOBtn:hover {
    background: var(--pine-dark);
}

#resetACOBtn {
    background: #eadfd0;
    color: var(--text);
}

#resetACOBtn:hover {
    background: #ded0bd;
}


/* =========================
   Convergence Chart
========================= */

.chart-card {
    padding: 14px;
    margin-bottom: 18px;

    background: var(--panel-soft);
    border: 1px solid var(--border);
    border-radius: 14px;
}

.chart-header h3 {
    margin: 0;
    color: var(--pine-dark);
    font-size: 16px;
}

.chart-wrap {
    display: flex;
    align-items: center;
    gap: 8px;

    margin-top: 12px;
}

.chart-main {
    flex: 1;
    min-width: 0;
}

.y-axis-label {
    writing-mode: vertical-rl;
    transform: rotate(180deg);

    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    text-align: center;
}

.x-axis-label {
    display: block;
    margin-top: 6px;

    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    text-align: center;
}

#convergenceCanvas {
    width: 100%;
    height: 130px;
    display: block;

    background: white;
    border: 1px solid var(--border);
    border-radius: 10px;
}

.chart-note {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
}


/* =========================
   Metrics
========================= */

.metrics {
    margin-top: 14px;
    padding: 12px;

    background: var(--panel-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);

    line-height: 1.7;
}

.metrics strong {
    color: var(--pine-dark);
}



/* =========================
   Footer
========================= */

.footer {
    min-height: 56px;
    padding: 14px 24px;

    background: var(--pine-dark);
    color: rgba(255, 255, 255, 0.72);

    font-size: 13px;
    text-align: center;
}


/* =========================
   Responsive
========================= */

@media (max-width: 1200px) {
    .page {
        grid-template-columns: 240px minmax(360px, 1fr) 280px;
    }
}

@media (max-width: 980px) {
    .page {
        height: auto;
        min-height: calc(100vh - 124px);

        grid-template-columns: 1fr;
        grid-template-rows: 460px auto auto;
    }

    #map {
        min-height: 460px;
    }

    .parameters,
    .sidebar {
        max-height: none;
    }
}

@media (max-width: 760px) {
    .navbar {
        height: auto;
        padding: 16px;

        flex-direction: column;
        align-items: flex-start;
        gap: 14px;
    }

    .nav-links {
        width: 100%;
        flex-wrap: wrap;
        gap: 8px;
    }

    .nav-links a {
        background: rgba(255, 255, 255, 0.08);
    }

    .page {
        padding: 10px;
        gap: 10px;
        grid-template-rows: 380px auto auto;
    }

    #map {
        min-height: 380px;
    }

    .sidebar,
    .parameters {
        padding: 14px;
    }

    #convergenceCanvas {
        height: 100px;
    }

    .chart-note {
        font-size: 11px;
    }
}

@media (max-width: 520px) {
    .brand {
        font-size: 20px;
    }

    .sidebar h1 {
        font-size: 22px;
    }

    .parameters h2 {
        font-size: 18px;
    }

    .nav-links a {
        font-size: 13px;
        padding: 8px 10px;
    }
}

.slides-wrapper {
  width: 100%;
  max-width: 1100px;
  aspect-ratio: 16 / 9;
  margin: 2rem auto;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  background: #111;
}

.slides-wrapper iframe {
  width: 100%;
  height: 100%;
  border: none;
}


html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;

    display: flex;
    flex-direction: column;

    font-family: Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}

.main-content {
    flex: 1;
    width: 100%;
}

.footer {
    margin-top: auto;
    min-height: 56px;
    padding: 14px 24px;

    background: var(--pine-dark);
    color: rgba(255, 255, 255, 0.72);

    font-size: 13px;
    text-align: center;
}

/* =========================
   How It Works Page
========================= */

.how-page {
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    padding: 28px 16px 48px;
}

.how-hero {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 24px;
    align-items: center;

    margin-bottom: 28px;
    padding: 28px;

    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.how-hero h1 {
    margin: 8px 0 12px;
    color: var(--pine-dark);
    font-size: clamp(32px, 5vw, 52px);
    line-height: 1.05;
}

.how-hero p,
.section-heading p,
.step-card p,
.code-card p,
.parameter-list p,
.how-summary p {
    color: var(--muted);
    line-height: 1.6;
}

.eyebrow {
    color: var(--trail);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.how-button {
    display: inline-block;
    margin-top: 12px;
    padding: 10px 18px;

    background: var(--pine);
    color: white;

    border-radius: 999px;
    text-decoration: none;
    font-weight: 700;

    transition: background 0.15s ease, transform 0.15s ease;
}

.how-button:hover {
    background: var(--pine-dark);
    transform: translateY(-1px);
}

.how-section {
    margin-top: 24px;
    padding: 24px;

    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.section-heading {
    max-width: 720px;
    margin-bottom: 18px;
}

.section-heading h2,
.how-summary h2 {
    margin: 8px 0 8px;
    color: var(--pine-dark);
    font-size: 28px;
}

.step-grid,
.photo-grid,
.code-grid {
    display: grid;
    gap: 16px;
}

.step-grid {
    grid-template-columns: repeat(4, 1fr);
}

.photo-grid {
    grid-template-columns: repeat(3, 1fr);
}

.code-grid {
    grid-template-columns: 1fr;
}

.step-card,
.code-card,
.parameter-list div {
    padding: 16px;

    background: var(--panel-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.step-number {
    color: var(--glacier);
    font-size: 13px;
    font-weight: 800;
}

.step-card h3,
.code-card h3 {
    margin: 8px 0;
    color: var(--pine-dark);
}

.how-photo {
    margin: 0;
    overflow: hidden;

    background: var(--panel-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.how-photo img {
    display: block;
    width: 100%;
    height: 220px;
    object-fit: cover;

    background: #eadfd0;
}

.hero-photo img {
    height: 320px;
}

.how-photo figcaption {
    padding: 10px 12px;
    color: var(--muted);
    font-size: 13px;
}

.code-card pre {
    margin: 12px 0 0;
    padding: 14px;

    overflow-x: auto;

    background: #1f2933;
    color: #f8f6f0;

    border-radius: 12px;
    font-size: 13px;
    line-height: 1.5;
}

.code-card code {
    font-family: Consolas, Monaco, monospace;
}

.parameter-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

.parameter-list strong {
    color: var(--pine-dark);
}

.parameter-list p {
    margin: 6px 0 0;
}

.how-summary {
    margin-top: 24px;
    padding: 28px;

    background: var(--pine-dark);
    color: white;

    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.how-summary h2 {
    color: white;
}

.how-summary p {
    color: rgba(255, 255, 255, 0.78);
}

.how-summary .how-button {
    background: var(--glacier);
    color: var(--pine-dark);
}

.how-summary .how-button:hover {
    background: white;
}


/* =========================
   How It Works Responsive
========================= */

@media (max-width: 980px) {
    .how-hero,
    .step-grid,
    .photo-grid,
    .parameter-list {
        grid-template-columns: 1fr;
    }

    .hero-photo img,
    .how-photo img {
        height: 240px;
    }
}

@media (max-width: 520px) {
    .how-page {
        padding: 16px 10px 32px;
    }

    .how-hero,
    .how-section,
    .how-summary {
        padding: 18px;
    }

    .section-heading h2,
    .how-summary h2 {
        font-size: 22px;
    }
}