.tesla-case {
    --tc-ink: #20383d;
    --tc-text: #45615b;
    --tc-accent: #086b78;
    --tc-border: #cfdfd6;
    --tc-paper: #fbfdfb;
    background: #f4f8f5;
}

html:has(.tesla-case) {
    scrollbar-gutter: stable;
}

.tesla-case main > section > .pi-shell {
    max-width: 1320px;
}

.tc-hero {
    padding: 127px 0 57px;
    background: radial-gradient(ellipse at 80% 6%, #dceee4, transparent 65%), #edf5f0;
}

.tc-hero__grid,
.tc-project__grid {
    display: grid;
    align-items: center;
    gap: clamp(28px, 5vw, 75px);
    grid-template-columns: minmax(0, .82fr) minmax(0, 1.18fr);
}

.tc-hero h1 {
    margin: 0;
    color: var(--tc-ink);
    font-size: clamp(44px, 5.25vw, 78px);
    font-weight: 800;
    line-height: 1.02;
    letter-spacing: -.062em;
    text-wrap: balance;
}

.tc-hero h1 em {
    color: var(--tc-accent);
    font-style: normal;
}

.tc-lead {
    max-width: 44ch;
    margin: 22px 0 0;
    color: var(--tc-text);
    font-size: clamp(15px, 1.25vw, 17px);
    line-height: 1.7;
    text-wrap: pretty;
}

.tc-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 24px;
    margin-top: 24px;
}

.tc-quote,
.tc-text-link {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    font-size: 14px;
    font-weight: 750;
}

.tc-quote {
    min-height: 54px;
    padding: 10px 12px 10px 22px;
    border-radius: 999px;
    color: #fff;
    background: #c93121;
    box-shadow: 0 9px 24px #bd31232e;
}

.tc-quote:visited,
.tc-quote:hover {
    color: #fff;
}

.tc-quote:hover {
    background: #ad2c1f;
}

.tc-quote span {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: #b62d20;
    background: #fff;
    font-size: 18px;
}

.tc-text-link {
    min-height: 44px;
    color: var(--tc-accent);
}

.tc-text-link:hover {
    text-decoration: underline;
    text-underline-offset: 4px;
}

.tc-hero__visual,
.tc-design,
.tc-gallery figure {
    margin: 0;
    overflow: hidden;
    border: 1px solid var(--tc-border);
    border-radius: 22px;
    background: var(--tc-paper);
}

.tc-hero__visual {
    border-radius: 26px;
    box-shadow: 0 24px 65px #153b2f1f;
}

.tc-photo {
    position: relative;
    display: block;
    overflow: hidden;
    background: #dce8e0;
}

.tc-photo img {
    display: block;
    width: 100%;
    height: auto;
}

.tc-photo__control {
    position: absolute;
    right: 14px;
    bottom: 14px;
    display: grid;
    place-items: center;
    width: 41px;
    height: 41px;
    border-radius: 50%;
    color: var(--tc-ink);
    background: #fffffff5;
    font-size: 20px;
    transition: color .18s ease, background-color .18s ease;
}

.tc-photo:hover .tc-photo__control {
    color: #fff;
    background: var(--tc-accent);
}

.tc-photo:focus-visible {
    outline: 3px solid var(--tc-accent);
    outline-offset: -3px;
}

.tc-quote:focus-visible,
.tc-text-link:focus-visible {
    outline: 2px solid var(--tc-accent);
    outline-offset: 4px;
}

.tesla-case figure figcaption {
    padding: 14px 18px;
    color: var(--tc-text);
    font-size: 13px;
    line-height: 1.5;
}

.tc-hero__visual figcaption {
    display: flex;
    justify-content: space-between;
    gap: 8px 16px;
    flex-wrap: wrap;
}

.tc-design .tc-photo {
    background: #f8fbf8;
}

.tc-hero__visual figcaption strong {
    color: var(--tc-ink);
}

.tc-facts {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: 34px 0 0;
    overflow: hidden;
    border: 1px solid var(--tc-border);
    border-radius: 18px;
    background: #f8fbf8;
}

