/* dilemma.quest - Botanical Field Guide for Moral Choices */
/* Colors from DESIGN.md:
   Background (Pressed Linen): #f5efe6
   Primary Text (Bark Brown): #3d2b1f
   Body Text (Espresso): #4a3728
   Accent Primary (Autumn Sap): #c4956a
   Accent Secondary (Fern Vein): #6b8f71
   Warning/Thorn (Dried Rose): #a8524a
   Annotation (Weathered Brass): #8b7355
   Card Surface (Vellum): #faf7f0
   Shadow Base (Root Shadow): #2a1f14
*/

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: #f5efe6;
    color: #4a3728;
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.8vw, 1.15rem);
    line-height: 1.85;
    overflow-x: hidden;
    cursor: default;
}

/* ========== ROOT NETWORK BACKGROUND ========== */
.root-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
    pointer-events: none;
    opacity: 0;
    transition: opacity 600ms ease;
}

.root-layer.visible {
    opacity: 1;
}

/* ========== CORNER ORNAMENTS ========== */
.corner-ornament {
    position: fixed;
    width: 80px;
    height: 80px;
    z-index: 4;
    pointer-events: none;
    display: none;
}

@media (min-width: 1200px) {
    .corner-ornament {
        display: block;
    }
}

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

/* ========== THE CANOPY (NAVIGATION) ========== */
#canopy {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px;
    background-color: rgba(245, 239, 230, 0.85);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.nav-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 400;
    font-size: 0.85rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #8b7355;
}

.nav-links {
    display: flex;
    gap: 40px;
}

.nav-link {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 400;
    font-size: 0.75rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #8b7355;
    text-decoration: none;
    position: relative;
    transition: color 300ms ease;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 1px;
    background-color: #c4956a;
    transition: width 300ms ease;
}

.nav-link:hover {
    color: #3d2b1f;
}

.nav-link:hover::after {
    width: 100%;
}

/* ========== SITE HEADER ========== */
.site-header {
    text-align: center;
    padding: 160px 40px 80px;
    max-width: 800px;
    margin: 0 auto;
}

.site-title {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 600;
    font-size: clamp(2rem, 5vw, 3.5rem);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #3d2b1f;
    line-height: 1.2;
    margin-bottom: 24px;
}

.site-subtitle {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.8vw, 1.15rem);
    color: #8b7355;
    line-height: 1.85;
    max-width: 560px;
    margin: 0 auto;
}

/* ========== SPECIMENS SECTION ========== */
.specimens {
    position: relative;
    z-index: 2;
    max-width: 900px;
    margin: 0 auto;
    padding: 0 40px 120px;
}

/* ========== SPECIMEN CARDS ========== */
.specimen-card {
    max-width: 680px;
    margin: 0 auto 120px;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 500ms ease-out, transform 500ms ease-out;
}

.specimen-card.visible {
    opacity: 1;
    transform: translateY(0);
}

.specimen-card[data-offset="left"] {
    margin-left: 0;
    margin-right: auto;
}

.specimen-card[data-offset="right"] {
    margin-left: auto;
    margin-right: 0;
}

@media (min-width: 900px) {
    .specimen-card[data-offset="left"] {
        transform: translateY(40px) translateX(-30px);
    }
    .specimen-card[data-offset="left"].visible {
        transform: translateY(0) translateX(-30px);
    }
    .specimen-card[data-offset="right"] {
        transform: translateY(40px) translateX(30px);
    }
    .specimen-card[data-offset="right"].visible {
        transform: translateY(0) translateX(30px);
    }
}

.card-inner {
    background-color: #faf7f0;
    border-radius: 6px;
    padding: 36px 40px;
    box-shadow: 0 2px 8px rgba(42, 31, 20, 0.08);
    transition: box-shadow 300ms ease;
    cursor: crosshair;
}

.card-inner:hover {
    box-shadow: 0 8px 24px rgba(42, 31, 20, 0.12);
}

/* ========== CARD HEADER ========== */
.card-header {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 20px;
}

.iso-icon {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
}

.card-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.specimen-number {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 400;
    font-size: 0.75rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: #8b7355;
}

.category-label {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 400;
    font-size: 0.7rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #c4956a;
}

/* ========== DILEMMA TITLE ========== */
.dilemma-title {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 600;
    font-size: clamp(1.4rem, 3vw, 2rem);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #3d2b1f;
    line-height: 1.3;
    margin-bottom: 12px;
    cursor: pointer;
    transition: letter-spacing 400ms ease, color 300ms ease;
}

.dilemma-title:hover {
    color: #c4956a;
}

.specimen-card.visible .dilemma-title {
    letter-spacing: 0.15em;
}

/* ========== DILEMMA PREMISE ========== */
.dilemma-premise {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.8vw, 1.1rem);
    color: #4a3728;
    line-height: 1.85;
}

/* ========== CARD EXPANDED CONTENT ========== */
.card-expanded {
    max-height: 0;
    overflow: hidden;
    transition: max-height 500ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.specimen-card.unfurled .card-expanded {
    max-height: 800px;
}

.dilemma-body {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.6vw, 1.05rem);
    color: #4a3728;
    line-height: 1.85;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(139, 115, 85, 0.15);
}

/* ========== DECISION TREE ========== */
.decision-tree {
    margin: 24px 0;
}

