/* aei.st - Seapunk Cartographic Institute */
/* Custom Properties */
:root {
    --abyss: #0a0c10;
    --deep: #1a1e26;
    --mid: #2a2e38;
    --thermo: #4a5060;
    --sediment: #b8bcc6;
    --surface: #e8ecf2;
    --foam: #f4f6fa;
    --biolum: #00e5c8;
    --gray: #808080;
    --font-headline: 'Space Mono', monospace;
    --font-body: 'IBM Plex Mono', monospace;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.85rem, 1.1vw, 1rem);
    line-height: 1.7;
    letter-spacing: 0.02em;
    color: var(--sediment);
    background: linear-gradient(to bottom, var(--deep), var(--abyss));
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* Navigation */
#nav-monogram {
    position: fixed;
    top: 24px;
    left: 24px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.nav-symbol {
    font-family: var(--font-headline);
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--surface);
    letter-spacing: 0.08em;
    cursor: pointer;
    transition: color 0.3s ease;
    line-height: 1;
}

.nav-symbol:hover {
    color: var(--biolum);
}

.nav-depth-counter {
    font-family: var(--font-headline);
    font-weight: 400;
    font-size: 0.7rem;
    color: var(--biolum);
    margin-top: 8px;
    font-variant-numeric: tabular-nums;
    opacity: 0.8;
}

#depth-value {
    display: inline-block;
    min-width: 3.5em;
    text-align: right;
}

.depth-unit {
    opacity: 0.6;
}

.nav-links {
    display: flex;
    flex-direction: column;
    margin-top: 12px;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}

#nav-monogram:hover .nav-links {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.nav-links a {
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 0.7rem;
    color: var(--biolum);
    text-decoration: none;
    padding: 4px 0;
    transition: opacity 0.2s ease;
    opacity: 0.7;
}

.nav-links a:hover {
    opacity: 1;
}

/* Survey Header */
#survey-header {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    background: repeating-linear-gradient(
        var(--thermo) 0px,
        transparent 1px,
        transparent 40px
    ),
    repeating-linear-gradient(
        90deg,
        var(--thermo) 0px,
        transparent 1px,
        transparent 40px
    );
    background-size: 40px 40px;
    background-position: center;
}

#survey-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, transparent 20%, var(--deep) 70%);
    pointer-events: none;
}

.contour-map {
    position: absolute;
    width: min(80vw, 80vh);
    height: min(80vw, 80vh);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.contour-svg {
    width: 100%;
    height: 100%;
}

.contour-ring {
    fill: none;
    stroke: var(--thermo);
    stroke-width: 1;
    opacity: 0;
}

.header-content {
    position: relative;
    z-index: 2;
    text-align: center;
}

.logotype {
    font-family: var(--font-headline);
    font-weight: 700;
    font-size: clamp(2rem, 5vw, 4.5rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--surface);
    margin-bottom: 16px;
}

.header-subtitle {
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--sediment);
    margin-bottom: 8px;
}

.header-descriptor {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: 0.7rem;
    color: var(--thermo);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.header-coordinates {
    position: absolute;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
    z-index: 2;
}

.coord {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: 0.7rem;
    color: var(--thermo);
    letter-spacing: 0.05em;
}

.coord-sep {
    color: var(--thermo);
    opacity: 0.4;
    font-size: 0.7rem;
}

/* Section Labels */
.section-label {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 48px 24px 24px;
    max-width: 1400px;
    margin: 0 auto;
}

.label-text {
    font-family: var(--font-headline);
    font-weight: 700;
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--surface);
    white-space: nowrap;
}

.label-line {
    flex: 1;
    height: 1px;
    background: var(--thermo);
    opacity: 0.4;
}

.label-depth {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: 0.7rem;
    color: var(--thermo);
    white-space: nowrap;
}

/* Masonry Grid */
.masonry-grid {
    columns: 3;
    column-width: clamp(280px, 30vw, 400px);
    column-gap: 2px;
    padding: 0 24px;
    max-width: 1400px;
    margin: 0 auto;
}

.masonry-registry {
    columns: 4;
    column-width: clamp(200px, 22vw, 300px);
}

