/* ==========================================================================
   MMIDDL.com - Styles
   Mid-century modern editorial design
   ========================================================================== */

/* --------------------------------------------------------------------------
   CSS Custom Properties
   -------------------------------------------------------------------------- */
:root {
    /* Colors */
    --linen-cream: #F5F0E8;
    --warm-graphite: #2C2825;
    --teak-orange: #D4743A;
    --mustard-gold: #C9A84C;
    --sage-mist: #8FA88B;
    --sandstone: #B8A99A;
    --bone: #EDE6DA;
    --charcoal-ink: #1E1C19;

    /* Fonts */
    --font-display: 'Libre Baskerville', Georgia, serif;
    --font-body: 'DM Sans', 'Helvetica Neue', sans-serif;
    --font-accent: 'Commissioner', 'Trebuchet MS', sans-serif;

    /* Golden Ratio Scale */
    --space-xs: 8px;
    --space-sm: 13px;
    --space-md: 21px;
    --space-lg: 34px;
    --space-xl: 55px;
    --space-2xl: 89px;
}

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

html {
    scroll-behavior: smooth;
    scroll-snap-type: y proximity;
    font-size: 17px;
    line-height: 1.8;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    font-weight: 400;
    color: var(--charcoal-ink);
    background-color: var(--linen-cream);
    letter-spacing: 0.01em;
    overflow-x: hidden;
    position: relative;
}

/* --------------------------------------------------------------------------
   Linen Paper Texture Overlay
   -------------------------------------------------------------------------- */
#linen-texture {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.06;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23noise)' opacity='0.5'/%3E%3C/svg%3E");
    background-repeat: repeat;
}

/* --------------------------------------------------------------------------
   Top Navigation Bar
   -------------------------------------------------------------------------- */
#top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md) var(--space-lg);
    background: transparent;
    mix-blend-mode: normal;
}

.wordmark {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--charcoal-ink);
}

#compass-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--space-xs);
    display: flex;
    align-items: center;
    justify-content: center;
}

#compass-rose {
    animation: compass-spin 60s linear infinite;
    will-change: transform;
}

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

#compass-btn:hover #compass-rose {
    animation-duration: 10s;
}

/* Compass Radial Menu */
.compass-menu {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(245, 240, 232, 0.95);
    opacity: 1;
    transition: opacity 0.4s ease;
}

.compass-menu.hidden {
    opacity: 0;
    pointer-events: none;
}

.compass-link {
    position: absolute;
    text-decoration: none;
    color: var(--charcoal-ink);
    font-family: var(--font-accent);
    font-weight: 300;
    font-size: 0.76rem;
    letter-spacing: 0.05em;
    font-variant: small-caps;
    transition: color 0.3s ease, transform 0.3s ease;
}

.compass-link:hover {
    color: var(--teak-orange);
    transform: scale(1.1);
}

.compass-n { top: 25%; left: 50%; transform: translateX(-50%); }
.compass-e { top: 50%; right: 25%; transform: translateY(-50%); }
.compass-s { bottom: 25%; left: 50%; transform: translateX(-50%); }
.compass-w { top: 50%; left: 25%; transform: translateY(-50%); }

/* --------------------------------------------------------------------------
   Sections Base
   -------------------------------------------------------------------------- */
