/* ===========================
   ethica.dev — Styles
   Surrealist philosophical ethics experience
   =========================== */

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    background-color: #1a1a2e;
    color: #d4cfc4;
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 400;
    font-size: 17px;
    line-height: 1.72;
    overflow-x: hidden;
}

/* --- Palette Variables --- */
:root {
    --deep-void: #1a1a2e;
    --midnight-indigo: #2b2d42;
    --parchment-warm: #f0ead6;
    --sand-ethical: #c9b896;
    --slate-thought: #4a4a5a;
    --ember-consequence: #a0522d;
    --sage-virtue: #6b8f71;
    --ivory-clarity: #faf8f2;
    --body-dark: #3d3d4e;
    --body-light: #d4cfc4;
    --ui-chrome: #7b6f5e;
}

/* ===========================
   INTRO SCREEN
   =========================== */

.intro-screen {
    position: relative;
    width: 100vw;
    height: 100vh;
    background: var(--deep-void);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    z-index: 10;
}

.intro-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}

.intro-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: clamp(5rem, 12vw, 10rem);
    letter-spacing: 0.15em;
    color: var(--parchment-warm);
    opacity: 0;
    transition: opacity 800ms ease-out;
    margin-bottom: 1rem;
}

.intro-title.visible {
    opacity: 1;
}

.intro-scale {
    width: clamp(200px, 30vw, 400px);
    height: auto;
    margin-bottom: 2rem;
}

/* Scale animation states */
.intro-scale .scale-initial-line {
    stroke-dasharray: 400;
    stroke-dashoffset: 400;
    transition: stroke-dashoffset 1200ms ease-out;
}

.intro-scale .scale-initial-line.drawn {
    stroke-dashoffset: 0;
}

.intro-scale .scale-line-left,
.intro-scale .scale-line-right,
.intro-scale .scale-stem,
.intro-scale .scale-fulcrum,
.intro-scale .scale-pan-left,
.intro-scale .scale-pan-right {
    opacity: 0;
    transition: opacity 600ms ease-out;
}

.intro-scale.formed .scale-initial-line {
    opacity: 0;
    transition: opacity 300ms ease-out;
}

.intro-scale.formed .scale-line-left,
.intro-scale.formed .scale-line-right,
.intro-scale.formed .scale-stem,
.intro-scale.formed .scale-fulcrum,
.intro-scale.formed .scale-pan-left,
.intro-scale.formed .scale-pan-right {
    opacity: 1;
}

.intro-subtitle {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: 16px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--sand-ethical);
    min-height: 1.5em;
}

.intro-chevron {
    position: absolute;
    bottom: 3rem;
    width: 40px;
    height: 24px;
    opacity: 0;
    animation: none;
}

.intro-chevron.visible {
    animation: pulseChevron 2s ease-in-out infinite;
}

@keyframes pulseChevron {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.8; }
}

.intro-chevron svg {
    width: 100%;
    height: 100%;
}

/* ===========================
   PROGRESS INDICATOR
   =========================== */

.progress-track {
    position: fixed;
    right: 2vw;
    top: 50%;
    transform: translateY(-50%);
    width: 2px;
    height: 40vh;
    background: rgba(74, 74, 90, 0.3);
    z-index: 100;
    opacity: 0;
    transition: opacity 600ms ease-out;
}

.progress-track.visible {
    opacity: 1;
}

.progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 0%;
    background: linear-gradient(to bottom, var(--sand-ethical), var(--midnight-indigo));
    transition: height 400ms ease-out;
}

.progress-node {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--slate-thought);
    border: 1px solid var(--sand-ethical);
    cursor: pointer;
    transition: background 400ms ease-out, transform 400ms ease-out;
}

.progress-node:nth-child(2) { top: 0%; }
.progress-node:nth-child(3) { top: 25%; }
.progress-node:nth-child(4) { top: 50%; }
.progress-node:nth-child(5) { top: 75%; }
.progress-node:nth-child(6) { top: 100%; }

.progress-node.active {
    background: var(--sand-ethical);
    transform: translateX(-50%) scale(1.4);
}

.progress-node.completed {
    background: var(--sage-virtue);
}

/* ===========================
   FRAYING THREAD
   =========================== */

.fraying-thread {
    position: absolute;
    top: 100vh;
    left: 50%;
    width: 2px;
    height: calc(100% - 100vh);
    z-index: 1;
    pointer-events: none;
    overflow: visible;
}

.thread-path {
    stroke: var(--sand-ethical);
    stroke-width: 1;
    fill: none;
    opacity: 0.3;
}

/* ===========================
   SCENARIO SECTIONS
   =========================== */

.scenario {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8vw;
    overflow: hidden;
}

/* Background variants */
.scenario[data-bg="ember-void"] {
    background:
        radial-gradient(ellipse at 20% 30%, rgba(160, 82, 45, 0.12) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 70%, rgba(26, 26, 46, 0.9) 0%, transparent 70%),
        var(--deep-void);
}

