/* ==========================================
   archetypic.dev - Styles
   Retro-Futuristic / Midnight Blue / Blur-Focus
   ========================================== */

/* CSS Custom Properties */
:root {
    --bg-primary: #0B1026;
    --bg-secondary: #111B33;
    --bg-tertiary: #1A2740;
    --bg-warm: #0F1228;
    --text-heading: #D8E0EA;
    --text-body: #C8BFA8;
    --accent-teal: #7FAFBF;
    --accent-amber: #C49A5C;
    --accent-rose: #B07A7A;
    --border-steel: #2A3B52;
    --caption-gray: #6B7A8D;
    --bg-hue: 230;
    --bg-lightness: 9%;
}

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

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

body {
    background-color: var(--bg-primary);
    color: var(--text-body);
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    font-size: 16px;
    line-height: 1.7;
    overflow-x: hidden;
}

/* ==========================================
   Starfield Background
   ========================================== */
#starfield {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
}

/* ==========================================
   Color Temperature Overlay
   ========================================== */
#color-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
    pointer-events: none;
    background: transparent;
    transition: background 0.5s ease;
}

/* ==========================================
   Grain Texture
   ========================================== */
#grain-texture {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    pointer-events: none;
    opacity: 0.05;
    mix-blend-mode: overlay;
}

/* ==========================================
   Fixed Site Title
   ========================================== */
#site-title {
    position: fixed;
    top: 24px;
    left: 24px;
    z-index: 100;
    font-family: 'Jost', sans-serif;
    font-weight: 500;
    font-size: 11px;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--text-heading);
    opacity: 1;
    transition: opacity 0.6s ease;
}

#site-title.faded {
    opacity: 0.3;
}

/* ==========================================
   Section Navigation Dots
   ========================================== */
#section-nav {
    position: fixed;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.nav-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    border: 1px solid var(--caption-gray);
    background: transparent;
    cursor: pointer;
    padding: 0;
    transition: all 0.4s ease;
    position: relative;
}

.nav-dot.active {
    background: var(--accent-teal);
    border-color: var(--accent-teal);
    box-shadow: 0 0 8px rgba(127, 175, 191, 0.4), 0 0 16px rgba(127, 175, 191, 0.15);
}

.nav-dot::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1px solid transparent;
    transition: border-color 0.4s ease;
}

.nav-dot.active::after {
    border-color: rgba(127, 175, 191, 0.2);
}

/* ==========================================
   Frame / Section Base
   ========================================== */
.frame {
    position: relative;
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 2;
}

/* ==========================================
   Letterbox Bars
   ========================================== */
.letterbox-top,
.letterbox-bottom {
    width: 100%;
    background-color: var(--bg-primary);
    z-index: 10;
    flex-shrink: 0;
    position: relative;
}

.letterbox-top {
    height: 8vh;
}

.letterbox-bottom {
    height: 8vh;
}

.scroll-progress-line {
    position: absolute;
    top: 50%;
    left: 10%;
    width: 0%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-steel), transparent);
    transition: width 0.3s ease;
}

/* ==========================================
   Frame Content
   ========================================== */
.frame-content {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 0 5vw;
}

/* ==========================================
   Z-Pattern Grid
   ========================================== */
.z-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-template-rows: 1fr 1fr;
    gap: 20px;
    width: 100%;
    height: 100%;
    align-items: center;
}

/* ==========================================
   Topographic Line Decorations
   ========================================== */
.topo-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.topo-bottom {
    top: auto;
    bottom: 0;
    height: 200px;
}

/* ==========================================
   Vertical Section Dividers
   ========================================== */
.vertical-divider {
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 40px;
    z-index: 2;
    position: relative;
}

.divider-line {
    width: 1px;
    flex: 1;
    background-color: var(--border-steel);
}

.diamond-glyph {
    width: 8px;
    height: 8px;
    background-color: var(--border-steel);
    transform: rotate(45deg);
    flex-shrink: 0;
}

.diamond-glyph-decorative {
    position: absolute;
    top: 40px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    width: 8px;
    height: 8px;
    background-color: var(--border-steel);
    z-index: 5;
}

/* ==========================================
   Crosshair Markers
   ========================================== */
.crosshair-marker {
    width: 12px;
    height: 12px;
    border: 1px solid var(--caption-gray);
    border-radius: 50%;
    position: absolute;
    top: -6px;
    left: -6px;
}

.crosshair-marker::before,
.crosshair-marker::after {
    content: '';
    position: absolute;
    background-color: var(--caption-gray);
}

