/* ==========================================================================
   CLT Greece — project case-study article layout
   Opt-in: wrap an article's content in <div class="clt-case">…</div>.
   Everything here is scoped to .clt-case (or to pages that contain one via
   :has()), so other articles and pages are untouched.
   Palette derived from the theme: rust #b05017, gold #c3a066.
   ========================================================================== */

.clt-case {
    --cc-rust: #b05017;
    --cc-rust-deep: #8f3f10;
    --cc-gold: #c3a066;
    --cc-gold-soft: #d9bf93;
    --cc-ink: #231d18;
    --cc-ink-2: #2e2620;
    --cc-text: #4a4038;
    --cc-muted: #7a6d62;
    --cc-sand: #f3ece2;
    --cc-linen: #faf6f0;
    --cc-line: rgba(35, 29, 24, 0.12);
    --cc-line-dark: rgba(250, 246, 240, 0.14);
    --cc-radius: 4px;
    --cc-shadow: 0 22px 44px -28px rgba(52, 33, 18, 0.55), 0 2px 6px -2px rgba(52, 33, 18, 0.12);
    --cc-body: 'Barlow', 'Roboto', system-ui, sans-serif;
    --cc-gap: clamp(28px, 4vw, 64px);
    --cc-section: clamp(64px, 9vw, 120px);

    color: var(--cc-text);
    font-family: var(--cc-body);
    font-size: 17px;
    line-height: 1.7;
    margin-top: 8px;
}

/* Page surface: warm linen instead of flat white, only on case-study pages */
body:has(.clt-case) {
    background: #faf6f0;
}
.post:has(.clt-case) .date {
    color: #7a6d62;
    margin-bottom: 20px;
}

.clt-case ::selection {
    background: #b05017;
    color: #fff;
}

/* ---------- typography ---------- */

.clt-case p {
    font-family: var(--cc-body);
    font-size: 17px;
    line-height: 1.7;
    color: var(--cc-text);
    margin: 0 0 1.05em;
    max-width: 68ch;
    text-wrap: pretty;
}
.clt-case p:last-child {
    margin-bottom: 0;
}
.clt-case strong {
    color: var(--cc-ink);
    font-weight: 600;
}

.clt-case h2 {
    color: var(--cc-rust);
    font-size: clamp(24px, 2.4vw, 32px);
    line-height: 1.25;
    letter-spacing: 0.1em;
    word-spacing: 0.12em;
    margin: 0 0 22px;
    text-wrap: balance;
    scroll-margin-top: 110px;
}
.clt-case .cc-sec[id] {
    scroll-margin-top: 110px;
}

.clt-case .cc-lead {
    font-size: clamp(19px, 1.7vw, 23px);
    line-height: 1.55;
    color: var(--cc-ink);
    font-weight: 400;
    max-width: 60ch;
}

.clt-case a:not(.cc-btn) {
    color: var(--cc-rust);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}
.clt-case a:not(.cc-btn):hover {
    color: var(--cc-rust-deep);
}
.clt-case a:focus-visible,
.clt-case button:focus-visible,
.clt-case video:focus-visible {
    outline: 2px solid var(--cc-rust);
    outline-offset: 3px;
    box-shadow: none;
}

/* ---------- sections & bands ---------- */

.clt-case > .cc-sec,
.clt-case > .cc-intro {
    margin-block: var(--cc-section);
}
.clt-case > .cc-intro {
    margin-top: 0;
}

/* Full-bleed colour band without horizontal overflow */
.clt-case .cc-band {
    position: relative;
    padding-block: var(--cc-section);
    background: var(--cc-band-bg);
    box-shadow: 0 0 0 100vmax var(--cc-band-bg);
    clip-path: inset(0 -100vmax);
}
.clt-case > .cc-sec.cc-band {
    margin-block: var(--cc-section);
}
/* Adjacent bands sit flush: no linen strip between them */
.clt-case > .cc-sec.cc-band:has(+ .cc-band) {
    margin-bottom: 0;
}
.clt-case > .cc-sec.cc-band + .cc-band {
    margin-top: 0;
}
.clt-case .cc-band--sand {
    --cc-band-bg: var(--cc-sand);
}
.clt-case .cc-band--ink {
    --cc-band-bg: var(--cc-ink);
    color: #e9e1d6;
}
.clt-case .cc-band--ink h2 {
    color: var(--cc-gold);
}
.clt-case .cc-band--ink p {
    color: #d8cfc3;
}
.clt-case .cc-band--ink strong {
    color: #fff;
}