.section {
    min-height: 100vh;
    scroll-snap-align: start;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* --------------------------------------------------------------------------
   Balance Line / Section Divider
   -------------------------------------------------------------------------- */
.balance-line {
    height: 1px;
    background: var(--sandstone);
    width: 0;
    margin: 0 auto;
    transition: none;
}

.balance-line.animate {
    animation: line-extend 800ms cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes line-extend {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

.section-divider {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
}

/* --------------------------------------------------------------------------
   Section 1: The Opening Spread
   -------------------------------------------------------------------------- */
.section-opening {
    background-color: var(--linen-cream);
    display: flex;
    align-items: center;
    justify-content: center;
}

.opening-content {
    text-align: center;
    padding: var(--space-lg);
}

.opening-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(15vw, 20vw, 25vw);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    line-height: 1;
    color: var(--charcoal-ink);
    position: relative;
    display: inline-flex;
    align-items: center;
}

.visible-letters {
    position: relative;
    z-index: 1;
}

.ghost-letter {
    opacity: 0.04;
    transition: opacity 0.6s ease;
}

.opening-title:hover .ghost-letter {
    opacity: 0.25;
}

.opening-tagline {
    font-family: var(--font-accent);
    font-weight: 300;
    font-size: 0.76rem;
    letter-spacing: 0.05em;
    font-variant: small-caps;
    color: var(--warm-graphite);
    margin-top: var(--space-lg);
}

/* --------------------------------------------------------------------------
   Section 2: The Balance Grid
   -------------------------------------------------------------------------- */
.section-balance {
    background-color: var(--bone);
    padding: var(--space-2xl) var(--space-lg);
    display: flex;
    align-items: center;
    justify-content: center;
}

.balance-grid {
    display: grid;
    grid-template-columns: 38.2% 1fr;
    gap: var(--space-xl);
    width: 100%;
    max-width: 1200px;
    align-items: center;
}

.balance-left {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.philosophy-statement p {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(0.95rem, 1.2vw, 1.15rem);
    line-height: 1.7;
    color: var(--warm-graphite);
    padding-left: var(--space-md);
    border-left: 2px solid var(--sandstone);
}

.balance-right {
    display: flex;
    align-items: center;
    justify-content: center;
}

#calder-mobile {
    width: 100%;
    max-width: 600px;
    height: auto;
}

/* Calder Mobile Animations */
.mobile-joint {
    will-change: transform;
}

@keyframes pendulum-7 {
    0%, 100% { transform: rotate(-3deg); }
    50% { transform: rotate(3deg); }
}

@keyframes pendulum-11 {
    0%, 100% { transform: rotate(3deg); }
    50% { transform: rotate(-3deg); }
}

@keyframes pendulum-13 {
    0%, 100% { transform: rotate(-2deg); }
    50% { transform: rotate(2deg); }
}

@keyframes pendulum-17 {
    0%, 100% { transform: rotate(2deg); }
    50% { transform: rotate(-2deg); }
}

@keyframes pendulum-19 {
    0%, 100% { transform: rotate(-1.5deg); }
    50% { transform: rotate(1.5deg); }
}

/* --------------------------------------------------------------------------
   Section 3: The Spectrum
   -------------------------------------------------------------------------- */
.section-spectrum {
    background-color: var(--linen-cream);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-2xl) 0;
    overflow: hidden;
}

.spectrum-container {
    position: relative;
    width: 100%;
    height: 200px;
}

.spectrum-gradient {
    position: absolute;
    top: 50%;
    left: -5%;
    width: 110%;
    height: 80px;
    transform: translateY(-50%);
    background: linear-gradient(
        to right,
        var(--charcoal-ink) 0%,
        var(--warm-graphite) 15%,
        var(--teak-orange) 40%,
        var(--mustard-gold) 55%,
        var(--sandstone) 70%,
        var(--bone) 85%,
        var(--linen-cream) 100%
    );
    border-radius: 4px;
}

.spectrum-markers {
    position: absolute;
    top: 0;
    left: 5%;
    right: 5%;
    height: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.spectrum-marker {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-xs);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.6s ease, transform 0.6s ease;
    position: relative;
}

.spectrum-marker.visible {
    opacity: 1;
    transform: translateY(0);
}

.marker-line {
    width: 1px;
    height: 100px;
    background: rgba(245, 240, 232, 0.6);
}

.spectrum-marker-center .marker-line {
    height: 120px;
    width: 2px;
    background: rgba(245, 240, 232, 0.8);
}

.marker-label-top,
.marker-label-bottom,
.marker-label-center {
    font-family: var(--font-accent);
    font-weight: 300;
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    font-variant: small-caps;
    color: var(--linen-cream);
    text-shadow: 0 1px 3px rgba(0,0,0,0.4);
    white-space: nowrap;
}

.marker-label-center {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.06em;
}

.spectrum-marker-center {
    animation: pulse-center 4s ease-in-out infinite;
}

@keyframes pulse-center {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

.spectrum-marker-center.visible {
    animation: pulse-center 4s ease-in-out infinite;
}

/* --------------------------------------------------------------------------
   Section 4: The Collection
   -------------------------------------------------------------------------- */
.section-collection {
    background-color: var(--linen-cream);
    padding: var(--space-2xl) var(--space-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.section-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.4rem, 3vw, 2.4rem);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--charcoal-ink);
    margin-bottom: var(--space-2xl);
    text-align: center;
}

.collection-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-lg);
    max-width: 1100px;
    width: 100%;
}

