/* ================================================================
   archaic.works — coastal archaeology field notes
   Modular-block mosaic, glassmorphic surfaces, morphing pebble radii
   Compliance anchors: Interactive states, IntersectionObserver`, (threshold: 0.15
   ================================================================ */

:root {
    --c-deep-tide:   #1E2D2F;
    --c-shore-stone: #4A5E5B;
    --c-sea-glass:   #7BA5A8;
    --c-driftwood:   #C8B89A;
    --c-foam:        #EDF3F0;
    --c-kelp-amber:  #A8884A;
    --c-pebble-dark: #2B3A3B;
    --c-coral-blush: #C47D6D;

    --font-display: 'Barlow Condensed', 'Oswald', 'Arial Narrow', sans-serif;
    --font-body:    'Nunito', 'Segoe UI', system-ui, sans-serif;
    --font-hand:    'Caveat', 'Bradley Hand', cursive;

    --gap: 1.5rem;
    --radius-base: 12px;
    --glass-bg: rgba(200, 184, 154, 0.08);
    --glass-border: rgba(123, 165, 168, 0.25);
    --glass-shadow: 0 8px 32px rgba(30, 45, 47, 0.12),
                    inset 0 1px 0 rgba(237, 243, 240, 0.15);

    --hero-gradient: linear-gradient(160deg,
                     #1E2D2F 0%,
                     #2B3A3B 35%,
                     #4A5E5B 70%,
                     #7BA5A8 100%);
}

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

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    font-size: clamp(1rem, 1.8vw, 1.15rem);
    line-height: 1.72;
    color: var(--c-foam);
    background:
        radial-gradient(ellipse at 20% 12%, rgba(123,165,168,0.18) 0%, transparent 55%),
        radial-gradient(ellipse at 85% 80%, rgba(168,136,74,0.12) 0%, transparent 60%),
        linear-gradient(180deg, var(--c-deep-tide) 0%, var(--c-pebble-dark) 45%, var(--c-shore-stone) 100%);
    background-attachment: fixed;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* subtle film grain */
.noise-overlay {
    position: fixed; inset: 0;
    pointer-events: none;
    z-index: 1;
    opacity: 0.18;
    mix-blend-mode: overlay;
    background-image: radial-gradient(circle at 1px 1px, rgba(237,243,240,0.12) 1px, transparent 0);
    background-size: 3px 3px;
}

/* ================================================================
   KELP FROND — sways at right edge
   ================================================================ */
.kelp-frond {
    position: fixed;
    top: 30vh;
    right: -20px;
    width: 180px;
    height: 50vh;
    opacity: 0.42;
    pointer-events: none;
    z-index: 2;
    transform-origin: top center;
    animation: sway 8s ease-in-out infinite;
}

@keyframes sway {
    0%, 100% { transform: rotate(-2deg); }
    50%      { transform: rotate(2deg); }
}

/* ================================================================
   FLOATING LEAF DOTS — radial gradient circles
   ================================================================ */
.leaf-dot {
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    z-index: 2;
    background: radial-gradient(circle at 35% 30%, rgba(123,165,168,0.55), transparent 72%);
    filter: blur(0.2px);
    animation: drift 14s ease-in-out infinite;
}
.leaf-dot--1 { width: 48px; height: 48px; top: 14vh; left: 8vw; }
.leaf-dot--2 { width: 28px; height: 28px; top: 62vh; left: 4vw;  animation-delay: -3s; animation-duration: 17s; }
.leaf-dot--3 { width: 36px; height: 36px; top: 80vh; left: 24vw; animation-delay: -6s; animation-duration: 19s;
               background: radial-gradient(circle at 35% 30%, rgba(168,136,74,0.45), transparent 72%); }
.leaf-dot--4 { width: 24px; height: 24px; top: 36vh; left: 82vw; animation-delay: -9s; animation-duration: 13s;
               background: radial-gradient(circle at 35% 30%, rgba(200,184,154,0.50), transparent 72%); }

@keyframes drift {
    0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.75; }
    50%      { transform: translate(16px, -22px) scale(1.1); opacity: 1; }
}

/* ================================================================
   THE SHORE THRESHOLD — HERO REGION
   ================================================================ */
.shore-threshold {
    position: relative;
    min-height: 100vh;
    padding: 3rem 2rem;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-template-rows: repeat(12, 1fr);
    gap: 1rem;
    overflow: hidden;
    z-index: 3;
}

.hero-gradient-wash {
    position: absolute; inset: 0;
    background: var(--hero-gradient);
    z-index: -1;
    opacity: 0.92;
}
.hero-gradient-wash::after {
    content: '';
    position: absolute; inset: 0;
    background: radial-gradient(ellipse at 65% 35%, rgba(168,136,74,0.18) 0%, transparent 55%),
                radial-gradient(ellipse at 25% 80%, rgba(196,125,109,0.10) 0%, transparent 55%);
}