/* ---------- intro ---------- */

.clt-case .cc-intro {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: var(--cc-gap);
    align-items: center;
}
.clt-case .cc-intro h2 {
    font-size: clamp(22px, 2vw, 27px);
}

/* ---------- in-page navigation ---------- */

.clt-case .cc-toc {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 6px;
    margin-top: clamp(40px, 5vw, 64px);
    padding-top: 22px;
    border-top: 1px solid var(--cc-line);
}
.clt-case .cc-toc a:not(.cc-btn) {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 14px;
    letter-spacing: 0.04em;
    color: var(--cc-ink);
    text-decoration: none;
    background: rgba(35, 29, 24, 0.045);
    transition: background-color 0.2s ease, color 0.2s ease;
}
.clt-case .cc-toc a:not(.cc-btn):hover {
    background: var(--cc-rust);
    color: #fff;
}

/* ---------- figures & media ---------- */

.clt-case .cc-fig {
    margin: 0;
}
.clt-case .cc-fig img,
.clt-case .cc-media {
    display: block;
    width: 100%;
    height: auto;
    border-radius: var(--cc-radius);
    box-shadow: var(--cc-shadow);
    background: #e7ddcf;
}
.clt-case img {
    transition: none;
}
.clt-case .cc-cap {
    margin: 12px 0 0;
    font-size: 14px;
    line-height: 1.5;
    color: var(--cc-muted);
    max-width: 70ch;
}
.clt-case .cc-band--ink .cc-cap {
    color: #a99d90;
}
.clt-case .cc-video {
    position: relative;
    aspect-ratio: 16 / 9;
    border-radius: var(--cc-radius);
    overflow: hidden;
    background: var(--cc-ink);
    box-shadow: var(--cc-shadow);
}
.clt-case .cc-video video {
    display: block;
    max-width: none;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ---------- spec sheet (project at a glance) ---------- */

.clt-case .cc-specs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    column-gap: var(--cc-gap);
    margin: 8px 0 0;
}
.clt-case .cc-specs > div {
    padding: 20px 0 22px;
    border-top: 1px solid var(--cc-line-dark);
}
.clt-case .cc-specs .cc-dt {
    font-weight: 400;
    font-size: 12.5px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--cc-gold);
    margin-bottom: 6px;
}
.clt-case .cc-specs .cc-dd {
    margin: 0;
    font-size: 19px;
    line-height: 1.4;
    color: #fbf7f1;
    font-variant-numeric: tabular-nums;
}
.clt-case .cc-specs .cc-spec-key .cc-dd {
    font-size: clamp(26px, 2.6vw, 34px);
    line-height: 1.15;
    color: #fff;
}

/* ---------- credits ---------- */

.clt-case .cc-credits {
    list-style: none;
    margin: 8px 0 0;
    padding: 0;
}
.clt-case .cc-credits li {
    display: grid;
    grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
    gap: 8px var(--cc-gap);
    padding: 20px 0;
    border-top: 1px solid var(--cc-line);
}
.clt-case .cc-credits li:last-child {
    border-bottom: 1px solid var(--cc-line);
}
.clt-case .cc-credits .cc-who {
    font-size: 19px;
    line-height: 1.35;
    color: var(--cc-ink);
    letter-spacing: 0.02em;
}
.clt-case .cc-credits .cc-what {
    color: var(--cc-text);
    line-height: 1.6;
}

/* ---------- split rows (media + text) ---------- */

.clt-case .cc-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: var(--cc-gap);
    align-items: center;
}
.clt-case .cc-split--wide-media {
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
}
.clt-case .cc-split--rev > :first-child {
    order: 2;
}
.clt-case .cc-split + .cc-split,
.clt-case .cc-split + .cc-block,
.clt-case .cc-block + .cc-split,
.clt-case .cc-block + .cc-block {
    margin-top: clamp(40px, 6vw, 72px);
}
.clt-case .cc-head {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: 8px var(--cc-gap);
    align-items: end;
    margin-bottom: clamp(28px, 4vw, 44px);
}
.clt-case .cc-head h2 {
    margin: 0;
}

