/* ============================================
   desca.dev - Pastoral-Holographic Portfolio
   ============================================ */

/* CSS Custom Properties */
:root {
    /* Backgrounds */
    --bg-primary: #FAF3E8;
    --bg-secondary: #F0E4D0;
    --bg-dark: #2A1F14;

    /* Text */
    --text-primary: #3D2B1F;
    --text-secondary: #8B5E3C;
    --text-tertiary: #8B7355;

    /* Accents - Holographic */
    --accent-amber: #D4A853;
    --accent-rose: #C4756E;
    --accent-sage: #8BA888;
    --accent-lavender: #9B8EC4;

    /* Border / Divider */
    --border-warm: #D6C4A8;

    /* Shadow */
    --shadow-umber: rgba(61, 43, 31, 0.12);

    /* Holographic angle (updated by JS) */
    --holo-angle: 0deg;
    --holo-x: 50%;
    --holo-y: 50%;

    /* Font variation settings for Fraunces */
    --hero-weight: 100;
}

/* @property for animatable custom property */
@property --hero-weight {
    syntax: '<number>';
    inherits: true;
    initial-value: 100;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.1vw, 1.125rem);
    line-height: 1.7;
    letter-spacing: 0.01em;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ============================================
   Top Border Line (Holographic)
   ============================================ */
.top-border-line {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: conic-gradient(
        from var(--holo-angle),
        #D4A853,
        #C4756E,
        #9B8EC4,
        #8BA888,
        #D4A853
    );
    z-index: 1000;
}

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

.nav-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--border-warm);
    cursor: pointer;
    transition: transform 0.3s ease, background-color 0.3s ease;
    animation: dotPulse 3s ease-in-out infinite;
}