/* Masonry Cards */
.masonry-card {
    break-inside: avoid;
    margin-bottom: 2px;
    background: var(--mid);
    position: relative;
    overflow: hidden;
    border: 1px solid transparent;
    border-radius: 1px;
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.masonry-card:hover {
    box-shadow: 0 0 20px 0 rgba(0, 229, 200, 0.08);
    border-color: rgba(0, 229, 200, 0.15);
}

.masonry-card:hover .card-depth-ticks::before {
    background: repeating-linear-gradient(
        to bottom,
        rgba(0, 229, 200, 0.4) 0px,
        rgba(0, 229, 200, 0.4) 1px,
        transparent 1px,
        transparent 20px
    );
}

/* Card coordinate grid background */
.masonry-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        var(--thermo) 0px,
        transparent 1px,
        transparent 60px
    ),
    repeating-linear-gradient(
        90deg,
        var(--thermo) 0px,
        transparent 1px,
        transparent 60px
    );
    opacity: 0.03;
    pointer-events: none;
}

.card-tall {
    min-height: 450px;
    padding: 32px 24px 120px;
}

.card-medium {
    min-height: 280px;
    padding: 24px;
}

.card-short {
    min-height: 120px;
    padding: 20px 24px;
}

.card-ridge {
    min-height: 60px;
    padding: 0;
    background: transparent;
    border: none;
}

.card-ridge:hover {
    box-shadow: none;
    border-color: transparent;
}

.card-registry {
    padding: 16px 20px;
    min-height: auto;
}

/* Card Content */
.card-content {
    position: relative;
    z-index: 2;
}

.masonry-card h2 {
    font-family: var(--font-headline);
    font-weight: 700;
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--surface);
    margin-bottom: 16px;
    line-height: 1.3;
}

.masonry-card h3 {
    font-family: var(--font-headline);
    font-weight: 700;
    font-size: clamp(0.9rem, 1.5vw, 1.1rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--surface);
    margin-bottom: 12px;
    line-height: 1.3;
}

.masonry-card h4 {
    font-family: var(--font-headline);
    font-weight: 700;
    font-size: 0.8rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--surface);
    margin-bottom: 8px;
}

.masonry-card p {
    margin-bottom: 8px;
}

.card-meta {
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 0.7rem;
    color: #808080;
    letter-spacing: 0.05em;
    margin-top: 12px;
}

/* Watermark numbers */
.card-watermark {
    position: absolute;
    top: 10px;
    right: 10px;
    font-family: var(--font-headline);
    font-weight: 400;
    font-size: clamp(4rem, 10vw, 9rem);
    color: var(--surface);
    opacity: 0.06;
    line-height: 1;
    pointer-events: none;
    z-index: 1;
}

/* Depth ticks */
.card-depth-ticks {
    position: absolute;
    top: 0;
    left: 0;
    width: 8px;
    height: 100%;
    z-index: 1;
}

.card-depth-ticks::before {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        to bottom,
        var(--thermo) 0px,
        var(--thermo) 1px,
        transparent 1px,
        transparent 20px
    );
    opacity: 0.5;
    transition: background 0.3s ease;
}

/* Mountain silhouettes */
.card-mountain {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 120px;
    color: var(--deep);
    opacity: 0.4;
    z-index: 1;
}

/* Contour rings in cards */
.card-contours {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.contour-inner {
    fill: none;
    stroke: var(--thermo);
    stroke-width: 1;
    opacity: 0.15;
}

/* Triangulated mesh */
.triangulated-mesh {
    position: absolute;
    inset: 0;
    z-index: 1;
    opacity: 0.15;
    color: var(--thermo);
}

.triangulated-mesh svg {
    width: 100%;
    height: 100%;
}

.triangulated-mesh path {
    stroke-width: 0.5;
}

.station-marker {
    fill: none;
    stroke: var(--thermo);
    stroke-width: 1;
}

/* Sonar arc */
.sonar-arc {
    position: absolute;
    top: 0;
    right: 0;
    width: 200px;
    height: 200px;
    background: conic-gradient(
        from 180deg at 100% 0%,
        transparent 0deg,
        rgba(74, 80, 96, 0.1) 45deg,
        transparent 90deg
    );
    border-radius: 0 0 0 100%;
    pointer-events: none;
    z-index: 1;
}

/* Ridgeline */
.ridgeline {
    width: 100%;
    height: 60px;
    color: var(--thermo);
}

.ridge-path {
    stroke-width: 1.5;
    opacity: 0.6;
}

/* Gradient field card */
.card-gradient-field {
    background: linear-gradient(to bottom, var(--mid), var(--deep));
}

/* Registry fields */
.registry-field {
    font-size: 0.75rem;
    line-height: 1.8;
    margin-bottom: 2px;
}

.field-label {
    font-weight: 500;
    color: var(--thermo);
    font-size: 0.65rem;
    letter-spacing: 0.05em;
    margin-right: 4px;
}

/* Depth Index */
#depth-index {
    padding: 0 0 48px;
}

