/* === Custom Properties === */
:root {
    --void: #1a0a0f;
    --surface: #2a1018;
    --accent: #8b2252;
    --ink: #d4c5b9;
    --secondary: #7a4455;
    --highlight: #c4713b;
    --alert: #4a8b6f;
    --border: #5a1a2a;
}

/* === Noise texture (inline SVG) === */
@keyframes stamp {
    from { transform: scale(1.3); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

@keyframes lineExpand {
    from { width: 0; }
    to { width: 60vw; }
}

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

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--void);
    color: var(--ink);
    font-family: 'Karla', sans-serif;
    font-size: 16px;
    line-height: 1.6;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4'%3E%3Crect width='1' height='1' x='1' y='1' fill='%23d4c5b9' opacity='0.03'/%3E%3C/svg%3E");
    overflow-x: hidden;
}

/* === Vault Door / Hero === */
#vault-door {
    min-height: 100vh;
    display: grid;
    place-content: center;
    text-align: center;
    padding: 2rem;
}

#hero-stamp {
    transition: opacity 0.2s;
}

#hero-stamp.hidden,
#counter-section.hidden {
    opacity: 0;
}

#hero-stamp.visible {
    animation: stamp 200ms ease-out forwards;
}

#domain-title {
    font-family: 'EB Garamond', serif;
    font-weight: 700;
    font-size: clamp(3rem, 8vw, 6rem);
    letter-spacing: -0.02em;
    color: var(--ink);
}

#hero-line {
    height: 1px;
    background: var(--accent);
    margin: 1.5rem auto;
    animation: lineExpand 600ms ease-out forwards;
    animation-delay: 200ms;
    width: 0;
}

#hero-subtitle {
    font-family: 'Karla', sans-serif;
    font-size: clamp(0.9rem, 2vw, 1.2rem);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--secondary);
    opacity: 0;
    animation: fadeIn 500ms ease-out forwards;
    animation-delay: 600ms;
}

#counter-section {
    margin-top: 3rem;
    transition: opacity 0.5s;
}

#counter-section.visible {
    opacity: 1;
}

#counter-number {
    display: block;
    font-family: 'Fira Code', monospace;
    font-size: clamp(2rem, 5vw, 4rem);
    font-weight: 700;
    color: var(--highlight);
    text-shadow: 0 0 8px rgba(196, 113, 59, 0.4);
}

#counter-label {
    display: block;
    font-family: 'Karla', sans-serif;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--secondary);
    font-variant: small-caps;
}

/* === Angular Dividers === */
.angular-divider {
    width: 100%;
    padding: 1rem 0;
    overflow: hidden;
}

.angular-divider svg {
    width: 100%;
    height: 40px;
}

.divider-path {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    transition: stroke-dashoffset 800ms ease-out;
}

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

/* === Card Grid === */
#archive-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    padding: 2rem clamp(1rem, 4vw, 4rem);
    max-width: 1400px;
    margin: 0 auto;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 1.5rem;
    position: relative;
    cursor: pointer;
    transform: translateY(30px);
    opacity: 0;
    transition: transform 150ms ease-out, border-color 150ms ease-out, box-shadow 150ms ease-out, opacity 400ms ease-out;
    clip-path: polygon(
        0% 1%, 3% 0%, 8% 0.5%, 15% 0%, 22% 0.3%, 30% 0%, 45% 0.2%, 55% 0%, 70% 0.4%, 80% 0%, 90% 0.2%, 97% 0%, 100% 0.8%,
        100% 10%, 99.8% 25%, 100% 40%, 99.6% 55%, 100% 70%, 99.8% 85%, 100% 99%,
        97% 100%, 90% 99.7%, 80% 100%, 70% 99.5%, 55% 100%, 45% 99.8%, 30% 100%, 15% 99.6%, 8% 100%, 3% 99.5%, 0% 100%,
        0% 85%, 0.3% 70%, 0% 55%, 0.4% 40%, 0% 25%, 0.2% 10%
    );
}

