/* ==========================================================================
   layer2.id — Translucent Frost / Asymmetric Two-Column / Layer-2 Depth
   Palette: #D8E8EF #8B8578 #C8D4DB #4A4238 #7A8B6F #A8C5D6 #B87D5B #2C2824
   Fonts:   Epilogue (variable), Instrument Sans (variable), JetBrains Mono
   ========================================================================== */

/* -----------------------------
   Tokens
   ----------------------------- */
:root {
    /* Palette */
    --glacier-core:   #D8E8EF;
    --glacier-cool:   #C8D4DB;
    --basalt-warm:    #4A4238;
    --river-stone:    #8B8578;
    --deep-sediment:  #2C2824;
    --copper-vein:    #B87D5B;
    --meltwater:      #A8C5D6;
    --lichen-green:   #7A8B6F;

    --frost-layer:    rgba(220, 235, 245, 0.72);
    --frost-layer-strong: rgba(220, 235, 245, 0.82);
    --frost-layer-soft:   rgba(220, 235, 245, 0.55);

    /* Typography */
    --ff-display: "Epilogue", "Inter", system-ui, sans-serif;
    --ff-body:    "Instrument Sans", "Inter", system-ui, sans-serif;
    --ff-mono:    "JetBrains Mono", ui-monospace, "SFMono-Regular", monospace;

    /* Type scale (perfect fourth 1.333) */
    --fs-body:   1.0625rem;  /* 17px */
    --fs-small:  0.8125rem;  /* 13px */
    --fs-h4:     1.4375rem;  /* 23px */
    --fs-h3:     1.875rem;   /* 30px */
    --fs-h2:     2.5rem;     /* 40px */
    --fs-h1:     3.375rem;   /* 54px */
    --fs-display:4.5rem;     /* 72px */
    --fs-hero:   6rem;       /* 96px */

    /* Rhythm */
    --baseline:  72px;
    --bl-half:   36px;
    --bl-quart:  18px;

    /* Layout */
    --content-max:    1200px;
    --col-narrow:     38%;
    --col-wide:       62%;
    --col-gutter:     48px;
    --spine-x:        56px;
    --side-pad:       72px;
}

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

html, body {
    margin: 0;
    padding: 0;
    background-color: var(--glacier-core);
    color: var(--basalt-warm);
    font-family: var(--ff-body);
    font-size: var(--fs-body);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
}

