/* ==============================================
   ethica.dev - Styles
   Colors from DESIGN.md:
     Moral Gray:          #1e1e2e (primary bg)
     Virtue Gold:         #e6c200 (primary accent)
     Consequence Crimson: #b33951 (secondary accent)
     Slate:               #2d2d44 (card bg)
     Parchment:           #f0ead6 (text)
     Code Green:          #50fa7b (code highlights)
     Neutral Stone:       #6c6c8a (secondary text)
     Deep Black:          #0d0d1a (code block bg)
   ============================================== */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 400;
    font-size: 1rem;
    line-height: 1.7;
    color: #f0ead6;
    background-color: #1e1e2e;
    overflow-x: hidden;
}

/* --- Generative SVG Background --- */
#generative-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
    overflow: visible;
}

.geo-shape {
    fill: none;
    stroke: #e6c200;
    stroke-opacity: 0.1;
    stroke-width: 1;
}

.shape-1 {
    transform: translate(10vw, 15vh) scale(2.5);
    animation: drift1 32s ease-in-out infinite alternate;
}
.shape-2 {
    transform: translate(70vw, 20vh) scale(1.8);
    animation: drift2 45s ease-in-out infinite alternate;
}
.shape-3 {
    transform: translate(85vw, 60vh) scale(1);
    animation: drift3 28s ease-in-out infinite alternate;
}
.shape-4 {
    transform: translate(25vw, 70vh) scale(3);
    animation: drift4 55s ease-in-out infinite alternate;
}
.shape-5 {
    transform: translate(50vw, 40vh) scale(1);
    animation: drift5 38s ease-in-out infinite alternate;
}
.shape-6 {
    transform: translate(90vw, 80vh) scale(2);
    animation: drift6 42s ease-in-out infinite alternate;
}
.shape-7 {
    transform: translate(5vw, 55vh) scale(1.5);
    animation: drift7 50s ease-in-out infinite alternate;
}
.shape-8 {
    transform: translate(60vw, 75vh) scale(1);
    animation: drift8 35s ease-in-out infinite alternate;
}
.shape-9 {
    transform: translate(40vw, 10vh) scale(2.2);
    animation: drift9 60s ease-in-out infinite alternate;
}
.shape-10 {
    transform: translate(75vw, 45vh) scale(1.3);
    animation: drift10 25s ease-in-out infinite alternate;
}
.shape-11 {
    transform: translate(15vw, 85vh) scale(1);
    animation: drift11 48s ease-in-out infinite alternate;
}
.shape-12 {
    transform: translate(55vw, 5vh) scale(1.6);
    animation: drift12 33s ease-in-out infinite alternate;
}

@keyframes drift1 {
    from { transform: translate(10vw, 15vh) scale(2.5) rotate(0deg); }
    to   { transform: translate(12vw, 12vh) scale(2.5) rotate(25deg); }
}
@keyframes drift2 {
    from { transform: translate(70vw, 20vh) scale(1.8) rotate(0deg); }
    to   { transform: translate(68vw, 23vh) scale(1.8) rotate(-30deg); }
}
@keyframes drift3 {
    from { transform: translate(85vw, 60vh) scale(1) rotate(0deg); }
    to   { transform: translate(83vw, 57vh) scale(1) rotate(20deg); }
}
@keyframes drift4 {
    from { transform: translate(25vw, 70vh) scale(3) rotate(0deg); }
    to   { transform: translate(27vw, 67vh) scale(3) rotate(15deg); }
}
@keyframes drift5 {
    from { transform: translate(50vw, 40vh) scale(1) rotate(0deg); }
    to   { transform: translate(48vw, 43vh) scale(1) rotate(-25deg); }
}
@keyframes drift6 {
    from { transform: translate(90vw, 80vh) scale(2) rotate(0deg); }
    to   { transform: translate(88vw, 77vh) scale(2) rotate(30deg); }
}
@keyframes drift7 {
    from { transform: translate(5vw, 55vh) scale(1.5) rotate(0deg); }
    to   { transform: translate(7vw, 52vh) scale(1.5) rotate(-20deg); }
}
@keyframes drift8 {
    from { transform: translate(60vw, 75vh) scale(1) rotate(0deg); }
    to   { transform: translate(58vw, 72vh) scale(1) rotate(35deg); }
}
@keyframes drift9 {
    from { transform: translate(40vw, 10vh) scale(2.2) rotate(0deg); }
    to   { transform: translate(42vw, 7vh) scale(2.2) rotate(-15deg); }
}
@keyframes drift10 {
    from { transform: translate(75vw, 45vh) scale(1.3) rotate(0deg); }
    to   { transform: translate(73vw, 48vh) scale(1.3) rotate(28deg); }
}
@keyframes drift11 {
    from { transform: translate(15vw, 85vh) scale(1) rotate(0deg); }
    to   { transform: translate(17vw, 82vh) scale(1) rotate(-22deg); }
}
@keyframes drift12 {
    from { transform: translate(55vw, 5vh) scale(1.6) rotate(0deg); }
    to   { transform: translate(53vw, 8vh) scale(1.6) rotate(18deg); }
}