.card.visible {
    transform: translateY(0);
    opacity: 1;
}

.card:hover {
    transform: rotate(0.5deg);
    border-color: var(--accent);
    box-shadow: 3px 3px 0 var(--accent);
}

.card.expanded {
    grid-row: span 2;
}

.card-tall {
    grid-row: span 2;
}

.card-wide {
    grid-column: span 2;
}

@media (max-width: 640px) {
    .card-wide {
        grid-column: span 1;
    }
}

/* Card diamond */
.card-diamond {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 12px;
    height: 12px;
    background: var(--accent);
    transform: rotate(45deg);
}

[data-category="film"] .card-diamond { background: var(--accent); }
[data-category="music"] .card-diamond { background: var(--highlight); }
[data-category="literature"] .card-diamond { background: var(--secondary); }
[data-category="games"] .card-diamond { background: var(--alert); }
[data-category="government"] .card-diamond { background: var(--border); }

.card-icon {
    margin-bottom: 0.75rem;
}

.card-category {
    display: inline-block;
    font-family: 'Karla', sans-serif;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--secondary);
    margin-bottom: 0.5rem;
}

.card-title {
    font-family: 'EB Garamond', serif;
    font-weight: 700;
    font-size: clamp(1.1rem, 2vw, 1.5rem);
    letter-spacing: -0.02em;
    color: var(--ink);
    margin-bottom: 0.4rem;
    line-height: 1.3;
}

.card-meta {
    font-family: 'Fira Code', monospace;
    font-size: 0.75rem;
    color: var(--secondary);
    margin-bottom: 0.75rem;
}

.card-desc {
    font-family: 'Karla', sans-serif;
    font-size: 0.9rem;
    color: var(--ink);
    opacity: 0.85;
    line-height: 1.5;
}

.card-expanded {
    max-height: 0;
    overflow: hidden;
    transition: max-height 400ms ease-out, margin-top 400ms ease-out;
    margin-top: 0;
}

.card.expanded .card-expanded {
    max-height: 300px;
    margin-top: 1rem;
}

.card-full-desc {
    font-family: 'Karla', sans-serif;
    font-size: 0.85rem;
    color: var(--ink);
    opacity: 0.75;
    line-height: 1.5;
    margin-bottom: 0.75rem;
}

.card-status {
    font-family: 'Fira Code', monospace;
    font-size: 0.75rem;
    color: var(--secondary);
}

.status-text {
    color: var(--alert);
}

/* === Manifesto Footer === */
#manifesto {
    max-width: 800px;
    margin: 4rem auto;
    padding: 3rem clamp(1.5rem, 4vw, 4rem);
    text-align: center;
}

.manifesto-text {
    font-family: 'EB Garamond', serif;
    font-size: clamp(1.3rem, 3vw, 2.2rem);
    font-style: italic;
    font-weight: 400;
    line-height: 1.6;
    color: var(--ink);
    opacity: 0.9;
}

.drop-cap {
    font-size: 2em;
    float: left;
    line-height: 0.8;
    margin-right: 0.1em;
    color: var(--highlight);
    font-style: normal;
    font-weight: 700;
}

.manifesto-sign {
    font-family: 'Fira Code', monospace;
    font-size: 0.85rem;
    color: var(--secondary);
    margin-top: 2rem;
    letter-spacing: 0.1em;
}

/* === Reduced Motion === */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0s !important;
        animation-delay: 0s !important;
        transition-duration: 0s !important;
    }
    .card {
        opacity: 1;
        transform: none;
    }
    .divider-path {
        stroke-dashoffset: 0;
    }
    #hero-stamp.hidden, #counter-section.hidden {
        opacity: 1;
    }
    #hero-subtitle {
        opacity: 1;
    }
    #hero-line {
        width: 60vw;
    }
}