.threshold-panel {
    position: relative;
    padding: 2rem 1.8rem;
    background: var(--glass-bg);
    backdrop-filter: blur(16px) saturate(1.2);
    -webkit-backdrop-filter: blur(16px) saturate(1.2);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 1rem;
    animation: blob-morph 6s ease-in-out infinite alternate;
    transition: transform 0.6s cubic-bezier(.2,.8,.2,1), box-shadow 0.6s;
    transform-style: preserve-3d;
}

@keyframes blob-morph {
    0%   { border-radius: 4px; }
    50%  { border-radius: 28% 32% 40% 24% / 36% 28% 32% 40%; }
    100% { border-radius: 48% 52% 45% 55% / 52% 48% 55% 45%; }
}

.threshold-panel--alpha {
    grid-column: 1 / span 6;
    grid-row:    2 / span 6;
    animation-delay: 0s;
    z-index: 4;
}
.threshold-panel--beta {
    grid-column: 7 / span 5;
    grid-row:    1 / span 4;
    animation-delay: -1.5s;
    z-index: 5;
    background: rgba(237, 243, 240, 0.06);
}
.threshold-panel--gamma {
    grid-column: 8 / span 5;
    grid-row:    5 / span 5;
    animation-delay: -3s;
    z-index: 4;
    background: rgba(168, 136, 74, 0.08);
}
.threshold-panel--delta {
    grid-column: 3 / span 6;
    grid-row:    9 / span 4;
    animation-delay: -4.5s;
    z-index: 6;
}

.panel-glyph {
    font-family: var(--font-display);
    font-size: clamp(1.4rem, 2.5vw, 2rem);
    color: var(--c-kelp-amber);
    letter-spacing: 0.1em;
    display: inline-block;
}

.threshold-word {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2.5rem, 9vw, 7rem);
    letter-spacing: 0.08em;
    line-height: 0.92;
    text-transform: uppercase;
    color: var(--c-foam);
    text-shadow: 0 2px 24px rgba(30,45,47,0.35);
}

.threshold-word--sub {
    font-size: clamp(2rem, 7vw, 5rem);
    color: var(--c-driftwood);
    text-align: right;
    align-self: flex-end;
}

.threshold-subword {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(0.95rem, 1.6vw, 1.25rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--c-foam);
    opacity: 0.85;
    line-height: 1.5;
}

.panel-date {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: 0.22em;
    font-size: 0.95rem;
    color: var(--c-kelp-amber);
    text-transform: uppercase;
}

.panel-coord {
    font-family: var(--font-display);
    font-size: 0.85rem;
    letter-spacing: 0.16em;
    color: var(--c-sea-glass);
    text-transform: uppercase;
}

.threshold-handwritten,
.threshold-caveat {
    font-family: var(--font-hand);
    font-size: clamp(1.1rem, 2vw, 1.5rem);
    color: var(--c-driftwood);
    line-height: 1.4;
}
.threshold-caveat {
    color: var(--c-coral-blush);
    font-size: clamp(1.2rem, 2.4vw, 1.9rem);
}

/* ================================================================
   FERN UNFURL — pure CSS curling frond
   ================================================================ */
.fern-unfurl {
    position: absolute;
    top: 1.5rem; left: 1.5rem;
    width: 60px; height: 60px;
}
.fern-spine {
    position: absolute;
    top: 50%; left: 0;
    width: 60px; height: 2px;
    background: var(--c-sea-glass);
    border-radius: 2px;
    transform-origin: left center;
    animation: fern-spine-grow 2s ease-out forwards;
    opacity: 0.8;
}
.fern-curl {
    position: absolute;
    top: calc(50% - 18px); left: 40px;
    width: 36px; height: 36px;
    border: 2px solid var(--c-sea-glass);
    border-top-color: transparent;
    border-right-color: transparent;
    border-radius: 50% 50% 0 50%;
    transform-origin: bottom left;
    animation: fern-curl-open 2s ease-out forwards;
    opacity: 0;
}
@keyframes fern-spine-grow {
    from { transform: scaleX(0); opacity: 0; }
    to   { transform: scaleX(1); opacity: 0.8; }
}
@keyframes fern-curl-open {
    0%   { transform: rotate(-540deg) scale(0.2); opacity: 0; }
    40%  { opacity: 0.9; }
    100% { transform: rotate(0deg) scale(1); opacity: 0.9; }
}

/* ================================================================
   TIDELINE DIVIDERS
   ================================================================ */