body {
    /* Two overlapping radial gradients (glacier-core / glacier-cool) at low
       opacity diff — barely-perceptible cloud-like variation */
    background-image:
        radial-gradient(ellipse 80% 60% at 18% 12%, rgba(168, 197, 214, 0.10), transparent 70%),
        radial-gradient(ellipse 70% 70% at 88% 78%, rgba(122, 139, 111, 0.08), transparent 72%),
        radial-gradient(ellipse 60% 50% at 50% 50%, rgba(200, 212, 219, 0.06), transparent 75%),
        linear-gradient(180deg, #DEEAF1 0%, #D2DEE6 100%);
    background-attachment: fixed;
    min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
ul { list-style: none; padding: 0; margin: 0; }
button { font: inherit; }

img, svg { display: block; max-width: 100%; }

::selection {
    background: rgba(168, 197, 214, 0.45);
    color: var(--deep-sediment);
}

/* SVG defs hidden */
.noise-defs {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* Paper grain — fixed overlay */
.paper-grain {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    opacity: 0.18;
    mix-blend-mode: multiply;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.45 0 0 0 0 0.42 0 0 0 0 0.36 0 0 0 0.5 0'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='0.55'/></svg>");
    background-size: 240px 240px;
}

/* -----------------------------
   Spine + Vertical Nav
   ----------------------------- */
.spine {
    position: fixed;
    top: 0;
    bottom: 0;
    left: var(--spine-x);
    width: 1px;
    z-index: 12;
    pointer-events: none;
}
.spine-line {
    display: block;
    width: 1px;
    height: 100%;
    background: linear-gradient(180deg,
        rgba(74, 66, 56, 0) 0%,
        rgba(74, 66, 56, 0.32) 8%,
        rgba(74, 66, 56, 0.32) 92%,
        rgba(74, 66, 56, 0) 100%);
}

.vertical-nav {
    position: fixed;
    top: 50%;
    left: calc(var(--spine-x) - 14px);
    transform: translate(-100%, -50%) rotate(-90deg);
    transform-origin: 100% 50%;
    z-index: 13;
}
.vertical-nav ul {
    display: flex;
    flex-direction: row;
    gap: 32px;
}
.nav-item {
    font-family: var(--ff-mono);
    font-size: 0.6875rem;     /* 11px */
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--basalt-warm);
    opacity: 0.2;
    transition: opacity 400ms cubic-bezier(0.25, 0.1, 0.25, 1);
    white-space: nowrap;
    cursor: pointer;
}
.nav-item:hover { opacity: 0.6; }
.nav-item.is-active { opacity: 1; }

/* -----------------------------
   Floating elements
   ----------------------------- */
.floaters {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 2;
    overflow: hidden;
}
.floater {
    position: absolute;
    color: var(--copper-vein);
    opacity: 0.5;
    will-change: transform;
}
.floater-circle {
    width: 12px;
    height: 12px;
    border: 1px solid currentColor;
    border-radius: 50%;
    background: transparent;
}
.floater-glyph {
    font-family: var(--ff-display);
    font-size: 22px;
    font-weight: 200;
    line-height: 1;
}
.floater-line {
    width: 18px;
    height: 1px;
    background: currentColor;
}

.f-1 { top: 14%; left: 8%;  width: 14px; height: 14px; opacity: 0.55; animation: drift-a 92s ease-in-out infinite; }
.f-2 { top: 38%; left: 4%;  width: 10px; height: 10px; opacity: 0.45; animation: drift-b 118s ease-in-out infinite; }
.f-3 { top: 62%; left: 7%;  font-size: 30px; opacity: 0.6;  animation: drift-c 78s ease-in-out infinite; }
.f-4 { top: 22%; right: 6%; font-size: 18px; opacity: 0.4;  animation: drift-b 104s ease-in-out infinite; }
.f-5 { top: 78%; right: 8%; opacity: 0.5;  animation: drift-a 86s ease-in-out infinite; }
.f-6 { top: 86%; left: 6%;  width: 8px; height: 8px; opacity: 0.5;  animation: drift-c 96s ease-in-out infinite; }
.f-7 { top: 50%; right: 5%; font-size: 24px; opacity: 0.45; animation: drift-a 110s ease-in-out infinite; }

@keyframes drift-a {
    0%   { transform: translate(0, 0); }
    25%  { transform: translate(14px, -22px); }
    50%  { transform: translate(28px, 6px); }
    75%  { transform: translate(8px, 28px); }
    100% { transform: translate(0, 0); }
}
@keyframes drift-b {
    0%   { transform: translate(0, 0); }
    25%  { transform: translate(-18px, 16px); }
    50%  { transform: translate(-6px, 32px); }
    75%  { transform: translate(20px, 14px); }
    100% { transform: translate(0, 0); }
}
@keyframes drift-c {
    0%   { transform: translate(0, 0); }
    33%  { transform: translate(22px, -18px); }
    66%  { transform: translate(-14px, -8px); }
    100% { transform: translate(0, 0); }
}

/* -----------------------------
   Ripple stage
   ----------------------------- */
.ripple-stage {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 3;
}
.ripple-ring {
    fill: none;
    stroke: var(--meltwater);
    stroke-opacity: 0.3;
    stroke-width: 2;
    transform-box: fill-box;
    transform-origin: center;
    animation: ripple 3500ms cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}
@keyframes ripple {
    0% {
        r: 0;
        stroke-opacity: 0.32;
        stroke-width: 2;
    }
    100% {
        r: 200;
        stroke-opacity: 0;
        stroke-width: 0.5;
    }
}

/* -----------------------------
   Strata layout
   ----------------------------- */
.strata {
    position: relative;
    z-index: 4;
    padding-left: calc(var(--spine-x) + var(--side-pad));
    padding-right: var(--side-pad);
}

.stratum {
    display: grid;
    grid-template-columns: var(--col-narrow) var(--col-wide);
    column-gap: var(--col-gutter);
    max-width: var(--content-max);
    margin: 0 auto;
    min-height: 100vh;
    padding: var(--baseline) 0;
    position: relative;
    /* Subtle vertical 1px gutter line at 6% opacity, between columns */
    background-image: linear-gradient(to right,
        transparent calc(var(--col-narrow) + (var(--col-gutter) / 2) - 0.5px),
        rgba(74, 66, 56, 0.06) calc(var(--col-narrow) + (var(--col-gutter) / 2) - 0.5px),
        rgba(74, 66, 56, 0.06) calc(var(--col-narrow) + (var(--col-gutter) / 2) + 0.5px),
        transparent calc(var(--col-narrow) + (var(--col-gutter) / 2) + 0.5px));
    will-change: transform;
}

.stratum > .col {
    position: relative;
    will-change: transform;
}

.col-narrow { padding-top: var(--bl-half); }
.col-wide   { padding-top: 0; }

/* Inverted stratum (Philosophy): wide on left, narrow on right */
.stratum.is-inverted {
    grid-template-columns: var(--col-wide) var(--col-narrow);
    background-image: linear-gradient(to right,
        transparent calc(var(--col-wide) + (var(--col-gutter) / 2) - 0.5px),
        rgba(74, 66, 56, 0.06) calc(var(--col-wide) + (var(--col-gutter) / 2) - 0.5px),
        rgba(74, 66, 56, 0.06) calc(var(--col-wide) + (var(--col-gutter) / 2) + 0.5px),
        transparent calc(var(--col-wide) + (var(--col-gutter) / 2) + 0.5px));
}
.stratum.is-inverted .col-wide  { order: 1; }
.stratum.is-inverted .col-narrow-right {
    order: 2;
    padding-top: var(--bl-half);
}

/* -----------------------------
   Hero Stratum
   ----------------------------- */
.stratum-hero { align-items: center; }

.hero-vline {
    position: absolute;
    top: 0;
    left: 0;
    width: 1px;
    height: 100%;
    background: rgba(74, 66, 56, 0.4);
    transform-origin: top center;
    transform: scaleY(0);
    animation: vline-draw 2000ms cubic-bezier(0.25, 0.1, 0.25, 1) forwards;
    animation-delay: 200ms;
}
@keyframes vline-draw {
    0%   { transform: scaleY(0); }
    100% { transform: scaleY(1); }
}

.stratum-tag {
    position: absolute;
    bottom: var(--baseline);
    left: 0;
    font-family: var(--ff-mono);
    font-size: 0.6875rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--river-stone);
}

.hero-title {
    font-family: var(--ff-display);
    font-weight: 100;
    font-size: clamp(3.5rem, 8vw, var(--fs-hero));
    line-height: 1.05;
    letter-spacing: -0.02em;
    color: rgba(74, 66, 56, 0.4);
    margin: 0 0 var(--bl-half) 0;
    font-variation-settings: "wght" 100;
}
.hero-stem { color: rgba(74, 66, 56, 0.4); }
.hero-dot  { color: var(--copper-vein); opacity: 0.85; }
.hero-tld  { color: rgba(74, 66, 56, 0.55); font-style: italic; font-weight: 200; }

.hero-descriptor {
    font-family: var(--ff-body);
    font-size: var(--fs-body);
    font-weight: 400;
    line-height: 1.65;
    color: var(--basalt-warm);
    max-width: 56ch;
    margin: 0 0 var(--baseline) 0;
}

.hero-meta { margin-top: var(--bl-half); }
.meta-stamp {
    font-family: var(--ff-mono);
    font-size: 0.6875rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--river-stone);
}