.crosshair-marker::before {
    width: 1px;
    height: 16px;
    top: -2px;
    left: 5px;
}

.crosshair-marker::after {
    width: 16px;
    height: 1px;
    top: 5px;
    left: -2px;
}

/* ==========================================
   Blur-Focus Animation
   ========================================== */
.blur-focus {
    filter: blur(12px);
    opacity: 0.6;
    transition: filter 800ms cubic-bezier(0.25, 0.1, 0.25, 1),
                opacity 800ms cubic-bezier(0.25, 0.1, 0.25, 1);
    will-change: filter, opacity;
}

.blur-focus.in-focus {
    filter: blur(0px);
    opacity: 1;
}

/* ==========================================
   Typography
   ========================================== */

/* Primary Headings - Jost */
h1, h2, .section-heading {
    font-family: 'Jost', sans-serif;
    font-weight: 500;
    color: var(--text-heading);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

h1 {
    font-size: 80px;
    letter-spacing: 0.12em;
}

h2, .section-heading {
    font-size: 56px;
    margin-bottom: 40px;
}

/* Subheadings / Accent - Josefin Sans */
.subtitle,
.pull-quote,
.signoff {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 300;
    color: var(--accent-teal);
    letter-spacing: 0.05em;
}

.subtitle {
    font-size: 18px;
    margin-top: 16px;
}

.pull-quote {
    font-size: 28px;
    font-style: italic;
    line-height: 1.5;
}

.signoff {
    font-size: 24px;
    text-align: center;
}

/* Body Text - Source Serif 4 */
.body-text {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    font-size: 16px;
    line-height: 1.7;
    color: var(--text-body);
    max-width: 580px;
    margin-bottom: 24px;
}

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

/* Caption / Instrument - IBM Plex Mono */
.caption-text,
.caption-label,
.link-item,
.link-separator {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 11px;
    color: var(--caption-gray);
    letter-spacing: 0.04em;
    line-height: 1.7;
}

.caption-label {
    display: block;
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 8px;
    color: var(--accent-amber);
}

/* Typography entrance animation */
.heading-animate {
    opacity: 0;
    letter-spacing: 0.2em;
    transition: opacity 500ms ease, letter-spacing 500ms ease;
}

.heading-animate.visible {
    opacity: 1;
    letter-spacing: 0.08em;
}

/* Amber underline */
.amber-underline {
    text-decoration: none;
    background-image: linear-gradient(var(--accent-amber), var(--accent-amber));
    background-position: 0 100%;
    background-repeat: no-repeat;
    background-size: 100% 1px;
    padding-bottom: 2px;
}

/* ==========================================
   Section 1: Opening Frame
   ========================================== */
#section-opening .frame-content {
    flex-direction: column;
    padding: 0;
}

.opening-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.mountain-landscape {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.mountain-svg {
    width: 100%;
    height: 100%;
    display: block;
}

.vignette {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    box-shadow: inset 0 0 120px 40px rgba(11, 16, 38, 0.5);
    pointer-events: none;
}

.opening-text {
    position: relative;
    z-index: 5;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#hero-title {
    font-size: 80px;
    letter-spacing: 0.12em;
}

.scroll-indicator {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    animation: pulse-chevron 2s ease-in-out infinite;
}

@keyframes pulse-chevron {
    0%, 100% { opacity: 0.4; transform: translateX(-50%) translateY(0); }
    50% { opacity: 0.8; transform: translateX(-50%) translateY(6px); }
}

/* ==========================================
   Section 2: Manifesto Frame
   ========================================== */
#section-manifesto {
    background-color: var(--bg-secondary);
}

.z-anchor-top-left {
    grid-column: 1 / 6;
    grid-row: 1;
    padding: 20px;
    z-index: 5;
}

.z-anchor-bottom-right {
    grid-column: 7 / 13;
    grid-row: 2;
    display: flex;
    justify-content: flex-end;
    z-index: 5;
}

/* ==========================================
   Caption Panel (Floating)
   ========================================== */
.caption-panel {
    max-width: 320px;
    border: 1px solid var(--caption-gray);
    padding: 20px;
    background: rgba(26, 39, 64, 0.85);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    position: relative;
}

/* ==========================================
   Section 3: Gallery Frame
   ========================================== */
#section-gallery .z-grid {
    grid-template-rows: auto auto auto;
}

.gallery-image-top-right {
    grid-column: 5 / 13;
    grid-row: 1;
    z-index: 5;
}