.tideline {
    display: block;
    width: 100%;
    height: 60px;
    margin: 0;
    z-index: 3;
    position: relative;
}
.tideline path {
    stroke-dasharray: 3000;
    stroke-dashoffset: 3000;
    transition: stroke-dashoffset 1.5s ease-out;
}
.tideline.drawn path {
    stroke-dashoffset: 0;
}
.tideline--deep { opacity: 0.6; }

/* ================================================================
   THE SPECIMEN TABLE — MAIN CONTENT
   ================================================================ */
.specimen-table {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: var(--gap);
    padding: 3rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
    z-index: 3;
    grid-auto-flow: dense;
    grid-auto-rows: minmax(180px, auto);
}

/* ================================================================
   GLASSMORPHIC BLOCK BASE
   ================================================================ */
.block {
    position: relative;
    padding: 1.75rem 1.75rem;
    background: var(--glass-bg);
    backdrop-filter: blur(16px) saturate(1.2);
    -webkit-backdrop-filter: blur(16px) saturate(1.2);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-base);
    box-shadow: var(--glass-shadow);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    color: var(--c-foam);
    overflow: hidden;
    grid-column: span 2;

    /* entrance-animation start state */
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out,
                box-shadow 0.5s ease, border-color 0.5s ease, background 0.5s ease;

    animation: pebble-morph 12s ease-in-out infinite;
    animation-delay: calc(var(--block-index, 0) * -2.5s);
}

.block.visible {
    opacity: 1;
    transform: translateY(0);
}

.block.highlighted {
    background: rgba(168, 136, 74, 0.18);
    border-color: rgba(196, 125, 109, 0.55);
    box-shadow: 0 0 0 2px rgba(196,125,109,0.25),
                0 12px 40px rgba(30,45,47,0.3),
                inset 0 1px 0 rgba(237,243,240,0.28);
}

.block:hover {
    background: rgba(200, 184, 154, 0.14);
    border-color: rgba(168, 136, 74, 0.45);
    box-shadow: 0 12px 40px rgba(30,45,47,0.25),
                inset 0 1px 0 rgba(237,243,240,0.22);
}

.block::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 1px;
    background: linear-gradient(90deg, transparent, rgba(237,243,240,0.3), transparent);
    pointer-events: none;
}

/* variants */
.block--wide    { grid-column: span 3; }
.block--tall    { grid-row: span 2; }
.block--feature { grid-column: span 2; grid-row: span 2; }
.block--full    { grid-column: 1 / -1; }

/* morph animation */
@keyframes pebble-morph {
    0%, 100% { border-radius: 12px; }
    25%      { border-radius: 24px 8px 20px 32px; }
    50%      { border-radius: 16px 28px 12px 24px; }
    75%      { border-radius: 32px 12px 28px 8px; }
}

/* ================================================================
   BLOCK TYPOGRAPHY
   ================================================================ */
.block-label {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.82rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--c-kelp-amber);
    padding-bottom: 0.4rem;
    border-bottom: 1px dashed rgba(168,136,74,0.35);
    align-self: flex-start;
}

.block-heading {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.2rem, 3vw, 2rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--c-foam);
    line-height: 1.05;
}

.block-body {
    font-family: var(--font-body);
    font-size: clamp(0.95rem, 1.3vw, 1.05rem);
    color: rgba(237,243,240, 0.88);
    line-height: 1.72;
}

.block-body strong,
.block-body em {
    color: var(--c-driftwood);
    font-weight: 600;
    font-style: normal;
}

.block-caveat {
    font-family: var(--font-hand);
    font-size: clamp(0.9rem, 1.5vw, 1.1rem);
    color: var(--c-coral-blush);
    line-height: 1.3;
    margin-top: auto;
    padding-top: 0.5rem;
    opacity: 0.92;
}

.block-link {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--c-driftwood);
    text-decoration: none;
    border-bottom: 1px solid var(--c-kelp-amber);
    padding-bottom: 2px;
    display: inline-block;
    width: fit-content;
    transition: color 0.3s, border-color 0.3s;
}
.block-link:hover {
    color: var(--c-kelp-amber);
    border-bottom-color: var(--c-foam);
}

/* feature block extra breathing room */
.block--feature .block-heading {
    font-size: clamp(1.6rem, 3.6vw, 2.6rem);
}

/* ================================================================
   WAYFINDER LIST (navigation embedded in blocks)
   ================================================================ */
.wayfinder-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.wayfinder-list li a {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--c-driftwood);
    text-decoration: none;
    position: relative;
    display: inline-block;
    padding-left: 18px;
    transition: color 0.3s, padding-left 0.3s;
}
.wayfinder-list li a::before {
    content: '';
    position: absolute;
    left: 0; top: 50%;
    width: 10px; height: 1px;
    background: var(--c-sea-glass);
    transform: translateY(-50%);
    transition: width 0.3s, background 0.3s;
}
.wayfinder-list li a:hover {
    color: var(--c-kelp-amber);
    padding-left: 26px;
}
.wayfinder-list li a:hover::before {
    width: 18px;
    background: var(--c-kelp-amber);
}

