/* ============================================
   mosun.xyz - Alpine Noir / Grainy-Textured
   Palette: Jewel Tones on Obsidian
   Typography: Playfair Display + Source Serif 4 + DM Mono
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --bg-primary: #0e0b14;        /* Obsidian Deep */
    --bg-secondary: #1a1525;      /* Slate Cavern */
    --text-primary: #b8a9c4;      /* Quartz Smoke */
    --text-display: #e8e0f0;      /* Moonstone White */
    --accent-primary: #7b3fa0;    /* Amethyst Fracture */
    --accent-secondary: #9e4a5c;  /* Garnet Dust */
    --accent-tertiary: #2a5f8f;   /* Sapphire Vein */
    --highlight: #c4883a;         /* Topaz Ember */
    --grain-color: #d4c8e0;       /* Mica Fleck */

    --font-display: 'Playfair Display', Georgia, serif;
    --font-body: 'Source Serif 4', 'Source Serif Pro', Georgia, serif;
    --font-accent: 'DM Mono', 'Courier New', monospace;
}

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

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    background-color: #000000;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-weight: 400;
    line-height: 1.72;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Font Classes --- */
.display-font {
    font-family: var(--font-display);
}

.body-font {
    font-family: var(--font-body);
}

.accent-font {
    font-family: var(--font-accent);
    font-weight: 400;
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

/* --- SVG Grain Overlay --- */
#grain-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9999;
    opacity: 0;
    mix-blend-mode: overlay;
    transition: opacity 1200ms ease;
}

#grain-overlay.visible {
    opacity: 0.04;
}

#grain-overlay.fog-active {
    opacity: 0.12;
}

/* --- Entry Screen --- */
#entry-screen {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding-left: 12vw;
    background-color: #000000;
    z-index: 10;
}

#entry-content {
    max-width: 680px;
}

#entry-title {
    font-weight: 900;
    font-size: clamp(3rem, 8vw, 7rem);
    letter-spacing: -0.02em;
    color: var(--text-display);
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 800ms cubic-bezier(0.4, 0, 0.2, 1),
                transform 800ms cubic-bezier(0.4, 0, 0.2, 1);
}

#entry-title.revealed {
    opacity: 1;
    transform: translateY(0);
}

#entry-subtitle {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.72;
    color: var(--text-primary);
    margin-top: 1.5rem;
    max-width: 58ch;
    opacity: 0;
    transition: opacity 800ms cubic-bezier(0.4, 0, 0.2, 1);
}

#entry-subtitle.revealed {
    opacity: 1;
}

/* --- Main Content Grid --- */
#main-content {
    position: relative;
    display: grid;
    grid-template-columns: 12vw 1fr 25vw;
    min-height: 100vh;
    background-color: var(--bg-primary);
    z-index: 5;
}

/* --- Elevation Bands --- */
.elevation-band {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 12vw 1fr 25vw;
    margin-top: clamp(8rem, 20vh, 16rem);
    position: relative;
}

.elevation-band:first-child {
    margin-top: clamp(4rem, 10vh, 8rem);
}

.elevation-marker {
    grid-column: 1;
    color: var(--accent-secondary);
    opacity: 0.7;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    align-self: start;
    padding-top: 0.5rem;
    padding-left: 1.5vw;
}

.band-content {
    grid-column: 2;
    max-width: 680px;
}

.band-content p {
    max-width: 58ch;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

/* --- Section Headings --- */
.section-heading {
    font-weight: 700;
    font-size: clamp(1.8rem, 4vw, 3rem);
    letter-spacing: 0em;
    color: var(--text-display);
    margin-bottom: 2rem;
}

/* --- Summit Section --- */
.elevation-summit {
    margin-top: clamp(12rem, 30vh, 24rem);
    margin-bottom: clamp(8rem, 20vh, 16rem);
}

.summit-content {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
}

.summit-text {
    font-weight: 900;
    font-size: clamp(2rem, 5vw, 4.5rem);
    letter-spacing: -0.02em;
    color: var(--text-display);
    text-align: center;
    max-width: 20ch;
    line-height: 1.2;
}

/* --- Pull Quotes --- */
.pull-quote {
    position: relative;
    padding-left: 2rem;
    margin: 2.5rem 0;
    font-style: italic;
    font-weight: 300;
    color: var(--text-primary);
    max-width: 58ch;
}

.pull-quote::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(to bottom, var(--accent-primary) 0%, var(--accent-primary) 20%);
    clip-path: polygon(0 0, 100% 0, 33% 100%, 0 100%);
}