/* --- Navigation --- */
#main-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2.5rem;
    background: rgba(30, 30, 46, 0.85);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(230, 194, 0, 0.15);
}

.nav-logo {
    display: flex;
    align-items: center;
}

.scales-icon {
    display: block;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-links a {
    color: #f0ead6;
    text-decoration: none;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: 0.9rem;
    letter-spacing: 0.03em;
    transition: color 0.3s ease;
}

.nav-links a:hover {
    color: #e6c200;
}

/* --- Hero Section --- */
#hero {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6rem 2rem 4rem;
}

.hero-content {
    max-width: 700px;
    text-align: left;
}

.hero-title {
    margin-bottom: 1.5rem;
    line-height: 1;
}

.hero-ethica {
    display: block;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(3.5rem, 10vw, 7rem);
    color: #f0ead6;
    letter-spacing: -0.02em;
}

.hero-dev {
    display: block;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: clamp(2rem, 5vw, 4rem);
    color: #e6c200;
    margin-left: 3rem;
    margin-top: -0.5rem;
}

.hero-tagline {
    font-family: 'Crimson Pro', serif;
    font-weight: 400;
    font-size: 1.5rem;
    font-style: italic;
    color: #e6c200;
    margin-bottom: 1rem;
}

.hero-sub {
    font-size: 1rem;
    line-height: 1.7;
    color: #6c6c8a;
    max-width: 520px;
}

/* --- Section Titles --- */
.section-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: clamp(2rem, 5vw, 3.5rem);
    color: #f0ead6;
    margin-bottom: 0.5rem;
}

.section-subtitle {
    font-family: 'Crimson Pro', serif;
    font-weight: 400;
    font-style: italic;
    font-size: 1.15rem;
    color: #6c6c8a;
    margin-bottom: 3rem;
}

/* --- Games Section --- */
#games {
    position: relative;
    z-index: 1;
    padding: 6rem 2.5rem;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 4rem;
    max-width: 1100px;
    margin: 2rem auto 0;
}

/* --- Card Stack --- */
.card-stack {
    position: relative;
    height: 360px;
    cursor: pointer;
    perspective: 800px;
}

.card {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #2d2d44;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.card-inner {
    padding: 2rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.card-bottom {
    transform: translate(16px, 16px) rotate(3deg);
    opacity: 0.2;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.card-middle {
    transform: translate(8px, 8px) rotate(1.5deg);
    opacity: 0.5;
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.3);
}

.card-top {
    transform: translate(0, 0) rotate(0deg);
    opacity: 1;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(230, 194, 0, 0.2);
}

.card-stack:hover .card-bottom {
    transform: translate(-20px, -10px) rotate(-5deg);
    opacity: 0.6;
}

.card-stack:hover .card-middle {
    transform: translate(0px, -5px) rotate(0deg);
    opacity: 0.8;
}

.card-stack:hover .card-top {
    transform: translate(20px, 10px) rotate(5deg);
    opacity: 1;
}

.card-tag {
    display: inline-block;
    font-family: 'Fira Code', monospace;
    font-size: 0.75rem;
    color: #e6c200;
    border: 1px solid rgba(230, 194, 0, 0.4);
    padding: 0.2rem 0.6rem;
    border-radius: 3px;
    margin-bottom: 0.75rem;
    width: fit-content;
}

.card h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: 1.5rem;
    color: #f0ead6;
    margin-bottom: 0.5rem;
}