.depth-index-strip {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    background: var(--abyss);
    border-top: 1px solid var(--thermo);
    border-bottom: 1px solid var(--thermo);
    cursor: grab;
}

.depth-index-strip:active {
    cursor: grabbing;
}

.depth-index-strip::-webkit-scrollbar {
    height: 2px;
}

.depth-index-strip::-webkit-scrollbar-track {
    background: var(--abyss);
}

.depth-index-strip::-webkit-scrollbar-thumb {
    background: var(--thermo);
}

.depth-index-svg {
    width: 3000px;
    height: 200px;
    display: block;
}

.depth-mountain-fill {
    fill: var(--mid);
    opacity: 0.3;
}

.depth-mountain-line {
    fill: none;
    stroke: var(--thermo);
    stroke-width: 1;
    opacity: 0.6;
}

.depth-mountain-fill-2 {
    fill: var(--deep);
    opacity: 0.5;
}

.depth-marker-text {
    fill: var(--thermo);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    font-weight: 500;
    opacity: 0.5;
}

/* Footer */
#bureau-footer {
    padding: 48px 24px;
    text-align: center;
    border-top: 1px solid var(--thermo);
    opacity: 0.6;
}

.footer-ridgeline {
    width: 100%;
    max-width: 600px;
    margin: 0 auto 24px;
    color: var(--thermo);
    opacity: 0.4;
}

.footer-ridgeline svg {
    width: 100%;
    height: 30px;
}

.footer-ridgeline path {
    stroke-width: 1;
}

.footer-text {
    font-family: var(--font-headline);
    font-weight: 700;
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    color: var(--surface);
    margin-bottom: 8px;
}

.footer-meta {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: 0.65rem;
    color: var(--thermo);
    letter-spacing: 0.1em;
}

/* Animation: initial hidden state */
.masonry-card[data-animate] {
    opacity: 0;
    transform: translateY(12px);
}

.masonry-card.animate-in {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 600ms cubic-bezier(0.16, 1, 0.3, 1),
                transform 600ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* Contour ring animation */
.contour-ring.animate-ring {
    opacity: 0.25;
    transition: opacity 300ms ease;
}

/* Ridgeline draw animation */
.ridge-path {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
}

.ridge-path.draw {
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1800ms ease-in-out;
}

/* SVG mountain draw animation */
.card-mountain path {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    stroke: var(--thermo);
    stroke-width: 1;
}

.card-mountain.draw path {
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1800ms ease-in-out;
    fill-opacity: 0;
}

.card-mountain.draw.fill-in path {
    fill-opacity: 1;
    transition: stroke-dashoffset 1800ms ease-in-out, fill-opacity 400ms 1800ms ease;
}

/* Responsive */
@media (max-width: 900px) {
    .masonry-grid {
        columns: 2;
        padding: 0 12px;
    }
    .masonry-registry {
        columns: 2;
    }
    #nav-monogram {
        top: 16px;
        left: 16px;
    }
}

@media (max-width: 600px) {
    .masonry-grid {
        columns: 1;
    }
    .masonry-registry {
        columns: 1;
    }
    .section-label {
        padding: 32px 12px 16px;
    }
    .header-coordinates {
        flex-direction: column;
        align-items: center;
        gap: 4px;
    }
    .coord-sep {
        display: none;
    }
}
