/* ==========================================================================
   PERSOPASS.IO -- Wabi-sabi + Opulent-Grand
   The Quiet Vault of Personal Identity
   ========================================================================== */

:root {
    /* Stone palette: 7-stop cool-gray system */
    --vault: #1a1a1f;
    --basalt: #2d2d32;
    --slate: #4a4a50;
    --weathered: #6b6b70;
    --limestone: #9a9a9e;
    --alabaster: #c8c5c0;
    --porcelain: #eae8e4;
    --bronze-accent: #8b7d6b;

    /* Type system */
    --font-display: 'Playfair Display', 'Times New Roman', serif;
    --font-body: 'DM Sans', 'Inter', -apple-system, sans-serif;
    --font-mono: 'IBM Plex Mono', 'Courier New', monospace;

    /* Motion */
    --ease-stone: cubic-bezier(0.23, 1, 0.32, 1);
    --bento-tilt-x: 0deg;
    --bento-tilt-y: 0deg;
}

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

html {
    scroll-behavior: smooth;
    background: var(--porcelain);
}

body {
    font-family: var(--font-body);
    font-weight: 400;
    color: var(--weathered);
    line-height: 1.7;
    /* Continuous tonal descent: porcelain -> alabaster -> vault */
    background:
        linear-gradient(180deg,
            var(--porcelain) 0%,
            var(--porcelain) 30%,
            var(--alabaster) 55%,
            var(--alabaster) 75%,
            var(--vault) 100%);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* ==========================================================================
   Erosion Texture Overlay
   ========================================================================== */
.erosion-overlay {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 1;
    opacity: 0.55;
    mix-blend-mode: multiply;
}

/* ==========================================================================
   Monogram Navigation
   ========================================================================== */
.monogram-nav {
    position: fixed;
    top: 28px;
    left: 28px;
    z-index: 100;
    display: flex;
    align-items: flex-start;
    gap: 18px;
}

.monogram-mark {
    display: inline-flex;
    width: 24px;
    height: 24px;
    color: var(--basalt);
    transform-origin: top left;
    transition: transform 600ms var(--ease-stone), color 400ms var(--ease-stone);
}

.monogram-mark svg {
    display: block;
}

.monogram-nav:hover .monogram-mark,
.monogram-nav:focus-within .monogram-mark {
    transform: scale(1.8);
    color: var(--bronze-accent);
}

.monogram-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
    opacity: 0;
    transform: translateX(-8px);
    transition: opacity 500ms var(--ease-stone) 100ms, transform 500ms var(--ease-stone) 100ms;
    pointer-events: none;
    margin-top: 2px;
}

.monogram-nav:hover .monogram-links,
.monogram-nav:focus-within .monogram-links {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

.monogram-links a {
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 11px;
    letter-spacing: 0.18em;
    color: var(--basalt);
    text-decoration: none;
    text-transform: uppercase;
    padding-left: 30px;
    transition: color 300ms var(--ease-stone);
}

.monogram-links a:hover {
    color: var(--bronze-accent);
}

/* Dark zones invert monogram */
.monogram-nav.is-dark .monogram-mark {
    color: var(--alabaster);
}
.monogram-nav.is-dark .monogram-links a {
    color: var(--alabaster);
}
.monogram-nav.is-dark .monogram-links a:hover {
    color: var(--bronze-accent);
}

/* ==========================================================================
   Section 1: The Grand Vestibule
   ========================================================================== */
.vestibule {
    position: relative;
    min-height: 100vh;
    width: 100%;
    overflow: hidden;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto 1fr auto auto;
    padding: 28px 40px 36px;
    z-index: 2;
}

.vestibule-bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    transform: rotate(var(--bg-rot, 0deg));
    transform-origin: center;
    transition: transform 200ms linear;
}

.bg-rect {
    position: absolute;
    background: var(--basalt);
    display: block;
}

