/* ============================================================
   diplomatic.day - Bauhaus Diplomatic Design System
   ============================================================ */

:root {
    --linen: #F4EDE4;
    --plaster: #EBE2D5;
    --ink: #2C2418;
    --carbon: #3D3226;
    --shadow: #8A7D6B;
    --brass: #B8A080;
    --seal: #A0522D;
    --oak: #5C4A36;
    --unit: 8px;
    --ease-draw: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-enter: cubic-bezier(0.25, 0.1, 0.25, 1);
    --ease-overshoot: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ---- Reset & Base ---- */

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

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

body {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 400;
    background-color: var(--linen);
    color: var(--carbon);
    line-height: 1.7;
    letter-spacing: 0.01em;
    overflow-x: hidden;
}

/* ---- Entry Overlay ---- */

#entry-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: var(--linen);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    pointer-events: none;
}

#entry-overlay.fade-out {
    opacity: 0;
    transition: opacity 500ms var(--ease-draw);
}

#entry-overlay.hidden {
    display: none;
}

#entry-seal {
    position: relative;
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#entry-seal .seal-square {
    position: absolute;
    width: 120px;
    height: 120px;
    border: 1px solid var(--ink);
    opacity: 0;
    transform: scale(0.85);
    transition: opacity 900ms var(--ease-enter), transform 900ms var(--ease-enter);
}

#entry-seal .seal-circle {
    position: absolute;
    width: 90px;
    height: 90px;
    border: 1px solid var(--brass);
    border-radius: 50%;
    opacity: 0;
    transform: scale(0.85);
    transition: opacity 900ms var(--ease-enter), transform 900ms var(--ease-enter);
}

#entry-seal .seal-triangle {
    position: absolute;
    width: 0;
    height: 0;
    border-left: 22px solid transparent;
    border-right: 22px solid transparent;
    border-bottom: 38px solid var(--seal);
    opacity: 0;
    transform: scale(0.85);
    transition: opacity 900ms var(--ease-enter), transform 900ms var(--ease-enter);
}

#entry-seal.animate .seal-square {
    opacity: 1;
    transform: scale(1);
}

#entry-seal.animate .seal-circle {
    opacity: 1;
    transform: scale(1);
    transition-delay: 200ms;
}

#entry-seal.animate .seal-triangle {
    opacity: 1;
    transform: scale(1);
    transition-delay: 400ms;
}

#entry-seal.shrink {
    transition: transform 700ms var(--ease-draw), opacity 700ms var(--ease-draw);
}

/* ---- Sweeps (Sections) ---- */

.sweep {
    position: relative;
    width: 100%;
    padding: 0 48px;
}

#sweep-1 {
    min-height: 100vh;
    display: flex;
    align-items: center;
    background-color: var(--linen);
}

#sweep-2 {
    min-height: 80vh;
    display: flex;
    align-items: center;
    background-color: var(--linen);
    padding-top: 128px;
    padding-bottom: 128px;
}

#sweep-3 {
    min-height: 80vh;
    display: flex;
    align-items: center;
    background-color: var(--plaster);
    padding-top: 128px;
    padding-bottom: 128px;
}

#sweep-4 {
    min-height: 60vh;
    display: flex;
    align-items: center;
    background-color: var(--linen);
    padding-top: 128px;
    padding-bottom: 96px;
}

.sweep-inner {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

/* ---- Sweep 1: Credential Presentation ---- */

.sweep-1-top {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: start;
    gap: 32px;
    position: relative;
    padding-bottom: 96px;
}

.logotype {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(3.2rem, 7vw, 6rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--ink);
    line-height: 1.05;
    opacity: 0;
    transform: translateY(16px);
}

.logotype.visible {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 600ms var(--ease-enter), transform 600ms var(--ease-enter);
}

.horizontal-rule {
    position: absolute;
    top: 50%;
    left: 0;
    height: 1px;
    background-color: var(--brass);
    width: 0;
    transition: width 1.2s var(--ease-draw);
}

.horizontal-rule.visible {
    width: 100%;
}

/* Seal Small - Top Right */

.seal-small {
    position: relative;
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 600ms var(--ease-enter);
}

.seal-small.visible {
    opacity: 1;
}

.seal-small .seal-square {
    position: absolute;
    top: 0;
    left: 0;
    width: 48px;
    height: 48px;
    border: 1px solid var(--ink);
}

.seal-small .seal-circle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 36px;
    height: 36px;
    border: 1px solid var(--brass);
    border-radius: 50%;
}

.seal-small .seal-triangle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -45%);
    width: 0;
    height: 0;
    border-left: 9px solid transparent;
    border-right: 9px solid transparent;
    border-bottom: 16px solid var(--seal);
}

.seal-small:hover .seal-square {
    transform: rotate(3deg);
    transition: transform 400ms var(--ease-draw);
}