.scenario[data-bg="sage-ivory"] {
    background:
        radial-gradient(ellipse at 70% 20%, rgba(107, 143, 113, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 30% 80%, rgba(250, 248, 242, 0.1) 0%, transparent 60%),
        linear-gradient(to bottom, var(--midnight-indigo), var(--deep-void));
}

.scenario[data-bg="indigo-deep"] {
    background:
        radial-gradient(ellipse at 50% 20%, rgba(43, 45, 66, 0.8) 0%, transparent 50%),
        radial-gradient(ellipse at 20% 80%, rgba(26, 26, 46, 0.95) 0%, transparent 70%),
        var(--deep-void);
}

.scenario[data-bg="void-slate"] {
    background:
        radial-gradient(ellipse at 80% 30%, rgba(74, 74, 90, 0.2) 0%, transparent 50%),
        radial-gradient(ellipse at 10% 60%, rgba(26, 26, 46, 0.95) 0%, transparent 70%),
        var(--deep-void);
}

.scenario[data-bg="deep-parchment"] {
    background:
        radial-gradient(ellipse at 40% 20%, rgba(240, 234, 214, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 60% 80%, rgba(26, 26, 46, 0.9) 0%, transparent 60%),
        var(--deep-void);
}

.scenario-inner {
    position: relative;
    width: 100%;
    max-width: 1100px;
    z-index: 5;
}

/* --- Question --- */
.scenario-question {
    text-align: center;
    margin-bottom: 2.5rem;
    opacity: 0;
    filter: blur(8px);
    transition: opacity 800ms ease-out, filter 800ms ease-out;
}

.scenario-question.revealed {
    opacity: 1;
    filter: blur(0);
}

.question-text {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: clamp(2rem, 5vw, 4.5rem);
    letter-spacing: 0.03em;
    color: var(--parchment-warm);
    line-height: 1.2;
}

/* --- Context --- */
.scenario-context {
    max-width: 600px;
    margin: 0 auto 3rem;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 600ms ease-out 200ms, transform 600ms ease-out 200ms;
    text-align: center;
}

.scenario-context.revealed {
    opacity: 1;
    transform: translateY(0);
}

.scenario-context p {
    font-family: 'Source Sans 3', sans-serif;
    font-size: 17px;
    line-height: 1.72;
    color: var(--body-light);
}

/* --- Central Axis --- */
.central-axis {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 1px;
    background: var(--slate-thought);
    opacity: 0.3;
    z-index: 1;
}

/* --- Choices Container --- */
.choices-container {
    display: flex;
    gap: 3rem;
    justify-content: center;
    align-items: stretch;
    position: relative;
    z-index: 5;
}

/* --- Choice Panels --- */
.choice-panel {
    flex: 1;
    max-width: 440px;
    background: rgba(250, 248, 242, 0.04);
    border: 1px solid var(--slate-thought);
    padding: 2.5rem 2rem;
    cursor: pointer;
    position: relative;
    transition: border-color 300ms ease-out, transform 400ms ease-out, box-shadow 400ms ease-out, opacity 600ms ease-out;
    overflow: hidden;
}

.choice-panel.choice-left {
    opacity: 0;
    transform: translateX(-40px);
    transition: opacity 600ms ease-out, transform 600ms ease-out, border-color 300ms ease-out, box-shadow 400ms ease-out;
}

.choice-panel.choice-right {
    opacity: 0;
    transform: translateX(40px);
    transition: opacity 600ms ease-out, transform 600ms ease-out, border-color 300ms ease-out, box-shadow 400ms ease-out;
}

.choice-panel.choice-left.revealed {
    opacity: 1;
    transform: translateX(0);
}

.choice-panel.choice-right.revealed {
    opacity: 1;
    transform: translateX(0);
}

.choice-panel:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.choice-panel.choice-left:hover {
    border-color: var(--ember-consequence);
}

.choice-panel.choice-right:hover {
    border-color: var(--sage-virtue);
}

.choice-label {
    display: block;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--ui-chrome);
    margin-bottom: 1rem;
}

.choice-desc {
    font-family: 'Source Sans 3', sans-serif;
    font-size: 17px;
    line-height: 1.72;
    color: var(--body-light);
}

/* --- Choice States --- */
.choice-panel.chosen {
    transform: scale(1.02);
    border-color: var(--sand-ethical);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
    cursor: default;
}

.choice-panel.unchosen {
    opacity: 0.15;
    transform: scale(0.95);
    pointer-events: none;
    cursor: default;
}

/* --- Mirror Reflection --- */
.choice-mirror {
    position: absolute;
    bottom: -60px;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(to bottom, rgba(250, 248, 242, 0.06), transparent);
    filter: blur(2px);
    transform: scaleY(-1);
    opacity: 0.06;
    pointer-events: none;
}

/* --- Consequence Text --- */
.consequence-text {
    text-align: center;
    max-width: 700px;
    margin: 0 auto;
    overflow: hidden;
}

.consequence-text p {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-weight: 400;
    font-size: clamp(1.1rem, 2vw, 1.4rem);
    line-height: 1.8;
    color: var(--sand-ethical);
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 500ms ease-out, opacity 600ms ease-out, margin-top 500ms ease-out;
    margin-top: 0;
}

.consequence-text p.visible {
    max-height: 300px;
    opacity: 1;
    margin-top: 3rem;
}

/* ===========================
   SHADOW FIGURES
   =========================== */

.shadow-figure {
    position: absolute;
    opacity: 0.05;
    z-index: 2;
    pointer-events: none;
    transition: transform 100ms linear;
}

.figure-switch {
    width: 80px;
    height: 160px;
    bottom: 15%;
    left: 12%;
    background:
        radial-gradient(circle at 50% 10%, var(--slate-thought) 8px, transparent 8px),
        linear-gradient(var(--slate-thought) 0%, var(--slate-thought) 100%);
    background-size: 100% 100%, 3px 100%;
    background-position: center top, center 20%;
    background-repeat: no-repeat;
}

.figure-lifeboat {
    width: 120px;
    height: 60px;
    bottom: 20%;
    right: 10%;
    border-bottom: 3px solid var(--slate-thought);
    border-radius: 0 0 50% 50%;
}

.figure-doctor {
    width: 60px;
    height: 140px;
    top: 15%;
    right: 15%;
    background:
        radial-gradient(circle at 50% 8%, var(--slate-thought) 10px, transparent 10px),
        linear-gradient(var(--slate-thought) 0%, var(--slate-thought) 100%);
    background-size: 100% 100%, 3px 80%;
    background-position: center top, center 20%;
    background-repeat: no-repeat;
}

.figure-prisoner {
    width: 100px;
    height: 100px;
    bottom: 10%;
    left: 8%;
    border: 2px solid var(--slate-thought);
    border-radius: 0;
}

.figure-server {
    width: 40px;
    height: 120px;
    top: 20%;
    left: 10%;
    border: 1px solid var(--slate-thought);
    background: repeating-linear-gradient(
        to bottom,
        transparent,
        transparent 15px,
        var(--slate-thought) 15px,
        var(--slate-thought) 16px
    );
}

/* ===========================
   INTERSTITIALS
   =========================== */

.interstitial {
    position: relative;
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8vw;
    background: var(--deep-void);
    overflow: hidden;
}

.interstitial::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, rgba(43, 45, 66, 0.3) 0%, transparent 70%);
}