.card p {
    font-size: 0.95rem;
    color: #6c6c8a;
    line-height: 1.6;
}

.card-top p {
    color: #f0ead6;
    opacity: 0.8;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid rgba(108, 108, 138, 0.2);
}

.meta-genre {
    font-family: 'Fira Code', monospace;
    font-size: 0.75rem;
    color: #6c6c8a;
}

.meta-status {
    font-family: 'Fira Code', monospace;
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-live {
    color: #50fa7b;
    border: 1px solid rgba(80, 250, 123, 0.4);
}

.status-dev {
    color: #e6c200;
    border: 1px solid rgba(230, 194, 0, 0.4);
}

.status-proto {
    color: #6c6c8a;
    border: 1px solid rgba(108, 108, 138, 0.4);
}

/* --- Philosophy Section --- */
#philosophy {
    position: relative;
    z-index: 1;
    padding: 6rem 2.5rem;
    background: linear-gradient(180deg, transparent 0%, rgba(13, 13, 26, 0.4) 50%, transparent 100%);
}

.philosophy-grid {
    max-width: 1000px;
    margin: 2rem auto 0;
    display: flex;
    flex-direction: column;
    gap: 4rem;
}

.philosophy-essay {
    display: grid;
    grid-template-columns: 1fr 260px;
    gap: 2rem;
    padding: 2.5rem;
    background: rgba(45, 45, 68, 0.4);
    border-radius: 8px;
    border-left: 3px solid #e6c200;
    position: relative;
}

.philosophy-essay:nth-child(2) {
    border-left-color: #b33951;
}

.philosophy-essay:nth-child(3) {
    border-left-color: #50fa7b;
}

/* Broken-grid overlap effect */
.philosophy-essay:nth-child(2) {
    margin-top: -1.5rem;
    margin-left: 2rem;
}

.philosophy-essay:nth-child(3) {
    margin-top: -1rem;
    margin-right: 2rem;
}

.essay-body h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: 1.6rem;
    color: #f0ead6;
    margin-bottom: 1rem;
}

.essay-text {
    font-family: 'Crimson Pro', serif;
    font-weight: 400;
    font-size: 1.05rem;
    line-height: 1.75;
    color: #f0ead6;
    opacity: 0.9;
    margin-bottom: 1rem;
}

.essay-text:last-child {
    margin-bottom: 0;
}

.essay-margin {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-left: 1.5rem;
    border-left: 1px solid rgba(108, 108, 138, 0.3);
}

.margin-note {
    font-family: 'Crimson Pro', serif;
    font-style: italic;
    font-size: 0.95rem;
    line-height: 1.6;
    color: #e6c200;
    opacity: 0.8;
}

.margin-attribution {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.8rem;
    color: #6c6c8a;
    margin-top: 0.5rem;
}

/* --- Branch Diagram Section --- */
#branches {
    position: relative;
    z-index: 1;
    padding: 6rem 2.5rem;
    text-align: center;
}

.branch-container {
    max-width: 800px;
    margin: 2rem auto 0;
}

#branch-diagram {
    width: 100%;
    height: auto;
}

.branch-line {
    stroke: #6c6c8a;
    stroke-width: 1.5;
    stroke-opacity: 0.6;
}

.node {
    stroke: none;
}

.node-virtue {
    fill: #e6c200;
}

.node-consequence {
    fill: #b33951;
}

.node-neutral {
    fill: #6c6c8a;
}

.node-label {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 10px;
    fill: #f0ead6;
    text-anchor: middle;
    dominant-baseline: middle;
    font-weight: 500;
}

.node-label-sm {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 8px;
    fill: #f0ead6;
    text-anchor: middle;
    dominant-baseline: middle;
    font-weight: 400;
}

.legend-label {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 10px;
    fill: #6c6c8a;
    text-anchor: start;
    dominant-baseline: middle;
}

/* --- Developers Section --- */
#developers {
    position: relative;
    z-index: 1;
    padding: 6rem 2.5rem;
}

.dev-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 3rem;
    max-width: 1000px;
    margin: 2rem auto 0;
    align-items: start;
}

/* Broken-grid overlap for dev section */
.dev-text {
    margin-top: 2rem;
}

