/* ============================================================
   soning.stream - Design System Stylesheet
   Light Academia Aesthetic | Warm Earthy Palette
   ============================================================ */

/* ============================================================
   COLOR PALETTE
   ============================================================ */

:root {
    --color-parchment: #FAF6EE;
    --color-warm-limestone: #E8DFD0;
    --color-plaster-cream: #F2EBD9;
    --color-charred-earth: #3B2D1F;
    --color-warm-stone: #8B6D47;
    --color-terracotta-clay: #C4704E;
    --color-faded-brick: #A85A3A;
    --color-amber-glow: #D4A055;

    --gap-masonry: 20px;
    --row-height: 10px;
    --transition-fast: 300ms;
    --transition-standard: 500ms;
    --transition-slow: 600ms;
}

/* ============================================================
   RESET & BASE STYLES
   ============================================================ */

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--color-parchment);
    color: var(--color-charred-earth);
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.8vw, 1.05rem);
    line-height: 1.7;
    overflow-x: hidden;
}

/* Typography Scale */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
}

/* ============================================================
   HERO OVERLAY SECTION
   ============================================================ */

.hero-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: var(--color-parchment);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: heroFadeOut 1s ease-out 2.6s forwards;
}

@keyframes heroFadeOut {
    from {
        opacity: 1;
        visibility: visible;
    }
    to {
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
    }
}

.hero-content {
    position: relative;
    text-align: center;
}

.hero-line {
    width: 120px;
    height: 1px;
    background-color: var(--color-warm-limestone);
    margin: 0 auto 40px;
    transform-origin: center;
    transform: scaleX(0);
    animation: drawLine 800ms ease-out 200ms forwards;
}

@keyframes drawLine {
    to {
        transform: scaleX(1);
    }
}

.hero-title {
    font-size: clamp(2.4rem, 5vw, 4.2rem);
    color: var(--color-charred-earth);
    font-weight: 600;
    opacity: 0;
    animation: fadeInTitle 600ms ease-out 1000ms forwards;
    letter-spacing: -0.02em;
}

@keyframes fadeInTitle {
    to {
        opacity: 1;
    }
}

.hero-subtitle {
    font-size: 16px;
    font-style: italic;
    color: var(--color-warm-stone);
    margin-top: 24px;
    opacity: 0;
    animation: fadeInSubtitle 500ms ease-out 1400ms forwards;
}

@keyframes fadeInSubtitle {
    to {
        opacity: 1;
    }
}

/* ============================================================
   MASONRY CONTAINER
   ============================================================ */

.masonry-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--gap-masonry);
    padding: 40px 24px;
    max-width: 100%;
    margin-top: 100vh;
    animation: fadeInMasonry 600ms ease-out 2.4s forwards;
    opacity: 0;
}

@keyframes fadeInMasonry {
    to {
        opacity: 1;
    }
}

/* Responsive Grid */
@media (max-width: 767px) {
    .masonry-container {
        grid-template-columns: 1fr;
        padding: 24px 16px;
    }
}

@media (min-width: 768px) and (max-width: 1199px) {
    .masonry-container {
        grid-template-columns: repeat(2, 1fr);
        padding: 32px 20px;
    }
}

@media (min-width: 1200px) {
    .masonry-container {
        padding: 40px 32px;
    }
}

/* ============================================================
   BLOCK STYLES - BASE
   ============================================================ */

.block {
    opacity: 0;
    transform: translateY(24px);
    transition:
        opacity var(--transition-standard) cubic-bezier(0.33, 0, 0.2, 1),
        transform var(--transition-standard) cubic-bezier(0.33, 0, 0.2, 1);
}

.block.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger delay calculation via JS */
.block[data-column="0"] { transition-delay: 0ms; }
.block[data-column="1"] { transition-delay: 80ms; }
.block[data-column="2"] { transition-delay: 160ms; }
.block[data-column="3"] { transition-delay: 240ms; }

