/* ===========================================================
   MTL Electric - Our Work gallery (/our-work)
   Implements the "Our Work Page" design (Claude Design).

   Loaded after css/shared.css and css/service.css (design
   tokens, base reset, buttons, .svc-crumbs, .svc-eyebrow and
   the .svc-cta closing band). The tiles, category chips and
   photo count are generated by build.js from content/work.json.
   =========================================================== */

/* -----------------------------------------------------------
   Page header
   ----------------------------------------------------------- */
.wk-head {
    padding: 72px 0 40px;
}

.wk-head .wrap {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 48px;
    align-items: end;
}

.wk-head__text {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.wk-head__title {
    font: 700 clamp(44px, 4.6vw + 10px, 74px)/.95 var(--font-display);
    color: var(--navy);
    text-transform: uppercase;
    text-wrap: pretty;
    max-width: 820px;
}

.wk-head__lead {
    font: 400 19px/1.55 var(--font-body);
    color: var(--body);
    max-width: 620px;
    text-wrap: pretty;
}

.wk-head__count {
    flex: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: right;
    border-left: 2px solid var(--navy);
    padding-left: 24px;
}
.wk-head__num {
    font: 700 56px/1 var(--font-display);
    color: var(--navy);
}
.wk-head__label {
    font: 600 12px/1.3 var(--font-body);
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--muted);
}

@media (max-width: 1024px) {
    .wk-head { padding: 48px 0 32px; }
    .wk-head .wrap { gap: 32px; }
    .wk-head__num { font-size: 44px; }
}

@media (max-width: 768px) {
    .wk-head { padding: 40px 0 24px; }
    .wk-head .wrap {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
    }
    .wk-head__text { gap: 14px; }
    .wk-head__lead { font-size: 16px; line-height: 1.5; }
    /* The count reads as part of the lead sentence on a phone */
    .wk-head__count { display: none; }
}

/* -----------------------------------------------------------
   Category filters
   ----------------------------------------------------------- */
.wk-filters {
    padding-bottom: 32px;
    border-bottom: 1px solid var(--line-soft);
}

.wk-filters .wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
}

.wk-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.wk-chip {
    border: 1px solid #cfd3dc;
    background: #fff;
    padding: 10px 16px;
    font: 600 12px/1 var(--font-body);
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--navy);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    transition: border-color .15s, background-color .15s, color .15s;
}
.wk-chip:hover { border-color: var(--navy); }
.wk-chip.is-active {
    background: var(--navy);
    border-color: var(--navy);
    color: #fff;
}
.wk-chip__count {
    opacity: .6;
    margin-left: 6px;
}

.wk-shown {
    flex: none;
    white-space: nowrap;
    font: 500 14px/1 var(--font-body);
    color: var(--muted);
}

@media (max-width: 768px) {
    /* Chips scroll sideways rather than stacking four rows deep */
    .wk-filters { padding-bottom: 20px; }
    .wk-filters .wrap { display: block; padding-right: 0; }
    .wk-chips {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-right: var(--gutter);
        scrollbar-width: none;
    }
    .wk-chips::-webkit-scrollbar { display: none; }
    .wk-chip {
        flex: none;
        min-height: 44px;
        padding: 12px 16px;
        white-space: nowrap;
    }
    .wk-chip__count { display: none; }
    .wk-shown { display: none; }
}

/* -----------------------------------------------------------
   Gallery grid
   ----------------------------------------------------------- */
.wk-gallery {
    padding: 40px 0 80px;
}

.wk-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: 290px;
    grid-auto-flow: dense;
    gap: 12px;
}

.wk-tile {
    position: relative;
    display: block;
    overflow: hidden;
    background: var(--paper);
    transition: box-shadow .15s;
}
.wk-tile:hover { box-shadow: 0 16px 40px -20px rgba(15, 42, 99, .5); }
.wk-tile:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }

.wk-tile--wide { grid-column: span 2; }
.wk-tile--tall { grid-row: span 2; }

.wk-tile img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .3s ease;
}
.wk-tile:hover img { transform: scale(1.03); }

.wk-tile__meta {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 14px 16px;
    background: linear-gradient(180deg, rgba(8, 20, 50, 0) 0%, rgba(8, 20, 50, .85) 100%);
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.wk-tile__cat {
    font: 600 11px/1 var(--font-body);
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--peach);
}
.wk-tile__caption {
    font: 600 15px/1.25 var(--font-body);
    color: #fff;
}

/* Hidden by the category filter */
.wk-tile[hidden] { display: none !important; }

@media (max-width: 1024px) {
    .wk-gallery { padding: 32px 0 var(--sec-y); }
    .wk-grid {
        grid-template-columns: repeat(3, 1fr);
        grid-auto-rows: 240px;
        gap: 10px;
    }
    .wk-tile__caption { font-size: 14px; }
}