.bg-rect-1 { top: 6%;  left: 4%;   width: 22%; height: 38%; opacity: 0.06; }
.bg-rect-2 { top: 18%; left: 28%;  width: 34%; height: 52%; opacity: 0.08; background: var(--slate); }
.bg-rect-3 { top: 4%;  left: 62%;  width: 28%; height: 30%; opacity: 0.05; }
.bg-rect-4 { top: 48%; left: 56%;  width: 38%; height: 44%; opacity: 0.07; background: var(--weathered); }
.bg-rect-5 { top: 54%; left: 8%;   width: 18%; height: 32%; opacity: 0.10; background: var(--bronze-accent); }
.bg-rect-6 { top: 36%; left: 44%;  width: 6%;  height: 40%; opacity: 0.14; background: var(--basalt); }
.bg-rect-7 { top: 72%; left: 32%;  width: 46%; height: 1px;  opacity: 0.30; background: var(--basalt); }

.vestibule-meta {
    position: relative;
    z-index: 2;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--slate);
    display: flex;
    align-items: center;
    gap: 12px;
}

.meta-top-left {
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
    padding-left: 78px;
}

.meta-top-right {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    font-family: var(--font-mono);
    font-weight: 300;
    letter-spacing: 0.12em;
}

.meta-dot {
    width: 6px;
    height: 6px;
    background: var(--bronze-accent);
    display: inline-block;
}

.meta-rule {
    flex: 0 0 56px;
    height: 1px;
    background: var(--slate);
    opacity: 0.6;
}

.meta-bottom-left {
    grid-column: 1;
    grid-row: 3;
    justify-self: start;
    align-self: end;
}

.meta-bottom-right {
    grid-column: 2;
    grid-row: 3;
    justify-self: end;
    align-self: end;
}

.hero-title {
    grid-column: 1 / -1;
    grid-row: 2;
    align-self: end;
    justify-self: center;
    width: 100%;
    max-width: 1600px;
    margin-top: 5vh;
    margin-bottom: 2vh;
    /* Each letter own implicit grid column */
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 0;
    font-family: var(--font-display);
    font-weight: 900;
    font-size: clamp(3rem, 12vw, 11rem);
    line-height: 0.92;
    letter-spacing: 0.04em;
    color: var(--basalt);
    text-transform: uppercase;
    position: relative;
    z-index: 2;
    --hero-shadow: 0;
}

.hero-letter {
    display: block;
    text-align: center;
    transform: translateY(var(--letter-offset, 0));
    text-shadow: 0 1px 0 rgba(0, 0, 0, calc(0.04 + var(--hero-shadow) * 0.01));
    transition: text-shadow 200ms linear;
}

/* Imperfect settling -- alternating subtle vertical offsets */
.hero-letter:nth-child(1) { --letter-offset: 0px; }
.hero-letter:nth-child(2) { --letter-offset: 2px; }
.hero-letter:nth-child(3) { --letter-offset: -1px; }
.hero-letter:nth-child(4) { --letter-offset: 1px; }
.hero-letter:nth-child(5) { --letter-offset: 0px; }
.hero-letter:nth-child(6) { --letter-offset: 2px; }
.hero-letter:nth-child(7) { --letter-offset: -1px; }
.hero-letter:nth-child(8) { --letter-offset: 1px; }
.hero-letter:nth-child(9) { --letter-offset: 0px; }

.scroll-indicator {
    grid-column: 1 / -1;
    grid-row: 4;
    justify-self: center;
    margin-top: 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.34em;
    color: var(--slate);
    z-index: 2;
}

.scroll-line {
    width: 1px;
    height: 56px;
    background: linear-gradient(180deg, var(--slate) 0%, transparent 100%);
    animation: scrollPulse 2400ms var(--ease-stone) infinite;
    transform-origin: top;
}

@keyframes scrollPulse {
    0%, 100% { transform: scaleY(0.4); opacity: 0.4; }
    50%      { transform: scaleY(1.0); opacity: 1.0; }
}

/* ==========================================================================
   Section 2: The Bento Floor
   ========================================================================== */
.bento-floor {
    position: relative;
    z-index: 2;
    padding: 12vh 40px 14vh;
    overflow: hidden;
}

