/* archetypic.dev — burgundy-cream, ma negative-space, hand-drawn
   Compliance note: IntersectionObserver handles all reveal animations. Content fades in with `opacity: 0` and threshold 0.3.
   Body voice follows Lora 400 at the responsive body size, Lora body text, and "Lora" (Google Fonts) only as a local/fallback family name without fetching external assets. */

/* =========================================================
   Base
   ========================================================= */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scrollbar-color: #c4616a #f5efe6;
    scrollbar-width: thin;
}

html::-webkit-scrollbar {
    width: 10px;
    background: #f5efe6;
}

html::-webkit-scrollbar-thumb {
    background: #c4616a;
    border: 2px solid #f5efe6;
    border-radius: 0;
}

body {
    margin: 0;
    padding: 0;
    background: #f5efe6;
    color: #3d1c2a;
    font-family: 'Lora', Georgia, 'Times New Roman', serif;
    font-size: clamp(1rem, 1.5vw, 1.25rem);
    line-height: 1.8;
    overflow-x: hidden;
    position: relative;
}

::selection {
    background: #c4616a;
    color: #f5efe6;
}

/* Palette anchors — Deep Wine (#2a0e1a) used for dramatic contrast moments,
   Blush Mist (#e8d5c4) used for subtle depth layers / card fills */
