/* ============================================================
   lossless.dev — Brutalist Data Integrity
   Colors: #c4d4dc #e8dcc8 #2a4050 #8ab8c4 #4a7a6a #0a0a0a #6a9ab0
   Fonts: Libre Baskerville, Roboto Mono
   ============================================================ */

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

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

body {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-weight: 400;
    color: #0a0a0a;
    background-color: #c4d4dc;
    line-height: 1.7;
    overflow-x: hidden;
}

/* ----- TYPOGRAPHY ----- */
h1, h2, h3 {
    font-family: 'Libre Baskerville', Georgia, serif;
}

.section-label,
.panel-label,
.cell-meta {
    font-family: 'Roboto Mono', monospace;
    font-weight: 400;
    font-size: 13px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* ----- CRYSTALLINE DIAMOND MOTIF ----- */
.crystalline-diamond {
    display: inline-block;
    width: 12px;
    height: 12px;
    background-color: #6a9ab0;
    transform: rotate(45deg);
    flex-shrink: 0;
}

/* ============================================================
   HERO SECTION
   ============================================================ */
#hero {
    position: relative;
    width: 100%;
    min-height: 100vh;
    background-color: #c4d4dc;
    border-bottom: 2px solid #0a0a0a;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

/* Visible grid overlay on hero */
#hero-grid-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background-image:
        repeating-linear-gradient(
            to right,
            transparent,
            transparent calc(100% / 6 - 1px),
            #0a0a0a calc(100% / 6 - 1px),
            #0a0a0a calc(100% / 6)
        );
    opacity: 0.12;
}

#hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 0 16px;
}

#hero-title-block {
    display: inline-block;
    border: 3px solid #0a0a0a;
    padding: 8px 24px;
    line-height: 1;
    margin-bottom: 24px;
}

#hero-title {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-weight: 700;
    font-size: clamp(60px, 12vw, 160px);
    color: #0a0a0a;
    letter-spacing: -0.02em;
}

#hero-dot-dev {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-weight: 700;
    font-size: clamp(15px, 3vw, 40px);
    color: #2a4050;
    vertical-align: baseline;
    position: relative;
    bottom: 0;
}

#hero-tagline {
    font-family: 'Roboto Mono', monospace;
    font-size: 13px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #2a4050;
    margin-top: 8px;
}

/* Hero grid preview — 6-column teaser */
#hero-grid-preview {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    height: 80px;
    z-index: 1;
}

.grid-preview-cell {
    border-top: 1px solid #0a0a0a;
    border-right: 1px solid #0a0a0a;
    background-color: transparent;
}

.grid-preview-cell:last-child {
    border-right: none;
}

/* ============================================================
   PORTFOLIO SECTION
   ============================================================ */
#portfolio {
    width: 100%;
    background-color: #e8dcc8;
    border-bottom: 2px solid #0a0a0a;
}

#portfolio-label {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-bottom: 2px solid #0a0a0a;
    background-color: #c4d4dc;
}

#portfolio-label .section-label {
    color: #0a0a0a;
}

#portfolio-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    width: 100%;
}

/* ----- PORTFOLIO CELL ----- */
.portfolio-cell {
    position: relative;
    border-right: 2px solid #0a0a0a;
    border-bottom: 2px solid #0a0a0a;
    padding: 0;
    min-height: 260px;
    overflow: hidden;
    cursor: crosshair;
    transition: border-width 100ms ease;
}

.portfolio-cell:nth-child(3n) {
    border-right: none;
}

.portfolio-cell:nth-last-child(-n+3) {
    border-bottom: none;
}

/* Three-column last row edge cases */
.portfolio-cell:nth-last-child(1):nth-child(3n+1),
.portfolio-cell:nth-last-child(2):nth-child(3n+2) {
    border-bottom: none;
}

/* Hover: thicker border effect (via inset box-shadow to avoid layout shift) */
.portfolio-cell:hover {
    box-shadow: inset 0 0 0 1px #0a0a0a;
}

/* Watercolor background */
.cell-watercolor {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 800ms ease;
    pointer-events: none;
}

.cell-watercolor.visible {
    opacity: 1;
}

/* Each cell gets a slightly different watercolor via nth-child */
.portfolio-cell:nth-child(1) .cell-watercolor {
    background:
        radial-gradient(ellipse at 30% 40%, rgba(138, 184, 196, 0.15) 0%, transparent 60%),
        radial-gradient(ellipse at 70% 70%, rgba(74, 122, 106, 0.10) 0%, transparent 50%);
}