.nav-dot:nth-child(1) { background-color: #D4A853; }
.nav-dot:nth-child(2) { background-color: #8B5E3C; }
.nav-dot:nth-child(3) { background-color: #8BA888; }
.nav-dot:nth-child(4) { background-color: #C4756E; }
.nav-dot:nth-child(5) { background-color: #9B8EC4; }
.nav-dot:nth-child(6) { background-color: #8B7355; }
.nav-dot:nth-child(7) { background-color: #D4A853; }
.nav-dot:nth-child(8) { background-color: #8BA888; }

.nav-dot.active {
    transform: scale(1.5);
}

@keyframes dotPulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* ============================================
   Hero Section
   ============================================ */
.hero-section {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
}

.hero-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.hero-bg-image {
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 30% 40%, #D4A853 0%, transparent 50%),
        radial-gradient(ellipse at 70% 60%, #C4756E 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, #8BA888 0%, transparent 40%),
        linear-gradient(180deg, #F0E4D0 0%, #D6C4A8 40%, #8B7355 80%, #2A1F14 100%);
    background-size: cover;
}

.duotone-container {
    background: linear-gradient(135deg, #2A1F14, #D4A853);
}

.duotone {
    filter: grayscale(100%) sepia(40%) contrast(1.1) brightness(0.95);
    mix-blend-mode: multiply;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(250, 243, 232, 0.3) 0%, rgba(250, 243, 232, 0.1) 50%, rgba(42, 31, 20, 0.3) 100%);
    z-index: 1;
}

.hero-holo-overlay {
    position: absolute;
    inset: 0;
    background: conic-gradient(
        from var(--holo-angle) at var(--holo-x) var(--holo-y),
        rgba(212, 168, 83, 0.15),
        rgba(196, 117, 110, 0.15),
        rgba(155, 142, 196, 0.15),
        rgba(139, 168, 136, 0.15),
        rgba(212, 168, 83, 0.15)
    );
    z-index: 2;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

/* Reticle markers */
.reticle {
    position: absolute;
    z-index: 5;
}

.reticle-tl { top: 24px; left: 24px; }
.reticle-tr { top: 24px; right: 24px; }
.reticle-bl { bottom: 24px; left: 24px; }
.reticle-br { bottom: 24px; right: 24px; }

/* Hero border SVG */
.hero-border-svg {
    position: absolute;
    inset: 12px;
    width: calc(100% - 24px);
    height: calc(100% - 24px);
    z-index: 4;
    pointer-events: none;
}

.hero-border-rect {
    stroke-dasharray: 400;
    stroke-dashoffset: 400;
    animation: drawBorder 2s ease-in-out 0.5s forwards;
}

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

/* Hero content */
.hero-content {
    position: relative;
    z-index: 10;
    padding: clamp(2rem, 5vw, 6rem);
    padding-bottom: clamp(3rem, 8vw, 8rem);
}

.hero-title {
    font-family: 'Fraunces', serif;
    font-weight: var(--hero-weight);
    font-variation-settings: 'WONK' 1, 'SOFT' 0;
    font-size: clamp(4rem, 12vw, 10rem);
    color: #F5E6D3;
    line-height: 1;
    letter-spacing: -0.02em;
    animation: materializeTitle 1.5s ease-out forwards;
    opacity: 0;
}

@keyframes materializeTitle {
    0% {
        opacity: 0;
        --hero-weight: 100;
        letter-spacing: 0.05em;
    }
    100% {
        opacity: 1;
        --hero-weight: 400;
        letter-spacing: -0.02em;
    }
}

.hero-subtitle {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 300;
    font-size: 13px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(139, 115, 85, 0.8);
    margin-top: 1rem;
    opacity: 0;
    animation: fadeIn 1s ease-out 1.5s forwards;
}

@keyframes fadeIn {
    to { opacity: 1; }
}

/* ============================================
   Spectral Line Dividers
   ============================================ */
.spectral-divider {
    width: 100%;
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        #D4A853 15%,
        #C4756E 35%,
        #9B8EC4 55%,
        #8BA888 75%,
        transparent 100%
    );
    opacity: 0.4;
    transition: opacity 0.6s ease;
}

.spectral-divider:hover {
    opacity: 0.8;
}

/* ============================================
   Interstitial Sections
   ============================================ */
.interstitial-section {
    position: relative;
    width: 100%;
    height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.interstitial-bg {
    position: absolute;
    inset: 0;
}

.interstitial-bg-image {
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 40% 50%, #8B5E3C 0%, transparent 60%),
        radial-gradient(ellipse at 60% 30%, #D4A853 0%, transparent 50%),
        linear-gradient(180deg, #2A1F14 0%, #3D2B1F 50%, #2A1F14 100%);
    background-size: cover;
    background-attachment: fixed;
}

.interstitial-overlay {
    position: absolute;
    inset: 0;
    background: rgba(42, 31, 20, 0.5);
    z-index: 1;
}

.interstitial-content {
    position: relative;
    z-index: 10;
    text-align: center;
    padding: 2rem;
}

.interstitial-title {
    font-family: 'Fraunces', serif;
    font-weight: 600;
    font-variation-settings: 'WONK' 0, 'SOFT' 100;
    font-size: clamp(2.5rem, 6vw, 5.5rem);
    color: #F5E6D3;
    letter-spacing: 0.05em;
    opacity: 0;
    transition: opacity 0.8s ease, letter-spacing 0.8s ease, font-variation-settings 0.6s ease;
}

.interstitial-title.visible {
    opacity: 1;
    letter-spacing: 0.02em;
    font-variation-settings: 'WONK' 1, 'SOFT' 100;
}

.interstitial-closing {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 300;
    font-size: clamp(1rem, 1.5vw, 1.25rem);
    color: rgba(245, 230, 211, 0.6);
    margin-top: 1.5rem;
    letter-spacing: 0.02em;
    opacity: 0;
    transition: opacity 1s ease 0.3s;
}

.interstitial-title.visible ~ .interstitial-closing,
.interstitial-closing.visible {
    opacity: 1;
}

/* ============================================
   Portfolio Grid
   ============================================ */
.grid-section {
    padding: clamp(2rem, 5vw, 4rem) clamp(1rem, 3vw, 3rem);
    background-color: var(--bg-primary);
}

.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    max-width: 1400px;
    margin: 0 auto;
}

/* Grid items */
.grid-item {
    position: relative;
    background: var(--bg-secondary);
    border-radius: 2px;
    overflow: visible;
    cursor: pointer;
    opacity: 0;
    transform: translateY(24px);
    transition:
        transform 0.3s ease,
        box-shadow 0.3s ease;
}

.grid-item.animated {
    opacity: 1;
    transform: translateY(0);
    transition:
        opacity 0.6s ease-out,
        transform 0.6s ease-out;
}

.grid-item.span-2 {
    grid-row: span 2;
}

/* Holographic border on grid items */
.grid-item::before {
    content: '';
    position: absolute;
    inset: -1px;
    background: conic-gradient(
        from var(--holo-angle),
        #D4A853,
        #C4756E,
        #9B8EC4,
        #8BA888,
        #D4A853
    );
    z-index: -1;
    opacity: 0.15;
    border-radius: 3px;
    transition: opacity 0.4s ease;
    animation: rotateBorder 20s linear infinite;
}

@keyframes rotateBorder {
    from { filter: hue-rotate(0deg); }
    to { filter: hue-rotate(360deg); }
}

.grid-item:hover::before {
    opacity: 0.5;
}

.grid-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 32px rgba(61, 43, 31, 0.15);
}

/* Grid item image */
.grid-item-image {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 70%;
    overflow: hidden;
}

.span-2 .grid-item-image {
    padding-bottom: 85%;
}

.grid-item-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
}

/* Procedural backgrounds for portfolio items */
.grid-item-img[data-bg="warm-field"] {
    background:
        radial-gradient(ellipse at 30% 60%, #D4A853 0%, transparent 50%),
        radial-gradient(ellipse at 70% 40%, #8BA888 0%, transparent 40%),
        linear-gradient(180deg, #F0E4D0 0%, #D6C4A8 50%, #8B7355 100%);
}

.grid-item-img[data-bg="dried-flowers"] {
    background:
        radial-gradient(circle at 50% 50%, #C4756E 0%, transparent 30%),
        radial-gradient(circle at 30% 70%, #9B8EC4 0%, transparent 25%),
        radial-gradient(circle at 70% 30%, #D4A853 0%, transparent 25%),
        linear-gradient(135deg, #F0E4D0 0%, #D6C4A8 100%);
}

.grid-item-img[data-bg="linen-texture"] {
    background:
        repeating-linear-gradient(0deg, transparent, transparent 3px, rgba(214, 196, 168, 0.3) 3px, rgba(214, 196, 168, 0.3) 4px),
        repeating-linear-gradient(90deg, transparent, transparent 3px, rgba(214, 196, 168, 0.3) 3px, rgba(214, 196, 168, 0.3) 4px),
        linear-gradient(180deg, #F0E4D0, #D6C4A8);
}

.grid-item-img[data-bg="greenhouse"] {
    background:
        radial-gradient(ellipse at 50% 20%, rgba(139, 168, 136, 0.6) 0%, transparent 50%),
        radial-gradient(ellipse at 30% 80%, rgba(212, 168, 83, 0.4) 0%, transparent 40%),
        linear-gradient(180deg, #8BA888 0%, #5C4033 50%, #2A1F14 100%);
}

.grid-item-img[data-bg="quartz"] {
    background:
        radial-gradient(circle at 40% 40%, rgba(155, 142, 196, 0.5) 0%, transparent 30%),
        radial-gradient(circle at 60% 60%, rgba(212, 168, 83, 0.5) 0%, transparent 30%),
        radial-gradient(circle at 50% 50%, rgba(196, 117, 110, 0.3) 0%, transparent 40%),
        linear-gradient(45deg, #F0E4D0, #D6C4A8, #8B7355);
}

.grid-item-img[data-bg="misty-valley"] {
    background:
        radial-gradient(ellipse at 50% 70%, rgba(214, 196, 168, 0.6) 0%, transparent 50%),
        linear-gradient(180deg, rgba(139, 168, 136, 0.3) 0%, rgba(214, 196, 168, 0.5) 40%, rgba(42, 31, 20, 0.3) 100%),
        linear-gradient(180deg, #F0E4D0 0%, #D6C4A8 100%);
}

.grid-item-img[data-bg="weathered-wood"] {
    background:
        repeating-linear-gradient(175deg, transparent, transparent 8px, rgba(139, 94, 60, 0.15) 8px, rgba(139, 94, 60, 0.15) 10px),
        repeating-linear-gradient(173deg, transparent, transparent 12px, rgba(92, 64, 51, 0.1) 12px, rgba(92, 64, 51, 0.1) 14px),
        linear-gradient(180deg, #8B5E3C 0%, #5C4033 50%, #3D2B1F 100%);
}

.grid-item-img[data-bg="pressed-leaves"] {
    background:
        radial-gradient(ellipse at 25% 35%, rgba(139, 168, 136, 0.6) 0%, transparent 30%),
        radial-gradient(ellipse at 65% 55%, rgba(139, 168, 136, 0.5) 0%, transparent 25%),
        radial-gradient(ellipse at 45% 75%, rgba(212, 168, 83, 0.4) 0%, transparent 30%),
        linear-gradient(135deg, #F0E4D0 0%, #D6C4A8 50%, #8B7355 100%);
}

.grid-item-img[data-bg="golden-field"] {
    background:
        radial-gradient(ellipse at 50% 80%, #D4A853 0%, transparent 60%),
        radial-gradient(ellipse at 30% 30%, rgba(196, 117, 110, 0.3) 0%, transparent 40%),
        linear-gradient(180deg, #FAF3E8 0%, #F0E4D0 30%, #D4A853 70%, #8B5E3C 100%);
}

.grid-item-img[data-bg="creek-water"] {
    background:
        radial-gradient(ellipse at 40% 50%, rgba(155, 142, 196, 0.3) 0%, transparent 40%),
        radial-gradient(ellipse at 60% 40%, rgba(139, 168, 136, 0.4) 0%, transparent 35%),
        linear-gradient(160deg, #8BA888 0%, #5C4033 50%, #2A1F14 100%);
}

.grid-item-img[data-bg="dried-lavender"] {
    background:
        radial-gradient(circle at 40% 40%, rgba(155, 142, 196, 0.6) 0%, transparent 30%),
        radial-gradient(circle at 60% 60%, rgba(196, 117, 110, 0.4) 0%, transparent 30%),
        linear-gradient(135deg, #9B8EC4 0%, #D6C4A8 50%, #8B7355 100%);
}

.grid-item-img[data-bg="solarium"] {
    background:
        radial-gradient(ellipse at 50% 30%, rgba(212, 168, 83, 0.7) 0%, transparent 50%),
        radial-gradient(ellipse at 30% 70%, rgba(139, 168, 136, 0.3) 0%, transparent 40%),
        linear-gradient(180deg, #D4A853 0%, #F0E4D0 30%, #D6C4A8 70%, #8B5E3C 100%);
}

.grid-item-img[data-bg="star-chart"] {
    background:
        radial-gradient(circle at 20% 30%, rgba(212, 168, 83, 0.5) 0%, transparent 10%),
        radial-gradient(circle at 50% 50%, rgba(155, 142, 196, 0.4) 0%, transparent 15%),
        radial-gradient(circle at 80% 40%, rgba(212, 168, 83, 0.3) 0%, transparent 8%),
        radial-gradient(circle at 35% 70%, rgba(196, 117, 110, 0.3) 0%, transparent 10%),
        radial-gradient(circle at 70% 75%, rgba(139, 168, 136, 0.3) 0%, transparent 10%),
        linear-gradient(180deg, #2A1F14 0%, #3D2B1F 50%, #2A1F14 100%);
}

.grid-item-img[data-bg="woven-linen"] {
    background:
        repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(214, 196, 168, 0.4) 2px, rgba(214, 196, 168, 0.4) 3px),
        repeating-linear-gradient(90deg, transparent, transparent 2px, rgba(139, 115, 85, 0.2) 2px, rgba(139, 115, 85, 0.2) 3px),
        linear-gradient(180deg, #F0E4D0, #D6C4A8, #8B7355);
}

/* Holographic overlay on images */
.holo-image-overlay {
    position: absolute;
    inset: 0;
    background: conic-gradient(
        from var(--holo-angle) at var(--holo-x) var(--holo-y),
        rgba(212, 168, 83, 0.2),
        rgba(196, 117, 110, 0.2),
        rgba(155, 142, 196, 0.2),
        rgba(139, 168, 136, 0.2),
        rgba(212, 168, 83, 0.2)
    );
    opacity: 0;
    transition: opacity 0.6s ease;
    pointer-events: none;
}

.grid-item:hover .holo-image-overlay {
    opacity: 1;
}

/* Data whiskers */
.grid-item-whisker {
    position: absolute;
    background-color: var(--border-warm);
    opacity: 0.3;
    transition: all 0.2s ease;
}

.whisker-top {
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 0.5px;
    height: 20px;
}

.whisker-bottom {
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 0.5px;
    height: 20px;
}

.whisker-left {
    left: -20px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 0.5px;
}

.whisker-right {
    right: -20px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 0.5px;
}

.grid-item:hover .whisker-top { height: 32px; top: -32px; }
.grid-item:hover .whisker-bottom { height: 32px; bottom: -32px; }
.grid-item:hover .whisker-left { width: 32px; left: -32px; }
.grid-item:hover .whisker-right { width: 32px; right: -32px; }

/* Grid item info */
.grid-item-info {
    padding: 16px 20px 20px;
}

.grid-item-title {
    font-family: 'Fraunces', serif;
    font-weight: 600;
    font-variation-settings: 'WONK' 0, 'SOFT' 0;
    font-size: clamp(1.1rem, 1.5vw, 1.35rem);
    color: var(--text-primary);
    line-height: 1.3;
    border-bottom: 1px solid transparent;
    border-image: linear-gradient(90deg, #D4A853, #C4756E, #9B8EC4, #8BA888) 1;
    padding-bottom: 8px;
    margin-bottom: 6px;
    transition: font-variation-settings 0.4s ease;
}

.grid-item:hover .grid-item-title {
    font-variation-settings: 'WONK' 0, 'SOFT' 100;
}

.grid-item-desc {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 400;
    font-size: clamp(0.85rem, 1vw, 0.95rem);
    color: var(--text-primary);
    opacity: 0.6;
    line-height: 1.5;
}

/* Coordinate labels */
.coordinate-label {
    position: absolute;
    bottom: 8px;
    right: 12px;
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 300;
    font-size: 9px;
    letter-spacing: 0.08em;
    color: var(--text-tertiary);
    opacity: 0.35;
    text-transform: none;
}

/* ============================================
   Reduced Motion
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    .hero-title {
        animation: none;
        opacity: 1;
        --hero-weight: 400;
    }

    .hero-subtitle {
        animation: none;
        opacity: 1;
    }

    .hero-border-rect {
        animation: none;
        stroke-dashoffset: 0;
    }

    .grid-item {
        opacity: 1;
        transform: none;
    }

    .interstitial-title {
        opacity: 1;
        letter-spacing: 0.02em;
    }

    .nav-dot {
        animation: none;
    }

    @keyframes rotateBorder {
        from, to { filter: none; }
    }
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 1024px) {
    .portfolio-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .section-nav {
        right: 12px;
    }
}

@media (max-width: 640px) {
    .portfolio-grid {
        grid-template-columns: 1fr;
    }

    .grid-item.span-2 {
        grid-row: span 1;
    }

    .span-2 .grid-item-image {
        padding-bottom: 70%;
    }

    .section-nav {
        display: none;
    }

    .hero-title {
        font-size: clamp(3rem, 15vw, 5rem);
    }

    .interstitial-section {
        height: 50vh;
    }

    .grid-item-whisker {
        display: none;
    }
}