.tc-facts div {
    padding: 17px clamp(15px, 3vw, 33px);
}

.tc-facts div + div {
    border-inline-start: 1px solid var(--tc-border);
}

.tc-facts dt {
    margin-bottom: 5px;
    color: var(--tc-accent);
    font-size: 12px;
    font-weight: 750;
}

.tc-facts dd {
    margin: 0;
    color: var(--tc-ink);
    font-size: 15px;
    font-weight: 700;
    line-height: 1.45;
}

.tc-section {
    padding-block: clamp(33px, 5.3vw, 68px);
    scroll-margin-top: 103px;
}

.tc-section h2 {
    margin: 0;
    color: var(--tc-ink);
    font-size: clamp(27px, 3.1vw, 44px);
    font-weight: 800;
    letter-spacing: -.047em;
    line-height: 1.12;
    text-wrap: balance;
}

.tc-section p {
    margin: 15px 0 0;
    color: var(--tc-text);
    font-size: 15px;
    line-height: 1.75;
    text-wrap: pretty;
}

.tc-project__grid {
    grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr);
}

.tc-project__copy h2 em {
    display: block;
    color: var(--tc-accent);
    font-style: normal;
}

.tc-project__details {
    margin-top: clamp(19px, 2.3vw, 29px);
    border-block-end: 1px solid var(--tc-border);
}

.tc-project__point {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr);
    align-items: start;
    gap: 7px 20px;
    padding-block: 14px;
    border-block-start: 1px solid var(--tc-border);
}

.tc-project__point h3 {
    margin: 2px 0 0;
    color: var(--tc-accent);
    font-size: 14px;
    font-weight: 750;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.tc-project .tc-project__point p {
    margin: 0;
    color: #385650;
    line-height: 1.65;
    overflow-wrap: anywhere;
}

.tc-section__heading {
    display: grid;
    gap: 8px;
    margin-bottom: clamp(20px, 2.75vw, 32px);
}

.tc-section__heading p {
    margin: 0;
}

.tc-gallery {
    padding-block: clamp(35px, 5vw, 64px);
    background: linear-gradient(180deg, #eaf3ed, #f2f7f3);
}

.tc-gallery__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(15px, 2.2vw, 28px);
    margin: 0;
    padding: 0;
    list-style: none;
}

.tc-gallery__grid a {
    display: block;
    aspect-ratio: 3 / 2;
}

.tc-gallery__grid img {
    height: 100%;
    object-fit: cover;
}

.tc-gallery__grid figure figcaption {
    color: var(--tc-ink);
    font-weight: 700;
    font-size: 14px;
}

.tc-gallery__grid figure {
    height: 100%;
    box-shadow: 0 10px 28px #28453612;
}

.tc-gallery__grid .tc-photo__control {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    box-shadow: 0 3px 12px #152d3220;
}

.tc-gallery .tc-result {
    margin-top: 22px;
    padding: 15px 18px;
    border: 1px solid var(--tc-border);
    border-inline-start: 3px solid #75a891;
    border-radius: 12px;
    background: var(--tc-paper);
}

.tesla-case .tc-contact > .tc-contact__panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    max-width: 1080px;
    gap: 25px 40px;
    padding: clamp(25px, 4vw, 46px);
    border: 1px solid var(--tc-border);
    border-radius: 24px;
    background: linear-gradient(110deg, var(--tc-paper), #e6f2ea);
}

.tc-contact__panel .tc-actions {
    align-items: start;
    flex-direction: column;
    gap: 6px;
    margin: 0;
}

.tc-lightbox {
    width: min(1160px, calc(100% - 32px));
    max-width: none;
    max-height: calc(100dvh - 28px);
    margin: auto;
    padding: 0;
    overflow: auto;
    overscroll-behavior: contain;
    border: 1px solid #48615d;
    border-radius: 22px;
    color: #f2faf6;
    background: #172c2a;
    box-shadow: 0 30px 100px #081a1980;
}

.tc-lightbox[open] {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
}

.tc-lightbox::backdrop {
    background: #0c2324ce;
    backdrop-filter: blur(6px);
}

.tc-lightbox__bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-block-end: 1px solid #3b514d;
}