@media (max-width: 768px) {
    .wk-gallery { padding: 20px 0 48px; }
    .wk-grid {
        grid-template-columns: 1fr 1fr;
        grid-auto-rows: 180px;
        gap: 8px;
    }
    /* Only the wide span survives; tall tiles would tower on a phone */
    .wk-tile--tall { grid-row: span 1; }
    .wk-tile__meta { padding: 10px 12px; }
    .wk-tile__cat { display: none; }
    .wk-tile__caption { font-size: 12px; line-height: 1.25; }
    .wk-tile:hover img { transform: none; }
}

/* -----------------------------------------------------------
   Standards band
   ----------------------------------------------------------- */
.wk-standards {
    background: var(--navy);
    padding: 72px 0;
}

.wk-standards .wrap {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 64px;
    align-items: center;
}

.wk-standards__text {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.wk-standards__text h2 {
    font: 700 46px/1 var(--font-display);
    color: #fff;
    text-transform: uppercase;
    text-wrap: pretty;
}
.wk-standards__text p {
    font: 400 16px/1.6 var(--font-body);
    color: rgba(255, 255, 255, .82);
    text-wrap: pretty;
}

.wk-points {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.wk-point {
    border: 1px solid rgba(255, 255, 255, .2);
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.wk-point strong {
    font: 700 22px/1 var(--font-display);
    color: #fff;
    text-transform: uppercase;
}
.wk-point span {
    font: 400 14px/1.4 var(--font-body);
    color: rgba(255, 255, 255, .7);
}

@media (max-width: 1024px) {
    .wk-standards { padding: var(--sec-y) 0; }
    .wk-standards .wrap {
        grid-template-columns: 1fr;
        gap: 32px;
    }
    .wk-standards__text h2 { font-size: 40px; }
}

@media (max-width: 768px) {
    .wk-standards { padding: 48px 0; }
    .wk-standards .wrap { gap: 16px; }
    .wk-standards__text { gap: 14px; }
    .wk-standards__text h2 { font-size: 36px; line-height: .98; }
    .wk-standards__text p { font-size: 15px; line-height: 1.55; }
    .wk-points { gap: 8px; }
    .wk-point { padding: 14px; }
    .wk-point strong { font-size: 15px; line-height: 1.1; }
    .wk-point span { display: none; }
}

/* -----------------------------------------------------------
   Lightbox
   ----------------------------------------------------------- */
.wk-lightbox {
    position: fixed;
    inset: 0;
    z-index: 50;
    background: rgba(8, 20, 50, .94);
    display: grid;
    grid-template-columns: 72px 1fr 72px;
    align-items: center;
    padding: 32px;
    font-family: var(--font-body);
}
.wk-lightbox[hidden] { display: none; }

.wk-lightbox__figure {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    min-width: 0;
    max-height: 100%;
}
.wk-lightbox__figure img {
    max-width: 100%;
    max-height: calc(100vh - 180px);
    object-fit: contain;
    box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .6);
}

.wk-lightbox figcaption {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-align: center;
}
.wk-lightbox__cat {
    font: 600 11px/1 var(--font-body);
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--peach);
}
.wk-lightbox__caption {
    font: 600 18px/1.3 var(--font-body);
    color: #fff;
}

.wk-lb-nav {
    width: 56px;
    height: 56px;
    border: 2px solid rgba(255, 255, 255, .4);
    background: none;
    color: #fff;
    font: 700 24px/1 var(--font-display);
    cursor: pointer;
    transition: background-color .15s, color .15s;
}
.wk-lb-nav:hover { background: #fff; color: var(--navy); }
.wk-lb-nav--next { justify-self: end; }

.wk-lb-close {
    position: absolute;
    top: 24px;
    right: 24px;
    width: 48px;
    height: 48px;
    border: 0;
    background: var(--orange);
    color: #fff;
    font: 600 14px/1 var(--font-body);
    letter-spacing: .08em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background-color .15s;
}
.wk-lb-close:hover { background: var(--orange-dark); }

@media (max-width: 768px) {
    /* Arrows move under the photo so the image gets the full width */
    .wk-lightbox {
        grid-template-columns: 1fr 1fr;
        align-content: center;
        gap: 20px 12px;
        padding: 72px 16px 24px;
    }
    .wk-lightbox__figure {
        grid-column: 1 / -1;
        order: 1;
    }
    .wk-lightbox__figure img { max-height: calc(100vh - 260px); }
    .wk-lb-nav {
        order: 2;
        width: 100%;
        height: 52px;
    }
    .wk-lb-nav--next { order: 3; justify-self: stretch; }
    .wk-lightbox__caption { font-size: 15px; }
    .wk-lb-close { top: 16px; right: 16px; }
}

@media (prefers-reduced-motion: reduce) {
    .wk-tile img,
    .wk-tile:hover img { transition: none; transform: none; }
}
