/* ========================================
   badge.bar — styles.css
   Light-academia aesthetic, muted-vintage palette
   ======================================== */

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    color: #5c5245;
    background-color: #faf6ef;
    line-height: 1.75;
    overflow-x: hidden;
    position: relative;
}

/* ---- Background Grid Overlay ---- */
.grid-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    background:
        repeating-linear-gradient(
            to right,
            #e8e0d0 0,
            #e8e0d0 1px,
            transparent 1px,
            transparent 48px
        ),
        repeating-linear-gradient(
            to bottom,
            #e8e0d0 0,
            #e8e0d0 1px,
            transparent 1px,
            transparent 48px
        );
    opacity: 0.3;
}

/* ---- Container ---- */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 clamp(24px, 4vw, 64px);
}

/* ---- Typography ---- */
h1, h2, h3 {
    font-family: 'Playfair Display', Georgia, serif;
    color: #3a2f25;
    font-weight: 700;
}

/* ---- Hero Section ---- */
.hero {
    position: relative;
    z-index: 1;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 clamp(24px, 4vw, 64px);
}

.hero-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.hero-wordmark {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    font-size: clamp(3.5rem, 8vw, 7rem);
    color: #3a2f25;
    letter-spacing: -0.02em;
    opacity: 0;
    animation: fadeIn 800ms ease-out 200ms forwards;
}

.hero-subtitle {
    font-family: 'Source Serif 4', Georgia, serif;
    font-style: italic;
    font-weight: 400;
    font-size: clamp(1.1rem, 2vw, 1.5rem);
    color: #5c5245;
    opacity: 0;
    animation: fadeIn 800ms ease-out 800ms forwards;
    max-width: 540px;
}

.hero-chevron {
    font-family: 'DM Mono', monospace;
    font-size: 1.5rem;
    color: #8b7e6a;
    opacity: 0;
    animation: fadeIn 600ms ease-out 1400ms forwards, nudge 2s ease-in-out 2s infinite;
    cursor: default;
    user-select: none;
}

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

@keyframes nudge {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(6px); }
}

/* ---- Section Headers ---- */
.section-header {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 40px;
    max-width: 1280px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 clamp(24px, 4vw, 64px);
}

.section-rule {
    flex: 1;
    border: none;
    height: 1px;
    background-color: #c4b89a;
}

.section-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    color: #3a2f25;
    letter-spacing: -0.02em;
    white-space: nowrap;
}

/* ---- Card Grid Section ---- */
.card-grid-section {
    position: relative;
    z-index: 1;
    padding: 40px 0 80px;
}

.card-grid-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    background:
        repeating-linear-gradient(
            to right,
            #e8e0d0 0,
            #e8e0d0 1px,
            transparent 1px,
            transparent 48px
        ),
        repeating-linear-gradient(
            to bottom,
            #e8e0d0 0,
            #e8e0d0 1px,
            transparent 1px,
            transparent 48px
        );
    opacity: 0;
    transition: opacity 1.2s ease;
}

.card-grid-section.grid-pulse::before {
    animation: gridPulse 1.2s ease forwards;
}

@keyframes gridPulse {
    0% { opacity: 0; }
    30% { opacity: 0.5; }
    100% { opacity: 0; }
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 28px;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 clamp(24px, 4vw, 64px);
    position: relative;
    z-index: 1;
}

/* ---- Badge Card ---- */
.badge-card {
    background: #faf6ef;
    border: 1px solid #c4b89a;
    box-shadow: 2px 3px 0 #c4b89a;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    display: flex;
    flex-direction: column;
}

.badge-card:hover {
    transform: translateY(-4px);
    box-shadow: 4px 6px 0 #b8a888;
}

.badge-card:hover .card-icon-area .card-grid-pattern {
    opacity: 0.35;
}

.badge-card:hover .badge-icon {
    filter: drop-shadow(0 0 4px rgba(184, 149, 47, 0.3));
}

/* Card Icon Area */
.card-icon-area {
    position: relative;
    padding-top: 75%;
    overflow: hidden;
}

.card-grid-pattern {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        repeating-linear-gradient(
            to right,
            #e8e0d0 0,
            #e8e0d0 1px,
            transparent 1px,
            transparent 12px
        ),
        repeating-linear-gradient(
            to bottom,
            #e8e0d0 0,
            #e8e0d0 1px,
            transparent 1px,
            transparent 12px
        );
    opacity: 0.15;
    transition: opacity 0.3s ease;
}