.tc-lightbox__heading h2 {
    margin: 0;
    color: #fff;
    font-size: 17px;
    font-weight: 750;
    line-height: 1.25;
}

.tc-lightbox__heading p {
    margin: 3px 0 0;
    color: #b5d2c8;
    font-size: 13px;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.tc-lightbox__counter {
    padding: 6px 10px;
    border: 1px solid #4b6b61;
    border-radius: 999px;
    color: #dcefe6;
    background: #25413b;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    line-height: 1.4;
    white-space: nowrap;
}

.tc-lightbox__stage {
    display: grid;
    grid-template: minmax(0, 1fr) / minmax(0, 1fr);
    place-items: center;
    padding: 10px 14px;
    background: #101f1e;
}

.tc-lightbox__stage img {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: min(100%, 720px);
    object-fit: contain;
    border-radius: 13px;
    background: #edf5ef;
}

.tc-lightbox__controls {
    display: grid;
    grid-template-columns: auto minmax(0, max-content) auto;
    justify-content: center;
    align-items: center;
    gap: clamp(6px, 1.5vw, 18px);
    padding: 9px 12px 12px;
    border-block-start: 1px solid #3b514d;
}

.tc-lightbox__button {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid #4b6b61;
    border-radius: 13px;
    color: #f2faf6;
    background: #25413b;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.tc-lightbox__close {
    font-size: 24px;
}

.tc-lightbox__button:hover,
.tc-lightbox__thumb:hover {
    border-color: #aadaca;
    background-color: #32564d;
}

.tc-lightbox__thumbs {
    display: flex;
    align-items: center;
    gap: clamp(4px, 1vw, 9px);
    overflow-x: auto;
    padding: 3px;
    scrollbar-width: thin;
}

.tc-lightbox__thumb {
    flex: 0 0 clamp(36px, 12vw, 76px);
    aspect-ratio: 1.6;
    overflow: hidden;
    padding: 2px;
    border: 2px solid transparent;
    border-radius: 9px;
    background: #25413b;
    cursor: pointer;
}

.tc-lightbox__thumb[aria-current="true"] {
    border-color: #a6edcf;
}

.tc-lightbox__thumb img {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 5px;
    background: #edf5ef;
    object-fit: cover;
}

.tc-lightbox button:focus-visible {
    outline: 2px solid #f2faf6;
    outline-offset: 2px;
}

@media (max-width: 560px) {
    .tc-lightbox {
        width: calc(100% - 16px);
        border-radius: 16px;
    }

    .tc-lightbox__bar {
        gap: 8px;
        padding: 9px 8px 9px 11px;
    }

    .tc-lightbox__heading h2 {
        font-size: 15px;
    }

    .tc-lightbox__heading p {
        font-size: 12px;
    }

    .tc-lightbox__stage {
        padding: 7px 8px;
    }

    .tc-lightbox__controls {
        padding-inline: 8px;
    }
}

@media (max-height: 500px) {
    .tc-lightbox__stage {
        padding-block: 6px;
    }

    .tc-lightbox__thumb {
        flex-basis: 54px;
    }
}

@media (max-width: 855px) {
    .tc-hero {
        padding-top: 105px;
    }

    .tc-hero__grid,
    .tc-project__grid {
        grid-template-columns: 1fr;
    }

    .tc-hero h1 {
        font-size: clamp(40px, 8vw, 65px);
    }

    .tc-project__copy {
        max-width: 64ch;
    }
}

@media (max-width: 620px) {
    .tc-hero {
        padding-bottom: 39px;
    }

    .tc-project__point {
        grid-template-columns: minmax(0, 1fr);
    }

    .tc-facts,
    .tc-gallery__grid,
    .tesla-case .tc-contact > .tc-contact__panel {
        grid-template-columns: minmax(0, 1fr);
    }

    .tc-facts div + div {
        border-inline-start: 0;
        border-block-start: 1px solid var(--tc-border);
    }

    .tc-contact__panel .tc-actions {
        align-items: stretch;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tc-photo__control {
        transition: none;
    }
}