.code-block {
    background: #0d0d1a;
    border-left: 3px solid #50fa7b;
    border-radius: 8px;
    overflow: hidden;
}

.code-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: rgba(80, 250, 123, 0.05);
    border-bottom: 1px solid rgba(80, 250, 123, 0.1);
}

.code-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.dot-red { background: #b33951; }
.dot-yellow { background: #e6c200; }
.dot-green { background: #50fa7b; }

.code-filename {
    font-family: 'Fira Code', monospace;
    font-size: 0.8rem;
    color: #6c6c8a;
    margin-left: 0.5rem;
}

.code-block pre {
    padding: 1.5rem;
    overflow-x: auto;
}

.code-block code {
    font-family: 'Fira Code', monospace;
    font-size: 0.85rem;
    line-height: 1.7;
    color: #f0ead6;
}

.code-keyword { color: #b33951; }
.code-type { color: #e6c200; }
.code-string { color: #50fa7b; }
.code-prop { color: #f0ead6; }
.code-fn { color: #50fa7b; }
.code-comment { color: #6c6c8a; font-style: italic; }

.dev-text h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: 1.6rem;
    color: #f0ead6;
    margin-bottom: 1rem;
}

.dev-text p {
    font-family: 'Crimson Pro', serif;
    font-size: 1.05rem;
    line-height: 1.75;
    color: #f0ead6;
    opacity: 0.9;
    margin-bottom: 1rem;
}

.dev-links {
    display: flex;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.dev-link {
    font-family: 'Fira Code', monospace;
    font-size: 0.85rem;
    color: #50fa7b;
    text-decoration: none;
    padding: 0.4rem 1rem;
    border: 1px solid rgba(80, 250, 123, 0.3);
    border-radius: 4px;
    transition: all 0.3s ease;
}

.dev-link:hover {
    background: rgba(80, 250, 123, 0.1);
    border-color: #50fa7b;
}

/* --- About Section --- */
#about {
    position: relative;
    z-index: 1;
    padding: 6rem 2.5rem;
    background: linear-gradient(180deg, transparent 0%, rgba(13, 13, 26, 0.5) 100%);
}

.about-content {
    max-width: 700px;
    margin: 0 auto;
}

.about-text {
    font-family: 'Crimson Pro', serif;
    font-size: 1.15rem;
    line-height: 1.75;
    color: #f0ead6;
    opacity: 0.9;
    margin-bottom: 1.5rem;
}

.about-contact {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(108, 108, 138, 0.3);
}

.contact-label {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.9rem;
    color: #6c6c8a;
}

.contact-link {
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
    color: #e6c200;
    text-decoration: none;
    transition: color 0.3s ease;
}

.contact-link:hover {
    color: #50fa7b;
}

/* --- Footer --- */
#main-footer {
    position: relative;
    z-index: 1;
    padding: 3rem 2.5rem;
    text-align: center;
    border-top: 1px solid rgba(108, 108, 138, 0.15);
}

.footer-ethica {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 1.5rem;
    color: #f0ead6;
}

.footer-dev {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: 1.5rem;
    color: #e6c200;
}

.footer-tagline {
    font-family: 'Crimson Pro', serif;
    font-style: italic;
    font-size: 1rem;
    color: #6c6c8a;
    margin-top: 0.5rem;
}

.footer-copy {
    font-size: 0.8rem;
    color: #6c6c8a;
    opacity: 0.6;
    margin-top: 1rem;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    #main-nav {
        padding: 0.75rem 1.5rem;
    }

    .nav-links {
        gap: 1rem;
    }

    .nav-links a {
        font-size: 0.8rem;
    }

    .games-grid {
        grid-template-columns: 1fr;
        gap: 3rem;
        padding: 0 1rem;
    }

    .philosophy-essay {
        grid-template-columns: 1fr;
    }

    .philosophy-essay:nth-child(2) {
        margin-left: 0;
    }

    .philosophy-essay:nth-child(3) {
        margin-right: 0;
    }

    .essay-margin {
        border-left: none;
        border-top: 1px solid rgba(108, 108, 138, 0.3);
        padding-left: 0;
        padding-top: 1rem;
    }

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

    .dev-text {
        margin-top: 0;
    }
}
