/* ============================================
   haroo.day - Swiss International Typographic Style
   Strict monochrome. 12-column modular grid.
   ============================================ */

/* --- Design Palette Reference ---
   #000000 - Black (Primary): display type, primary rules, inverted cell backgrounds
   #0a0a0a - Near-Black: deep shadow tones in photographs
   #1a1a1a - Dark Gray: body text, secondary headings
   #666666 - Medium Gray: micro labels, captions, metadata
   #c0c0c0 - Light Gray: grid cell borders, structural dividers
   #d0d0d0 - Pale Gray: visible grid overlay lines
   #e0e0e0 - Ghost Gray: faint grid lines, subtle separators
   #f0f0f0 - Near-White: ghost grid state, photograph highlight tones
   #f5f5f5 - Off-White: photograph bright values, secondary backgrounds
   #ffffff - White (Ground): page background, inverted cell text
*/

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

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

body {
    background-color: #ffffff;
    color: #1a1a1a;
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    line-height: 1;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* --- Grid Overlay (Fixed, 11 internal column lines) --- */
#grid-overlay {
    position: fixed;
    top: 0;
    left: 60px;
    right: 60px;
    bottom: 0;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
    z-index: 1000;
    opacity: 0;
    animation: gridReveal 600ms cubic-bezier(0.33, 0, 0.67, 1) 400ms forwards;
}

#grid-overlay.grid-faint .grid-line {
    background-color: #f0f0f0;
}

#grid-overlay.grid-visible .grid-line {
    background-color: #d0d0d0;
}

#grid-overlay.grid-hidden .grid-line {
    background-color: transparent;
}

.grid-line {
    width: 1px;
    height: 100%;
    background-color: #d0d0d0;
    transition: background-color 600ms ease;
}

@keyframes gridReveal {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

@keyframes gridFade {
    0% {
        /* lines are #d0d0d0 from gridReveal */
    }
    100% {
        /* lines become ghost gray */
    }
}

/* After the reveal, lines fade to ghost state */
#grid-overlay.grid-faint {
    opacity: 1;
}

#grid-overlay.grid-visible {
    opacity: 1;
}

#grid-overlay.grid-hidden {
    opacity: 1;
}

/* --- Module Base --- */
.module {
    position: relative;
    width: 100%;
    padding-left: 60px;
    padding-right: 60px;
}

.module-fullscreen {
    min-height: 100vh;
    display: flex;
    align-items: center;
}

/* ============================================
   MODULE 0: The Grid Reveal
   ============================================ */
#module-0 {
    justify-content: flex-start;
    align-items: flex-start;
}

.module-0-content {
    /* Align to column 1, row ~8 of an 8px baseline grid */
    padding-top: calc(8px * 40);  /* ~320px from top, roughly row 8 of viewport */
    width: 100%;
}

.site-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(3rem, 11vw, 8rem);
    letter-spacing: -0.03em;
    color: #000000;
    line-height: 1;
    opacity: 0;
    animation: titleReveal 400ms ease 1000ms forwards;
}

.site-subtitle {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: 16px;
    line-height: 32px;
    color: #1a1a1a;
    margin-top: 16px;
    opacity: 0;
    animation: titleReveal 400ms ease 1200ms forwards;
}

@keyframes titleReveal {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

/* ============================================
   MODULE 1: The Photography Grid
   ============================================ */
#module-1 {
    min-height: 100vh;
    padding-top: 80px;
    padding-bottom: 80px;
}

.photo-grid {
    /* Columns 2-11 of 12-column grid: offset by ~1 column on each side */
    margin-left: calc((100% - 120px) / 12);
    margin-right: calc((100% - 120px) / 12);
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.photo-cell {
    position: relative;
}

.photo-placeholder {
    width: 100%;
    aspect-ratio: 3 / 2;
    overflow: hidden;
    cursor: crosshair;
    border: 2px solid transparent;
    transition: border-color 300ms ease-out;
}

.photo-placeholder:hover {
    border-color: #000000;
    transition: none;
}

.photo-placeholder svg {
    width: 100%;
    height: 100%;
    display: block;
    filter: grayscale(100%) contrast(1.2);
    background-color: #f5f5f5;
}

/* Deep shadow tone for photo dark areas */
.photo-cell::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background-color: #0a0a0a;
    opacity: 0;
}

/* Ghost separator between modules */
.module + .module::before {
    content: '';
    display: block;
    width: 100%;
    height: 1px;
    background-color: #e0e0e0;
    margin-bottom: 0;
}

/* ============================================
   MODULE 2: The Text Block
   ============================================ */
#module-2 {
    padding-top: 120px;
    padding-bottom: 120px;
}

.text-block-container {
    display: flex;
    position: relative;
}

.text-block-rule {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    /* Rule sits in columns 1-2 area */
    width: 2px;
    background-color: #000000;
    margin-left: calc((100% - 120px) / 12);
}

.text-block-content {
    /* Columns 3-8 (6 of 12 columns) */
    margin-left: calc((100% - 120px) / 12 * 2 + 40px);
    max-width: 580px;
}

.text-block-content p {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: 18px;
    line-height: 32px;
    color: #1a1a1a;
    margin-bottom: 32px;
}

.text-block-content p:last-child {
    margin-bottom: 0;
}

