/* ==============================================
   rational.today — Styles
   Mid-century intellectual gallery
   ============================================== */

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

:root {
    --bg-primary: #f5efe6;
    --bg-alt: #fefcf8;
    --text-primary: #2b2d3a;
    --text-secondary: #4a4a5a;
    --accent-teal: #2a9d8f;
    --accent-coral: #e76f51;
    --accent-gold: #c17f4e;
    --accent-dark: #264653;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Source Sans 3', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-secondary);
    font-size: 1.0625rem;
    line-height: 1.7;
    letter-spacing: 0.01em;
    /* Crosshatch texture */
    background-image:
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 15px,
            rgba(0,0,0,0.04) 15px,
            rgba(0,0,0,0.04) 16px
        ),
        repeating-linear-gradient(
            -45deg,
            transparent,
            transparent 15px,
            rgba(0,0,0,0.04) 15px,
            rgba(0,0,0,0.04) 16px
        );
}

/* --- Hero --- */
#hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 48px;
}

.hero-content {
    max-width: 800px;
}

.hero-title {
    font-family: 'DM Serif Display', serif;
    font-size: clamp(3rem, 10vw, 8rem);
    font-weight: 400;
    color: var(--text-primary);
    line-height: 1;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.hero-title.visible {
    opacity: 1;
}

.hero-rule {
    display: block;
    width: 60%;
    height: 2px;
    margin: 24px auto;
    overflow: visible;
}

.hero-rule line {
    stroke: var(--accent-gold);
    stroke-width: 1;
    transition: none;
}

.hero-today {
    display: block;
    font-family: 'Source Sans 3', sans-serif;
    font-size: clamp(1.2rem, 3vw, 2.4rem);
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.hero-today.visible {
    opacity: 1;
}

.hero-thesis {
    margin-top: 32px;
    font-size: 1.125rem;
    line-height: 1.8;
    color: var(--text-secondary);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.hero-thesis.visible {
    opacity: 1;
}

/* --- Portfolio Grid --- */
#portfolio,
.portfolio-section {
    padding: 0 48px 48px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 24px;
    max-width: 1400px;
    margin: 0 auto;
}

/* Card sizing */
.card-wide {
    grid-column: span 4;
}

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

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

/* --- Card Base --- */
.card {
    position: relative;
    border-radius: 4px;
    overflow: hidden;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                box-shadow 0.25s ease;
    box-shadow: 0 2px 8px rgba(43,45,58,0.08);
    cursor: default;
}

.card.in-view {
    opacity: 1;
    transform: translateY(0);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(43,45,58,0.12);
}

.card.in-view:hover {
    transform: translateY(-4px);
}

.card-inner {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 32px;
}

.card:nth-child(odd) .card-inner {
    background-color: var(--bg-primary);
}

.card:nth-child(even) .card-inner {
    background-color: var(--bg-alt);
}

/* Corner brackets */
.card::before,
.card::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    pointer-events: none;
}

.card::before {
    top: 8px;
    left: 8px;
    border-top: 1px solid rgba(74,74,90,0.3);
    border-left: 1px solid rgba(74,74,90,0.3);
}

.card::after {
    bottom: 8px;
    right: 8px;
    border-bottom: 1px solid rgba(74,74,90,0.3);
    border-right: 1px solid rgba(74,74,90,0.3);
}

/* Card text */
.card-tag {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent-gold);
    margin-bottom: 8px;
    display: block;
}

/* Starburst before tag */
.card-tag::before {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-right: 6px;
    vertical-align: middle;
    background: var(--accent-coral);
    clip-path: polygon(
        50% 0%, 63% 28%, 100% 28%, 70% 46%,
        80% 76%, 50% 58%, 20% 76%, 30% 46%,
        0% 28%, 37% 28%
    );
}

.card-title {
    font-family: 'DM Serif Display', serif;
    font-size: clamp(1.4rem, 3vw, 2rem);
    font-weight: 400;
    color: var(--text-primary);
    line-height: 1.2;
    margin-bottom: 12px;
}

.card-desc {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-secondary);
}

.card-text {
    margin-top: auto;
}

/* --- Thought Objects --- */
.thought-object {
    width: 100%;
    flex: 1;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    perspective: 800px;
    margin-bottom: 20px;
    position: relative;
}

