/* ========================================
   archetype.moe - Ocean Deep Design System
   Mid-century modern x marine biology
   ======================================== */

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

:root {
    /* Ocean Deep Palette */
    --abyssal-navy: #0B2545;
    --twilight-blue: #13395E;
    --open-water: #1B6B93;
    --surface-teal: #4A9EBF;
    --foam-white: #D4E4EC;
    --coral-pink: #FF6B6B;
    --sunfish-yellow: #F4D06F;
    --wet-sand: #E8DBC5;
    --mid-navy: #1A3A5C;

    /* Typography */
    --font-display: 'Cormorant Garamond', Georgia, serif;
    --font-body: 'Lora', Georgia, serif;
    --font-accent: 'DM Sans', Arial, sans-serif;

    /* Grid */
    --grid-cols: 8;
    --grid-gap: 6px;
    --max-width: 1200px;
    --module-radius: 4px;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    background-color: var(--twilight-blue);
    color: var(--foam-white);
    font-family: var(--font-body);
    line-height: 1.65;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Fixed Navigation --- */
.fixed-nav {
    position: fixed;
    top: 24px;
    left: 24px;
    z-index: 100;
}

.logo {
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.logo:hover {
    opacity: 0.8;
}

.logo-fish {
    display: block;
}

/* --- Fixed Depth Indicator --- */
.depth-indicator {
    position: fixed;
    bottom: 32px;
    right: 32px;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 12px;
    opacity: 0.9;
    transition: opacity 0.3s ease;
}

.depth-indicator:hover {
    opacity: 1;
}

.depth-gauge {
    display: flex;
    align-items: center;
}

.pressure-gauge {
    display: block;
}

.depth-text {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.depth-label {
    font-family: var(--font-accent);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--surface-teal);
    margin-right: 4px;
}

.depth-number-container {
    width: 24px;
    height: 24px;
    overflow: hidden;
    position: relative;
}

.depth-number {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 700;
    color: var(--foam-white);
    position: absolute;
    width: 100%;
    text-align: center;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.depth-total {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
    color: var(--surface-teal);
    opacity: 0.7;
}

/* --- Mobile Progress Bar --- */
.mobile-progress {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: rgba(11, 37, 69, 0.5);
    z-index: 100;
}

.mobile-progress-fill {
    height: 100%;
    background: var(--surface-teal);
    width: 20%;
    transition: width 0.4s ease;
}

/* --- Typography --- */
.heading-display {
    font-family: var(--font-display);
    font-size: clamp(48px, 6vw, 80px);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
    color: var(--foam-white);
    margin-bottom: 24px;
}

.accent-dot {
    color: var(--coral-pink);
}

.heading-section {
    font-family: var(--font-display);
    font-size: clamp(36px, 4vw, 56px);
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.15;
    color: var(--foam-white);
    margin-bottom: 20px;
}

.heading-section em {
    font-style: italic;
    font-weight: 600;
}

.heading-module {
    font-family: var(--font-display);
    font-size: clamp(22px, 2.5vw, 30px);
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--foam-white);
    margin-bottom: 10px;
}

.body-text {
    font-family: var(--font-body);
    font-size: clamp(16px, 1.2vw, 19px);
    font-weight: 400;
    line-height: 1.65;
    letter-spacing: 0.01em;
    color: #B8D4E3;
    margin-bottom: 16px;
}

.body-text:last-child {
    margin-bottom: 0;
}

.label-text {
    font-family: var(--font-accent);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    display: block;
}

.caption-text {
    font-family: var(--font-body);
    font-size: 15px;
    font-weight: 400;
    line-height: 1.5;
}

.caption-text em {
    font-style: italic;
}

/* --- Depth Sections --- */
.depth-section {
    position: relative;
    padding: 80px 24px;
    min-height: 100vh;
    overflow: hidden;
}

.depth-1 {
    background-color: var(--twilight-blue);
}

.depth-2 {
    background-color: #112e50;
}

.depth-3 {
    background-color: #0e274a;
}

.depth-4 {
    background-color: #0c2244;
}

.depth-5 {
    background-color: var(--abyssal-navy);
}

/* --- Module Grid --- */
.module-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: var(--grid-gap);
    max-width: var(--max-width);
    margin: 0 auto;
    align-items: start;
}

/* Column spans */
.col-2 { grid-column: span 2; }
.col-3 { grid-column: span 3; }
.col-4 { grid-column: span 4; }
.col-5 { grid-column: span 5; }
.col-6 { grid-column: span 6; }

/* Row heights */
.row-short { min-height: 200px; }
.row-medium { min-height: 380px; }
.row-tall { min-height: 560px; }

/* --- Module Base Styles --- */
.module {
    position: relative;
    border-radius: var(--module-radius);
    overflow: hidden;
    transition: border-color 0.2s ease;
    border: 2px solid transparent;
}

/* Staggered vertical offset for visual rhythm */
.module:nth-child(2n) {
    margin-top: 28px;
}

.module:nth-child(3n) {
    margin-top: 16px;
}

.module:nth-child(5n) {
    margin-top: 36px;
}

/* --- Module Types --- */

/* Reef Block */
.reef-block {
    background-color: var(--abyssal-navy);
    padding: 40px 36px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.reef-block .module-content {
    position: relative;
    z-index: 2;
}

.reef-block .body-text {
    color: #B8D4E3;
}

/* Specimen Block */
.specimen-block {
    background-color: var(--twilight-blue);
    padding: 32px 28px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.specimen-block .module-content {
    position: relative;
    z-index: 2;
    text-align: center;
}

.specimen-block .label-text {
    color: var(--surface-teal);
    margin-bottom: 8px;
}

.specimen-block .body-text,
.specimen-block .caption-text {
    color: #B8D4E3;
}

/* Caption Block */
.caption-block {
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.caption-gold {
    background-color: var(--sunfish-yellow);
}

.caption-gold .caption-text,
.caption-gold .label-text {
    color: var(--abyssal-navy);
}

.caption-coral {
    background-color: var(--coral-pink);
}

.caption-coral .caption-text,
.caption-coral .label-text {
    color: var(--abyssal-navy);
}

/* Tide Block */
.tide-block {
    background-color: var(--twilight-blue);
    position: relative;
    min-height: 200px;
}

/* --- Water Caustics --- */
.caustic-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 2s ease;
}

.tide-block.is-visible .caustic-layer {
    opacity: 1;
}

.caustic-1 {
    background:
        radial-gradient(ellipse 80px 60px at 30% 40%, rgba(74, 158, 191, 0.08) 0%, transparent 70%),
        radial-gradient(ellipse 60px 80px at 70% 60%, rgba(74, 158, 191, 0.06) 0%, transparent 70%),
        radial-gradient(ellipse 100px 40px at 50% 20%, rgba(74, 158, 191, 0.07) 0%, transparent 70%);
    animation: causticMove1 8s ease-in-out infinite;
}

.caustic-2 {
    background:
        radial-gradient(ellipse 70px 50px at 60% 30%, rgba(74, 158, 191, 0.06) 0%, transparent 70%),
        radial-gradient(ellipse 50px 70px at 20% 70%, rgba(74, 158, 191, 0.08) 0%, transparent 70%),
        radial-gradient(ellipse 90px 35px at 80% 50%, rgba(74, 158, 191, 0.05) 0%, transparent 70%);
    animation: causticMove2 10s ease-in-out infinite;
}

.caustic-3 {
    background:
        radial-gradient(ellipse 60px 90px at 40% 60%, rgba(74, 158, 191, 0.07) 0%, transparent 70%),
        radial-gradient(ellipse 80px 50px at 80% 20%, rgba(74, 158, 191, 0.05) 0%, transparent 70%);
    animation: causticMove3 12s ease-in-out infinite;
}

@keyframes causticMove1 {
    0%, 100% { transform: scale(1) rotate(0deg); opacity: 0.08; }
    33% { transform: scale(1.15) rotate(2deg); opacity: 0.12; }
    66% { transform: scale(0.95) rotate(-1deg); opacity: 0.06; }
}

@keyframes causticMove2 {
    0%, 100% { transform: scale(1) rotate(0deg); opacity: 0.06; }
    50% { transform: scale(1.1) rotate(-2deg); opacity: 0.1; }
}

@keyframes causticMove3 {
    0%, 100% { transform: scale(1.05) rotate(1deg); opacity: 0.07; }
    50% { transform: scale(0.9) rotate(-1.5deg); opacity: 0.1; }
}

/* --- Bubble Accents --- */
.bubble-accents {
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.bubble {
    position: absolute;
    border-radius: 50%;
    background-color: var(--foam-white);
    display: block;
    transition: transform 0.4s ease, opacity 0.4s ease;
}

.module:hover .bubble {
    transform: translateY(-8px);
    opacity: 0.45;
}

/* --- Starburst Accents --- */
.starburst-accent {
    position: absolute;
    top: 12px;
    left: 14px;
}

.starburst-accent.starburst-right {
    left: auto;
    right: 14px;
}

/* --- Fish Illustrations --- */
.fish-illustration {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2;
    margin-top: 20px;
}

.fish-svg {
    width: 100%;
    max-width: 320px;
    height: auto;
}

/* SVG Path-Draw Animation */
.draw-path {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 1.4s ease-in-out;
}

.draw-detail {
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
    transition: stroke-dashoffset 1s ease-in-out 0.4s;
}

.fish-fills path {
    transition: opacity 0.6s ease 1s;
}

/* When visible, draw the paths */
.module.is-visible .draw-path {
    stroke-dashoffset: 0;
}

.module.is-visible .draw-detail {
    stroke-dashoffset: 0;
}

.module.is-visible .fish-fills path {
    opacity: 0.35;
}

/* Anemone paths */
.anemone-bg .draw-path {
    stroke-dasharray: 400;
    stroke-dashoffset: 400;
}

.module.is-visible .anemone-bg .draw-path {
    stroke-dashoffset: 0;
}

/* --- Wandering Fish --- */
.wandering-fish {
    position: absolute;
    z-index: 5;
    transition: transform 0.6s ease;
    pointer-events: none;
}

.wf-1 { top: 15%; left: 82%; }
.wf-2 { top: 70%; left: 5%; }
.wf-3 { top: 25%; right: 4%; }
.wf-4 { top: 60%; left: 3%; }
.wf-5 { top: 40%; right: 6%; }
.wf-6 { top: 80%; left: 8%; }

.wandering-fish.startled {
    transform: rotate(12deg) translateX(5px);
}

/* --- Ocean Floor Divider --- */
.ocean-floor-divider {
    width: 100%;
    height: 120px;
    position: relative;
    overflow: hidden;
}

.seabed-svg {
    display: block;
    width: 100%;
    height: 100%;
}

/* Section-specific divider backgrounds for depth progression */
.depth-1 + .ocean-floor-divider {
    background-color: var(--twilight-blue);
    background: linear-gradient(to bottom, var(--twilight-blue), #112e50);
}

.depth-2 + .ocean-floor-divider {
    background-color: #112e50;
    background: linear-gradient(to bottom, #112e50, #0e274a);
}

.depth-3 + .ocean-floor-divider {
    background-color: #0e274a;
    background: linear-gradient(to bottom, #0e274a, #0c2244);
}

.depth-4 + .ocean-floor-divider {
    background-color: #0c2244;
    background: linear-gradient(to bottom, #0c2244, var(--abyssal-navy));
}

/* --- Module Hover Effects --- */
.reef-block:hover,
.specimen-block:hover {
    border-color: var(--surface-teal);
}

/* --- Scroll-Triggered Entrance Animations --- */

/* Initial hidden states */
.animate-reef {
    opacity: 0;
    transform: translateY(30px);
}

.animate-specimen {
    opacity: 0;
    transform: scale(0.92);
}

.animate-caption {
    opacity: 0;
}

.animate-caption[data-position="left"] {
    transform: translateX(-30px);
}

.animate-caption[data-position="right"] {
    transform: translateX(30px);
}

.animate-tide {
    opacity: 0;
}

/* Visible states */
.animate-reef.is-visible {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94), transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.animate-specimen.is-visible {
    opacity: 1;
    transform: scale(1);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.animate-caption.is-visible {
    opacity: 1;
    transform: translateX(0);
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.animate-tide.is-visible {
    opacity: 1;
    transition: opacity 0.5s ease-out;
}

/* --- Process Steps --- */
.process-steps {
    margin-top: 28px;
}

.process-step {
    display: flex;
    align-items: baseline;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(74, 158, 191, 0.15);
}

.process-step:last-child {
    border-bottom: none;
}

.step-number {
    font-family: var(--font-accent);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.1em;
    color: var(--surface-teal);
    min-width: 28px;
}

.step-name {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 600;
    color: var(--foam-white);
    min-width: 140px;
}

.step-desc {
    font-family: var(--font-body);
    font-size: 15px;
    color: #B8D4E3;
    opacity: 0.8;
}

/* --- Contact Links --- */
.contact-links {
    margin-top: 28px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.contact-link {
    display: flex;
    align-items: baseline;
    gap: 16px;
    text-decoration: none;
    padding: 10px 0;
    border-bottom: 1px solid rgba(74, 158, 191, 0.15);
    transition: border-color 0.3s ease;
}

.contact-link:hover {
    border-color: var(--surface-teal);
}

.contact-link:last-child {
    border-bottom: none;
}

.link-label {
    font-family: var(--font-accent);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--surface-teal);
    min-width: 70px;
}

.link-value {
    font-family: var(--font-body);
    font-size: 17px;
    color: var(--foam-white);
    transition: color 0.3s ease;
}

.contact-link:hover .link-value {
    color: var(--surface-teal);
}

/* --- Footer --- */
.site-footer {
    background-color: var(--abyssal-navy);
    padding: 48px 24px 32px;
    text-align: center;
    position: relative;
}

.footer-content {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
}

.footer-content .label-text {
    display: inline;
    color: var(--surface-teal);
    opacity: 0.6;
}

.footer-divider {
    color: var(--surface-teal);
    opacity: 0.3;
}

.coral-border-footer {
    margin-top: 24px;
}

.coral-border-svg {
    display: block;
    width: 100%;
    height: 40px;
}

/* --- Responsive: Tablet (768px) --- */
@media (max-width: 768px) {
    .module-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 4px;
    }

    .col-2, .col-3, .col-4, .col-5, .col-6 {
        grid-column: span 4;
    }

    .col-2 {
        grid-column: span 2;
    }

    .col-3 {
        grid-column: span 2;
    }

    .depth-section {
        padding: 48px 16px;
    }

    .heading-display {
        font-size: 42px;
    }

    .heading-section {
        font-size: 32px;
    }

    .wandering-fish {
        display: none;
    }

    .depth-indicator {
        display: none;
    }

    .mobile-progress {
        display: block;
    }

    .reef-block {
        padding: 28px 24px;
    }

    .specimen-block {
        padding: 24px 20px;
    }

    .module:nth-child(2n),
    .module:nth-child(3n),
    .module:nth-child(5n) {
        margin-top: 0;
    }

    .row-tall {
        min-height: 420px;
    }

    .row-medium {
        min-height: 280px;
    }

    .process-step {
        flex-direction: column;
        gap: 4px;
    }

    .step-name {
        min-width: auto;
    }

    .fish-svg {
        max-width: 240px;
    }
}

/* --- Responsive: Mobile (480px) --- */
@media (max-width: 480px) {
    .module-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 4px;
    }

    .col-2, .col-3, .col-4, .col-5, .col-6 {
        grid-column: span 2;
    }

    .depth-section {
        padding: 32px 12px;
    }

    .heading-display {
        font-size: 36px;
    }

    .heading-section {
        font-size: 28px;
    }

    .reef-block {
        padding: 24px 18px;
    }

    .specimen-block {
        padding: 20px 16px;
    }

    .row-tall {
        min-height: 360px;
    }

    .row-medium {
        min-height: 240px;
    }

    .row-short {
        min-height: 150px;
    }

    .ocean-floor-divider {
        height: 80px;
    }

    .fish-svg {
        max-width: 200px;
    }

    .contact-link {
        flex-direction: column;
        gap: 4px;
    }

    .fixed-nav {
        top: 16px;
        left: 16px;
    }
}