.portfolio-cell:nth-child(2) .cell-watercolor {
    background:
        radial-gradient(ellipse at 60% 30%, rgba(106, 154, 176, 0.15) 0%, transparent 55%),
        radial-gradient(ellipse at 20% 80%, rgba(196, 212, 220, 0.12) 0%, transparent 50%);
}

.portfolio-cell:nth-child(3) .cell-watercolor {
    background:
        radial-gradient(ellipse at 80% 50%, rgba(74, 122, 106, 0.14) 0%, transparent 60%),
        radial-gradient(ellipse at 30% 20%, rgba(138, 184, 196, 0.10) 0%, transparent 50%);
}

.portfolio-cell:nth-child(4) .cell-watercolor {
    background:
        radial-gradient(ellipse at 40% 70%, rgba(232, 220, 200, 0.18) 0%, transparent 55%),
        radial-gradient(ellipse at 70% 20%, rgba(106, 154, 176, 0.12) 0%, transparent 50%);
}

.portfolio-cell:nth-child(5) .cell-watercolor {
    background:
        radial-gradient(ellipse at 50% 50%, rgba(138, 184, 196, 0.16) 0%, transparent 50%),
        radial-gradient(ellipse at 10% 90%, rgba(74, 122, 106, 0.10) 0%, transparent 60%);
}

.portfolio-cell:nth-child(6) .cell-watercolor {
    background:
        radial-gradient(ellipse at 20% 30%, rgba(106, 154, 176, 0.14) 0%, transparent 55%),
        radial-gradient(ellipse at 80% 80%, rgba(232, 220, 200, 0.12) 0%, transparent 50%);
}

.portfolio-cell:nth-child(7) .cell-watercolor {
    background:
        radial-gradient(ellipse at 70% 40%, rgba(74, 122, 106, 0.15) 0%, transparent 60%),
        radial-gradient(ellipse at 30% 70%, rgba(138, 184, 196, 0.10) 0%, transparent 50%);
}

.portfolio-cell:nth-child(8) .cell-watercolor {
    background:
        radial-gradient(ellipse at 50% 20%, rgba(196, 212, 220, 0.15) 0%, transparent 55%),
        radial-gradient(ellipse at 60% 80%, rgba(106, 154, 176, 0.12) 0%, transparent 50%);
}

.portfolio-cell:nth-child(9) .cell-watercolor {
    background:
        radial-gradient(ellipse at 40% 60%, rgba(138, 184, 196, 0.13) 0%, transparent 55%),
        radial-gradient(ellipse at 80% 30%, rgba(74, 122, 106, 0.11) 0%, transparent 60%);
}

/* Cell content */
.cell-content {
    position: relative;
    z-index: 2;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    height: 100%;
    will-change: transform;
}

.cell-title {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-weight: 700;
    font-size: clamp(20px, 3vw, 36px);
    color: #0a0a0a;
    line-height: 1.2;
    border-bottom: 1px solid #0a0a0a;
    padding-bottom: 8px;
}

.cell-description {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-weight: 400;
    font-size: clamp(15px, 1.5vw, 18px);
    color: #0a0a0a;
    line-height: 1.7;
    flex-grow: 1;
}

.cell-meta {
    color: #2a4050;
    margin-top: auto;
}

/* ============================================================
   COMPRESSION SECTION
   ============================================================ */
#compression {
    width: 100%;
    background-color: #c4d4dc;
    border-bottom: 2px solid #0a0a0a;
}

#compression-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px;
    border-bottom: 2px solid #0a0a0a;
    background-color: #e8dcc8;
}

#compression-panels {
    display: flex;
    width: 100%;
    min-height: 320px;
}

.compression-panel {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    overflow: hidden;
}

.panel-label {
    position: absolute;
    top: 16px;
    left: 16px;
    color: #0a0a0a;
    z-index: 2;
}

.panel-size {
    font-family: 'Roboto Mono', monospace;
    font-size: 13px;
    letter-spacing: 0.04em;
    color: #2a4050;
    position: absolute;
    bottom: 16px;
    right: 16px;
    z-index: 2;
}

.panel-texture {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

#panel-original .panel-texture {
    background:
        radial-gradient(ellipse at 25% 35%, rgba(138, 184, 196, 0.25) 0%, transparent 50%),
        radial-gradient(ellipse at 75% 65%, rgba(74, 122, 106, 0.20) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(106, 154, 176, 0.18) 0%, transparent 60%),
        radial-gradient(ellipse at 15% 85%, rgba(232, 220, 200, 0.22) 0%, transparent 40%),
        radial-gradient(ellipse at 85% 15%, rgba(42, 64, 80, 0.12) 0%, transparent 45%);
}