/* -----------------------------
   Tectonic Divider
   ----------------------------- */
.tectonic-divider {
    position: relative;
    height: var(--baseline);
    max-width: var(--content-max);
    margin: 0 auto;
    overflow: hidden;
}
.tline {
    position: absolute;
    top: 50%;
    height: 1px;
    background: rgba(139, 133, 120, 0.3);
    transition: transform 800ms cubic-bezier(0.45, 0, 0.55, 1);
}
.tline-narrow {
    left: 0;
    width: 38%;
    transform: translateX(20%);
}
.tline-wide {
    right: 0;
    width: 62%;
    transform: translateX(-20%);
}
.tectonic-divider.is-crossed .tline-narrow { transform: translateX(60%); }
.tectonic-divider.is-crossed .tline-wide   { transform: translateX(-60%); }

/* -----------------------------
   Frost Panels
   ----------------------------- */
.frost-panel {
    position: relative;
    background: var(--frost-layer);
    backdrop-filter: blur(20px) saturate(105%);
    -webkit-backdrop-filter: blur(20px) saturate(105%);
    border-radius: 4px;
    padding: var(--bl-half) var(--baseline) calc(var(--baseline) + 24px) var(--baseline);
    overflow: hidden;
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .frost-panel { background: rgba(216, 232, 239, 0.92); }
}
/* Sediment gradient strip fades panel bottom into background */
.frost-panel::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 24px;
    background: linear-gradient(to bottom,
        rgba(220, 235, 245, 0) 0%,
        rgba(220, 235, 245, 0.55) 100%);
    pointer-events: none;
}