.tree-svg {
    width: 100%;
    max-width: 400px;
    display: block;
    margin: 0 auto;
}

.tree-branch {
    cursor: pointer;
    transition: stroke-width 200ms ease, opacity 200ms ease;
}

.tree-branch:hover {
    stroke-width: 3;
}

.tree-branch.selected {
    stroke-width: 3;
}

.tree-branch.faded {
    opacity: 0.3;
}

.branch-label {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 11px;
    letter-spacing: 0.1em;
    cursor: pointer;
}

.branch-terminal {
    transition: r 200ms ease, opacity 200ms ease;
}

/* Stroke animation for branches */
.tree-trunk,
.tree-branch {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
}

.specimen-card.unfurled .tree-trunk,
.specimen-card.unfurled .tree-branch {
    animation: drawBranch 800ms ease forwards;
}

.specimen-card.unfurled .tree-trunk {
    animation-delay: 0ms;
}

.specimen-card.unfurled .branch-a {
    animation-delay: 200ms;
}

.specimen-card.unfurled .branch-b {
    animation-delay: 350ms;
}

@keyframes drawBranch {
    to {
        stroke-dashoffset: 0;
    }
}

/* ========== CONSEQUENCES ========== */
.consequences {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 16px;
}

.consequence {
    opacity: 0;
    transition: opacity 400ms ease;
    padding: 12px;
    border-radius: 4px;
}

.consequence.active {
    opacity: 1;
}

.consequence-a {
    border-left: 2px solid #6b8f71;
}

.consequence-b {
    border-left: 2px solid #a8524a;
}

.consequence-text {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    font-size: 0.9rem;
    color: #4a3728;
    line-height: 1.7;
}

/* ========== WAVE FORM ========== */
.wave-form {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid rgba(139, 115, 85, 0.1);
}

.wave-svg {
    width: 100%;
    height: 40px;
    display: block;
}

.wave-path {
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
}

.specimen-card.unfurled .wave-path {
    animation: drawWave 1200ms ease-in-out forwards;
    animation-delay: 400ms;
}

@keyframes drawWave {
    to {
        stroke-dashoffset: 0;
    }
}

/* ========== NARRATIVE OVERLAY ========== */
.narrative-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    background-color: rgba(245, 239, 230, 0.97);
    opacity: 0;
    visibility: hidden;
    transition: opacity 400ms ease, visibility 400ms ease;
    overflow-y: auto;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 80px 40px;
}

.narrative-overlay.active {
    opacity: 1;
    visibility: visible;
}

.narrative-close {
    position: fixed;
    top: 24px;
    right: 32px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.2rem;
    color: #8b7355;
    background: none;
    border: none;
    cursor: crosshair;
    z-index: 101;
    padding: 8px;
    transition: color 200ms ease;
    line-height: 1;
}

.narrative-close:hover {
    color: #3d2b1f;
}

.narrative-content {
    max-width: 720px;
    width: 100%;
}

.narrative-content .narrative-title {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 600;
    font-size: clamp(2rem, 5vw, 3.5rem);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #3d2b1f;
    line-height: 1.2;
    margin-bottom: 16px;
}

.narrative-content .narrative-category {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 400;
    font-size: 0.75rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: #c4956a;
    margin-bottom: 40px;
    display: block;
}

.narrative-content .narrative-premise {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 500;
    font-size: clamp(1.1rem, 2vw, 1.3rem);
    color: #3d2b1f;
    line-height: 1.85;
    margin-bottom: 32px;
}

.narrative-content .narrative-body {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.8vw, 1.15rem);
    color: #4a3728;
    line-height: 1.85;
    margin-bottom: 40px;
}

.narrative-content .narrative-tree-container {
    margin: 40px auto;
    max-width: 100%;
}

.narrative-content .narrative-tree-container svg {
    width: 100%;
    max-width: 600px;
    display: block;
    margin: 0 auto;
}

/* ========== INTERACTIVE CURSOR ========== */
.tree-branch,
.branch-label,
.dilemma-title {
    cursor: crosshair;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    #canopy {
        padding: 16px 20px;
    }

    .nav-links {
        gap: 20px;
    }

    .nav-link {
        font-size: 0.65rem;
    }

    .site-header {
        padding: 120px 20px 60px;
    }

    .specimens {
        padding: 0 20px 80px;
    }

    .card-inner {
        padding: 24px 20px;
    }

    .specimen-card[data-offset="left"],
    .specimen-card[data-offset="right"] {
        margin-left: auto;
        margin-right: auto;
    }

    .consequences {
        grid-template-columns: 1fr;
    }

    .specimen-card {
        margin-bottom: 80px;
    }
}

@media (max-width: 480px) {
    .nav-links {
        gap: 12px;
    }

    .nav-title {
        font-size: 0.7rem;
    }

    .site-header {
        padding: 100px 16px 40px;
    }

    .card-header {
        flex-direction: column;
    }
}

/* ========== THORN-VINE DIVIDER (between cards) ========== */
.specimen-card + .specimen-card::before {
    content: '';
    display: block;
    width: 200px;
    height: 1px;
    background: linear-gradient(90deg, transparent, #8b7355 20%, #8b7355 80%, transparent);
    opacity: 0.2;
    margin: 0 auto 120px;
    position: relative;
    top: -60px;
}