.floor-header {
    max-width: 1600px;
    margin: 0 auto 64px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
        "eyebrow eyebrow"
        "heading lede";
    gap: 16px 64px;
    padding-left: 78px;
}

.floor-eyebrow {
    grid-area: eyebrow;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--slate);
    display: inline-flex;
    align-items: center;
    gap: 14px;
}

.floor-eyebrow::before {
    content: "";
    width: 38px;
    height: 1px;
    background: var(--bronze-accent);
}

.floor-heading {
    grid-area: heading;
    font-family: var(--font-display);
    font-weight: 900;
    font-size: clamp(2.4rem, 5.4vw, 5.2rem);
    line-height: 0.96;
    letter-spacing: 0.02em;
    color: var(--basalt);
    text-transform: uppercase;
}

.floor-lede {
    grid-area: lede;
    align-self: end;
    font-size: 17px;
    line-height: 1.65;
    color: var(--weathered);
    max-width: 46ch;
    padding-bottom: 8px;
}

/* Bento grid -- intentional imperfection via offset gap */
.bento-grid {
    max-width: 1600px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-auto-rows: minmax(140px, auto);
    gap: 2px;
    perspective: 1200px;
    /* Subtle 1-3px offsets created via cell margins */
}

.bento-cell {
    position: relative;
    background: var(--alabaster);
    padding: 32px;
    overflow: hidden;
    transform-style: preserve-3d;
    transform: perspective(800px) rotateX(0deg) rotateY(0deg);
    transition: transform 600ms var(--ease-stone), background 400ms var(--ease-stone);
    will-change: transform;
    /* Reveal initial state */
    opacity: 0;
    --reveal: 0;
}

.bento-cell.is-revealed {
    opacity: 1;
    --reveal: 1;
    transition:
        opacity 1100ms var(--ease-stone),
        transform 600ms var(--ease-stone),
        background 400ms var(--ease-stone);
}

.bento-cell:hover {
    transform: perspective(800px) rotateX(var(--bento-tilt-x, 0deg)) rotateY(var(--bento-tilt-y, 0deg)) translateZ(0);
    transition-duration: 400ms;
}

/* Cell sizes: irregular bento composition */
.cell-manifesto      { grid-column: 1 / span 7; grid-row: span 2; margin-top: 0; }
.cell-geometry-1     { grid-column: 8 / span 5; grid-row: span 3; margin-top: 2px; }
.cell-glyphs         { grid-column: 1 / span 4; grid-row: span 2; margin-top: 1px; }
.cell-crack          { grid-column: 5 / span 3; grid-row: span 2; margin-top: 3px; }
.cell-rain           { grid-column: 1 / span 7; grid-row: span 2; margin-top: 1px; background: var(--basalt); }
.cell-fragment       { grid-column: 8 / span 5; grid-row: span 2; margin-top: 2px; }
.cell-contemplation  { grid-column: 1 / span 8; grid-row: span 2; margin-top: 1px; }
.cell-mono-list      { grid-column: 9 / span 4; grid-row: span 2; margin-top: 3px; background: var(--porcelain); }
.cell-accent         { grid-column: 1 / span 12; grid-row: span 1; margin-top: 2px; min-height: 180px; background: var(--vault); color: var(--alabaster); }

/* Cell shape compositions */
.cell-shapes {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: visible;
    opacity: calc(0.15 + var(--reveal, 0) * 0.85);
    transition: opacity 1400ms var(--ease-stone);
}

.shape {
    position: absolute;
    left: var(--x);
    top: var(--y);
    width: var(--w);
    height: var(--h);
    background: var(--c);
    opacity: var(--o);
    display: block;
}

.shape-line {
    height: 1px !important;
}

.bleed-right  { right: -6%; left: auto; }
.bleed-left   { left: -8%; }
.bleed-bottom { bottom: -10%; top: auto; }

/* Cell content layering */
.cell-content {
    position: relative;
    z-index: 2;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.cell-content-bottom {
    justify-content: flex-end;
}

.cell-content-overlay {
    position: relative;
    z-index: 3;
}

.cell-content-center {
    align-items: center;
    justify-content: center;
    text-align: center;
}

.cell-eyebrow {
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--bronze-accent);
}

