/* ============================================================
   archetype.moe — Art Deco + Sci-Fi HUD Design System
   ============================================================ */

/* --- CSS Custom Properties --- */
:root {
    --color-bg-primary: #f5f0e8;
    --color-bg-secondary: #ede4d4;
    --color-surface: #faf6f0;
    --color-gold: #d4af37;
    --color-gold-hover: #e8c94a;
    --color-teal: #1a5c5a;
    --color-text-primary: #2c2418;
    --color-text-secondary: #7a6f60;
    --color-hud: #4de8d0;
    --color-hud-line: rgba(77, 232, 208, 0.15);
    --color-marble-dark: #c9a89a;
    --color-marble-light: #d8c5c0;
    --hud-opacity: 0.03;
    --font-display: 'Poiret One', cursive;
    --font-subhead: 'Josefin Sans', sans-serif;
    --font-body: 'Nunito Sans', sans-serif;
    --font-mono: 'IBM Plex Mono', monospace;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    font-weight: 300;
    color: var(--color-text-primary);
    background: var(--color-bg-primary);
    line-height: 1.8;
    overflow-x: hidden;
    position: relative;
}

/* --- Marble Texture Layer --- */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at 30% 40%, #f5f0e8, #ede4d4);
    filter: url(#marble-filter);
    z-index: -2;
    pointer-events: none;
}

/* --- SVG Filters (hidden) --- */
.svg-filters {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* --- HUD Overlay Layer --- */
.hud-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    opacity: var(--hud-opacity);
    background-image:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 3px,
            rgba(77, 232, 208, 0.03) 3px,
            rgba(77, 232, 208, 0.03) 4px
        ),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 60px,
            rgba(77, 232, 208, 0.04) 60px,
            rgba(77, 232, 208, 0.04) 61px
        ),
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 60px,
            rgba(77, 232, 208, 0.04) 60px,
            rgba(77, 232, 208, 0.04) 61px
        );
    transition: opacity 0.3s ease;
}

/* --- HUD Waypoint Diamonds --- */
.hud-diamond {
    position: fixed;
    width: 20px;
    height: 20px;
    border: 1px solid rgba(77, 232, 208, 0.2);
    transform: rotate(45deg);
    z-index: 2;
    pointer-events: none;
    animation: rotateDiamond 8s linear infinite;
}

.hud-diamond-1 {
    top: 15%;
    right: 5%;
}

.hud-diamond-2 {
    top: 50%;
    left: 3%;
}

.hud-diamond-3 {
    bottom: 20%;
    right: 8%;
}

@keyframes rotateDiamond {
    from { transform: rotate(45deg); }
    to { transform: rotate(405deg); }
}

/* --- Navigation Rosette --- */
.nav-rosette {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 100;
}

.rosette-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: var(--color-surface);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(44, 36, 24, 0.12);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
    position: relative;
    z-index: 101;
}

.rosette-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(44, 36, 24, 0.18);
}

.rosette-btn.active {
    transform: scale(1.08) rotate(45deg);
}

.rosette-svg {
    width: 40px;
    height: 40px;
}

.radial-menu {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.radial-menu.open {
    pointer-events: auto;
    opacity: 1;
}

.radial-item {
    position: absolute;
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: var(--color-text-primary);
    font-family: var(--font-subhead);
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 0.06em;
    white-space: nowrap;
    padding: 6px 12px;
    background: var(--color-surface);
    border-radius: 20px;
    box-shadow: 0 2px 12px rgba(44, 36, 24, 0.1);
    transform: scale(0) rotate(-45deg);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
    opacity: 0;
}

.radial-menu.open .radial-item {
    transform: scale(1) rotate(0deg);
    opacity: 1;
}

.radial-item:hover {
    color: var(--color-gold);
}

.radial-chevron {
    width: 16px;
    height: 16px;
}

/* Radial positions (semicircle below-left) */
.radial-menu.open .radial-item[data-index="0"] {
    top: -60px;
    left: -80px;
    transition-delay: 0ms;
}
.radial-menu.open .radial-item[data-index="1"] {
    top: -20px;
    left: -110px;
    transition-delay: 50ms;
}
.radial-menu.open .radial-item[data-index="2"] {
    top: 25px;
    left: -110px;
    transition-delay: 100ms;
}
.radial-menu.open .radial-item[data-index="3"] {
    top: 65px;
    left: -85px;
    transition-delay: 150ms;
}
.radial-menu.open .radial-item[data-index="4"] {
    top: 95px;
    left: -45px;
    transition-delay: 200ms;
}

/* --- HERO ZONE --- */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.hero-content {
    text-align: center;
    z-index: 5;
    position: relative;
}

.scanline-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 3px,
        rgba(77, 232, 208, 0.015) 3px,
        rgba(77, 232, 208, 0.015) 3.5px
    );
    animation: scanlineScroll 60s linear infinite;
    z-index: 3;
}

