:root {
    --vellum: #f2e6cc;
    --ink: #4a3a28;
    --ocean: #d8dce8;
    --terrain: #c8b898;
    --rhumb: #8a7a5a;
    --sea-text: #6a8aaa;
    --warning-red: #8a3a2a;
    --sidebar-bg: #3a3028;
    --sidebar-text: #c8b898;
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    background-color: var(--vellum);
    color: var(--ink);
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 400;
    font-size: clamp(0.9rem, 1.1vw, 1.05rem);
    line-height: 1.75;
}

/* Paper texture */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
    background:
        radial-gradient(circle at 20% 30%, rgba(200, 184, 152, 0.05) 0%, transparent 2%),
        radial-gradient(circle at 60% 70%, rgba(200, 184, 152, 0.04) 0%, transparent 1.5%),
        radial-gradient(circle at 80% 20%, rgba(200, 184, 152, 0.03) 0%, transparent 2.5%);
}

/* Fixed sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 200px;
    height: 100vh;
    background-color: var(--sidebar-bg);
    z-index: 10;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.sidebar-instrument {
    display: flex;
    flex-direction: column;
}

.instrument-label {
    font-family: 'Space Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.6rem, 0.7vw, 0.7rem);
    letter-spacing: 0.15em;
    color: var(--rhumb);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.instrument-value {
    font-family: 'Space Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.7rem, 0.8vw, 0.8rem);
    color: var(--sidebar-text);
}

.instrument-date {
    font-family: 'IM Fell English', Georgia, serif;
    font-style: italic;
}

.instrument-sub {
    font-family: 'Caveat', cursive;
    font-size: 0.75rem;
    color: var(--rhumb);
}

.sidebar-divider {
    width: 100%;
    height: 1px;
    background-color: var(--rhumb);
    opacity: 0.3;
}

.depth-gauge {
    flex: 1;
    display: flex;
    align-items: stretch;
    padding: 10px 0;
}

.depth-bar {
    width: 8px;
    height: 100%;
    border: 1px solid var(--rhumb);
    position: relative;
    border-radius: 2px;
}

.depth-mark {
    position: absolute;
    left: -4px;
    width: 16px;
    height: 1px;
    background-color: var(--rhumb);
}

/* Horizontal scroll container */
.chart-scroll {
    position: fixed;
    top: 0;
    left: 200px;
    width: calc(100vw - 200px);
    height: 100vh;
    overflow-x: scroll;
    overflow-y: hidden;
}

.chart-canvas {
    width: 560vw;
    height: 100vh;
    position: relative;
    background-color: var(--vellum);
}

/* Fold lines */
.fold-line {
    position: absolute;
    top: 0;
    width: 1px;
    height: 100%;
    background-color: var(--terrain);
    opacity: 0.15;
}

/* Rhumb lines overlay */
.rhumb-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* Chart sections */
.chart-section {
    position: absolute;
    top: 0;
    height: 100%;
}