.frost-panel-70 { width: 70%; max-width: 540px; }
.frost-panel-flush { width: 100%; }
.frost-panel-full { width: 100%; max-width: none; }

.frost-eyebrow {
    font-family: var(--ff-mono);
    font-size: 0.6875rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--river-stone);
    margin: 0 0 var(--bl-quart) 0;
}

.frost-caption {
    font-family: var(--ff-body);
    font-size: var(--fs-small);
    color: var(--river-stone);
    line-height: 1.6;
    margin: var(--bl-half) 0 0 0;
}

/* -----------------------------
   Identity Stratum
   ----------------------------- */
.rotated-label {
    display: inline-block;
    font-family: var(--ff-mono);
    font-size: 0.6875rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--river-stone);
    transform: rotate(-90deg);
    transform-origin: 0 0;
    position: absolute;
    top: var(--baseline);
    left: 8px;
    white-space: nowrap;
}
.rotated-label-right {
    left: auto;
    right: 8px;
    transform: rotate(90deg);
    transform-origin: 100% 0;
    top: var(--baseline);
}

.identity-statement {
    font-family: var(--ff-display);
    font-weight: 300;
    font-size: clamp(1.75rem, 3.4vw, var(--fs-h2));
    line-height: 1.25;
    letter-spacing: -0.012em;
    color: var(--basalt-warm);
    margin: 0;
    font-variation-settings: "wght" 300;
}

/* -----------------------------
   Philosophy Stratum
   ----------------------------- */
.philosophy-heading {
    font-family: var(--ff-display);
    font-weight: 300;
    font-size: clamp(1.75rem, 3.6vw, var(--fs-h2));
    line-height: 1.2;
    letter-spacing: -0.012em;
    color: var(--basalt-warm);
    margin: 0 0 var(--bl-half) 0;
    font-variation-settings: "wght" 300;
}
.philosophy-body {
    font-family: var(--ff-body);
    font-size: var(--fs-body);
    color: var(--basalt-warm);
    line-height: 1.65;
    max-width: 60ch;
    margin: 0 0 var(--bl-half) 0;
}
.philosophy-body:last-child { margin-bottom: 0; }

.floating-word {
    position: absolute;
    bottom: var(--baseline);
    right: 0;
    font-family: var(--ff-display);
    font-weight: 100;
    font-size: var(--fs-display);
    color: var(--basalt-warm);
    opacity: 0.08;
    line-height: 1;
    letter-spacing: -0.02em;
    pointer-events: none;
    user-select: none;
    font-variation-settings: "wght" 100;
}

/* -----------------------------
   Evidence Stratum
   ----------------------------- */
.stratum-evidence {
    min-height: 120vh;
}

.evidence-counter {
    position: absolute;
    bottom: var(--baseline);
    left: 0;
    font-family: var(--ff-mono);
    font-size: 0.6875rem;
    letter-spacing: 0.12em;
    color: var(--river-stone);
}

.evidence-stack {
    display: flex;
    flex-direction: column;
    gap: var(--bl-half);
    padding-top: var(--bl-half);
}

.evidence-panel { width: 100%; }
.evidence-panel-1 { width: 60%; margin-left: 0;     max-width: 460px; }
.evidence-panel-2 { width: 80%; margin-left: 32px;  max-width: 600px; }
.evidence-panel-3 { width: 70%; margin-left: 64px;  max-width: 520px; }
.evidence-panel-4 { width: 78%; margin-left: 24px;  max-width: 580px; }

.evidence-heading {
    font-family: var(--ff-display);
    font-weight: 400;
    font-size: var(--fs-h3);
    line-height: 1.25;
    letter-spacing: -0.01em;
    color: var(--basalt-warm);
    margin: 0 0 var(--bl-quart) 0;
    font-variation-settings: "wght" 400;
}
.evidence-body {
    font-family: var(--ff-body);
    font-size: var(--fs-body);
    color: var(--basalt-warm);
    line-height: 1.65;
    margin: 0;
}

/* -----------------------------
   Connection Stratum
   ----------------------------- */
.stratum-connection {
    grid-template-columns: 1fr;
    min-height: 80vh;
    align-items: center;
    background-image: none;
}

.frost-panel-full {
    width: 100%;
    padding: calc(var(--baseline) + var(--bl-half)) var(--baseline) calc(var(--baseline) + 24px) var(--baseline);
}

