/* ============================================
   STEPHEN TOLFREY — PERSONAL SITE
   Dark industrial. Grotesque headings.
   Monospace body. No fluff.
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@700;900&family=IBM+Plex+Mono:wght@400;500&display=swap');

/* ============================================
   TOKENS
   ============================================ */
:root {
    --bg:           #364442;
    --surface:      #111111;
    --border:       #222222;
    --accent:       #e8e000;
    --accent-dim:   #9a9600;
    --text:         #d4d4d4;
    --text-dim:     #666666;
    --text-bright:  #f0f0f0;
    --header-h:     52px;

    --font-head:    'Barlow Condensed', 'Arial Narrow', sans-serif;
    --font-body:    'IBM Plex Mono', 'Courier New', monospace;

    --grid-min:     180px;
    --grid-gap:     2px;
}

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

html {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 13px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

body {
    display: flex;
    flex-direction: column;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    color: var(--text-bright);
}

/* ============================================
   HEADER
   ============================================ */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--header-h);
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
}

.site-title {
    font-family: var(--font-head);
    font-weight: 900;
    font-size: 2rem;
    letter-spacing: 0.08em;
    color: var(--text-bright);
    text-decoration: none;
    transition: color 0.15s;
}

.site-title:hover {
    color: var(--accent);
}

nav {
    display: flex;
    gap: 24px;
}

.nav-link {
    font-family: var(--font-body);
    font-size: 1.5rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    color: var(--text-dim);
    text-decoration: none;
    padding-bottom: 2px;
    border-bottom: 1px solid transparent;
    transition: color 0.15s, border-color 0.15s;
}

.nav-link:hover,
.nav-link.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* ============================================
   GRID
   ============================================ */
.grid-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--grid-gap);
    padding: var(--grid-gap);
    background: var(--border);
    align-content: start;
    height: auto;
    min-height: 0;
}

.grid-item {
    position: relative;
    overflow: hidden;
    background: var(--surface);
    cursor: pointer;
}

/* Padding-top trick for bulletproof square cells */
.grid-item::before {
    content: '';
    display: block;
    padding-top: 100%;
}

.grid-item img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease, filter 0.4s ease;
    filter: grayscale(20%);
}

.grid-item-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0);
    display: flex;
    align-items: flex-end;
    padding: 10px;
    transition: background 0.3s ease;
}

.grid-item-label {
    font-family: var(--font-body);
    font-size: 1rem;
    letter-spacing: 0.1em;
    color: var(--accent);
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.grid-item:hover img {
    transform: scale(1.04);
    filter: grayscale(0%);
}

.grid-item:hover .grid-item-overlay {
    background: rgba(0, 0, 0, 0.45);
}

.grid-item:hover .grid-item-label {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   GRID ICONS — video play + gallery stack
   ============================================ */
.grid-item-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--accent);
    opacity: 0;
    transition: opacity 0.2s, transform 0.2s;
    pointer-events: none;
    line-height: 1;
}

/* Video tiles: subtle persistent icon, brighter on hover */
.grid-item--video .grid-item-icon {
    opacity: 0.7;
}

.grid-item--video:hover .grid-item-icon {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.15);
}

.grid-item-play {
    font-size: 2rem;
}

/* Gallery tiles: icon appears on hover */
.grid-item--gallery .grid-item-icon {
    opacity: 0;
}

.grid-item--gallery:hover .grid-item-icon {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.08);
}

.grid-item-stack svg {
    display: block;
    filter: drop-shadow(0 1px 3px rgba(0,0,0,0.6));
}

/* Empty state */
.empty-state {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    font-family: var(--font-body);
    font-size: 0.8rem;
    letter-spacing: 0.1em;
    color: var(--text-dim);
    text-align: center;
    line-height: 2;
}

/* ============================================
   LIGHTBOX
   ============================================ */
.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 999;
    align-items: center;
    justify-content: center;
}

.lightbox.is-open {
    display: flex;
}

.lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    cursor: pointer;
}