.seal-small:hover .seal-circle {
    transform: translate(-50%, -50%) rotate(-5deg);
    transition: transform 400ms var(--ease-draw);
}

.seal-small:hover .seal-triangle {
    transform: translate(-50%, -45%) rotate(8deg);
    transition: transform 400ms var(--ease-draw);
}

.sweep-1-bottom {
    max-width: 55ch;
}

.intro-statement {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 18px;
    font-weight: 400;
    line-height: 1.7;
    letter-spacing: 0.01em;
    color: var(--carbon);
    opacity: 0;
    transform: translateY(16px);
}

.intro-statement.visible {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 600ms var(--ease-enter), transform 600ms var(--ease-enter);
    transition-delay: 200ms;
}

/* ---- Sweep Dividers ---- */

.sweep-divider {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    height: 1px;
    position: relative;
    overflow: hidden;
}

.divider-ltr::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 1px;
    background-color: var(--brass);
    transition: width 800ms var(--ease-draw);
}

.divider-ltr.visible::after {
    width: 100%;
}

.divider-rtl::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 0;
    height: 1px;
    background-color: var(--brass);
    transition: width 800ms var(--ease-draw);
}

.divider-rtl.visible::after {
    width: 100%;
}

.divider-center {
    display: flex;
    justify-content: center;
    height: 2px;
}

.divider-center .divider-left-half,
.divider-center .divider-right-half {
    width: 0;
    height: 2px;
    background-color: var(--ink);
    transition: width 600ms var(--ease-draw);
}

.divider-center.visible .divider-left-half,
.divider-center.visible .divider-right-half {
    width: 50%;
}

/* ---- Sweep 2: Protocol Chamber ---- */

.border-draw {
    padding: 48px;
    position: relative;
    background:
        linear-gradient(var(--brass), var(--brass)) top left / 0% 1px no-repeat,
        linear-gradient(var(--brass), var(--brass)) top right / 1px 0% no-repeat,
        linear-gradient(var(--brass), var(--brass)) bottom right / 0% 1px no-repeat,
        linear-gradient(var(--brass), var(--brass)) bottom left / 1px 0% no-repeat;
    transition: background-size 1.4s var(--ease-draw);
}

.border-draw.visible {
    background-size: 100% 1px, 1px 100%, 100% 1px, 1px 100%;
}

.sweep-2-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 48px;
}

.section-heading {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(1.6rem, 3.5vw, 2.4rem);
    font-weight: 500;
    letter-spacing: 0.25em;
    color: var(--ink);
    text-transform: uppercase;
    opacity: 0;
    transform: translateY(16px);
}

.section-heading.visible {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 600ms var(--ease-enter), transform 600ms var(--ease-enter);
}

.geometric-accent.accent-triangle-down {
    width: 0;
    height: 0;
    border-left: 20px solid transparent;
    border-right: 20px solid transparent;
    border-top: 40px solid var(--brass);
    opacity: 0;
    transform: scale(0);
}

.geometric-accent.accent-triangle-down.visible {
    opacity: 1;
    transform: scale(1);
    transition: opacity 400ms var(--ease-overshoot), transform 400ms var(--ease-overshoot);
    transition-delay: 200ms;
}

.sweep-2-content {
    max-width: 65ch;
    margin-bottom: 48px;
}

.body-text {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 18px;
    font-weight: 400;
    line-height: 1.7;
    letter-spacing: 0.01em;
    color: var(--carbon);
    margin-bottom: 32px;
    opacity: 0;
    transform: translateY(16px);
}

.body-text.visible {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 600ms var(--ease-enter), transform 600ms var(--ease-enter);
}

.sweep-2-bottom {
    display: flex;
    justify-content: flex-start;
}

.metadata {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--shadow);
    opacity: 0;
    transform: translateY(16px);
}

.metadata.visible {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 600ms var(--ease-enter), transform 600ms var(--ease-enter);
}

/* ---- Sweep 3: Assembly Hall ---- */

.sweep-3-top {
    margin-bottom: 48px;
}

.sweep-3-columns {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 48px;
    align-items: start;
}

.column-primary {
    max-width: 65ch;
}

.column-secondary {
    display: flex;
    flex-direction: column;
    gap: 32px;
    align-items: center;
}

/* Epigraph */

.epigraph-container {
    position: relative;
    padding-left: 24px;
    margin: 48px 0;
}

.epigraph-bar {
    position: absolute;
    left: 0;
    top: 0;
    width: 1px;
    height: 0;
    background-color: var(--brass);
    transition: height 1.2s var(--ease-draw);
}

.epigraph-container.visible .epigraph-bar {
    height: 100%;
}

.epigraph-text {
    font-family: 'DM Serif Display', serif;
    font-size: clamp(1.4rem, 3vw, 2.2rem);
    font-style: italic;
    font-weight: 400;
    letter-spacing: 0.02em;
    color: var(--brass);
    line-height: 1.4;
}