.connection-heading {
    font-family: var(--ff-display);
    font-weight: 300;
    font-size: clamp(1.875rem, 4vw, var(--fs-h1));
    line-height: 1.15;
    letter-spacing: -0.018em;
    color: var(--basalt-warm);
    margin: 0 0 var(--bl-half) 0;
    max-width: 22ch;
    font-variation-settings: "wght" 300;
}
.connection-body {
    font-family: var(--ff-body);
    font-size: var(--fs-body);
    color: var(--basalt-warm);
    line-height: 1.65;
    max-width: 64ch;
    margin: 0 0 var(--bl-half) 0;
}

.connection-links {
    display: flex;
    flex-wrap: wrap;
    gap: 24px var(--baseline);
    margin: 0 0 var(--baseline) 0;
}
.copper-link {
    font-family: var(--ff-body);
    font-size: var(--fs-body);
    font-weight: 600;
    color: var(--copper-vein);
    border-bottom: 1px solid rgba(184, 125, 91, 0.4);
    padding-bottom: 2px;
    transition: color 300ms ease, border-color 300ms ease;
}
.copper-link:hover {
    color: #9F684A;
    border-color: rgba(184, 125, 91, 0.85);
}
.copper-link-visited { color: var(--lichen-green); border-color: rgba(122, 139, 111, 0.45); }
.copper-link-visited:hover { color: #5F7156; border-color: rgba(122, 139, 111, 0.85); }

.connection-footer {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
    padding-top: var(--bl-half);
    border-top: 1px solid rgba(74, 66, 56, 0.1);
}

/* -----------------------------
   Scroll-triggered fade-in
   ----------------------------- */
.fade-target {
    opacity: 0;
    transition: opacity 600ms cubic-bezier(0.25, 0.1, 0.25, 1);
}
.fade-target.is-visible { opacity: 1; }

/* -----------------------------
   Variable font breathing (gated by @supports)
   ----------------------------- */
@supports (font-variation-settings: normal) {
    [data-breathe] {
        animation: breathe 6000ms ease-in-out infinite;
    }
    @keyframes breathe {
        0%, 100% { font-variation-settings: "wght" 300; }
        50%      { font-variation-settings: "wght" 450; }
    }
    .hero-title[data-breathe] {
        animation: breathe-hero 6000ms ease-in-out infinite;
    }
    @keyframes breathe-hero {
        0%, 100% { font-variation-settings: "wght" 100; }
        50%      { font-variation-settings: "wght" 180; }
    }
}

/* -----------------------------
   Responsive
   ----------------------------- */
@media (max-width: 1024px) {
    :root {
        --side-pad: 48px;
        --col-gutter: 32px;
    }
    .stratum,
    .stratum.is-inverted {
        grid-template-columns: 1fr;
        background-image: none;
    }
    .stratum.is-inverted .col-wide { order: 2; }
    .stratum.is-inverted .col-narrow-right { order: 1; }
    .col-narrow { padding-top: 0; }
    .rotated-label,
    .rotated-label-right {
        position: static;
        transform: none;
        display: inline-block;
        margin-bottom: var(--bl-quart);
    }
    .frost-panel-70,
    .evidence-panel-1,
    .evidence-panel-2,
    .evidence-panel-3,
    .evidence-panel-4 {
        width: 100%;
        margin-left: 0;
        max-width: 720px;
    }
    .floating-word { font-size: var(--fs-h1); right: 0; bottom: 32px; }
    .vertical-nav ul { gap: 22px; }
}

@media (max-width: 768px) {
    :root {
        --baseline: 56px;
        --bl-half: 28px;
        --bl-quart: 14px;
        --side-pad: 28px;
        --spine-x: 28px;
    }
    body { font-size: 1rem; }
    .hero-title { font-size: clamp(2.75rem, 13vw, 4.25rem); }
    .frost-panel { padding: var(--bl-half) var(--bl-half) calc(var(--bl-half) + 24px) var(--bl-half); }
    .frost-panel-full { padding: var(--baseline) var(--bl-half) calc(var(--baseline) - var(--bl-quart)) var(--bl-half); }
    .vertical-nav ul { gap: 14px; }
    .nav-item { font-size: 0.625rem; }
    .stratum { padding: calc(var(--baseline) - 8px) 0; }
    .connection-links { gap: 16px 28px; }
    .floating-word { font-size: 3rem; }
}

/* -----------------------------
   Reduced Motion
   ----------------------------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
    .floaters,
    .ripple-stage { display: none; }
    .fade-target { opacity: 1; }
    .hero-vline { transform: scaleY(1); }
    [data-breathe] { animation: none; }
}
