/**
 * ═══════════════════════════════════════════════════════════════════════════════
 *
 *   DGN-3: ADVANCED DESIGN THINKING
 *   Shrine Aesthetic Stylesheet
 *
 *   Aligned with the main Design Shrine design system.
 *   Reverent, editorial, museum-quality curation.
 *
 *   Typography: Cormorant Garamond + Inter + JetBrains Mono
 *   Color: Restrained dark palette with intentional accent
 *   Contrast: WCAG AAA (7:1 normal text, 4.5:1 large)
 *
 * ═══════════════════════════════════════════════════════════════════════════════
 */


/* =============================================================================
   1. DESIGN TOKENS
   ============================================================================= */

:root {
    /* Core Tones — inherited from shrine */
    --void: #08080c;
    --deep: #101014;
    --surface: #18181c;
    --elevated: #1e1e24;
    --muted: #8b95a5;
    --text: #d4dae6;
    --cream: #f5f5f4;

    /* Accent — coral red (shrine heartbeat) */
    --accent: #e85d5d;
    --accent-dim: rgba(232, 93, 93, 0.12);
    --accent-hover: #f07070;
    --accent-glow: rgba(232, 93, 93, 0.06);

    /* Status Colors */
    --status-active: #4ade80;
    --status-active-bg: rgba(74, 222, 128, 0.1);
    --status-progress: #facc15;
    --status-progress-bg: rgba(250, 204, 21, 0.1);

    /* Typography: Design Temple System */
    --font-display: 'Playfair Display', 'Georgia', serif;
    --font-body: 'Poppins', 'Segoe UI', sans-serif;
    --font-accent: 'Bai Jamjuree', 'Arial', sans-serif;

    /* Semantic Aliases */
    --font-serif: var(--font-display);
    --font-sans: var(--font-body);
    --font-mono: 'Courier New', monospace;

    /* Type Scale (Perfect Fourth 1.333) */
    --step--2: clamp(0.7rem, 0.65rem + 0.25vw, 0.8rem);
    --step--1: clamp(0.8rem, 0.75rem + 0.3vw, 0.95rem);
    --step-0: clamp(0.95rem, 0.88rem + 0.4vw, 1.125rem);
    --step-1: clamp(1.15rem, 1rem + 0.75vw, 1.5rem);
    --step-2: clamp(1.4rem, 1.15rem + 1.25vw, 2rem);
    --step-3: clamp(1.75rem, 1.35rem + 2vw, 2.75rem);
    --step-4: clamp(2.25rem, 1.6rem + 3.25vw, 4rem);

    /* Spacing */
    --space-xs: clamp(0.5rem, 0.4rem + 0.5vw, 0.75rem);
    --space-s: clamp(0.75rem, 0.65rem + 0.5vw, 1rem);
    --space-m: clamp(1.25rem, 1rem + 1.25vw, 2rem);
    --space-l: clamp(2rem, 1.5rem + 2.5vw, 3.5rem);
    --space-xl: clamp(3rem, 2rem + 5vw, 6rem);

    /* Motion */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
    --duration-fast: 0.15s;
    --duration-normal: 0.3s;
    --duration-slow: 0.6s;
}


/* =============================================================================
   2. RESET & BASE
   ============================================================================= */

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

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

body {
    font-family: var(--font-sans);
    font-size: var(--step-0);
    line-height: 1.7;
    color: var(--text);
    background-color: var(--void);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Subtle grain texture */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(ellipse 80% 60% at 50% 0%, var(--accent-glow), transparent 70%),
        radial-gradient(ellipse 60% 40% at 80% 30%, rgba(90, 156, 245, 0.03), transparent 60%);
    pointer-events: none;
}

img { max-width: 100%; height: auto; display: block; }

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--duration-fast) var(--ease-out);
}

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

a:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 4px;
    border-radius: 2px;
}

strong { color: var(--cream); font-weight: 600; }


/* =============================================================================
   3. SKIP LINK (WCAG AAA)
   ============================================================================= */

.skip-link {
    position: absolute;
    left: -10000px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
    z-index: 9999;
}

.skip-link:focus {
    position: fixed;
    left: var(--space-s);
    top: var(--space-s);
    width: auto;
    height: auto;
    background: var(--void);
    color: var(--cream);
    padding: var(--space-xs) var(--space-s);
    border: 2px solid var(--accent);
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: var(--step--1);
    font-weight: 500;
}