/* ============================================================
   PHOTO BLOCKS
   ============================================================ */

.photo-block {
    position: relative;
    overflow: hidden;
    background-color: var(--color-parchment);
    border: 1px solid var(--color-plaster-cream);
}

.photo-block figure {
    margin: 0;
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.photo-block img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 500ms ease-out;
}

.photo-block::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(139, 109, 71, 0.15);
    opacity: 0;
    transition: opacity 600ms ease-out;
    pointer-events: none;
}

.photo-block:hover::after {
    opacity: 1;
}

.photo-block figcaption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(59, 45, 31, 0.7));
    color: var(--color-plaster-cream);
    padding: 24px 16px 12px;
    font-size: 13px;
    font-style: italic;
    font-family: 'Nunito', sans-serif;
    font-weight: 400;
    transform: translateY(100%);
    transition: transform 600ms ease-out;
    line-height: 1.4;
}

.photo-block:hover figcaption {
    transform: translateY(0);
}

/* ============================================================
   TEXT BLOCKS
   ============================================================ */

.text-block {
    background-color: var(--color-parchment);
    border-top: 2px solid var(--color-terracotta-clay);
    padding: 32px;
    display: flex;
    align-items: center;
}

.text-block p {
    color: var(--color-charred-earth);
    font-size: clamp(0.95rem, 1.8vw, 1.05rem);
    line-height: 1.7;
    margin: 0;
}

/* ============================================================
   QUOTE BLOCKS
   ============================================================ */

.quote-block {
    background-color: var(--color-warm-limestone);
    padding: 40px;
    padding-left: 40px;
    border-left: 4px solid var(--color-faded-brick);
    display: flex;
    align-items: center;
    position: relative;
}

.quote-block blockquote {
    margin: 0;
    font-family: 'Cormorant Garamond', serif;
    font-weight: 500;
    font-size: 20px;
    line-height: 1.5;
    color: var(--color-charred-earth);
    font-style: italic;
}

.corner-bracket {
    position: absolute;
    width: 12px;
    height: 12px;
    border: 1px solid var(--color-warm-stone);
    display: inline-block;
}

.corner-bracket.top-left {
    top: 12px;
    left: 12px;
    border-right: none;
    border-bottom: none;
}

.corner-bracket.bottom-right {
    bottom: 12px;
    right: 12px;
    border-left: none;
    border-top: none;
}

/* ============================================================
   COUNTER BLOCKS
   ============================================================ */

.counter-block {
    background-color: var(--color-terracotta-clay);
    padding: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    aspect-ratio: 1;
}

.counter-content {
    text-align: center;
    width: 100%;
}

.counter-number {
    display: block;
    font-family: 'DM Mono', monospace;
    font-size: 48px;
    font-weight: 400;
    color: var(--color-parchment);
    line-height: 1;
    margin-bottom: 12px;
    letter-spacing: 0.04em;
}

.counter-label {
    font-family: 'Nunito', sans-serif;
    font-size: 11px;
    font-weight: 600;
    color: var(--color-parchment);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin: 0;
    opacity: 0;
    animation: fadeIn 400ms ease-out 2.2s forwards;
}

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

/* ============================================================
   MASONRY ROW-SPAN CALCULATIONS (via JS)
   ============================================================ */

/* These are set dynamically by JavaScript based on content height */
.block[data-rows="3"] { grid-row: span 3; }
.block[data-rows="4"] { grid-row: span 4; }
.block[data-rows="5"] { grid-row: span 5; }
.block[data-rows="6"] { grid-row: span 6; }
.block[data-rows="7"] { grid-row: span 7; }
.block[data-rows="8"] { grid-row: span 8; }
.block[data-rows="9"] { grid-row: span 9; }
.block[data-rows="10"] { grid-row: span 10; }
.block[data-rows="15"] { grid-row: span 15; }
.block[data-rows="20"] { grid-row: span 20; }