.epigraph-text .char {
    opacity: 0;
    transition: opacity 60ms var(--ease-enter);
}

.epigraph-text .char.visible {
    opacity: 1;
}

/* ---- Kandinsky Compositions ---- */

.kandinsky-composition {
    width: 200px;
    height: 200px;
    position: relative;
    border: 1px solid var(--shadow);
    transition: border-color 300ms var(--ease-draw);
    opacity: 0;
    transform: scale(0);
}

.kandinsky-composition.visible {
    opacity: 1;
    transform: scale(1);
    transition: opacity 400ms var(--ease-overshoot), transform 400ms var(--ease-overshoot), border-color 300ms var(--ease-draw);
}

.kandinsky-composition:hover {
    border-color: var(--ink);
}

/* Composition Alpha */

.comp-alpha-circle {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 80px;
    height: 80px;
    border: 2px solid var(--brass);
    border-radius: 50%;
}

.comp-alpha-line {
    position: absolute;
    bottom: 60px;
    left: 0;
    width: 180px;
    height: 1px;
    background-color: var(--ink);
    transform: rotate(35deg);
    transform-origin: left center;
}

.comp-alpha-triangle {
    position: absolute;
    bottom: 15px;
    left: 15px;
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-bottom: 17px solid var(--oak);
}

/* Composition Beta */

.comp-beta-rect-1 {
    position: absolute;
    top: 30px;
    left: 25px;
    width: 100px;
    height: 70px;
    border: 1px solid var(--shadow);
}

.comp-beta-rect-2 {
    position: absolute;
    top: 65px;
    left: 60px;
    width: 80px;
    height: 100px;
    border: 1px solid var(--brass);
}

.comp-beta-circle {
    position: absolute;
    top: 58px;
    left: 53px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--seal);
}

/* Composition Gamma */

.gamma-grid {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: grid;
    grid-template-columns: repeat(3, 16px);
    grid-template-rows: repeat(3, 16px);
    gap: 12px;
}

.gamma-cell {
    width: 16px;
    height: 16px;
    display: block;
}

.gamma-cell.dark {
    background-color: var(--ink);
}

.gamma-cell.light {
    background-color: var(--plaster);
}

.gamma-cell.displaced {
    transform: translate(8px, 8px);
}

/* ---- Sweep 4: Closing Protocol ---- */

.sweep-4-top {
    margin-bottom: 64px;
}

.closing-statement {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 18px;
    font-weight: 400;
    line-height: 1.7;
    letter-spacing: 0.01em;
    color: var(--carbon);
    max-width: 55ch;
    opacity: 0;
    transform: translateY(16px);
}

.closing-statement.visible {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 600ms var(--ease-enter), transform 600ms var(--ease-enter);
}

.rule-closing {
    position: relative;
    width: 0;
    height: 2px;
    background-color: var(--ink);
    margin-bottom: 48px;
    transition: width 1.2s var(--ease-draw);
}

.rule-closing.visible {
    width: 100%;
}

.sweep-4-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 24px;
    opacity: 0;
    transform: translateY(16px);
}

.sweep-4-footer.visible {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 600ms var(--ease-enter), transform 600ms var(--ease-enter);
}

.footer-domain {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--oak);
}

.footer-rule {
    width: 48px;
    height: 1px;
    background-color: var(--oak);
}

.footer-year {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--oak);
}

/* ---- Interactive States ---- */

a, .interactive {
    color: var(--ink);
    text-decoration: none;
    position: relative;
    transition: color 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

a:hover, .interactive:hover {
    color: var(--brass);
}

a::after, .interactive::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background-color: var(--brass);
    transition: width 300ms var(--ease-draw);
}

a:hover::after, .interactive:hover::after {
    width: 100%;
}

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

@media (max-width: 768px) {
    .sweep {
        padding: 0 24px;
    }

    .sweep-1-top {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .seal-small {
        position: absolute;
        top: 0;
        right: 0;
    }

    .sweep-3-columns {
        grid-template-columns: 1fr;
        gap: 48px;
    }

    .column-secondary {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }

    .kandinsky-composition {
        width: 160px;
        height: 160px;
    }

    .border-draw {
        padding: 32px;
    }

    #sweep-2 {
        padding-top: 64px;
        padding-bottom: 64px;
    }

    #sweep-3 {
        padding-top: 64px;
        padding-bottom: 64px;
    }

    #sweep-4 {
        padding-top: 64px;
        padding-bottom: 48px;
    }
}

@media (max-width: 480px) {
    .logotype {
        font-size: clamp(2.4rem, 10vw, 3.6rem);
    }

    .kandinsky-composition {
        width: 140px;
        height: 140px;
    }

    .sweep-4-footer {
        flex-direction: column;
        align-items: flex-end;
        gap: 12px;
    }
}