/* =============================================================================
   4. LAYOUT: PAGE SHELL
   ============================================================================= */

.page-shell {
    display: grid;
    grid-template-columns: 1fr min(72ch, 90%) 1fr;
    grid-template-rows: auto 1fr auto;
    min-height: 100vh;
    row-gap: var(--space-l);
}

.page-shell > * {
    grid-column: 2;
}

/* Sidebar floats on desktop */
.sidebar-nav {
    grid-column: 2;
    order: 10;
}

.site-footer {
    grid-column: 1 / -1;
}


/* =============================================================================
   5. HEADER: COURSE IDENTITY
   ============================================================================= */

.course-header {
    padding-top: var(--space-l);
}

/* Breadcrumb */
.breadcrumb ol {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.5em;
    font-family: var(--font-mono);
    font-size: var(--step--2);
    color: var(--muted);
    letter-spacing: 0.02em;
}

.breadcrumb li:not(:last-child)::after {
    content: '/';
    margin-left: 0.5em;
    color: var(--muted);
    opacity: 0.5;
}

.breadcrumb a {
    color: var(--muted);
    text-decoration: none;
    transition: color var(--duration-fast) var(--ease-out);
}

.breadcrumb a:hover { color: var(--cream); }

/* Course Identity Block */
.course-identity {
    margin-top: var(--space-m);
}

.course-code {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: var(--step--1);
    font-weight: 600;
    color: var(--accent);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    padding: 0.3em 0.8em;
    border: 1px solid var(--accent-dim);
    border-left: 3px solid var(--accent);
    background: var(--accent-dim);
    border-radius: 0 4px 4px 0;
    margin-bottom: var(--space-xs);
}

.course-identity h1 {
    font-family: var(--font-serif);
    font-size: var(--step-4);
    font-weight: 300;
    line-height: 1.1;
    color: var(--cream);
    letter-spacing: -0.02em;
    margin-top: var(--space-xs);
}

.course-meta {
    display: flex;
    align-items: center;
    gap: 0.75em;
    margin-top: var(--space-xs);
    font-family: var(--font-mono);
    font-size: var(--step--2);
    color: var(--muted);
    letter-spacing: 0.05em;
}

.meta-separator { opacity: 0.4; }

.status-active {
    color: var(--status-active);
    background: var(--status-active-bg);
    padding: 0.2em 0.6em;
    border-radius: 3px;
    font-weight: 500;
}


/* =============================================================================
   6. SECTIONS: Shared Patterns
   ============================================================================= */

section {
    padding: var(--space-l) 0;
    border-top: 1px solid rgba(139, 149, 165, 0.1);
}

.section-marker {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    margin-bottom: var(--space-s);
}

.marker-line {
    display: block;
    width: 2rem;
    height: 1px;
    background: var(--accent);
}

.marker-label {
    font-family: var(--font-mono);
    font-size: var(--step--2);
    color: var(--accent);
    letter-spacing: 0.1em;
    font-weight: 500;
}

.section-heading {
    font-family: var(--font-serif);
    font-size: var(--step-3);
    font-weight: 400;
    color: var(--cream);
    line-height: 1.2;
    letter-spacing: -0.01em;
    margin-bottom: var(--space-m);
}


/* =============================================================================
   7. PHILOSOPHY SECTION
   ============================================================================= */

.philosophy-quote {
    border-left: 3px solid var(--accent);
    padding: var(--space-s) var(--space-m);
    margin-bottom: var(--space-m);
    background: var(--accent-dim);
    border-radius: 0 6px 6px 0;
}

.philosophy-quote p {
    font-family: var(--font-serif);
    font-size: var(--step-1);
    font-style: italic;
    color: var(--cream);
    line-height: 1.5;
}

.philosophy-text p {
    margin-bottom: var(--space-s);
    max-width: 65ch;
}

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


/* =============================================================================
   8. CLIENT SECTION
   ============================================================================= */

.client-context {
    margin-bottom: var(--space-m);
    max-width: 65ch;
}

.client-context p {
    color: var(--text);
}


/* =============================================================================
   9. PROJECT CARDS
   ============================================================================= */

.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 28ch), 1fr));
    gap: var(--space-m);
}

.project-card {
    background: var(--deep);
    border: 1px solid rgba(139, 149, 165, 0.08);
    border-radius: 8px;
    padding: var(--space-m);
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    transition:
        transform var(--duration-normal) var(--ease-out),
        border-color var(--duration-normal) var(--ease-out),
        box-shadow var(--duration-normal) var(--ease-out);
}