.cell-mono,
.cell-mono-text {
    font-family: var(--font-mono);
    font-weight: 300;
    font-size: 13px;
    color: var(--slate);
    letter-spacing: 0.02em;
}

.cell-mono-text {
    line-height: 1.6;
    color: var(--weathered);
}

.cell-title {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: clamp(1.6rem, 2.6vw, 2.4rem);
    line-height: 1.05;
    letter-spacing: 0.02em;
    color: var(--basalt);
    text-transform: uppercase;
    max-width: 22ch;
}

.cell-title-sm {
    font-size: clamp(1.2rem, 1.8vw, 1.6rem);
    max-width: 18ch;
}

.cell-body {
    font-size: 15px;
    line-height: 1.7;
    color: var(--weathered);
    max-width: 52ch;
}

.cell-body-sm {
    font-size: 14px;
    max-width: 36ch;
}

.cell-caption {
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--limestone);
    line-height: 1.5;
    max-width: 40ch;
}

/* Sharp cell corner marks (no rounding) */
.cell-corner {
    position: absolute;
    width: 14px;
    height: 14px;
    pointer-events: none;
    z-index: 4;
    border: 1px solid var(--basalt);
    opacity: 0.45;
}

.cell-corner-tl { top: 10px; left: 10px;  border-right: 0; border-bottom: 0; }
.cell-corner-tr { top: 10px; right: 10px; border-left: 0;  border-bottom: 0; }
.cell-corner-br { bottom: 10px; right: 10px; border-left: 0; border-top: 0; }
.cell-corner-bl { bottom: 10px; left: 10px;  border-right: 0; border-top: 0; }

/* Crack SVG fills cells */
.crack-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: visible;
}

/* Glyph cluster */
.glyph-cluster {
    position: relative;
    width: 100%;
    height: 60%;
    min-height: 160px;
    display: block;
}

.glyph {
    position: absolute;
    background: var(--basalt);
    display: block;
}

.glyph-circle {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    top: 22%;
    left: 28%;
    opacity: 0.72;
}

.glyph-circle.small {
    width: 8px;
    height: 8px;
    top: 64%;
    left: 78%;
    opacity: 0.55;
    background: var(--bronze-accent);
}

.glyph-square {
    width: 12px;
    height: 12px;
    top: 48%;
    left: 18%;
    opacity: 0.62;
    background: var(--slate);
}

.glyph-triangle {
    width: 0;
    height: 0;
    background: transparent;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 14px solid var(--basalt);
    top: 18%;
    left: 62%;
    opacity: 0.65;
}

.glyph-hex {
    width: 16px;
    height: 16px;
    top: 56%;
    left: 48%;
    background: var(--basalt);
    opacity: 0.58;
    clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%);
}

/* Password rain */
.cell-rain {
    color: var(--alabaster);
}

.cell-rain .cell-eyebrow { color: var(--bronze-accent); }
.cell-rain .cell-title { color: var(--alabaster); }

.rain-canvas {
    position: absolute;
    inset: 0;
    z-index: 1;
    overflow: hidden;
    pointer-events: none;
}

.rain-string {
    position: absolute;
    font-family: var(--font-mono);
    font-weight: 300;
    font-size: 12px;
    color: var(--slate);
    white-space: nowrap;
    letter-spacing: 0.04em;
    transform: translateY(0);
    will-change: transform, opacity;
}

/* Fragment cell -- monumental figure */
.cell-fragment-figure {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: clamp(3rem, 6vw, 6rem);
    line-height: 0.9;
    color: var(--basalt);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-top: auto;
    margin-bottom: 12px;
}

/* Mono list */
.mono-list {
    list-style: none;
    margin-top: 18px;
    display: grid;
    gap: 12px;
}

.mono-list li {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    border-bottom: 1px solid rgba(74, 74, 80, 0.12);
    padding-bottom: 10px;
    font-family: var(--font-mono);
    font-weight: 300;
    font-size: 13px;
    color: var(--slate);
}

.mono-key {
    color: var(--weathered);
}

