:root {
    --zen-white: #faf8f5;
    --ink-stone: #1e1e28;
    --sakura-pop: #ff5da0;
    --electric-teal: #00c9b7;
    --saffron-candy: #ffb347;
    --lavender-fizz: #b48cff;
    --cloud-mochi: #f0ecf8;
    --pebble-gray: #9e99a8;
    --border-faint: #e8e4f0;
    --space-base: 1.5rem;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Commissioner', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.15vw, 1.125rem);
    line-height: 1.7;
    color: var(--ink-stone);
    background-color: var(--zen-white);
    overflow-x: hidden;
    position: relative;
}

/* Spine lines - background texture */
.spine-lines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    background-image: repeating-linear-gradient(
        to right,
        transparent,
        transparent calc(6rem - 1px),
        rgba(158, 153, 168, 0.15) calc(6rem - 1px),
        rgba(158, 153, 168, 0.15) 6rem
    );
}

/* ===================== ACT I: HERO ===================== */
.act-hero {
    position: relative;
    z-index: 1;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(2rem, 5vw, 6rem);
}

.hero-content {
    text-align: center;
}

.wordmark-container {
    position: relative;
    display: inline-block;
    padding: 1.5rem 3rem;
}

.wordmark-border {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.wordmark-border rect {
    stroke-dasharray: 1360;
    stroke-dashoffset: 1360;
    transition: stroke-dashoffset 2.5s ease-out;
}

.wordmark-border.animate rect {
    stroke-dashoffset: 0;
}

.wordmark {
    font-family: 'Commissioner', sans-serif;
    font-weight: 700;
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    letter-spacing: 0.01em;
    line-height: 1.2;
    color: var(--ink-stone);
    font-feature-settings: 'ss01' on;
}

.wordmark .letter {
    display: inline-block;
    opacity: 0;
    transition: opacity 120ms ease-out;
}

.wordmark .letter.visible {
    opacity: 1;
}

.tagline {
    font-weight: 400;
    font-size: 1.125rem;
    color: var(--pebble-gray);
    margin-top: 1.5rem;
    opacity: 0;
    transition: opacity 0.6s ease-out;
}

.tagline.visible {
    opacity: 1;
}

/* ===================== ZEN DIVIDER ===================== */
.zen-divider {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: center;
    padding: 3rem 0;
}

/* ===================== ACT II: STONES ===================== */
.act-stones {
    position: relative;
    z-index: 1;
    padding: clamp(2rem, 5vw, 6rem);
}

.stones-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto 9rem auto;
    gap: 3rem;
    max-width: 1200px;
    margin: 0 auto;
}

.stone-1 { grid-column: 1; grid-row: 1; }
.stone-2 { grid-column: 2; grid-row: 1; }
.stone-3 { grid-column: 1; grid-row: 3; }
.stone-4 { grid-column: 2; grid-row: 3; }

.stone {
    position: relative;
    background: var(--cloud-mochi);
    border-radius: 4px;
    padding: 3rem;
    overflow: hidden;
}

/* Page-corner fold */
.stone-corner {
    position: absolute;
    top: 0;
    right: 0;
    width: 24px;
    height: 24px;
    background: var(--zen-white);
    clip-path: polygon(0 0, 100% 0, 100% 100%);
    z-index: 3;
}

/* Border-animate SVG overlay */
.stone-border-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

.stone-border-svg svg {
    width: 100%;
    height: 100%;
}

.stone-border-svg rect {
    stroke-dasharray: 396;
    stroke-dashoffset: 396;
    transition: stroke-dashoffset 1.2s ease-out;
}

.stone.revealed .stone-border-svg rect {
    stroke-dashoffset: 0;
}

.stone-inner {
    position: relative;
    z-index: 1;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.5s ease-out 0.3s, transform 0.5s ease-out 0.3s;
}

.stone.revealed .stone-inner {
    opacity: 1;
    transform: translateY(0);
}

/* Icon containers */
.icon-container {
    position: relative;
    width: 72px;
    height: 72px;
    margin-bottom: 1.5rem;
    cursor: default;
}