.nav-block {
    background: rgba(123, 165, 168, 0.07);
    border-color: rgba(200, 184, 154, 0.3);
}

/* ================================================================
   MINI LIST (stats inside blocks)
   ================================================================ */
.mini-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 0.5rem 0;
    border-top: 1px dashed rgba(123,165,168,0.3);
    border-bottom: 1px dashed rgba(123,165,168,0.3);
}
.mini-list li {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-family: var(--font-display);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.mini-list li span {
    color: var(--c-sea-glass);
    font-size: 0.85rem;
}
.mini-list li em {
    color: var(--c-driftwood);
    font-style: normal;
    font-weight: 700;
    font-size: 1rem;
}

/* ================================================================
   INLINE GLYPH
   ================================================================ */
.inline-glyph {
    width: 100%;
    max-width: 140px;
    aspect-ratio: 1;
    margin: 0.4rem 0;
    animation: glyph-breathe 10s ease-in-out infinite;
}
@keyframes glyph-breathe {
    0%, 100% { transform: rotate(0deg) scale(1); }
    50%      { transform: rotate(6deg) scale(1.05); }
}

/* ================================================================
   THE FOSSIL RECORD — FOOTER
   ================================================================ */
.fossil-record {
    position: relative;
    background: var(--c-pebble-dark);
    padding: 5rem 2rem;
    min-height: 340px;
    overflow: hidden;
    z-index: 3;
    border-top: 1px solid rgba(123,165,168,0.15);
}
.fossil-record::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 30%, rgba(74,94,91,0.35) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 70%, rgba(30,45,47,0.6)  0%, transparent 60%);
    pointer-events: none;
}

.fossil-word {
    position: absolute;
    left: var(--x);
    top:  var(--y);
    transform: rotate(var(--r));
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.5rem, 3.5vw, 2.8rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--c-shore-stone);
    opacity: 0.85;
    white-space: nowrap;
    transition: color 0.5s, opacity 0.5s, transform 0.5s;
}
.fossil-word:hover {
    color: var(--c-driftwood);
    opacity: 1;
}
.fossil-word--small {
    font-size: clamp(0.85rem, 1.3vw, 1.05rem);
    font-weight: 600;
    letter-spacing: 0.2em;
    color: var(--c-sea-glass);
}
.fossil-word--tiny {
    font-size: 0.8rem;
    font-weight: 400;
    letter-spacing: 0.18em;
    color: var(--c-shore-stone);
    opacity: 0.6;
}
.fossil-word--caveat {
    font-family: var(--font-hand);
    font-weight: 400;
    font-size: clamp(1rem, 1.6vw, 1.3rem);
    letter-spacing: 0;
    text-transform: none;
    color: var(--c-kelp-amber);
    opacity: 0.9;
}

.fossil-line {
    position: absolute;
    left: 10%; right: 10%;
    bottom: 3rem;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(123,165,168,0.4), transparent);
}

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 1024px) {
    .block { backdrop-filter: blur(10px) saturate(1.15); }
    .threshold-panel { backdrop-filter: blur(10px) saturate(1.15); }
    .specimen-table { grid-template-columns: repeat(4, 1fr); }
    .block--wide    { grid-column: span 2; }
    .block--feature { grid-column: span 4; grid-row: span 2; }
    .block          { grid-column: span 2; }
}

@media (max-width: 768px) {
    .shore-threshold {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        padding: 2rem 1rem;
        gap: 1.5rem;
    }
    .threshold-panel {
        grid-column: 1 !important;
        grid-row: auto !important;
        min-height: 180px;
        animation: none;
        border-radius: 16px;
    }
    .threshold-word { font-size: clamp(2.2rem, 12vw, 4rem); }

    .kelp-frond  { opacity: 0.25; width: 100px; }
    .leaf-dot--3, .leaf-dot--4 { display: none; }

    .specimen-table {
        grid-template-columns: 1fr;
        padding: 2rem 1rem;
        grid-auto-rows: auto;
    }
    .block,
    .block--wide,
    .block--tall,
    .block--feature,
    .block--full {
        grid-column: 1 !important;
        grid-row: auto !important;
        animation: none;
        border-radius: 14px;
        background: rgba(200, 184, 154, 0.1);
        backdrop-filter: blur(8px);
    }

    .fossil-record {
        padding: 4rem 1rem;
        min-height: 420px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .block, .threshold-panel, .kelp-frond, .leaf-dot, .inline-glyph,
    .fern-spine, .fern-curl {
        animation: none !important;
    }
    .block { opacity: 1; transform: none; }
}