.gallery-text {
    grid-column: 3 / 10;
    grid-row: 2;
    z-index: 5;
    display: flex;
    justify-content: center;
}

.gallery-image-bottom-left {
    grid-column: 1 / 6;
    grid-row: 3;
    z-index: 5;
}

/* Vintage Photo Treatment */
.vintage-photo {
    position: relative;
    overflow: hidden;
    border-radius: 0;
    filter: contrast(1.08) saturate(0.85) sepia(0.08) brightness(0.95);
}

.vintage-photo .photo-svg {
    width: 100%;
    height: auto;
    display: block;
}

.vintage-photo.clipped {
    clip-path: polygon(0 0, 100% 0, 100% 85%, 90% 95%, 70% 88%, 50% 92%, 30% 86%, 10% 93%, 0 88%);
}

/* ==========================================
   Section 4: Detail Frame
   ========================================== */
#section-detail .z-grid {
    grid-template-columns: repeat(12, 1fr);
    grid-template-rows: 1fr;
    align-items: center;
}

.detail-caption {
    grid-column: 1 / 4;
    grid-row: 1;
    z-index: 5;
}

.detail-image {
    grid-column: 4 / 13;
    grid-row: 1;
    z-index: 5;
}

/* ==========================================
   Section 5: Reflection Frame
   ========================================== */
#section-reflection .frame-content {
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#section-reflection .z-grid {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.reflection-content {
    max-width: 580px;
    position: relative;
    z-index: 5;
    padding: 40px 20px;
}

.reflection-content .section-heading {
    text-align: center;
}

/* ==========================================
   Section 6: Closing Frame
   ========================================== */
#section-closing .frame-content {
    flex-direction: column;
    padding: 0;
}

.closing-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.closing-text {
    position: relative;
    z-index: 5;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
}

.closing-links {
    display: flex;
    gap: 12px;
    align-items: center;
}

.link-item {
    cursor: pointer;
    transition: color 0.3s ease;
}

.link-item:hover {
    color: var(--accent-teal);
}

.link-separator {
    opacity: 0.4;
}

/* ==========================================
   Scroll-linked Background Transition
   ========================================== */
.frame:nth-child(odd) {
    background-color: var(--bg-primary);
}

.frame:nth-child(even) {
    background-color: var(--bg-secondary);
}

#section-closing {
    background-color: var(--bg-warm);
}

/* ==========================================
   Responsive Adjustments
   ========================================== */
@media (max-width: 1024px) {
    h1, #hero-title {
        font-size: 56px;
    }

    h2, .section-heading {
        font-size: 40px;
    }

    .pull-quote {
        font-size: 22px;
    }

    .z-anchor-top-left {
        grid-column: 1 / 7;
    }

    .z-anchor-bottom-right {
        grid-column: 6 / 13;
    }

    .gallery-image-top-right {
        grid-column: 4 / 13;
    }

    .gallery-image-bottom-left {
        grid-column: 1 / 7;
    }

    .detail-caption {
        grid-column: 1 / 5;
    }

    .detail-image {
        grid-column: 5 / 13;
    }
}

@media (max-width: 768px) {
    h1, #hero-title {
        font-size: 40px;
        letter-spacing: 0.08em;
    }

    h2, .section-heading {
        font-size: 32px;
    }

    .pull-quote {
        font-size: 20px;
    }

    .body-text {
        font-size: 15px;
    }

    .z-grid {
        display: flex;
        flex-direction: column;
        padding: 40px 20px;
        gap: 30px;
    }

    #section-gallery .z-grid {
        flex-direction: column;
    }

    .gallery-image-top-right,
    .gallery-image-bottom-left,
    .gallery-text {
        width: 100%;
    }

    .detail-caption,
    .detail-image {
        width: 100%;
    }

    .z-anchor-top-left,
    .z-anchor-bottom-right {
        width: 100%;
        padding: 10px;
    }

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

    #section-nav {
        right: 12px;
    }

    #site-title {
        top: 16px;
        left: 16px;
    }

    .letterbox-top {
        height: 5vh;
    }

    .letterbox-bottom {
        height: 5vh;
    }
}

@media (max-width: 480px) {
    h1, #hero-title {
        font-size: 28px;
    }

    h2, .section-heading {
        font-size: 24px;
    }

    .pull-quote {
        font-size: 18px;
    }

    .subtitle {
        font-size: 14px;
    }

    .signoff {
        font-size: 18px;
    }
}