/* --- Ridgeline Dividers --- */
.ridgeline-divider {
    grid-column: 1 / -1;
    padding: 0 12vw;
    margin-top: clamp(4rem, 10vh, 8rem);
    overflow: hidden;
}

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

.ridgeline-path {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    transition: stroke-dashoffset 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.ridgeline-path.drawn {
    stroke-dashoffset: 0;
}

/* --- Geometric Abstract Elements --- */
#geometric-elements {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 8;
}

/* Ridge Triangles */
.ridge-triangle {
    position: absolute;
    width: 0;
    height: 0;
    border-left: 40px solid transparent;
    border-right: 40px solid transparent;
    border-bottom-style: solid;
    border-bottom-color: var(--accent-tertiary);
    opacity: 0.15;
    transition: transform 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

.ridge-triangle[data-height="80"] {
    border-left-width: 25px;
    border-right-width: 25px;
    border-bottom-width: 80px;
}

.ridge-triangle[data-height="100"] {
    border-left-width: 30px;
    border-right-width: 30px;
    border-bottom-width: 100px;
}

.ridge-triangle[data-height="120"] {
    border-left-width: 35px;
    border-right-width: 35px;
    border-bottom-width: 120px;
}

.ridge-triangle[data-height="140"] {
    border-left-width: 40px;
    border-right-width: 40px;
    border-bottom-width: 140px;
}

.ridge-triangle[data-height="160"] {
    border-left-width: 45px;
    border-right-width: 45px;
    border-bottom-width: 160px;
}

.ridge-triangle[data-height="200"] {
    border-left-width: 55px;
    border-right-width: 55px;
    border-bottom-width: 200px;
}

/* Contour Line Groups */
.contour-group {
    position: absolute;
    width: 22vw;
    height: auto;
    transition: transform 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

/* Mineral Facets */
.mineral-facet {
    position: absolute;
    background-color: var(--highlight);
    opacity: 0.10;
    transition: transform 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

/* --- Text Reveal Animation --- */
.reveal-text {
    opacity: 0;
    transition: opacity 600ms cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal-text.visible {
    opacity: 1;
}

/* --- Minimal Navigation --- */
#minimal-nav {
    position: fixed;
    bottom: 2rem;
    left: 2rem;
    z-index: 100;
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-link {
    color: var(--accent-secondary);
    opacity: 0.7;
    text-decoration: none;
    font-family: var(--font-accent);
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    transition: color 0.3s ease, opacity 0.3s ease;
}

.nav-link:hover {
    color: var(--highlight);
    opacity: 1;
}

.nav-home {
    opacity: 1;
    color: var(--text-primary);
}

/* --- Footer --- */
#site-footer {
    position: relative;
    grid-column: 1 / -1;
    padding: 4rem 12vw;
    padding-bottom: 6rem;
    background-color: var(--bg-primary);
    z-index: 5;
}

.footer-ridgeline {
    width: 100%;
    height: 30px;
    display: block;
    margin-bottom: 2rem;
}

.footer-coords {
    display: flex;
    gap: 2rem;
    color: var(--accent-secondary);
    opacity: 0.5;
}

/* --- Responsive: Mobile (<768px) --- */
@media (max-width: 768px) {
    #main-content {
        display: block;
        padding: 0 6vw;
    }

    .elevation-band {
        display: block;
        margin-top: clamp(6rem, 15vh, 10rem);
    }

    .elevation-marker {
        writing-mode: horizontal-tb;
        text-orientation: initial;
        margin-bottom: 0.5rem;
        padding-left: 0;
    }

    .band-content {
        max-width: 100%;
    }

    .band-content p {
        max-width: 100%;
    }

    .pull-quote {
        max-width: 100%;
    }

    .summit-content {
        min-height: 40vh;
    }

    .summit-text {
        max-width: 100%;
    }

    #entry-screen {
        padding-left: 6vw;
        padding-right: 6vw;
    }

    #geometric-elements {
        display: none;
    }

    .ridgeline-divider {
        padding: 0;
    }

    #site-footer {
        padding: 4rem 6vw;
        padding-bottom: 6rem;
    }

    #minimal-nav {
        bottom: 1.5rem;
        left: 1.5rem;
    }

    .nav-link {
        font-size: 13px;
    }

    .footer-coords {
        flex-direction: column;
        gap: 0.5rem;
    }

    #grain-overlay.visible {
        opacity: 0.03;
    }
}

/* --- Selection Color --- */
::selection {
    background-color: var(--accent-primary);
    color: var(--text-display);
}

::-moz-selection {
    background-color: var(--accent-primary);
    color: var(--text-display);
}

/* --- Scrollbar (Webkit) --- */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--accent-secondary);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}

/* --- Link Styles --- */
a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--highlight);
}