.artifact-card {
    background: var(--bone);
    border-radius: 4px;
    overflow: hidden;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease, box-shadow 0.3s ease;
    will-change: transform, opacity;
}

.artifact-card.visible {
    opacity: 1;
    transform: translateY(0) rotate(var(--card-rotation, 0deg));
}

.artifact-card:hover {
    transform: translateY(0) rotate(0deg) !important;
    box-shadow: 0 8px 30px rgba(30, 28, 25, 0.1);
}

.card-artwork {
    aspect-ratio: 3 / 4;
    overflow: hidden;
    position: relative;
}

.card-artwork svg {
    width: 100%;
    height: 100%;
}

.card-info {
    padding: var(--space-md);
}

.card-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.04em;
    color: var(--charcoal-ink);
    margin-bottom: var(--space-xs);
}

.card-description {
    font-family: var(--font-accent);
    font-weight: 300;
    font-size: 0.76rem;
    letter-spacing: 0.05em;
    font-variant: small-caps;
    color: var(--warm-graphite);
}

/* Staggered vertical offsets for cards */
.artifact-card:nth-child(2) {
    margin-top: var(--space-xl);
}

.artifact-card:nth-child(4) {
    margin-top: calc(var(--space-lg) * -1);
}

.artifact-card:nth-child(5) {
    margin-top: var(--space-lg);
}

.artifact-card:nth-child(6) {
    margin-top: calc(var(--space-md) * -1);
}

/* --------------------------------------------------------------------------
   Section 5: The Closing
   -------------------------------------------------------------------------- */
.section-closing {
    background-color: var(--warm-graphite);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20vh var(--space-lg);
}

.closing-content {
    max-width: 700px;
    text-align: center;
}

.manifesto {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(1.1rem, 2.5vw, 1.8rem);
    line-height: 1.7;
    color: var(--bone);
    margin-bottom: var(--space-2xl);
}

.closing-domain {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.4rem, 3vw, 2.2rem);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--linen-cream);
    margin-bottom: var(--space-xl);
}

.closing-line-container {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

.closing-line {
    width: 100%;
    height: 2px;
}

.closing-line-left,
.closing-line-right {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    transition: none;
}

.closing-line-left.animate,
.closing-line-right.animate {
    animation: draw-line 1.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes draw-line {
    to {
        stroke-dashoffset: 0;
    }
}

/* --------------------------------------------------------------------------
   Ghost M Background Watermarks
   -------------------------------------------------------------------------- */
.ghost-m-bg {
    position: fixed;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 30vw;
    line-height: 1;
    color: var(--charcoal-ink);
    opacity: 0.03;
    pointer-events: none;
    z-index: 0;
    user-select: none;
}

.ghost-m-bg-1 {
    top: 15%;
    right: -5%;
    transform: rotate(-15deg);
}

.ghost-m-bg-2 {
    top: 50%;
    left: -8%;
    transform: rotate(10deg);
}

.ghost-m-bg-3 {
    bottom: 5%;
    right: 10%;
    transform: rotate(-5deg);
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
    .balance-grid {
        grid-template-columns: 1fr;
        gap: var(--space-lg);
    }

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

    .artifact-card:nth-child(n) {
        margin-top: 0;
    }

    .artifact-card:nth-child(2n) {
        margin-top: var(--space-lg);
    }
}

@media (max-width: 600px) {
    .collection-grid {
        grid-template-columns: 1fr;
    }

    .artifact-card:nth-child(n) {
        margin-top: 0;
    }

    .opening-title {
        font-size: clamp(12vw, 18vw, 22vw);
    }

    #top-bar {
        padding: var(--space-sm) var(--space-md);
    }

    .spectrum-markers {
        left: 2%;
        right: 2%;
    }
}