.icon-circle {
    position: absolute;
    top: 0;
    left: 0;
    width: 72px;
    height: 72px;
}

.icon-circle circle {
    stroke-dasharray: 214;
    stroke-dashoffset: 214;
    transition: stroke-dashoffset 0.6s ease-out, stroke 0.3s ease;
}

.icon-container:hover .icon-circle circle {
    stroke-dashoffset: 0;
    stroke: var(--hover-accent, #e8e4f0);
}

.icon-glyph {
    position: absolute;
    top: 12px;
    left: 12px;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.3s ease;
}

.icon-container:hover .icon-glyph {
    transform: scale(1.08);
    filter: brightness(1.1);
}

.stone h2 {
    font-family: 'Commissioner', sans-serif;
    font-weight: 700;
    font-size: clamp(1.5rem, 3vw, 2.25rem);
    letter-spacing: 0.01em;
    line-height: 1.2;
    margin-bottom: 1rem;
    font-feature-settings: 'ss01' on;
}

.stone p {
    line-height: 1.7;
    color: var(--ink-stone);
}

.footnote-marker {
    font-family: 'Commissioner', sans-serif;
    font-weight: 300;
    font-size: 0.75rem;
    color: var(--lavender-fizz);
    margin-left: 2px;
}

.footnote-text {
    display: block;
    margin-top: 1.5rem;
    font-family: 'DM Mono', monospace;
    font-size: 0.75rem;
    color: var(--pebble-gray);
    letter-spacing: 0.02em;
}

/* ===================== TONE SPECTRUM ===================== */
.tone-spectrum {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.tone-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    background: var(--pill-bg);
    color: var(--pill-text);
    font-family: 'Commissioner', sans-serif;
    font-weight: 300;
    font-size: 0.8125rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: default;
    transition: width 0.3s ease, padding 0.3s ease;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

.tone-pill svg {
    flex-shrink: 0;
}

.pill-desc {
    display: block;
    max-width: 0;
    overflow: hidden;
    opacity: 0;
    font-size: 0.6875rem;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0.01em;
    transition: max-width 0.3s ease, opacity 0.3s ease, margin-left 0.3s ease;
    margin-left: 0;
}

.tone-pill:hover .pill-desc {
    max-width: 300px;
    opacity: 1;
    margin-left: 0.5rem;
}

/* ===================== ACT III: CLOSING ===================== */
.act-closing {
    position: relative;
    z-index: 1;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(2rem, 5vw, 6rem);
}

.closing-content {
    text-align: center;
}

.closing-statement {
    font-family: 'Commissioner', sans-serif;
    font-weight: 600;
    font-size: clamp(1.75rem, 4vw, 3rem);
    color: var(--ink-stone);
    line-height: 1.3;
    margin-bottom: 3rem;
    font-feature-settings: 'ss01' on;
}

.closing-icon {
    position: relative;
    width: 72px;
    height: 72px;
    margin: 0 auto;
}

.closing-circle {
    position: absolute;
    top: 0;
    left: 0;
    width: 72px;
    height: 72px;
}

.closing-circle circle {
    stroke-dasharray: 214;
    stroke-dashoffset: 214;
    animation: trace-loop 4s ease-in-out infinite;
}

@keyframes trace-loop {
    0% { stroke-dashoffset: 214; }
    50% { stroke-dashoffset: 0; }
    60% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: -214; }
}

.closing-pen {
    position: absolute;
    top: 4px;
    left: 4px;
}

/* ===================== RESPONSIVE ===================== */
@media (max-width: 1023px) {
    .stones-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        gap: 4.5rem;
    }

    .stone-1 { grid-column: 1; grid-row: auto; }
    .stone-2 { grid-column: 1; grid-row: auto; }
    .stone-3 { grid-column: 1; grid-row: auto; }
    .stone-4 { grid-column: 1; grid-row: auto; }

    .tone-spectrum {
        flex-direction: column;
    }
}