.badge-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: filter 0.3s ease;
}

/* Card Divider */
.card-divider {
    height: 1px;
    background-color: #8b7e6a;
    margin: 0;
}

/* Card Text Area */
.card-text-area {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
    position: relative;
}

.card-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    font-size: clamp(1.15rem, 2vw, 1.4rem);
    color: #3a2f25;
    letter-spacing: -0.02em;
    margin-bottom: 10px;
}

.card-description {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    font-size: clamp(0.88rem, 1vw, 0.95rem);
    color: #5c5245;
    line-height: 1.65;
    margin-bottom: 16px;
    flex: 1;
}

.card-detail {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.4s ease;
    opacity: 0;
}

.card-detail.visible {
    max-height: 200px;
    opacity: 1;
    margin-bottom: 12px;
}

.card-detail p {
    font-family: 'Source Serif 4', Georgia, serif;
    font-style: italic;
    font-size: 0.88rem;
    color: #8b7e6a;
    line-height: 1.6;
    padding-top: 8px;
    border-top: 1px dashed #e8e0d0;
}

.card-date {
    font-family: 'DM Mono', monospace;
    font-size: 0.75rem;
    color: #8b7e6a;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    text-shadow: 0.5px 0.5px 0 #c4b89a;
    align-self: flex-end;
    margin-top: auto;
}

/* ---- Badge Shake Animation ---- */
@keyframes badgeShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

@keyframes badgeExpand {
    0% { transform: scale(1); }
    100% { transform: scale(1.02); }
}

.badge-card.shaking {
    animation: badgeShake 400ms ease;
}

.badge-card.expanded {
    transform: scale(1.02);
}

/* ---- Narrative Sections ---- */
.narrative-section {
    position: relative;
    z-index: 1;
    padding: 80px 0;
    background-color: #f0e8d8;
}

.narrative-container {
    max-width: 640px;
    margin: 0 auto;
    padding: 0 clamp(24px, 4vw, 64px);
    position: relative;
}

.narrative-text p {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.1vw, 1.15rem);
    color: #5c5245;
    line-height: 1.75;
}

/* Drop Cap */
.drop-cap::first-letter {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    float: left;
    font-size: 4.5em;
    line-height: 0.8;
    padding-right: 12px;
    padding-top: 6px;
    color: #8c4a3a;
    border-bottom: 2px solid #b8952f;
}

/* ---- Scroll Reveal Animations ---- */
.scroll-reveal {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 500ms cubic-bezier(0.25, 0.46, 0.45, 0.94), transform 500ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

.scroll-reveal-left {
    opacity: 0;
    transform: translateX(-30px);
    transition: opacity 600ms ease, transform 600ms ease;
}

.scroll-reveal-left.revealed {
    opacity: 1;
    transform: translateX(0);
}

/* ---- Embossed Seal ---- */
.embossed-seal {
    display: inline-block;
    animation: spin 60s linear infinite;
    margin-bottom: 24px;
}

.embossed-seal.seal-entrance {
    animation: sealStamp 800ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards, spin 60s linear 800ms infinite;
}

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

@keyframes sealStamp {
    from {
        transform: scale(0) rotate(-90deg);
        opacity: 0;
    }
    to {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

/* ---- Footer ---- */
.site-footer {
    position: relative;
    z-index: 1;
    padding: 40px 0 60px;
    text-align: center;
}

.footer-rule {
    border: none;
    height: 1px;
    background-color: #c4b89a;
    max-width: 1280px;
    margin: 0 auto 40px;
    padding: 0 clamp(24px, 4vw, 64px);
}

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

.footer-wordmark {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    font-size: 1.5rem;
    color: #3a2f25;
    letter-spacing: -0.02em;
}

.footer-note {
    font-family: 'DM Mono', monospace;
    font-size: 0.75rem;
    color: #8b7e6a;
    text-transform: uppercase;
    letter-spacing: 0.14em;
}

/* ---- Responsive ---- */

/* Tablet: 768px - 1199px */
@media (max-width: 1199px) {
    .card-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

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

    .hero-wordmark {
        font-size: clamp(2.5rem, 12vw, 4rem);
    }

    .card-icon-area {
        padding-top: 50%;
    }

    .section-header {
        gap: 16px;
    }

    .narrative-container {
        padding: 0 24px;
    }
}

/* ---- Hidden utility ---- */
.hidden {
    /* Used by JS to toggle card details */
}