/* ---------- image grids ---------- */

/* Row heights come from aspect-ratio boxes; images are absolutely positioned inside
   them. (An <img> with height:100% in a 1fr-row grid blows up to ~20000px in Safari.) */
.clt-case .cc-mosaic {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: clamp(12px, 1.6vw, 20px);
}
.clt-case .cc-mosaic .cc-fig,
.clt-case .cc-album a {
    position: relative;
    overflow: hidden;
    border-radius: var(--cc-radius);
    box-shadow: var(--cc-shadow);
    background: #e7ddcf;
}
.clt-case .cc-mosaic .cc-fig:first-child {
    grid-row: 1 / span 2;
}
.clt-case .cc-mosaic .cc-fig:not(:first-child) {
    aspect-ratio: 4 / 3;
}
.clt-case .cc-mosaic img,
.clt-case .cc-album img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0;
    box-shadow: none;
}

/* Two videos side by side: landscape + portrait, equal heights (16:9 vs 720:1116) */
.clt-case .cc-vpair {
    display: grid;
    grid-template-columns: minmax(0, 2.75fr) minmax(0, 1fr);
    gap: clamp(14px, 1.8vw, 24px);
    align-items: start;
}
.clt-case .cc-video--portrait {
    aspect-ratio: 720 / 1116;
}

/* Section photo album: 8 columns, first photo 2x2 → 13 photos fill exactly 2 rows */
.clt-case .cc-album {
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: clamp(8px, 1vw, 14px);
    margin-top: clamp(32px, 4vw, 56px);
}
.clt-case .cc-album a {
    display: block;
    aspect-ratio: 3 / 4;
    cursor: zoom-in;
}
.clt-case .cc-album a:first-child {
    grid-column: span 2;
    grid-row: span 2;
    aspect-ratio: auto;
}
.clt-case .cc-album img {
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.clt-case .cc-album a:hover img {
    transform: scale(1.04);
}
.clt-case .cc-album a:focus-visible {
    outline: 2px solid var(--cc-rust);
    outline-offset: 3px;
}

/* ---------- buttons ---------- */

.clt-case .cc-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 32px;
}
.clt-case .cc-btn {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-height: 50px;
    padding: 13px 24px 13px 26px;
    border: 1px solid transparent;
    border-radius: 2px;
    font-family: var(--cc-body);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.3;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.clt-case .cc-btn::after {
    content: "";
    flex: none;
    width: 18px;
    height: 18px;
    background-color: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M3.5 10h12M11 5.5l4.5 4.5-4.5 4.5' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M3.5 10h12M11 5.5l4.5 4.5-4.5 4.5' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
    transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}
.clt-case .cc-btn:hover::after {
    transform: translateX(4px);
}
.clt-case .cc-btn--primary {
    background: var(--cc-rust);
    color: #fff;
    box-shadow: 0 10px 22px -12px rgba(143, 63, 16, 0.8);
}
.clt-case .cc-btn--primary:hover {
    background: var(--cc-rust-deep);
    color: #fff;
}
.clt-case .cc-btn--primary:active {
    box-shadow: none;
}
.clt-case .cc-btn--line {
    border-color: rgba(176, 80, 23, 0.55);
    color: var(--cc-rust);
    background: transparent;
}
.clt-case .cc-btn--line:hover {
    border-color: var(--cc-rust);
    background: var(--cc-rust);
    color: #fff;
}
.clt-case .cc-band--ink .cc-btn--line {
    border-color: rgba(233, 225, 214, 0.4);
    color: #f3ece2;
}
.clt-case .cc-band--ink .cc-btn--line:hover {
    border-color: var(--cc-gold);
    background: var(--cc-gold);
    color: var(--cc-ink);
}
.clt-case .cc-band--ink .cc-btn:focus-visible {
    outline-color: var(--cc-gold);
}

/* ---------- FAQ (Bootstrap accordion, re-skinned) ---------- */

.clt-case .accordion {
    --bs-accordion-bg: transparent;
    --bs-accordion-border-color: var(--cc-line);
    --bs-accordion-border-radius: 0;
    --bs-accordion-inner-border-radius: 0;
    --bs-accordion-btn-padding-x: 0;
    --bs-accordion-btn-padding-y: 22px;
    --bs-accordion-body-padding-x: 0;
    --bs-accordion-body-padding-y: 0;
    --bs-accordion-active-bg: transparent;
    --bs-accordion-active-color: var(--cc-rust);
    --bs-accordion-btn-focus-box-shadow: none;
    --bs-accordion-btn-focus-border-color: transparent;
    max-width: 900px;
    margin-top: 8px;
}
.clt-case .accordion-item {
    border-left: 0;
    border-right: 0;
}
.clt-case .accordion-item:first-of-type {
    border-top: 1px solid var(--cc-line);
}
.clt-case .accordion-header {
    margin: 0;
}
.clt-case .accordion-button {
    font-family: var(--cc-body);
    font-size: 19px;
    line-height: 1.4;
    color: var(--cc-ink);
    gap: 24px;
}
.clt-case .accordion-button:hover {
    color: var(--cc-rust);
}
.clt-case .accordion-button:focus-visible {
    outline: 2px solid var(--cc-rust);
    outline-offset: 2px;
}
.clt-case .accordion-button:not(.collapsed) {
    box-shadow: none;
}
.clt-case .accordion-body {
    font-size: 17px;
    line-height: 1.7;
    color: var(--cc-text);
    max-width: 70ch;
    padding-bottom: 26px;
}

/* ---------- closing band ---------- */

.clt-case .cc-signoff {
    margin-top: 28px;
    font-size: 14px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--cc-gold-soft);
}