/* Counter blocks are always square-ish */
.counter-block { aspect-ratio: 1 / 1; }

/* ============================================================
   BOTTOM NAVIGATION
   ============================================================ */

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 48px;
    background-color: rgba(59, 45, 31, 0.95);
    backdrop-filter: blur(8px);
    border-top: 1px solid rgba(196, 112, 78, 0.3);
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
}

.nav-left {
    flex: 0 0 auto;
}

.nav-domain {
    font-family: 'Cormorant Garamond', serif;
    font-size: 16px;
    font-weight: 600;
    color: var(--color-plaster-cream);
}

.nav-right {
    flex: 0 0 auto;
    display: flex;
    gap: 32px;
}

.nav-link {
    font-family: 'Nunito', sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-warm-stone);
    text-decoration: none;
    transition: color 300ms ease-out;
}

.nav-link:hover {
    color: var(--color-plaster-cream);
}

/* ============================================================
   DECORATIVE ELEMENTS & MOTIFS
   ============================================================ */

/* Mortar lines between sections (optional, added via ::before pseudo-elements) */
.block::before {
    content: '';
    position: absolute;
    top: -20px;
    left: 20%;
    right: 20%;
    height: 1px;
    background-color: var(--color-warm-limestone);
    display: none; /* Activate for section dividers */
}

/* ============================================================
   SPACING & LAYOUT ADJUSTMENTS
   ============================================================ */

/* Ensure bottom nav doesn't overlap content */
.masonry-container {
    padding-bottom: calc(48px + 40px);
}

@media (max-width: 767px) {
    .masonry-container {
        padding-bottom: calc(48px + 24px);
    }
}

/* ============================================================
   ACCESSIBILITY & INTERACTION STATES
   ============================================================ */

/* Focus visible for keyboard navigation */
.nav-link:focus-visible {
    outline: 2px solid var(--color-amber-glow);
    outline-offset: 2px;
}

/* ============================================================
   PRINT STYLES
   ============================================================ */

@media print {
    .hero-overlay,
    .bottom-nav {
        display: none;
    }

    .masonry-container {
        margin-top: 0;
        padding-bottom: 40px;
    }

    .block {
        opacity: 1 !important;
        transform: none !important;
        page-break-inside: avoid;
    }
}

/* ============================================================
   HIGH CONTRAST MODE
   ============================================================ */

@media (prefers-contrast: more) {
    .photo-block::after {
        background-color: rgba(139, 109, 71, 0.25);
    }

    .bottom-nav {
        background-color: rgba(59, 45, 31, 0.98);
    }
}

/* ============================================================
   DARK PREFERENCE (respects light-academia aesthetic)
   ============================================================ */

@media (prefers-color-scheme: dark) {
    body {
        background-color: #1a1410;
        color: #f0ebe3;
    }

    .masonry-container {
        background-color: #1a1410;
    }

    .text-block {
        background-color: #2a2218;
    }

    .hero-overlay {
        background-color: #1a1410;
    }

    .hero-title {
        color: #f0ebe3;
    }
}

/* ============================================================
   UTILITY CLASSES
   ============================================================ */

.no-scroll {
    overflow: hidden;
}

/* ============================================================
   ANIMATION TRIGGERS & TRANSITIONS
   ============================================================ */

/* Smooth entry for all interactive elements */
@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    html {
        scroll-behavior: auto;
    }
}

/* ============================================================
   RESPONSIVE TYPOGRAPHY
   ============================================================ */

@media (max-width: 480px) {
    .quote-block blockquote {
        font-size: 18px;
    }

    .counter-number {
        font-size: 40px;
    }
}

/* ============================================================
   CUSTOM SCROLLBAR (Optional Enhancement)
   ============================================================ */

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--color-parchment);
}

::-webkit-scrollbar-thumb {
    background: var(--color-warm-stone);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-terracotta-clay);
}