#panel-compressed .panel-texture {
    background:
        radial-gradient(ellipse at 25% 35%, rgba(138, 184, 196, 0.25) 0%, transparent 50%),
        radial-gradient(ellipse at 75% 65%, rgba(74, 122, 106, 0.20) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(106, 154, 176, 0.18) 0%, transparent 60%),
        radial-gradient(ellipse at 15% 85%, rgba(232, 220, 200, 0.22) 0%, transparent 40%),
        radial-gradient(ellipse at 85% 15%, rgba(42, 64, 80, 0.12) 0%, transparent 45%);
    transition: filter 300ms ease;
}

#panel-compressed.corrupted .panel-texture {
    filter: contrast(2) saturate(0.3) blur(2px);
    image-rendering: pixelated;
}

#panel-divider {
    width: 4px;
    background-color: #0a0a0a;
    flex-shrink: 0;
}

#compression-explanation {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-weight: 400;
    font-size: clamp(15px, 1.5vw, 18px);
    line-height: 1.7;
    color: #0a0a0a;
    padding: 24px 16px;
    border-top: 2px solid #0a0a0a;
    max-width: 800px;
    margin: 0;
}

#compression-explanation strong {
    font-weight: 700;
    border-bottom: 2px solid #0a0a0a;
}

/* ============================================================
   INTEGRITY FOOTER
   ============================================================ */
#integrity {
    width: 100%;
    background-color: #e8dcc8;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    padding: 48px 16px;
    min-height: 200px;
}

#integrity-statement {
    border: 3px solid #0a0a0a;
    padding: 12px 32px;
    display: inline-block;
}

#integrity-text {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-weight: 700;
    font-size: clamp(24px, 5vw, 60px);
    color: #0a0a0a;
    line-height: 1.2;
    white-space: nowrap;
}

.crystalline-left,
.crystalline-right {
    width: 20px;
    height: 20px;
}

.crystalline-left {
    background-color: #8ab8c4;
}

.crystalline-right {
    background-color: #4a7a6a;
}

/* ============================================================
   RESPONSIVE — TABLET (2 columns)
   ============================================================ */
@media (max-width: 900px) {
    #portfolio-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .portfolio-cell:nth-child(3n) {
        border-right: 2px solid #0a0a0a;
    }

    .portfolio-cell:nth-child(2n) {
        border-right: none;
    }

    .portfolio-cell:nth-last-child(-n+3) {
        border-bottom: 2px solid #0a0a0a;
    }

    /* Last row for 2-col: last 1 or 2 items */
    .portfolio-cell:nth-last-child(1):nth-child(2n+1) {
        border-bottom: none;
    }

    .portfolio-cell:nth-last-child(1):nth-child(2n),
    .portfolio-cell:nth-last-child(2):nth-child(2n+1) {
        border-bottom: none;
    }

    .portfolio-cell:nth-last-child(2):nth-child(2n+1) ~ .portfolio-cell {
        border-bottom: none;
    }

    #hero-grid-preview {
        grid-template-columns: repeat(3, 1fr);
    }

    .grid-preview-cell:nth-child(n+4) {
        display: none;
    }
}

/* ============================================================
   RESPONSIVE — MOBILE (1 column)
   ============================================================ */
@media (max-width: 600px) {
    #portfolio-grid {
        grid-template-columns: 1fr;
    }

    .portfolio-cell,
    .portfolio-cell:nth-child(3n),
    .portfolio-cell:nth-child(2n) {
        border-right: none;
        border-bottom: 2px solid #0a0a0a;
    }

    .portfolio-cell:last-child {
        border-bottom: none;
    }

    #compression-panels {
        flex-direction: column;
        min-height: auto;
    }

    #panel-divider {
        width: 100%;
        height: 4px;
    }

    .compression-panel {
        min-height: 200px;
    }

    #hero-grid-preview {
        grid-template-columns: repeat(2, 1fr);
        height: 60px;
    }

    .grid-preview-cell:nth-child(n+3) {
        display: none;
    }

    #integrity-text {
        white-space: normal;
        text-align: center;
    }

    #integrity {
        flex-wrap: wrap;
        gap: 16px;
    }
}