/* Balanced Form */
.thought-balanced {
    transform-style: preserve-3d;
}

.balanced-beam {
    position: absolute;
    width: 100px;
    height: 2px;
    background: var(--accent-teal);
    transform: rotateX(20deg) rotateY(15deg);
    animation: gentleRotateBalanced 24s linear infinite;
}

.balanced-circle {
    position: absolute;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-teal);
    left: calc(50% - 60px);
    box-shadow: 4px 6px 0 var(--accent-coral);
    animation: gentleRotateBalanced 24s linear infinite;
}

.balanced-rect {
    position: absolute;
    width: 30px;
    height: 30px;
    background: var(--accent-coral);
    left: calc(50% + 30px);
    box-shadow: 4px 6px 0 var(--accent-teal);
    animation: gentleRotateBalanced 24s linear infinite;
}

.thought-balanced-alt .balanced-beam {
    animation-duration: 28s;
    animation-direction: reverse;
}
.thought-balanced-alt .balanced-circle {
    animation-duration: 28s;
    animation-direction: reverse;
}
.thought-balanced-alt .balanced-rect {
    animation-duration: 28s;
    animation-direction: reverse;
}

@keyframes gentleRotateBalanced {
    0% { transform: perspective(800px) rotateX(15deg) rotateY(0deg); }
    100% { transform: perspective(800px) rotateX(15deg) rotateY(360deg); }
}

/* Crystalline Prism */
.thought-prism {
    transform-style: preserve-3d;
    position: relative;
}

.prism-face {
    position: absolute;
    width: 0;
    height: 0;
    border-left: 30px solid transparent;
    border-right: 30px solid transparent;
    border-bottom: 52px solid rgba(42,157,143,0.7);
    animation: gentleRotatePrism 26s linear infinite;
}

.prism-face-1 { border-bottom-color: rgba(42,157,143,0.7); transform: perspective(800px) rotateY(0deg) translateZ(20px); }
.prism-face-2 { border-bottom-color: rgba(193,127,78,0.7); transform: perspective(800px) rotateY(60deg) translateZ(20px); }
.prism-face-3 { border-bottom-color: rgba(231,111,81,0.7); transform: perspective(800px) rotateY(120deg) translateZ(20px); }
.prism-face-4 { border-bottom-color: rgba(42,157,143,0.5); transform: perspective(800px) rotateY(180deg) translateZ(20px); }
.prism-face-5 { border-bottom-color: rgba(193,127,78,0.5); transform: perspective(800px) rotateY(240deg) translateZ(20px); }
.prism-face-6 { border-bottom-color: rgba(231,111,81,0.5); transform: perspective(800px) rotateY(300deg) translateZ(20px); }

.thought-prism-alt .prism-face {
    animation-duration: 30s;
    animation-direction: reverse;
}

@keyframes gentleRotatePrism {
    0% { transform: perspective(800px) rotateX(20deg) rotateY(0deg) translateZ(20px); }
    100% { transform: perspective(800px) rotateX(20deg) rotateY(360deg) translateZ(20px); }
}

/* Orbital */
.thought-orbital {
    transform-style: preserve-3d;
    position: relative;
}

.orbital-ring {
    position: absolute;
    width: 80px;
    height: 80px;
    border: 2px solid var(--accent-gold);
    border-radius: 50%;
    animation: gentleRotateOrbital 22s linear infinite;
}

.orbital-ring-1 { transform: perspective(800px) rotateX(70deg) rotateY(0deg); }
.orbital-ring-2 { transform: perspective(800px) rotateX(70deg) rotateY(60deg); animation-duration: 26s; }
.orbital-ring-3 { transform: perspective(800px) rotateX(70deg) rotateY(120deg); animation-duration: 30s; }

.orbital-center {
    width: 10px;
    height: 10px;
    background: var(--text-primary);
    border-radius: 50%;
    position: absolute;
}

.thought-orbital-alt .orbital-ring {
    animation-direction: reverse;
}

@keyframes gentleRotateOrbital {
    0% { transform: perspective(800px) rotateX(70deg) rotateY(0deg); }
    100% { transform: perspective(800px) rotateX(70deg) rotateY(360deg); }
}

/* Stack */
.thought-stack {
    transform-style: preserve-3d;
    position: relative;
}