.section-cartouche {
    left: 0;
    width: 80vw;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Cartouche */
.cartouche-frame {
    width: min(500px, 40vw);
    height: auto;
    position: absolute;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
}

.cartouche-path {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    animation: draw-cartouche 2s ease forwards;
}

@keyframes draw-cartouche {
    to {
        stroke-dashoffset: 0;
    }
}

.cartouche-text {
    position: absolute;
    top: 25%;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    width: min(400px, 35vw);
}

.cartouche-title {
    font-family: 'IM Fell English', Georgia, serif;
    font-style: italic;
    font-weight: 400;
    font-size: clamp(1.5rem, 2.5vw, 2.5rem);
    color: var(--ink);
    margin-bottom: 12px;
    letter-spacing: 0.05em;
}

.cartouche-subtitle {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 400;
    font-style: italic;
    font-size: clamp(0.8rem, 1vw, 1rem);
    color: var(--ink);
    margin-bottom: 8px;
}

.cartouche-date {
    font-family: 'Caveat', cursive;
    font-size: clamp(0.75rem, 0.9vw, 0.9rem);
    color: var(--rhumb);
}

/* Compass roses */
.compass-rose-start {
    position: absolute;
    bottom: 15%;
    right: 10%;
    width: 120px;
    height: 120px;
}

.compass-rose-end {
    position: absolute;
    bottom: 20%;
    left: 30%;
    width: 120px;
    height: 120px;
}

/* Island sections */
.section-island {
    position: relative;
}

.section-island[data-island="eros"] { left: 80vw; width: 100vw; }
.section-island[data-island="philia"] { left: 230vw; width: 90vw; }
.section-island[data-island="storge"] { left: 370vw; width: 80vw; }
.section-island[data-island="agape"] { left: 450vw; width: 70vw; }

/* Ocean fills behind islands */
.ocean-fill {
    position: absolute;
    top: 50%;
    width: 100%;
    height: 50%;
    background-color: var(--ocean);
    opacity: 0.15;
    z-index: 0;
}

/* Island SVGs */
.island-svg {
    position: absolute;
    z-index: 1;
}

.island-eros {
    width: min(600px, 45vw);
    bottom: 10%;
    left: 20%;
}

.island-philia {
    width: min(700px, 50vw);
    bottom: 15%;
    left: 10%;
}

.island-storge {
    width: min(700px, 55vw);
    bottom: 8%;
    left: 10%;
}

.island-agape {
    width: min(600px, 45vw);
    top: 0;
    left: 15%;
}

/* Island names */
.island-name {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: clamp(1rem, 1.5vw, 1.5rem);
    letter-spacing: 0.15em;
    color: var(--ink);
    position: absolute;
    z-index: 2;
}

.section-island[data-island="eros"] .island-name { top: 25%; left: 35%; }
.section-island[data-island="philia"] .island-name { top: 20%; left: 30%; }
.section-island[data-island="storge"] .island-name { top: 15%; left: 35%; }
.section-island[data-island="agape"] .island-name { bottom: 40%; left: 30%; }

/* Place names */
.place-name {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 400;
    font-style: italic;
    font-size: clamp(0.7rem, 0.85vw, 0.85rem);
    color: var(--ink);
    opacity: 0.7;
    position: absolute;
    z-index: 2;
}

/* Island annotations */
.island-annotation {
    font-family: 'Caveat', cursive;
    font-weight: 400;
    font-size: clamp(0.75rem, 0.9vw, 0.9rem);
    line-height: 1.5;
    color: var(--ink);
    position: absolute;
    max-width: 280px;
    z-index: 2;
}

.section-island[data-island="eros"] .island-annotation { top: 15%; right: 8%; }
.section-island[data-island="philia"] .island-annotation { top: 10%; right: 5%; max-width: 300px; }
.section-island[data-island="storge"] .island-annotation { top: 8%; left: 5%; max-width: 320px; }
.section-island[data-island="agape"] .island-annotation { bottom: 15%; left: 10%; max-width: 300px; }

/* Terra Incognita */
.terra-incognita {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: clamp(0.7rem, 0.85vw, 0.85rem);
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--ink);
    opacity: 0.5;
    position: absolute;
    top: 5%;
    left: 30%;
    z-index: 2;
}

/* Rhumb dotted lines */
.rhumb-dotted {
    position: absolute;
    right: -5%;
    top: 50%;
    width: 15%;
    height: 20px;
}

/* Ocean sections */
.section-ocean {
    position: relative;
}

.section-ocean-1 { left: 180vw; width: 50vw; }
.section-ocean-2 { left: 320vw; width: 50vw; }

.ocean-annotation {
    font-family: 'Caveat', cursive;
    font-weight: 400;
    font-size: clamp(0.75rem, 0.9vw, 0.9rem);
    color: var(--sea-text);
    position: absolute;
}

.section-ocean-1 .ocean-annotation { top: 20%; left: 30%; }
.annotation-passage { top: 60%; left: 10%; max-width: 250px; line-height: 1.5; }

.current-arrows {
    position: absolute;
    top: 30%;
    left: 10%;
    width: 120px;
    height: 250px;
}

/* Sea creatures */
.sea-creature {
    position: absolute;
}

.creature-serpent {
    width: 70px;
    height: 70px;
    bottom: 25%;
    left: 50%;
}

.creature-whale {
    width: 80px;
    height: 50px;
    bottom: 30%;
    right: 15%;
}

/* Wind rose */
.wind-rose {
    position: absolute;
    top: 15%;
    right: 20%;
    width: 100px;
    height: 100px;
}

/* Ship */
.ship-svg {
    position: absolute;
    top: 45%;
    left: 40%;
    width: 50px;
    height: 35px;
}

/* Chart edge section */
.section-edge {
    left: 520vw;
    width: 40vw;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px;
}

.chart-crease {
    position: absolute;
    left: 10%;
    top: 0;
    width: 1px;
    height: 100%;
    background-color: var(--terrain);
    opacity: 0.2;
}

.cartographer-note {
    font-family: 'Caveat', cursive;
    font-weight: 400;
    font-size: clamp(0.8rem, 1vw, 1rem);
    line-height: 1.6;
    color: var(--ink);
    max-width: 350px;
    text-align: center;
    position: absolute;
    top: 30%;
    left: 50%;
    transform: translateX(-50%);
}

/* Warning marks */
.warning-mark {
    color: var(--warning-red);
    font-family: 'Caveat', cursive;
    font-size: 0.75rem;
}

/* Mobile */
@media (max-width: 768px) {
    .sidebar {
        width: 120px;
        padding: 20px 10px;
    }

    .chart-scroll {
        left: 120px;
        width: calc(100vw - 120px);
    }

    .chart-canvas {
        width: 800vw;
    }

    .island-annotation {
        max-width: 200px;
    }
}