/* ---------- theme gallery below the article ---------- */

.post:has(.clt-case) {
    padding-bottom: 0;
}
.post:has(.clt-case) + .section-padding {
    padding-top: 0;
}
.post:has(.clt-case) + .section-padding .gallery-img img {
    border-radius: 4px;
}
.clt-case > .cc-gallery-head {
    margin-bottom: 36px;
}
.clt-case > .cc-gallery-head p {
    color: var(--cc-muted);
}

/* ---------- responsive ---------- */

@media (max-width: 991.98px) {
    .clt-case .cc-specs {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    /* 4 columns, first photo 2x2 → 13 photos fill exactly 4 rows */
    .clt-case .cc-album {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
    .clt-case .cc-intro,
    .clt-case .cc-head {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 767.98px) {
    .clt-case {
        font-size: 16px;
    }
    .clt-case p,
    .clt-case .accordion-body {
        font-size: 16px;
    }
    .clt-case .cc-split,
    .clt-case .cc-split--wide-media {
        grid-template-columns: minmax(0, 1fr);
    }
    .clt-case .cc-split--rev > :first-child {
        order: 0;
    }
    .clt-case .cc-credits li {
        grid-template-columns: minmax(0, 1fr);
        gap: 4px;
    }
    .clt-case .cc-mosaic {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }
    .clt-case .cc-mosaic .cc-fig:first-child {
        grid-column: 1 / -1;
        grid-row: auto;
        aspect-ratio: 4 / 3;
    }
    .clt-case .cc-vpair {
        grid-template-columns: minmax(0, 1fr);
    }
    .clt-case .cc-vpair .cc-fig + .cc-fig {
        width: min(100%, 420px);
        margin-inline: auto;
    }
    .clt-case .cc-toc {
        flex-wrap: nowrap;
        overflow-x: auto;
        margin-inline: -12px;
        padding-inline: 12px;
        scrollbar-width: none;
    }
    .clt-case .cc-toc a:not(.cc-btn) {
        flex: none;
    }
    .clt-case .cc-btn {
        width: 100%;
        justify-content: space-between;
    }
    .clt-case .accordion-button {
        font-size: 17px;
    }
}

@media (max-width: 479.98px) {
    .clt-case .cc-specs {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (prefers-reduced-motion: reduce) {
    .clt-case .cc-btn,
    .clt-case .cc-btn::after,
    .clt-case .cc-toc a {
        transition: none;
    }
}

/* Theme gallery grid uses -15px gutters inside a 12px container → 3px sideways
   scroll on phones. Align it to the Bootstrap 5 gutter on case-study pages. */
.post:has(.clt-case) + .section-padding .masonry-grid {
    margin-left: -12px;
    margin-right: -12px;
}
.post:has(.clt-case) + .section-padding .gallery-item {
    padding-left: 12px;
    padding-right: 12px;
    margin-bottom: 24px;
}

/* ---------- timber band (spec sheet) — matches the clt-lefkada.gr footer ---------- */

body:has(.clt-case) {
    overflow-x: clip;
}
.clt-case .cc-band--timber {
    background: none;
    box-shadow: none;
    clip-path: none;
    isolation: isolate;
    color: #efe3d3;
}
.clt-case .cc-band--timber::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 100vw;
    transform: translateX(-50%);
    z-index: -1;
    background:
        repeating-linear-gradient(135deg, rgba(255, 236, 214, 0.035) 0 1px, transparent 1px 16px),
        linear-gradient(150deg, #6b3820 0%, #5a2e12 40%, #3d1f08 100%);
}
.clt-case .cc-band--timber h2 {
    color: #e6c99a;
}
.clt-case .cc-band--timber .cc-specs > div {
    border-top-color: rgba(255, 228, 196, 0.16);
}
.clt-case .cc-band--timber .cc-specs .cc-dt {
    color: #d9b98a;
}

/* ---------- FAQ: centred column ---------- */

.clt-case .cc-faq > h2 {
    text-align: center;
    max-width: 900px;
    margin-inline: auto;
    margin-bottom: 32px;
}
.clt-case .cc-faq .accordion {
    margin-inline: auto;
}
.clt-case .accordion-button,
.clt-case .accordion-button:hover,
.clt-case .accordion-button:focus {
    border: 0;
    background-color: transparent;
}

/* ---------- reveal on scroll (classes set by js/case-study.js) ---------- */

.clt-case.cc-reveal-on [data-cc-reveal] {
    opacity: 0;
    transform: translate3d(var(--cc-dx, 0), var(--cc-dy, 32px), 0);
    transition:
        opacity 0.9s cubic-bezier(0.16, 1, 0.3, 1) var(--cc-delay, 0s),
        transform 1.1s cubic-bezier(0.16, 1, 0.3, 1) var(--cc-delay, 0s);
    will-change: opacity, transform;
}
.clt-case.cc-reveal-on [data-cc-reveal="left"] {
    --cc-dx: -56px;
    --cc-dy: 0;
}
.clt-case.cc-reveal-on [data-cc-reveal="right"] {
    --cc-dx: 56px;
    --cc-dy: 0;
}
.clt-case.cc-reveal-on [data-cc-reveal].is-in {
    opacity: 1;
    transform: none;
}
@media (max-width: 767.98px) {
    .clt-case.cc-reveal-on [data-cc-reveal="left"] { --cc-dx: -24px; }
    .clt-case.cc-reveal-on [data-cc-reveal="right"] { --cc-dx: 24px; }
}
@media (prefers-reduced-motion: reduce) {
    .clt-case.cc-reveal-on [data-cc-reveal] {
        opacity: 1;
        transform: none;
        transition: none;
    }
}

/* ---------- Lightbox (Magnific Popup): fit the screen. SITE-WIDE fix ----------
   The layout has no <!DOCTYPE>, so pages render in quirks mode, where jQuery's
   $(window).height() returns the whole document height. Magnific uses it for the
   inline max-height (e.g. 13830px), and the theme's global img{width:100%} stretches
   the photo, so tall photos run off the screen. Cap it to the viewport instead. */
img.mfp-img {
    width: auto !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: calc(100vh - 44px) !important;
    max-height: calc(100dvh - 44px) !important;
    margin: 0 auto;
    object-fit: contain;
}
.mfp-image-holder .mfp-content {
    max-width: 100%;
}
@media (max-width: 767.98px) {
    img.mfp-img {
        padding-top: 48px;
        padding-bottom: 48px;
    }
}
/* keep the lightbox above the theme's fixed social bar (it shows through on phones) */
.mfp-bg {
    z-index: 100000;
}
.mfp-wrap {
    z-index: 100001;
}
