/* ===== layer-2.quest -- flat-design, single-column, triadic ===== */

:root {
    --triadic-a: #3a8c7c;
    --triadic-b: #e8c84a;
    --triadic-c: #c85a8c;
    --text-on-dark: #f8f8f0;
    --text-on-light: #1a1a18;
    --stroke-near-black: #1a1a18;
    --stroke-soft: rgba(26, 26, 24, 0.8);
    --status-green: #4a9c6a;
    --status-gray: #a0a0a0;
    --max-text-col: 36em;
}

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

html, body {
    background: var(--triadic-a);
    color: var(--text-on-dark);
    font-family: "Work Sans", system-ui, sans-serif;
    font-size: clamp(16px, 1.6vw, 19px);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body {
    overflow-x: hidden;
}

/* ===== Section base ===== */

.quest-section {
    position: relative;
    padding: clamp(32px, 6vw, 80px) clamp(24px, 5vw, 64px);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    /* Hard-edge color transitions: zero gap between sections */
}

.section-inner {
    width: 100%;
    max-width: var(--max-text-col);
    margin: 0 auto;
}

.section-eyebrow {
    font-family: "Recursive", "Work Sans", monospace;
    font-variation-settings: "MONO" 1, "CASL" 0, "wght" 500, "slnt" 0;
    font-size: 14px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    margin-bottom: 12px;
    opacity: 0.85;
}

.section-heading {
    font-family: "Recursive", "Work Sans", sans-serif;
    font-variation-settings: "MONO" 0, "CASL" 0, "wght" 700, "slnt" 0;
    font-weight: 700;
    font-size: clamp(28px, 5vw, 60px);
    line-height: 1.05;
    letter-spacing: -0.01em;
    margin-bottom: 32px;
}

.prose p + p {
    margin-top: 1em;
}

.prose {
    font-weight: 400;
}

.prose strong, .prose b {
    font-weight: 600;
}

/* ===== Section colors ===== */

.section-opening {
    background: var(--triadic-a);
    color: var(--text-on-dark);
}

.section-layer1 {
    background: var(--triadic-b);
    color: var(--text-on-light);
}

.section-layer2 {
    background: var(--triadic-c);
    color: var(--text-on-dark);
}

.section-log {
    background: var(--triadic-a);
    color: var(--text-on-dark);
}

.section-closing {
    background: var(--triadic-b);
    color: var(--text-on-light);
}

/* ===== Opening ===== */

.opening-inner {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
}

.domain-title {
    font-family: "Recursive", monospace;
    font-variation-settings: "MONO" 0, "CASL" 0, "wght" 700, "slnt" 0;
    font-weight: 700;
    font-size: clamp(40px, 9vw, 110px);
    line-height: 1;
    letter-spacing: -0.02em;
    color: var(--text-on-dark);
}

.opening-sub {
    font-family: "Recursive", monospace;
    font-variation-settings: "MONO" 1, "CASL" 0, "wght" 400, "slnt" 0;
    font-size: 14px;
    letter-spacing: 0.04em;
    opacity: 0.85;
    max-width: 32em;
}

/* Quest banner: a flat rectangle that draws its outline, then fills */
.quest-banner {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 22px 36px;
    background: transparent;
    color: var(--text-on-light);
    transition: background-color 200ms linear;
    min-width: min(420px, 80vw);
}

.quest-banner-border {
    position: absolute;
    inset: 0;
    border: 0 solid var(--triadic-b);
    pointer-events: none;
    transition: border-width 400ms linear;
}

.quest-banner.is-bordered .quest-banner-border {
    border-width: 3px;
}

.quest-banner.is-filled {
    background-color: var(--triadic-b);
}

.quest-banner-text {
    font-family: "Recursive", monospace;
    font-variation-settings: "MONO" 0, "CASL" 0, "wght" 600, "slnt" 0;
    font-size: clamp(16px, 1.8vw, 20px);
    letter-spacing: 0.02em;
    color: var(--text-on-light);
    opacity: 0;
    transition: opacity 300ms linear;
}

.quest-banner.is-filled .quest-banner-text {
    opacity: 1;
}

/* ===== Diagrams ===== */

.diagram {
    margin: 40px 0 24px;
    width: 100%;
}

.flat-diagram {
    width: 100%;
    height: auto;
    display: block;
    overflow: visible;
}

.flat-diagram .block,
.flat-diagram .node {
    opacity: 0;
    transform-origin: center;
    transform: scale(0.85);
    transition: opacity 280ms linear, transform 280ms linear;
}

.flat-diagram.is-built .block { opacity: 1; transform: none; }
.flat-diagram.is-built .node  { opacity: 1; transform: none; }

.flat-diagram .connection {
    stroke-dasharray: 320;
    stroke-dashoffset: 320;
    transition: stroke-dashoffset 400ms linear;
}

.flat-diagram.is-drawn .connection {
    stroke-dashoffset: 0;
}

.diagram-caption {
    font-family: "Recursive", monospace;
    font-variation-settings: "MONO" 1, "CASL" 0, "wght" 400, "slnt" 0;
    font-size: 14px;
    letter-spacing: 0.02em;
    margin-top: 12px;
    opacity: 0.85;
}

.section-layer1 .diagram-caption,
.section-closing .diagram-caption {
    color: var(--text-on-light);
    opacity: 0.75;
}

/* ===== Bullet list (flat squares) ===== */

.bullet-list {
    list-style: none;
    margin-top: 28px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.bullet-list li {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

.bullet-square {
    flex: 0 0 auto;
    width: 14px;
    height: 14px;
    background: var(--triadic-c);
    margin-top: 0.45em;
}

.bullet-list-rose .bullet-square {
    background: var(--triadic-b);
}

/* ===== Quest log ===== */

.quest-log {
    list-style: none;
    margin-top: 32px;
    display: flex;
    flex-direction: column;
    gap: 0;
    border-top: 2px solid rgba(248, 248, 240, 0.85);
}

.quest-entry {
    position: relative;
    overflow: hidden;
    display: grid;
    grid-template-columns: 110px 1fr 22px;
    gap: 18px;
    align-items: center;
    padding: 18px 20px;
    background: rgba(248, 248, 240, 0.03);
    border-bottom: 2px solid rgba(248, 248, 240, 0.85);
    opacity: 0;
    transition: opacity 300ms linear;
}

.quest-entry.is-revealed {
    opacity: 1;
}

.entry-time {
    font-family: "Recursive", monospace;
    font-variation-settings: "MONO" 1, "CASL" 0, "wght" 400, "slnt" 0;
    font-size: 14px;
    letter-spacing: 0.02em;
    color: var(--text-on-dark);
    opacity: 0.85;
}

.entry-name {
    font-family: "Recursive", sans-serif;
    font-variation-settings: "MONO" 0, "CASL" 0, "wght" 500, "slnt" 0;
    font-size: clamp(15px, 1.6vw, 18px);
}

.entry-status {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: inline-block;
    flex: 0 0 auto;
    justify-self: end;
}

.status-understood { background: var(--status-green); }
.status-pending    { background: var(--status-gray); }

/* Ripple animation: expanding circle in section's complement color */
.ripple {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 8px;
    height: 8px;
    margin-left: -4px;
    margin-top: -4px;
    border-radius: 50%;
    background: var(--triadic-c);
    opacity: 0;
    transform: scale(1);
    pointer-events: none;
}

.quest-entry.is-rippling .ripple {
    animation: ripple-expand 700ms linear forwards;
}

@keyframes ripple-expand {
    0% {
        opacity: 0.22;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(120);
    }
}

.log-meta {
    display: flex;
    gap: 28px;
    margin-top: 28px;
    font-family: "Recursive", monospace;
    font-variation-settings: "MONO" 1, "CASL" 0, "wght" 400, "slnt" 0;
    font-size: 14px;
    letter-spacing: 0.02em;
    flex-wrap: wrap;
}

.meta-cell {
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
}

.meta-key {
    opacity: 0.75;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 12px;
}

.meta-val {
    font-variation-settings: "MONO" 1, "CASL" 0, "wght" 700, "slnt" 0;
    font-size: 18px;
}

/* ===== Closing ===== */

.closing-inner {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 18px;
    align-items: center;
}

.closing-title {
    font-family: "Recursive", sans-serif;
    font-variation-settings: "MONO" 0, "CASL" 0, "wght" 700, "slnt" 0;
    font-weight: 700;
    font-size: clamp(36px, 7vw, 80px);
    line-height: 1.05;
    letter-spacing: -0.01em;
    color: var(--text-on-light);
}

.closing-sub {
    font-family: "Recursive", monospace;
    font-variation-settings: "MONO" 1, "CASL" 0, "wght" 400, "slnt" 0;
    font-size: 14px;
    letter-spacing: 0.04em;
    color: var(--text-on-light);
    opacity: 0.75;
}

/* ===== Section index ===== */

.section-index {
    position: fixed;
    right: clamp(12px, 2vw, 22px);
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
}

.section-index ol {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 12px 10px;
    background: rgba(26, 26, 24, 0.55);
}

.section-index button {
    background: transparent;
    border: 0;
    color: inherit;
    cursor: pointer;
    padding: 4px 6px;
    font-family: "Recursive", monospace;
    font-variation-settings: "MONO" 1, "CASL" 0, "wght" 500, "slnt" 0;
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-on-dark);
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-index .dot {
    width: 8px;
    height: 8px;
    background: var(--text-on-dark);
    display: inline-block;
    opacity: 0.45;
    transition: opacity 200ms linear, background-color 200ms linear;
}

.section-index button.is-active .dot {
    opacity: 1;
}

.section-index button[data-target="opening"].is-active .dot,
.section-index button[data-target="log"].is-active     .dot { background: var(--triadic-b); }
.section-index button[data-target="layer1"].is-active  .dot { background: var(--triadic-c); }
.section-index button[data-target="layer2"].is-active  .dot { background: var(--triadic-b); }
.section-index button[data-target="closing"].is-active .dot { background: var(--triadic-a); }

.section-index .label {
    opacity: 0.75;
}

@media (max-width: 720px) {
    .section-index {
        display: none;
    }

    .quest-entry {
        grid-template-columns: 90px 1fr 18px;
        gap: 12px;
        padding: 14px 12px;
    }
}

@media (max-width: 480px) {
    .domain-title {
        font-size: clamp(40px, 13vw, 80px);
    }

    .quest-banner {
        padding: 18px 22px;
    }

    .section-inner {
        max-width: 100%;
    }
}