.mono-val {
    color: var(--basalt);
    letter-spacing: 0.04em;
}

/* Accent strip (vault-toned cell) */
.cell-accent .cell-content-center {
    height: 100%;
}

.accent-mark {
    font-family: var(--font-display);
    font-size: 28px;
    color: var(--bronze-accent);
    line-height: 1;
}

.accent-caption {
    color: var(--limestone);
    margin-top: 14px;
}

/* ==========================================================================
   Section 3: The Vault Footer
   ========================================================================== */
.vault {
    position: relative;
    z-index: 2;
    background: var(--vault);
    color: var(--alabaster);
    padding: 18vh 0 6vh;
    overflow: hidden;
}

.vault-rule {
    height: 1px;
    width: 100%;
    background: linear-gradient(90deg,
        transparent 0%,
        var(--bronze-accent) 22%,
        var(--bronze-accent) 78%,
        transparent 100%);
    opacity: 0.5;
    margin-bottom: 14vh;
}

.vault-content {
    max-width: 42ch;
    margin: 0 auto;
    padding: 0 32px;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.vault-eyebrow {
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--bronze-accent);
    display: inline-flex;
    align-items: center;
    gap: 14px;
}

.vault-eyebrow::before {
    content: "";
    width: 38px;
    height: 1px;
    background: var(--bronze-accent);
}

.vault-heading {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: clamp(2rem, 4vw, 3.4rem);
    line-height: 1.02;
    letter-spacing: 0.02em;
    color: var(--alabaster);
    text-transform: uppercase;
}

.vault-body {
    font-size: 15px;
    line-height: 1.75;
    color: var(--limestone);
}

.vault-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px 36px;
    margin-top: 16px;
    padding-top: 28px;
    border-top: 1px solid rgba(200, 197, 192, 0.12);
}

.vault-col {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.vault-label {
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--bronze-accent);
}

.vault-value {
    font-family: var(--font-mono);
    font-weight: 300;
    font-size: 13px;
    color: var(--alabaster);
    letter-spacing: 0.04em;
    line-height: 1.5;
}

.vault-signature {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid rgba(200, 197, 192, 0.08);
    display: flex;
    align-items: center;
    gap: 14px;
}

.vault-mark {
    color: var(--bronze-accent);
    display: inline-flex;
}

.vault-signoff {
    font-family: var(--font-mono);
    font-weight: 300;
    font-size: 12px;
    color: var(--limestone);
    letter-spacing: 0.10em;
}

.vault-year {
    color: var(--alabaster);
}

/* ==========================================================================
   Responsive: collapse to single column gracefully
   ========================================================================== */
@media (max-width: 960px) {
    .vestibule {
        padding: 24px 24px 36px;
        grid-template-columns: 1fr;
        grid-template-rows: auto auto 1fr auto auto;
    }
    .meta-top-left  { grid-column: 1; grid-row: 1; padding-left: 56px; }
    .meta-top-right { grid-column: 1; grid-row: 2; justify-self: start; padding-left: 56px; }
    .hero-title     { grid-row: 3; }
    .meta-bottom-left  { grid-column: 1; grid-row: 4; }
    .meta-bottom-right { grid-column: 1; grid-row: 5; justify-self: start; }

    .floor-header {
        grid-template-columns: 1fr;
        grid-template-areas:
            "eyebrow"
            "heading"
            "lede";
        padding-left: 56px;
    }

    .bento-floor { padding: 10vh 24px 12vh; }

    .cell-manifesto,
    .cell-geometry-1,
    .cell-glyphs,
    .cell-crack,
    .cell-rain,
    .cell-fragment,
    .cell-contemplation,
    .cell-mono-list,
    .cell-accent {
        grid-column: 1 / -1;
    }
}

@media (max-width: 560px) {
    .monogram-nav { top: 18px; left: 18px; }
    .vestibule { padding: 18px 18px 32px; }
    .meta-top-left { padding-left: 44px; }
    .meta-top-right { padding-left: 44px; }
    .floor-header { padding-left: 44px; }
    .bento-cell { padding: 24px; }
}