.stack-layer {
    position: absolute;
    width: 70px;
    height: 14px;
    animation: gentleRotateStack 20s linear infinite;
}

.stack-layer-1 { background: #f5efe6; transform: perspective(800px) rotateX(50deg) translateY(-24px) translateX(0px); box-shadow: 2px 2px 0 rgba(43,45,58,0.1); }
.stack-layer-2 { background: #c17f4e; transform: perspective(800px) rotateX(50deg) translateY(-12px) translateX(4px); box-shadow: 2px 2px 0 rgba(43,45,58,0.1); }
.stack-layer-3 { background: #2a9d8f; transform: perspective(800px) rotateX(50deg) translateY(0px) translateX(8px); box-shadow: 2px 2px 0 rgba(43,45,58,0.1); }
.stack-layer-4 { background: #e76f51; transform: perspective(800px) rotateX(50deg) translateY(12px) translateX(12px); box-shadow: 2px 2px 0 rgba(43,45,58,0.1); }
.stack-layer-5 { background: #2b2d3a; transform: perspective(800px) rotateX(50deg) translateY(24px) translateX(16px); box-shadow: 2px 2px 0 rgba(43,45,58,0.1); }

.thought-stack-alt .stack-layer {
    animation-duration: 25s;
    animation-direction: reverse;
}

@keyframes gentleRotateStack {
    0% { transform: perspective(800px) rotateX(50deg) rotateY(0deg); }
    100% { transform: perspective(800px) rotateX(50deg) rotateY(360deg); }
}

/* Hover: pause auto-rotation, manual tilt */
.card:hover .thought-object * {
    animation-play-state: paused;
}

.card:hover .thought-object {
    transform: perspective(800px) rotateY(5deg);
    transition: transform 0.3s ease;
}

/* --- Interstitial Sections --- */
.interstitial {
    height: 60vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 48px;
    background-image: none;
}

.interstitial-teal {
    background-color: var(--accent-teal);
}

.interstitial-coral {
    background-color: var(--accent-coral);
}

.interstitial-gold {
    background-color: var(--accent-gold);
}

.interstitial-quote {
    font-family: 'DM Serif Display', serif;
    font-style: italic;
    font-size: clamp(1.8rem, 5vw, 4.5rem);
    color: #fefcf8;
    max-width: 900px;
    line-height: 1.3;
    border: none;
    margin: 0;
    padding: 0;
}

.interstitial-cite {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(254,252,248,0.7);
    margin-top: 24px;
    font-style: normal;
}

/* --- Colophon / Footer --- */
#colophon {
    background-color: var(--text-primary);
    padding: 64px 48px;
    text-align: center;
}

.colophon-text {
    font-size: 1.0625rem;
    line-height: 1.8;
    color: rgba(254,252,248,0.8);
    max-width: 640px;
    margin: 0 auto 32px;
}

.colophon-nav {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-bottom: 32px;
}

.colophon-nav a {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(254,252,248,0.6);
    text-decoration: none;
    transition: color 0.2s ease;
}

.colophon-nav a:hover {
    color: var(--accent-gold);
}

.colophon-mark {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.75rem;
    color: rgba(254,252,248,0.35);
    letter-spacing: 0.05em;
}

/* --- Responsive --- */
@media (max-width: 1199px) {
    .grid {
        grid-template-columns: repeat(4, 1fr);
    }
    .card-wide {
        grid-column: span 3;
    }
    .card-tall {
        grid-column: span 1;
        grid-row: span 2;
    }
    .card-square {
        grid-column: span 2;
    }
}

@media (max-width: 767px) {
    .grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .card-wide,
    .card-tall,
    .card-square {
        grid-column: span 2;
        grid-row: span 1;
    }
    #hero {
        padding: 32px 24px;
    }
    #portfolio,
    .portfolio-section {
        padding: 0 24px 24px;
    }
    .interstitial {
        padding: 32px 24px;
    }
    #colophon {
        padding: 48px 24px;
    }
    .colophon-nav {
        flex-wrap: wrap;
        gap: 16px;
    }
}

@media (max-width: 479px) {
    .grid {
        grid-template-columns: 1fr;
    }
    .card-wide,
    .card-tall,
    .card-square {
        grid-column: span 1;
        grid-row: span 1;
    }
}