.lightbox-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    max-width: 94vw;
    max-height: 92vh;
    animation: lb-in 0.2s ease;
}

@keyframes lb-in {
    from { opacity: 0; transform: scale(0.97); }
    to   { opacity: 1; transform: scale(1); }
}

.lightbox-content > img {
    display: block;
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border: 1px solid var(--border);
}

.lightbox-label {
    font-family: var(--font-body);
    font-size: 1rem;
    letter-spacing: 0.12em;
    color: var(--text-dim);
    text-transform: uppercase;
}

.lightbox-close {
    position: fixed;
    top: 16px;
    right: 20px;
    z-index: 10;
    background: none;
    border: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 1rem;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
}

.lightbox-close:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Video embed */
.lightbox-video-wrapper {
    position: relative;
    width: 80vw;
    max-width: 1100px;
    aspect-ratio: 16 / 9;
    background: #000;
    border: 1px solid var(--border);
}

.lightbox-video-wrapper iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* ============================================
   CAROUSEL
   ============================================ */
#carouselImg {
    display: block;
    max-width: 90vw;
    max-height: 75vh;
    object-fit: contain;
    border: 1px solid var(--border);
}

.lightbox-carousel-controls {
    display: flex;
    align-items: center;
    gap: 20px;
}

.carousel-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 1.1rem;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s, opacity 0.2s;
    font-family: var(--font-body);
}

.carousel-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.carousel-counter {
    font-family: var(--font-body);
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    color: var(--text-dim);
    min-width: 60px;
    text-align: center;
}

/* ============================================
   ABOUT PAGE
   ============================================ */
.about-container {
    flex: 1;
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    padding: 60px 24px 80px;
}

.about-rule {
    width: 100%;
    height: 1px;
    background: var(--border);
    margin: 48px 0;
}

.about-rule:first-child {
    margin-top: 0;
}

.about-block {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 40px;
    align-items: start;
}

.about-heading {
    font-family: var(--font-head);
    font-weight: 900;
    font-size: clamp(2.8rem, 6vw, 5rem);
    line-height: 0.92;
    letter-spacing: -0.01em;
    color: var(--text-bright);
    text-transform: uppercase;
}

.about-body {
    display: flex;
    flex-direction: column;
    gap: 20px;
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.75;
    color: var(--text);
}

.about-body p:first-child {
    font-size: 1.3rem;
    color: var(--text-bright);
}

.about-block--meta {
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.about-meta-col {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.about-subheading {
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.18em;
    color: var(--accent);
    text-transform: uppercase;
}

.about-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.about-list li {
    font-family: var(--font-body);
    font-size: 1rem;
    color: #d4d4d4;
    line-height: 1.4;
}

.about-list a {
    color: var(--text-dim);
    border-bottom: 1px solid var(--border);
    transition: color 0.15s, border-color 0.15s;
}

.about-list a:hover {
    color: #d3dacd;
    border-bottom-color: var(--accent);
}

.about-block--statement {
    display: block;
}

.about-statement {
    font-family: var(--font-head);
    font-weight: 700;
    font-size: clamp(1.2rem, 3vw, 1.8rem);
    line-height: 1.4;
    letter-spacing: 0.01em;
    color: var(--text-dim);
    text-transform: uppercase;
}

/* ============================================
   FOOTER
   ============================================ */
.site-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    font-family: var(--font-body);
    font-size: 1rem;
    letter-spacing: 0.1em;
    color: var(--text-dim);
    text-align: center;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (min-width: 1200px) {
    .grid-container {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 640px) {
    :root {
        --header-h: 48px;
    }

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

    .about-block {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .about-block--meta {
        grid-template-columns: 1fr 1fr;
    }

    .about-container {
        padding: 40px 16px 60px;
    }

    #carouselImg {
        max-height: 65vh;
    }
}

@media (max-width: 420px) {
    .grid-container {
        grid-template-columns: repeat(2, 1fr);
    }

    .about-block--meta {
        grid-template-columns: 1fr;
    }
}