.interstitial-quote {
    position: relative;
    text-align: center;
    max-width: 800px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 800ms ease-out, transform 800ms ease-out;
}

.interstitial-quote.revealed {
    opacity: 1;
    transform: translateY(0);
}

.interstitial-quote p {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-weight: 400;
    font-size: clamp(1.5rem, 3.5vw, 2.8rem);
    line-height: 2.2;
    letter-spacing: 0.06em;
    color: var(--sand-ethical);
    margin-bottom: 1.5rem;
}

.interstitial-quote cite {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--ui-chrome);
    font-style: normal;
}

/* ===========================
   SCALE DECORATIVE (section breaks)
   =========================== */

.scale-decorative {
    text-align: center;
    margin-bottom: 2rem;
    opacity: 0.4;
}

.scale-decorative svg {
    width: 120px;
    height: auto;
}

/* ===========================
   ETHICAL PROFILE
   =========================== */

.profile-section {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8vw;
    background: var(--parchment-warm);
    overflow: hidden;
}

.profile-inner {
    text-align: center;
    max-width: 700px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1000ms ease-out, transform 1000ms ease-out;
}

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

.profile-heading {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: clamp(2rem, 4vw, 3.5rem);
    letter-spacing: 0.03em;
    color: var(--midnight-indigo);
    margin-bottom: 2.5rem;
}

.profile-text {
    margin-bottom: 3rem;
}

.profile-content {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-weight: 400;
    font-size: clamp(1.2rem, 2.5vw, 1.6rem);
    line-height: 2;
    color: var(--body-dark);
    opacity: 0;
    transition: opacity 1200ms ease-out;
}

.profile-content.visible {
    opacity: 1;
}

.profile-restart {
    opacity: 0;
    transition: opacity 800ms ease-out 500ms;
}

.profile-restart.visible {
    opacity: 1;
}

.restart-btn {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--ui-chrome);
    background: transparent;
    border: 1px solid var(--slate-thought);
    padding: 0.8rem 2rem;
    cursor: pointer;
    transition: border-color 300ms ease-out, color 300ms ease-out;
}

.restart-btn:hover {
    border-color: var(--ember-consequence);
    color: var(--ember-consequence);
}

/* ===========================
   RESPONSIVE
   =========================== */

@media (max-width: 768px) {
    .scenario {
        padding: 6vw 5vw;
    }

    .choices-container {
        flex-direction: column;
        gap: 1.5rem;
        align-items: center;
    }

    .choice-panel {
        max-width: 100%;
    }

    .choice-panel.choice-left {
        transform: translateY(-20px);
    }

    .choice-panel.choice-right {
        transform: translateY(20px);
    }

    .choice-panel.choice-left.revealed,
    .choice-panel.choice-right.revealed {
        transform: translateY(0);
    }

    .central-axis {
        display: none;
    }

    .progress-track {
        display: none;
    }

    .interstitial {
        min-height: 40vh;
    }
}