@keyframes scanlineScroll {
    from { background-position: 0 0; }
    to { background-position: 0 120px; }
}

/* --- Archetype Glyph --- */
.archetype-glyph {
    width: 160px;
    height: 160px;
    margin: 0 auto 40px;
    animation: glyphSpin 30s linear infinite;
}

.glyph-svg {
    width: 100%;
    height: 100%;
}

.glyph-circle {
    stroke-dasharray: 377;
    stroke-dashoffset: 377;
    animation: drawShape 6s ease-in-out infinite;
}

.glyph-triangle {
    stroke-dasharray: 480;
    stroke-dashoffset: 480;
    animation: drawShape 8s ease-in-out infinite;
}

.glyph-square {
    stroke-dasharray: 560;
    stroke-dashoffset: 560;
    animation: drawShape 10s ease-in-out infinite;
}

@keyframes glyphSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes drawShape {
    0%, 100% { stroke-dashoffset: 0; }
    40% { stroke-dashoffset: 0; }
    50% { stroke-dashoffset: 0; opacity: 1; }
    85% { stroke-dashoffset: 0; }
    95% { opacity: 0.4; }
}

/* --- Hero Typography --- */
.hero-title {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(2.8rem, 7vw, 6rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-text-primary);
    margin-bottom: 20px;
    line-height: 1.1;
}

/* --- Gold Rule with Diamond --- */
.gold-rule {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 20px;
    width: 300px;
    margin-left: auto;
    margin-right: auto;
}

.rule-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, #d4af37 30%, #d4af37 70%, transparent 100%);
}

.rule-diamond {
    width: 10px;
    height: 10px;
    background: var(--color-gold);
    transform: rotate(45deg);
    flex-shrink: 0;
}

/* --- Hero Subtitle --- */
.hero-subtitle {
    font-family: var(--font-subhead);
    font-weight: 300;
    font-size: clamp(1.1rem, 2.5vw, 1.6rem);
    letter-spacing: 0.06em;
    color: var(--color-text-secondary);
    margin-bottom: 40px;
}