/* ============================================
   MODULE 3: The Timeline Strip
   ============================================ */
#module-3 {
    justify-content: center;
    overflow: hidden;
}

.timeline-container {
    width: 100%;
    position: relative;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding: 80px 0;
}

.timeline-line {
    position: absolute;
    top: 50%;
    left: 60px;
    right: 60px;
    height: 1px;
    background-color: #000000;
    transform: translateY(-0.5px);
}

.timeline-markers {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-width: 100%;
    padding: 0 60px;
    position: relative;
}

.timeline-hour {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    scroll-snap-align: center;
    flex-shrink: 0;
    width: calc(100% / 24);
    min-width: 40px;
}

.tick {
    width: 1px;
    height: 16px;
    background-color: #000000;
    margin-bottom: 8px;
}

.tick-extended {
    width: 1px;
    height: 40px;
    background-color: #000000;
    position: absolute;
    bottom: calc(100% - 28px);
    left: 50%;
    transform: translateX(-50%);
}

.hour-label {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 400;
    font-size: 11px;
    color: #666666;
    white-space: nowrap;
}

.hour-label-top {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 400;
    font-size: 9px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #666666;
    position: absolute;
    bottom: calc(100% - 24px + 44px);
    white-space: nowrap;
}

/* Current hour marker */
.timeline-hour.current .tick {
    width: 8px;
    height: 8px;
    background-color: #000000;
    border-radius: 50%;
    margin-bottom: 12px;
}

/* ============================================
   MODULE 4: The Closing Grid
   ============================================ */
#module-4 {
    padding-top: 120px;
    padding-bottom: 120px;
}

.word-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    /* Center within columns 2-11 */
    margin-left: calc((100% - 120px) / 12);
    margin-right: calc((100% - 120px) / 12);
}

.word-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #c0c0c0;
    padding: 40px 16px;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 24px;
    letter-spacing: 0.02em;
    color: #000000;
    cursor: default;
    user-select: none;
    transition: background 200ms ease-out, color 200ms ease-out;
}

.word-cell:hover {
    background-color: #000000;
    color: #ffffff;
    transition: none;
}

/* Collapse duplicate borders */
.word-cell:not(:nth-child(4n+1)) {
    border-left: none;
}

.word-cell:nth-child(n+5) {
    border-top: none;
}

/* ============================================
   GRID TOGGLE BUTTON
   ============================================ */
#grid-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1001;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 400;
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #666666;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    line-height: 1;
}

/* ============================================
   RESPONSIVE: Below 768px
   ============================================ */
@media (max-width: 768px) {
    .module {
        padding-left: 24px;
        padding-right: 24px;
    }

    #grid-overlay {
        left: 24px;
        right: 24px;
    }

    /* 4-column grid on mobile */
    #grid-overlay .grid-line:nth-child(n+4) {
        display: none;
    }

    .module-0-content {
        padding-top: calc(8px * 20);
    }

    .site-title {
        font-size: clamp(2.5rem, 11vw, 5rem);
    }

    /* Photography: 2x3 */
    .photo-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
        margin-left: 0;
        margin-right: 0;
    }

    /* Text block */
    .text-block-rule {
        margin-left: 0;
    }

    .text-block-content {
        margin-left: 24px;
        max-width: 100%;
    }

    .text-block-content p {
        font-size: 16px;
        line-height: 28px;  /* Closest multiple of 8 that maintains readability */
    }

    /* Timeline: vertical on mobile */
    .timeline-container {
        overflow-x: visible;
        overflow-y: visible;
        padding: 40px 0;
    }

    .timeline-line {
        top: 0;
        bottom: 0;
        left: 40px;
        right: auto;
        width: 1px;
        height: 100%;
    }

    .timeline-markers {
        flex-direction: column;
        align-items: flex-start;
        padding: 0 0 0 60px;
    }

    .timeline-hour {
        flex-direction: row;
        width: auto;
        min-width: auto;
        margin-bottom: 16px;
        align-items: center;
    }

    .tick {
        width: 16px;
        height: 1px;
        margin-bottom: 0;
        margin-right: 8px;
    }

    .tick-extended {
        width: 40px;
        height: 1px;
        position: absolute;
        bottom: auto;
        left: -60px;
        top: 50%;
        transform: translateY(-50%);
    }

    .hour-label-top {
        position: relative;
        bottom: auto;
        margin-left: 8px;
    }

    .timeline-hour.current .tick {
        width: 8px;
        height: 8px;
        margin-right: 8px;
        margin-bottom: 0;
    }

    /* Word grid: 3x4 */
    .word-grid {
        grid-template-columns: repeat(3, 1fr);
        margin-left: 0;
        margin-right: 0;
    }

    .word-cell {
        font-size: 18px;
        padding: 24px 8px;
    }

    /* Fix border collapse for 3-column */
    .word-cell:not(:nth-child(4n+1)) {
        border-left: 1px solid #c0c0c0;
    }

    .word-cell:nth-child(n+5) {
        border-top: 1px solid #c0c0c0;
    }

    .word-cell:not(:nth-child(3n+1)) {
        border-left: none;
    }

    .word-cell:nth-child(n+4) {
        border-top: none;
    }

    #grid-toggle {
        bottom: 16px;
        right: 16px;
    }
}