.project-card:hover {
    transform: translateY(-3px);
    border-color: rgba(232, 93, 93, 0.2);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

/* Elevated card (Art Series) */
.project-card--elevated {
    border-color: rgba(232, 93, 93, 0.15);
    background: linear-gradient(
        135deg,
        var(--deep) 0%,
        rgba(232, 93, 93, 0.04) 100%
    );
}

.project-card--elevated:hover {
    border-color: var(--accent);
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.4),
        0 0 0 1px var(--accent-dim);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-xs);
}

.card-code {
    font-family: var(--font-mono);
    font-size: var(--step--2);
    font-weight: 600;
    color: var(--accent);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.card-status {
    font-family: var(--font-mono);
    font-size: var(--step--2);
    font-weight: 500;
    padding: 0.2em 0.6em;
    border-radius: 3px;
    letter-spacing: 0.03em;
}

.card-status--active {
    color: var(--status-active);
    background: var(--status-active-bg);
}

.card-status--progress {
    color: var(--status-progress);
    background: var(--status-progress-bg);
}

.card-title {
    font-family: var(--font-serif);
    font-size: var(--step-2);
    font-weight: 500;
    color: var(--cream);
    line-height: 1.2;
}

.card-subtitle {
    font-family: var(--font-mono);
    font-size: var(--step--2);
    color: var(--muted);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.card-description {
    color: var(--text);
    line-height: 1.65;
    max-width: 55ch;
}

.card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5em;
    margin-top: auto;
    padding-top: var(--space-xs);
}

.meta-tag {
    font-family: var(--font-mono);
    font-size: var(--step--2);
    color: var(--muted);
    padding: 0.2em 0.6em;
    border: 1px solid rgba(139, 149, 165, 0.15);
    border-radius: 3px;
    letter-spacing: 0.03em;
}

.card-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5em;
    margin-top: var(--space-s);
    padding: 0.6em 1.2em;
    font-family: var(--font-sans);
    font-size: var(--step--1);
    font-weight: 500;
    color: var(--cream);
    background: var(--surface);
    border: 1px solid rgba(139, 149, 165, 0.12);
    border-radius: 6px;
    text-decoration: none;
    width: fit-content;
    transition:
        background var(--duration-fast) var(--ease-out),
        border-color var(--duration-fast) var(--ease-out),
        transform var(--duration-fast) var(--ease-out);
}

.card-link:hover {
    background: var(--elevated);
    border-color: var(--accent);
    color: var(--cream);
    transform: translateX(4px);
}

.card-link--primary {
    background: var(--accent);
    color: var(--void);
    border-color: var(--accent);
    font-weight: 600;
}

.card-link--primary:hover {
    background: var(--accent-hover);
    color: var(--void);
    border-color: var(--accent-hover);
}

.link-arrow {
    transition: transform var(--duration-fast) var(--ease-out);
}

.card-link:hover .link-arrow {
    transform: translateX(3px);
}


/* =============================================================================
   10. ART SECTION CONTEXT
   ============================================================================= */

.art-context {
    margin-bottom: var(--space-m);
    max-width: 65ch;
}

.art-context p {
    color: var(--text);
}


/* =============================================================================
   11. FRAMEWORK SECTION
   ============================================================================= */

.framework-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 18ch), 1fr));
    gap: var(--space-s);
}

.framework-step {
    padding: var(--space-s);
    border: 1px solid rgba(139, 149, 165, 0.06);
    border-radius: 6px;
    background: var(--deep);
    transition:
        border-color var(--duration-normal) var(--ease-out),
        background var(--duration-normal) var(--ease-out);
}

.framework-step:hover {
    border-color: rgba(232, 93, 93, 0.15);
    background: var(--surface);
}

.step-number {
    display: block;
    font-family: var(--font-mono);
    font-size: var(--step--2);
    color: var(--accent);
    letter-spacing: 0.1em;
    margin-bottom: 0.5em;
    opacity: 0.7;
}

.step-title {
    font-family: var(--font-serif);
    font-size: var(--step-1);
    font-weight: 500;
    color: var(--cream);
    margin-bottom: 0.3em;
}

.step-desc {
    font-size: var(--step--1);
    color: var(--muted);
    line-height: 1.5;
}