/* --- Chevron Cascade --- */
.chevron-cascade {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.cascade-chevron {
    width: 40px;
    height: 20px;
    opacity: 0;
    transform: translateY(-20px);
}

.cascade-chevron.animate {
    animation: chevronDrop 400ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.cascade-chevron:nth-child(1).animate { animation-delay: 0ms; }
.cascade-chevron:nth-child(2).animate { animation-delay: 120ms; }
.cascade-chevron:nth-child(3).animate { animation-delay: 240ms; }
.cascade-chevron:nth-child(4).animate { animation-delay: 360ms; }
.cascade-chevron:nth-child(5).animate { animation-delay: 480ms; }

@keyframes chevronDrop {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Chevron Divider --- */
.chevron-divider {
    display: flex;
    justify-content: center;
    padding: 40px 0;
}

.chevron-set {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.chevron {
    width: 0;
    height: 0;
    border-left: 20px solid transparent;
    border-right: 20px solid transparent;
    border-bottom: 12px solid var(--color-gold);
    transform: rotate(180deg);
    animation: chevronPulse 4s ease-in-out infinite;
}

.chevron-outer {
    opacity: 0.4;
    border-left-width: 24px;
    border-right-width: 24px;
    border-bottom-width: 14px;
}

.chevron-mid {
    opacity: 0.7;
    animation-delay: 0.3s;
}

.chevron-inner {
    opacity: 1;
    border-left-width: 16px;
    border-right-width: 16px;
    border-bottom-width: 10px;
    animation-delay: 0.6s;
}

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

/* --- Section Heading --- */
.section-heading {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(2rem, 5vw, 3.5rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-text-primary);
    text-align: center;
    margin-bottom: 16px;
}

.section-cascade {
    margin-bottom: 48px;
}

/* --- Card Gallery Section --- */
.card-gallery {
    padding: 60px 32px 80px;
    max-width: 1280px;
    margin: 0 auto;
    position: relative;
    z-index: 5;
}

/* --- Card Grid --- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

/* Vertical stagger: odd columns offset */
.archetype-card[data-col="1"],
.archetype-card[data-col="3"] {
    margin-top: 40px;
}

/* --- Archetype Card --- */
.archetype-card {
    aspect-ratio: 3 / 4;
    background: var(--color-surface);
    clip-path: polygon(0 12px, 12px 0, calc(100% - 12px) 0, 100% 12px, 100% calc(100% - 12px), calc(100% - 12px) 100%, 12px 100%, 0 calc(100% - 12px));
    display: grid;
    grid-template-rows: auto 1fr auto;
    padding: 28px 24px;
    position: relative;
    contain: layout style paint;
    opacity: 0;
    transform: scale(0.92);
    transition: transform 500ms cubic-bezier(0.22, 1, 0.36, 1), opacity 500ms cubic-bezier(0.22, 1, 0.36, 1);
    overflow: hidden;
    /* Stepped zigzag top border */
    background-image: repeating-linear-gradient(90deg, #d4af37 0px, #d4af37 8px, transparent 8px, transparent 16px);
    background-size: 100% 3px;
    background-repeat: no-repeat;
    background-position: top center;
}

.archetype-card.visible {
    opacity: 1;
    transform: scale(1);
}

/* HUD Corner Brackets */
.archetype-card::before,
.archetype-card::after {
    content: '';
    position: absolute;
    width: 24px;
    height: 24px;
    pointer-events: none;
}

.archetype-card::before {
    top: 16px;
    left: 16px;
    border-top: 2px solid rgba(77, 232, 208, 0.12);
    border-left: 2px solid rgba(77, 232, 208, 0.12);
}

.archetype-card::after {
    bottom: 16px;
    right: 16px;
    border-bottom: 2px solid rgba(77, 232, 208, 0.12);
    border-right: 2px solid rgba(77, 232, 208, 0.12);
}

/* Gold Shimmer on Hover */
.archetype-card .card-shimmer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(110deg, transparent 30%, rgba(212, 175, 55, 0.15) 45%, transparent 60%);
    transform: translateX(-100%);
    pointer-events: none;
    z-index: 10;
}

.archetype-card:hover .card-shimmer {
    animation: goldShimmer 600ms ease forwards;
}

@keyframes goldShimmer {
    from { transform: translateX(-100%); }
    to { transform: translateX(100%); }
}

/* --- Card Inner Elements --- */
.card-icon {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px 0;
}

.card-icon svg {
    width: 60px;
    height: 60px;
}

.card-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.card-title {
    font-family: var(--font-subhead);
    font-weight: 600;
    font-size: clamp(1.1rem, 2.5vw, 1.6rem);
    letter-spacing: 0.06em;
    color: var(--color-text-primary);
}

.card-text {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: 0.95rem;
    line-height: 1.8;
    color: var(--color-text-secondary);
}

.card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid rgba(77, 232, 208, 0.1);
    margin-top: auto;
}

.meta-coord,
.meta-id {
    font-family: var(--font-mono);
    font-weight: 300;
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    color: var(--color-hud);
    opacity: 0.6;
}

/* --- About Section --- */
.about-section {
    padding: 80px 32px;
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
    position: relative;
    z-index: 5;
}

.about-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.about-text {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: 1rem;
    line-height: 1.8;
    color: var(--color-text-secondary);
}

/* --- Concepts Section --- */
.concepts-section {
    padding: 60px 32px 80px;
    max-width: 1100px;
    margin: 0 auto;
    position: relative;
    z-index: 5;
}

.concepts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
    margin-top: 40px;
}

.concept-item {
    background: var(--color-surface);
    padding: 32px 24px;
    clip-path: polygon(0 12px, 12px 0, calc(100% - 12px) 0, 100% 12px, 100% calc(100% - 12px), calc(100% - 12px) 100%, 12px 100%, 0 calc(100% - 12px));
    position: relative;
}

.concept-item::before {
    content: '';
    position: absolute;
    top: 16px;
    left: 16px;
    width: 20px;
    height: 20px;
    border-top: 2px solid rgba(77, 232, 208, 0.12);
    border-left: 2px solid rgba(77, 232, 208, 0.12);
}

.concept-number {
    font-family: var(--font-mono);
    font-weight: 300;
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    color: var(--color-hud);
    opacity: 0.5;
    margin-bottom: 12px;
}

.concept-title {
    font-family: var(--font-subhead);
    font-weight: 600;
    font-size: 1.2rem;
    letter-spacing: 0.06em;
    color: var(--color-text-primary);
    margin-bottom: 12px;
}

.concept-desc {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--color-text-secondary);
}

/* --- HUD Footer --- */
.hud-footer {
    height: 80px;
    border-top: 1px solid transparent;
    border-image: linear-gradient(90deg, transparent, #d4af37, transparent) 1;
    display: flex;
    align-items: center;
    padding: 0 32px;
    position: relative;
    z-index: 5;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
}

.footer-left,
.footer-right {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.footer-data {
    font-family: var(--font-mono);
    font-weight: 300;
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    color: var(--color-hud);
    opacity: 0.6;
}

.footer-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.footer-diamond {
    width: 12px;
    height: 12px;
    background: var(--color-hud);
    transform: rotate(45deg);
    animation: diamondPulse 2s ease-in-out infinite;
    box-shadow: 0 0 12px rgba(77, 232, 208, 0.4);
}

@keyframes diamondPulse {
    0%, 100% { transform: rotate(45deg) scale(0.8); box-shadow: 0 0 8px rgba(77, 232, 208, 0.2); }
    50% { transform: rotate(45deg) scale(1.2); box-shadow: 0 0 16px rgba(77, 232, 208, 0.5); }
}

.footer-label {
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    color: var(--color-gold);
    text-transform: uppercase;
}

/* --- Responsive: Tablet --- */
@media (max-width: 1200px) {
    .card-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
        padding: 0;
    }

    .card-gallery {
        padding: 60px 32px 80px;
    }

    .archetype-card[data-col="1"],
    .archetype-card[data-col="3"] {
        margin-top: 40px;
    }

    .concepts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* --- Responsive: Mobile --- */
@media (max-width: 768px) {
    .card-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .archetype-card {
        aspect-ratio: 16 / 9;
    }

    .archetype-card[data-col="1"],
    .archetype-card[data-col="3"] {
        margin-top: 0;
    }

    .card-gallery {
        padding: 40px 16px 60px;
    }

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

    .hero-title {
        font-size: clamp(2rem, 10vw, 3.5rem);
    }

    .gold-rule {
        width: 200px;
    }

    .footer-content {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }

    .footer-left,
    .footer-right {
        align-items: center;
    }

    .hud-footer {
        height: auto;
        padding: 16px;
    }

    .nav-rosette {
        top: 12px;
        right: 12px;
    }

    .rosette-btn {
        width: 44px;
        height: 44px;
    }

    .rosette-svg {
        width: 32px;
        height: 32px;
    }

    .archetype-glyph {
        width: 120px;
        height: 120px;
    }
}

/* --- Sunburst Rosette Background --- */
.rosette-btn::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: conic-gradient(
        from 0deg,
        #d4af37 0deg, transparent 15deg,
        #d4af37 30deg, transparent 45deg,
        #d4af37 60deg, transparent 75deg,
        #d4af37 90deg, transparent 105deg,
        #d4af37 120deg, transparent 135deg,
        #d4af37 150deg, transparent 165deg,
        #d4af37 180deg, transparent 195deg,
        #d4af37 210deg, transparent 225deg,
        #d4af37 240deg, transparent 255deg,
        #d4af37 270deg, transparent 285deg,
        #d4af37 300deg, transparent 315deg,
        #d4af37 330deg, transparent 345deg,
        #d4af37 360deg
    );
    opacity: 0.06;
    z-index: -1;
}