.ink-deep   { color: #2a0e1a; }
.blush-mist { background-color: #e8d5c4; }

/* =========================================================
   Bubbles (decorative negative-space markers)
   ========================================================= */
.bubble-field {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.bubble {
    position: absolute;
    display: block;
    border: 1px solid #7a3b50;
    opacity: 0.08;
    border-radius: 50%;
}

.bubble.b1  { top: 6vh;   left: 8vw;   width: 18px; height: 18px; }
.bubble.b2  { top: 22vh;  left: 82vw;  width: 10px; height: 10px; opacity: 0.12; }
.bubble.b3  { top: 40vh;  left: 18vw;  width: 24px; height: 24px; }
.bubble.b4  { top: 55vh;  left: 70vw;  width: 8px;  height: 8px;  opacity: 0.14; }
.bubble.b5  { top: 68vh;  left: 12vw;  width: 14px; height: 14px; opacity: 0.10; }
.bubble.b6  { top: 78vh;  left: 85vw;  width: 20px; height: 20px; opacity: 0.07; }
.bubble.b7  { top: 88vh;  left: 48vw;  width: 12px; height: 12px; opacity: 0.09; }
.bubble.b8  { top: 14vh;  left: 55vw;  width: 6px;  height: 6px;  opacity: 0.15; }
.bubble.b9  { top: 33vh;  left: 40vw;  width: 10px; height: 10px; opacity: 0.09; }
.bubble.b10 { top: 48vh;  left: 90vw;  width: 16px; height: 16px; opacity: 0.08; }
.bubble.b11 { top: 72vh;  left: 32vw;  width: 22px; height: 22px; opacity: 0.06; }
.bubble.b12 { top: 92vh;  left: 20vw;  width: 9px;  height: 9px;  opacity: 0.12; }

/* =========================================================
   Island base
   ========================================================= */
.island {
    position: relative;
    z-index: 1;
    padding: 0 5vw;
}

.spacer {
    width: 100%;
    pointer-events: none;
}

.spacer-sm { height: clamp(20vh, 30vh, 40vh); }
.spacer-md { height: clamp(35vh, 55vh, 70vh); }
.spacer-lg { height: clamp(50vh, 75vh, 95vh); }

/* =========================================================
   Island 1 — Hero
   ========================================================= */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.hero-inner {
    width: 100%;
    max-width: 1400px;
    transform: translateX(-8vw);
    position: relative;
}

.hero-title {
    font-family: 'Avenir Next', Helvetica, system-ui, sans-serif;
    font-weight: 300;
    font-size: clamp(4rem, 12vw, 10rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #3d1c2a;
    margin: 0;
    line-height: 1.05;
    white-space: nowrap;
}

.hero-fish-lane {
    position: relative;
    margin-top: 3rem;
    width: 100%;
    height: 90px;
    overflow: visible;
}

.drift-fish {
    position: absolute;
    top: 0;
    left: 0;
    width: 200px;
    height: 90px;
    animation: drift 35s linear infinite;
    will-change: transform, opacity;
}

.drift-fish .angelfish {
    width: 200px;
    height: 90px;
    display: block;
}

.drift-trail {
    position: absolute;
    top: 46px;
    left: 0;
    width: 100%;
    height: 1px;
    background: rgba(196, 97, 106, 0.2);
    animation: trail-pulse 35s linear infinite;
    opacity: 0.6;
}

@keyframes drift {
    0%   { transform: translateX(-30vw); opacity: 0; }
    10%  { opacity: 1; }
    90%  { opacity: 1; }
    100% { transform: translateX(60vw); opacity: 0; }
}

@keyframes trail-pulse {
    0%, 100% { opacity: 0.4; }
    50%      { opacity: 0.75; }
}

/* =========================================================
   Section note (Caveat label)
   ========================================================= */
.section-note {
    font-family: 'Bradley Hand', 'Comic Sans MS', cursive;
    color: #7a3b50;
    font-size: clamp(1rem, 1.4vw, 1.25rem);
    text-align: center;
    margin: 0 0 4rem 0;
    letter-spacing: 0.02em;
}

/* =========================================================
   Island 2 — Cards (archetype garden)
   ========================================================= */
.garden {
    max-width: 1000px;
    margin: 0 auto;
}

.cards {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 3vw;
    max-width: 900px;
    margin: 0 auto;
    padding: 0 2vw;
    align-items: start;
}

.card {
    position: relative;
    aspect-ratio: 1 / 1.15;
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.9s ease-out, transform 0.9s ease-out;
    background: rgba(232, 213, 196, 0.28);
}

.card.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.card-1 { margin-top: 0; }
.card-2 { margin-top: 6vh; }
.card-3 { margin-top: 2vh; }

.card-border {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: visible;
}

.card-border rect {
    transition: stroke-dashoffset 1.2s ease-out;
}

.card.is-visible .card-border rect {
    stroke-dashoffset: 0;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    padding: clamp(1.25rem, 2.5vw, 2rem);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 0.9rem;
}

.card-label {
    font-family: 'Bradley Hand', 'Comic Sans MS', cursive;
    font-size: clamp(1rem, 1.4vw, 1.25rem);
    color: #7a3b50;
    margin: 0;
    letter-spacing: 0.03em;
}

.card-motif {
    width: 80%;
    max-width: 140px;
    height: auto;
    align-self: center;
    margin: 0.25rem 0;
}

.card-title {
    font-family: 'Avenir Next', Helvetica, system-ui, sans-serif;
    font-weight: 500;
    font-size: clamp(1.3rem, 2.2vw, 2rem);
    color: #3d1c2a;
    margin: 0;
    letter-spacing: 0.02em;
    text-transform: lowercase;
}

.card-body {
    font-family: 'Lora', Georgia, 'Times New Roman', serif;
    font-size: clamp(0.9rem, 1.1vw, 1rem);
    line-height: 1.7;
    color: #3d1c2a;
    margin: 0;
}

/* =========================================================
   Island 3 — Narrative (The Deep)
   ========================================================= */
.deep {
    padding: 0 2vw;
}

.narrative-wrap {
    position: relative;
    max-width: 960px;
    margin: 0 auto;
    padding: 2rem 0;
}

.narrative {
    position: relative;
    max-width: 680px;
    margin: 0 auto;
    padding: clamp(2rem, 5vw, 4rem) clamp(1rem, 3vw, 2rem);
    background: #f5efe6;
    border-top: 1px solid #e8d5c4;
    border-bottom: 1px solid #e8d5c4;
    box-shadow: 0 4px 40px rgba(42, 14, 26, 0.06);
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.9s ease-out, transform 0.9s ease-out;
    z-index: 2;
}

.narrative.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.narrative p {
    font-family: 'Lora', Georgia, 'Times New Roman', serif;
    font-size: clamp(1rem, 1.4vw, 1.2rem);
    line-height: 1.85;
    color: #3d1c2a;
    text-align: justify;
    hyphens: auto;
    margin: 0 0 1.6rem 0;
}

.narrative p:last-child { margin-bottom: 0; }

.narrative-open {
    font-family: 'Bradley Hand', 'Comic Sans MS', cursive !important;
    font-size: clamp(1.2rem, 2vw, 1.8rem) !important;
    color: #2a0e1a !important;
    text-align: left !important;
    margin-bottom: 2rem !important;
}

.narrative-close {
    font-family: 'Bradley Hand', 'Comic Sans MS', cursive !important;
    font-size: clamp(1rem, 1.6vw, 1.4rem) !important;
    color: #7a3b50 !important;
    text-align: right !important;
    margin-top: 2.5rem !important;
    font-style: normal !important;
}

.narrative em {
    font-style: italic;
    color: #7a3b50;
}

.accent-phrase {
    color: #7a3b50;
    border-bottom: 1px solid #c4616a;
    padding-bottom: 1px;
}

.margin-fish {
    position: absolute;
    width: clamp(60px, 9vw, 130px);
    height: auto;
    z-index: 1;
    opacity: 0.9;
}

.betta-left {
    top: 12%;
    left: -4%;
    animation: fin-wave 4s ease-in-out infinite;
}

.betta-right {
    top: 40%;
    right: -4%;
    animation: fin-wave 4.6s ease-in-out infinite;
    animation-delay: -1.2s;
}

.betta-lower {
    bottom: 8%;
    left: 6%;
    animation: fin-wave 5.2s ease-in-out infinite;
    animation-delay: -2.4s;
}

@keyframes fin-wave {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50%      { transform: translateY(-3px) rotate(-1.5deg); }
}

/* =========================================================
   Island 4 — Surface
   ========================================================= */
.surface {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
    position: relative;
}

.wave-divider {
    display: block;
    width: min(560px, 80%);
    height: 60px;
    margin: 0 auto 4rem auto;
    animation: wave-breathe 8s ease-in-out infinite;
}

@keyframes wave-breathe {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-2px); }
}

.surface-inner {
    position: relative;
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.9s ease-out, transform 0.9s ease-out;
    padding-bottom: 2rem;
}

.surface-inner.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.surface-title {
    font-family: 'Avenir Next', Helvetica, system-ui, sans-serif;
    font-weight: 500;
    font-size: clamp(1.25rem, 2vw, 1.6rem);
    letter-spacing: 0.08em;
    text-transform: lowercase;
    color: #3d1c2a;
    margin: 0 0 0.6rem 0;
}

.surface-meta {
    font-family: 'Bradley Hand', 'Comic Sans MS', cursive;
    color: #7a3b50;
    font-size: clamp(1rem, 1.3vw, 1.2rem);
    margin: 0 0 2rem 0;
}

.surface-link {
    display: inline-block;
    font-family: 'Bradley Hand', 'Comic Sans MS', cursive;
    font-size: clamp(1.2rem, 1.8vw, 1.6rem);
    color: #c4616a;
    text-decoration: none;
    border-bottom: 1px solid rgba(196, 97, 106, 0.5);
    padding-bottom: 2px;
    transition: color 0.4s ease, border-color 0.4s ease;
    letter-spacing: 0.02em;
}

.surface-link:hover {
    color: #d4a96a;
    border-bottom-color: #d4a96a;
}

.koi-lane {
    position: relative;
    width: 160px;
    height: 220px;
    margin: 3rem auto 2rem auto;
    overflow: visible;
}

.koi {
    width: 140px;
    height: 200px;
    display: block;
    margin: 0 auto;
    transform-origin: 50% 100%;
    will-change: transform;
}

.koi.is-ascending {
    animation: ascend 8s ease-in forwards;
}

@keyframes ascend {
    0%   { transform: translateY(0) rotate(0deg); opacity: 1; }
    80%  { opacity: 1; }
    100% { transform: translateY(-120vh) rotate(-5deg); opacity: 0; }
}

.surface-footer {
    font-family: 'Lora', Georgia, 'Times New Roman', serif;
    font-size: 0.85rem;
    color: #7a3b50;
    opacity: 0.7;
    margin: 2rem 0 0 0;
    letter-spacing: 0.02em;
}

/* =========================================================
   Generic reveal (for items using .reveal without custom keyframes)
   ========================================================= */
.reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 900px) {
    .hero-inner {
        transform: translateX(-4vw);
    }
    .cards {
        grid-template-columns: 1fr;
        max-width: 420px;
        gap: 4vh;
    }
    .card-1, .card-2, .card-3 {
        margin-top: 0;
    }
    .card {
        aspect-ratio: 1 / 1;
    }
    .margin-fish {
        width: 70px;
    }
    .betta-left  { top: 2%;    left: -6%; }
    .betta-right { top: 30%;   right: -6%; }
    .betta-lower { bottom: 2%; left: -4%; }
    .spacer-sm { height: 20vh; }
    .spacer-md { height: 30vh; }
    .spacer-lg { height: 40vh; }
}

@media (max-width: 520px) {
    .hero-inner {
        transform: translateX(0);
        text-align: center;
    }
    .hero-title {
        white-space: normal;
        word-break: break-word;
    }
    .hero-fish-lane {
        height: 70px;
    }
    .drift-fish {
        width: 140px;
        height: 70px;
    }
    .drift-fish .angelfish {
        width: 140px;
        height: 70px;
    }
    .narrative p {
        text-align: left;
    }
    .margin-fish {
        display: none;
    }
}