/* =============================================================================
   12. SIDEBAR NAVIGATION
   ============================================================================= */

.sidebar-nav {
    padding: var(--space-l) 0 var(--space-m);
    border-top: 1px solid rgba(139, 149, 165, 0.1);
}

.nav-links {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
}

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5em;
    padding: 0.5em 1em;
    font-family: var(--font-sans);
    font-size: var(--step--1);
    font-weight: 500;
    color: var(--text);
    background: var(--deep);
    border: 1px solid rgba(139, 149, 165, 0.1);
    border-radius: 6px;
    text-decoration: none;
    transition:
        background var(--duration-fast) var(--ease-out),
        border-color var(--duration-fast) var(--ease-out),
        color var(--duration-fast) var(--ease-out);
}

.nav-link:hover {
    background: var(--surface);
    border-color: rgba(139, 149, 165, 0.2);
    color: var(--cream);
}

.nav-link--primary {
    background: var(--accent-dim);
    border-color: rgba(232, 93, 93, 0.15);
    color: var(--cream);
}

.nav-link--primary:hover {
    background: var(--accent);
    color: var(--void);
    border-color: var(--accent);
}

.nav-code {
    font-family: var(--font-mono);
    font-size: var(--step--2);
    color: var(--accent);
    letter-spacing: 0.05em;
    font-weight: 600;
}

.nav-label {
    letter-spacing: 0.01em;
}

.sidebar-meta {
    margin-top: var(--space-s);
}

.last-updated {
    font-family: var(--font-mono);
    font-size: var(--step--2);
    color: var(--muted);
    letter-spacing: 0.03em;
    opacity: 0.7;
}


/* =============================================================================
   13. FOOTER
   ============================================================================= */

.site-footer {
    padding: var(--space-m) var(--space-s);
    border-top: 1px solid rgba(139, 149, 165, 0.08);
    background: var(--void);
    text-align: center;
}

.site-footer p {
    font-family: var(--font-mono);
    font-size: var(--step--2);
    color: var(--muted);
    letter-spacing: 0.03em;
}

.site-footer a {
    color: var(--accent);
    text-decoration: none;
}

.site-footer a:hover {
    text-decoration: underline;
}


/* =============================================================================
   14. SCROLL REVEAL ANIMATIONS
   ============================================================================= */

.reveal-target {
    opacity: 0;
    transform: translateY(20px);
    transition:
        opacity var(--duration-slow) var(--ease-out),
        transform var(--duration-slow) var(--ease-out);
}

.reveal-target.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger delay for grid items */
.project-grid .reveal-target:nth-child(2) {
    transition-delay: 0.1s;
}

.framework-grid .reveal-target:nth-child(2) { transition-delay: 0.08s; }
.framework-grid .reveal-target:nth-child(3) { transition-delay: 0.16s; }
.framework-grid .reveal-target:nth-child(4) { transition-delay: 0.24s; }
.framework-grid .reveal-target:nth-child(5) { transition-delay: 0.32s; }


/* =============================================================================
   15. REDUCED MOTION
   ============================================================================= */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    html { scroll-behavior: auto; }

    .reveal-target {
        opacity: 1;
        transform: none;
    }
}


/* =============================================================================
   16. RESPONSIVE
   ============================================================================= */

/* Tablet */
@media (max-width: 768px) {
    .page-shell {
        grid-template-columns: 1fr min(90%, 100%) 1fr;
        padding: 0 var(--space-s);
    }

    .course-identity h1 {
        font-size: var(--step-3);
    }

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

    .framework-grid {
        grid-template-columns: repeat(auto-fit, minmax(min(100%, 14ch), 1fr));
    }

    .nav-links {
        flex-direction: column;
    }

    .nav-link {
        width: 100%;
        justify-content: center;
    }
}

/* Mobile */
@media (max-width: 480px) {
    .page-shell {
        row-gap: var(--space-m);
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
    }

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


/* =============================================================================
   17. PRINT STYLES
   ============================================================================= */

@media print {
    body {
        background: white;
        color: black;
    }

    body::before { display: none; }

    .skip-link,
    .sidebar-nav,
    .section-marker { display: none; }

    .project-card {
        break-inside: avoid;
        border: 1px solid #ccc;
        background: white;
    }

    a { color: black; }

    .card-link::after {
        content: ' (' attr(href) ')';
        font-size: 0.8em;
        color: #666;
    }
}
