:root {
    --primary: #346aff;
    --accent: #050a5e;
    --muted: #6b7280;
    --ink: #0f172a;
    --ink-2: #1f2937;
    --bg: #ffffff;
    --bg-2: #f3f4f6;
    --line: #ececec;
    --timeline-marker: #e9efff;
    --nav-inactive: #c7cad9;
    --white: #ffffff;
    --surface-dark: #111827;
    --gray-mid: var(--muted);
    --gray-dark: #4b5563;
    --muted-dark: #94a3b8;
}

html.dark {
    --bg: #0b1020;
    --bg-2: #0f152a;
    --ink: #e5e7eb;
    --ink-2: #cbd5e1;
    --muted: #94a3b8;
    --line: #1f2937;
    --muted-dark: #94a3b8;
    --surface-dark: #111827;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: 'SF Pro Display', 'SF Pro Text', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--ink-2);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

.text-gradient--blue {
    background: linear-gradient(90deg, #000f96 0%, #0076ea 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
}

.dark .text-gradient--blue {
    background: linear-gradient(90deg, #6fa3d6 0%, #0076ea 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
}

body.menu-open {
    overflow: hidden;
}

.dark body {
    background: var(--bg);
    color: var(--ink-2);
}

img {
    max-width: 100%;
    display: block;
    border: 0.5px solid #e9e9e9;
    border-radius: 8px;
}

figure {
    margin: 0;
}

.hero__logo {
    border: none;
    border-radius: 0;
}
a {
    color: inherit;
    text-decoration: none;
}

ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

h1, h2, h3, h4 {
    margin: 0;
    color: var(--accent);
    line-height: 1.2;
}

.letter-tight {
}

p {
    margin: 0 0 1.25rem;
}

.page {
    min-height: 100vh;
}

.main {
    padding-top: 96px;
}

section {
    padding: 6rem 0;
    scroll-margin-top: 120px;
}

@media (max-width: 1024px) {
    section {
        padding: 5rem 0;
    }
}

@media (max-width: 700px) {
    section {
        padding: 4.25rem 0;
    }

    .container {
        width: min(100%, 94vw);
    }
}

.container {
    width: min(1280px, 92vw);
    margin: 0 auto;
}

.surface-card {
    background: #fafafa;
    border-radius: 24px;
    border: none;
    box-shadow: 0 32px 80px -48px rgba(15, 23, 42, 0.15);
    padding: 2.75rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.95rem;
    border-radius: 999px;
    border: 1px solid transparent;
    padding: 0.8rem 1.6rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
    cursor: pointer;
}

.btn--primary {
    background: linear-gradient(90deg, #0014c6 0%, #0076ea 100%);
    color: var(--white);
    box-shadow: 0 24px 55px -30px rgba(0, 20, 198, 0.45);
}

.btn--primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 28px 65px -28px rgba(0, 118, 234, 0.5);
}

.btn--primary:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 118, 234, 0.25), 0 24px 55px -30px rgba(0, 20, 198, 0.45);
}

.dark .btn--primary {
    background: #3448ff;
    box-shadow: 0 24px 55px -30px rgba(52, 72, 255, 0.45);
}

.dark .btn--primary:hover {
    box-shadow: 0 28px 65px -28px rgba(52, 72, 255, 0.55);
}

.dark .btn--primary:focus-visible {
    box-shadow: 0 0 0 3px rgba(52, 72, 255, 0.25), 0 24px 55px -30px rgba(52, 72, 255, 0.45);
}

.btn--outline {
    background: transparent;
    border-color: var(--line);
    color: var(--ink-2);
}

.btn--contact {
    background: linear-gradient(90deg, #0a1fcf 0%, #0a1fcf 4%, #2b71e9 96%, #2b71e9 100%);
}

.btn--outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn--ghost {
    background: rgba(52, 106, 255, 0.12);
    color: var(--primary);
    border-color: var(--line);
}

.btn--ghost:hover {
    background: rgba(52, 106, 255, 0.2);
}

.btn--ghost-light {
    background: rgba(52, 106, 255, 0.12);
    color: var(--primary);
    border-color: var(--line);
}

.btn--ghost-light:hover {
    background: rgba(52, 106, 255, 0.2);
}

.btn--block {
    width: 100%;
}

.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--white);
    border-bottom: 1px solid #e9e9e9;
    transition: background 0.2s ease;
    color: #6b7280;
}

.site-header.is-scrolled {
    box-shadow: none;
}

.header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 1.25rem 0;
}

.brand {
    font-size: 1.35rem;
    font-weight: 800;
    background-image: linear-gradient(90deg, rgb(55 75 255) 0%, rgb(0, 118, 234) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
}

.dark .brand {
    background-image: linear-gradient(90deg, #6fa3d6 0%, rgb(0, 118, 234) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
}


.nav {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-left: auto;
}

.nav__list {
    display: flex;
    gap: 1.25rem;
    align-items: center;
}

.nav__item--dropdown {
    position: relative;
    display: flex;
    align-items: center;
}

.nav__button {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: transparent;
    border: 0;
    padding: 0;
    font: inherit;
    color: #6b7280;
    cursor: pointer;
    transition: color 0.2s ease, transform 0.2s ease;
}

.nav__button:hover,
.nav__button:focus-visible,
.nav__item--dropdown[aria-expanded="true"] .nav__button {
    color: var(--primary);
}

.nav__button .lucide-icon {
    width: 16px;
    height: 16px;
    transition: transform 0.2s ease;
}

.nav__item--dropdown[aria-expanded="true"] .nav__button .lucide-icon {
    transform: rotate(180deg);
}

.dropdown {
    position: absolute;
    top: calc(100% + 12px);
    left: 0;
    min-width: 240px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 24px 60px -30px rgba(15, 23, 42, 0.16);
    padding: 0.5rem;
    list-style: none;
    margin: 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    z-index: 120;
}

.nav__item--dropdown[aria-expanded="true"] .dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.dropdown a {
    display: block;
    padding: 0.6rem 0.8rem;
    border-radius: 10px;
    color: #6b7280;
    font-weight: 500;
    transition: background 0.3s ease, color 0.3s ease;
}

.dropdown a:hover,
.dropdown a:focus-visible {
    background: var(--bg-2);
    color: var(--primary);
}

.dark .dropdown {
    background: var(--surface-dark);
    border-color: var(--line);
    box-shadow: 0 24px 60px -32px rgba(0, 0, 0, 0.5);
}

.dark .dropdown a {
    color: #94a3b8;
}

.dark .dropdown a:hover,
.dark .dropdown a:focus-visible {
    background: #1e293b;
    color: #ffffff;
}

.mobile-dd {
    display: grid;
}

.mobile-dd__toggle {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 0.5rem;
    padding: 0.6rem 0;
    background: transparent;
    border: 0;
    font: inherit;
    color: #6b7280;
    font-weight: 600;
    cursor: pointer;
}

.mobile-dd__panel {
    display: none;
    list-style: none;
    padding-left: 0.5rem;
    margin-top: 0.25rem;
    gap: 0.5rem;
}

.mobile-dd[aria-expanded="true"] .mobile-dd__panel {
    display: grid;
}

.mobile-dd__toggle .lucide-icon {
    width: 18px;
    height: 18px;
    transition: transform 0.2s ease;
}

.mobile-dd[aria-expanded="true"] .mobile-dd__toggle .lucide-icon {
    transform: rotate(180deg);
}

.mobile-dd__panel a {
    display: block;
    padding: 0.4rem 0;
    color: inherit;
}

.dark .mobile-dd__toggle {
    color: #6b7280;
}

.nav__link {
    font-weight: 500;
    color: #6b7280;
    transition: color 0.2s ease;
}

.nav__link:hover,
.nav__link:focus-visible,
.nav__link[aria-current="page"],
.nav__link.active {
    color: var(--primary);
}

.nav-link {
    position: relative;
    color: #6b7280;
    font-weight: 500;
    transition: color 0.2s ease;
}

.nav-link:hover,
.nav-link:focus-visible {
    color: var(--primary);
}

.header__icons {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    color: inherit;
    margin-left: 1rem;
}

.header__icons a {
    display: inline-flex;
    align-items: center;
    line-height: 1;
    color: #6b7280;
    transition: color 0.2s ease;
}

.header__icons a:hover {
    color: var(--primary);
}

.mobile-menu__icons,
.footer__icons {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.mobile-menu__icons a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    transition: color 0.2s ease;
}

.mobile-menu__icons a:hover {
    color: var(--primary);
}

.footer__icons {
    gap: 1.5rem;
}

.footer__icons a {
    display: inline-flex;
    align-items: center;
    line-height: 1;
    color: #6b7280;
    transition: color 0.2s ease;
}

.footer__icons a:hover {
    color: var(--primary);
}

.header__icons a[data-tooltip],
.mobile-menu__icons a[data-tooltip],
.footer__icons a[data-tooltip] {
    position: relative;
}

.header__icons a[data-tooltip]::after,
.mobile-menu__icons a[data-tooltip]::after,
.footer__icons a[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 50%;
    transform: translateX(-50%) translateY(-4px);
    white-space: nowrap;
    padding: 0.35rem 0.6rem;
    font-size: 0.75rem;
    border-radius: 6px;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
    z-index: 20;
    background: #111827;
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
}

.header__icons a[data-tooltip]:hover::after,
.mobile-menu__icons a[data-tooltip]:hover::after {
    top: calc(100% + 0.35rem);
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
}

.footer__icons a[data-tooltip]:hover::after {
    bottom: calc(100% + 0.35rem);
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
}

.dark .header__icons a[data-tooltip]::after,
.dark .mobile-menu__icons a[data-tooltip]::after,
.dark .footer__icons a[data-tooltip]::after {
    background: #0b1020;
    color: #ffffff;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.45);
}

/* -------------------------------------------------------------------------- */
/* Case study pages                                                           */
/* -------------------------------------------------------------------------- */

.case .case-main {
    padding-top: 96px;
}

.case .case-section {
    padding: 6rem 0;
}

.case .case-section + .case-section {
    border-top: 1px solid #fafafa;
}

.case .case-section__container {
    display: grid;
    gap: 2.5rem;
    width: min(1100px, 94vw);
    margin: 0 auto;
}

.case p {
    color: #6b7280;
}

.case-hero {
    padding: 5rem 0 3.5rem;
}

.case-hero__container {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 2.5rem;
}

.case__toc {
    position: sticky;
    top: 132px;
    align-self: start;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: 0 20px 40px -30px rgba(15, 23, 42, 0.25);
}

.case__toc-title {
    display: block;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--accent);
}

.case__toc nav ul {
    display: grid;
    gap: 0.75rem;
    font-size: 0.92rem;
    color: var(--muted);
}

.case__toc nav a {
    color: inherit;
    transition: color 0.2s ease;
}

.case__toc nav a:hover,
.case__toc nav a.is-active {
    color: var(--primary);
}

.case__toc-toggle {
    display: none;
}

.case-hero__content {
    display: grid;
    gap: 1.75rem;
    justify-items: center;
}

.case__breadcrumb {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 500;
    color: var(--muted);
    transition: color 0.2s ease;
}

.case__breadcrumb:hover {
    color: var(--primary);
}

.case-hero__meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1.75rem;
}

@media (max-width: 720px) {
    .case-hero__meta {
        grid-template-columns: 1fr;
    }
}

.case-hero__metric {
    background: var(--bg-2);
    border-radius: 16px;
    padding: 1rem 1.25rem;
}

.case-hero__metric-label {
    display: block;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 0.4rem;
}

.case-hero__metric-value {
    font-weight: 600;
    color: var(--accent);
}

.case-grid.two {
    display: grid;
    gap: 1.75rem;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.case-grid.three {
    display: grid;
    gap: 1.75rem;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.case-grid.solution {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.case-grid.four {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.case-card,
.solution-card,
.impact-card {
    background: var(--white);
    border-radius: 20px;
    border: 1px solid var(--line);
    padding: 1.75rem;
    box-shadow: none;
    display: grid;
    gap: 0.75rem;
}

.solution-card h3,
.case-card h3,
.impact-card h3 {
    color: var(--accent);
    font-size: 1.05rem;
}

.case-highlight {
    background: rgba(52, 106, 255, 0.08);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 1.5rem 2rem;
    color: var(--accent);
    font-weight: 600;
}

.dark .case--aegis .case-card h3 {
    color: #6fa3d6;
}

.case-overview__grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.case-overview__grid h3 {
    margin-bottom: 0.5rem;
}

.dark .case-overview__grid h3 {
    color: #346aff;
}

.case-goals__list,
.case-future__list {
    display: grid;
    gap: 0.75rem;
    padding: 0;
    margin: 2rem 0 0;
    list-style: none;
}

.case-goals__list li,
.case-future__list li {
    padding-left: 1.6rem;
    position: relative;
}

.case-goals__list li::before,
.case-future__list li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--primary);
}

.case-figure {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.case-figure__img,
.figure__img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--bg-2);
    box-shadow: none;
    object-fit: cover;
}

.case-figure__img--flat {
    box-shadow: none;
    background: none;
}

.case-figure__img[data-fit="contain"] {
    object-fit: contain;
    padding: 1.6rem;
    background: var(--bg-2);
}

.case-figure__caption,
.figure__caption {
    font-size: 14px;
    color: var(--muted);
    margin-top: 0.75rem;
    text-align: center;
}

.case-gallery {
    margin-top: 2.5rem;
    display: grid;
    gap: 2rem;
}

/* Case study layout helpers (moved from inline HTML) */
.case--aegis .figure-large,
.case--logica .figure-large,
.case--timo .figure-large,
.case--timo-silver .figure-large {
    --case-figure-max-width: 1400px;
    width: 100vw;
    margin: 0;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    padding-inline: clamp(1rem, 6vw, 2.5rem);
    box-sizing: border-box;
}

.case--aegis .figure-large {
    --case-figure-max-width: 1280px;
}

.case--logica .figure-large,
.case--timo .figure-large,
.case--timo-silver .figure-large {
    --case-figure-max-width: 1280px;
}

.case--aegis .figure-large .figure__img,
.case--logica .figure-large .figure__img,
.case--timo .figure-large .figure__img,
.case--timo-silver .figure-large .figure__img {
    width: min(100%, var(--case-figure-max-width));
    height: auto;
    border-radius: 14px;
    display: block;
    margin: 0 auto;
}

.case--aegis .figure-large .figure__img,
.case--logica .figure-large .figure__img,
.case--timo .figure-large .figure__img {
    border: 1px solid var(--line);
    background: var(--bg);
    box-shadow: 0 18px 44px -28px rgba(15, 23, 42, 0.35);
}

.case--timo-silver .figure-large .figure__img,
.case--timo-silver .figure__img {
    border: none;
    background: none;
    box-shadow: none;
}

.case--aegis .figure-large .figure__img {
    box-shadow: none;
}

.case--timo-silver .figure__img {
    width: 100%;
    border-radius: 12px;
}

.case--aegis .figure-large .figure__caption,
.case--logica .figure-large .figure__caption,
.case--timo .figure-large .figure__caption,
.case--timo-silver .figure-large .figure__caption {
    margin: 12px auto 0;
    max-width: min(90ch, 92vw, var(--case-figure-max-width));
    text-align: center;
    font-size: 0.95rem;
    color: var(--muted);
}

.case--timo-silver .figure__caption {
    margin-top: 0.75rem;
    font-size: 0.95rem;
    color: var(--muted);
    text-align: center;
}

.case--aegis .gallery,
.case--logica .gallery,
.case--timo .gallery,
.case--timo-silver .gallery {
    display: grid;
    gap: 3rem;
}

.case--aegis .case-hero,
.case--logica .case-hero,
.case--timo .case-hero,
.case--timo-silver .case-hero {
    padding-bottom: 2rem;
}

.case--aegis .hero__logo,
.case--logica .hero__logo,
.case--timo .hero__logo,
.case--timo-silver .hero__logo {
    display: block;
    width: clamp(200px, 26vw, 300px);
    margin: clamp(1rem, 2.5vw, 1.75rem) auto;
}

.case--logica .hero__title {
    background: linear-gradient(90deg, #000f96 0%, #0076ea 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
}

.case--aegis .hero__logo {
    width: clamp(100px, 18vw, 150px);
}

@media (max-width: 640px) {
    .case--aegis .figure-large .figure__caption,
    .case--logica .figure-large .figure__caption,
    .case--timo .figure-large .figure__caption,
    .case--timo-silver .figure-large .figure__caption,
    .case--timo-silver .figure__caption {
        font-size: 0.9rem;
    }
}

.case--timo-silver .anchor-offset {
    height: 1px;
    scroll-margin-top: 120px;
}

/* =========================
   Aegis Clinician — Highlights
   Scoped to #highlights to avoid style bleed
   ========================= */

/* Subhead tone */
#highlights .section__subhead {
    margin-top: 0.5rem;
    color: var(--muted);
    font-size: 0.95rem;
}

/* --- V1 vs V2 side-by-side (first two figures inside #highlights) --- */
@media (min-width: 1100px) {
    #highlights .figure-large:nth-of-type(1),
    #highlights .figure-large:nth-of-type(2) {
        display: inline-block;
        vertical-align: top;
        width: calc(50% - 0.75rem);
        margin: 0;
        padding-inline: 0;
    }
    #highlights .figure-large:nth-of-type(1) .figure__img,
    #highlights .figure-large:nth-of-type(2) .figure__img {
        width: 100%;
        max-width: none;
    }
    #highlights .figure-large:nth-of-type(1) .figure__caption,
    #highlights .figure-large:nth-of-type(2) .figure__caption {
        max-width: 66ch;
        text-align: center;
    }
}

/* --- Five detail figures (3..7): image 2/3 + caption 1/3 --- */
@media (min-width: 1100px) {
    #highlights .figure-large:nth-of-type(n+3) {
        display: grid;
        grid-template-columns: 2fr 1fr;
        gap: 1.25rem;
        align-items: start;
        width: min(100%, 1280px);
        margin: 0 auto;
        padding-inline: 0;
    }
    #highlights .figure-large:nth-of-type(n+3) .figure__img {
        grid-column: 1;
        width: 100%;
        max-width: none;
    }
    #highlights .figure-large:nth-of-type(n+3) .figure__caption {
        grid-column: 2;
        text-align: left;
        max-width: 40ch;
        margin-top: 0.25rem;
    }
}

/* ===== Aegis: Highlights caption styling ===== */
#highlights .figure__caption {
    color: var(--muted);
    font-size: 0.95rem;
}

#highlights .figure__caption strong {
    color: var(--accent);
    font-size: 1.18rem;
    line-height: 1.35;
    margin-bottom: 0.3rem;
    display: block;
}

.case-gallery__heading {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
}

.case-gallery__grid {
    display: grid;
    gap: 1rem;
}

.case-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1.5rem;
}

.case-table th,
.case-table td {
    border: 1px solid var(--line);
    padding: 0.75rem;
    text-align: left;
    vertical-align: top;
}

.case-table th {
    color: var(--accent);
    font-weight: 600;
}

@media (min-width: 768px) {
    .case-gallery__grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    }
}


/* === Aegis Clinician: Reset Highlights to vertical stack === */
/* Desktop & up: force all figures to stack image (top) + caption (bottom) */
@media (min-width: 1100px) {
    /* Cancel the first-two side-by-side */
    #highlights .figure-large:nth-of-type(1),
    #highlights .figure-large:nth-of-type(2),
    /* Cancel the 2/3–1/3 grid for subsequent figures */
    #highlights .figure-large:nth-of-type(n+3) {
        display: block !important;
        width: 100% !important;
        margin: 0 auto !important;
        padding-inline: 0 !important;
    }

    #highlights .figure-large:nth-of-type(n+1) .figure__img {
        width: min(100%, 1280px) !important;
        max-width: none !important;
        display: block;
        margin: 0 auto;
    }

    #highlights .figure-large:nth-of-type(n+1) .figure__caption {
        text-align: center !important;
        max-width: min(90ch, 92vw, 1280px) !important;
        margin: 12px auto 0 !important;
    }

}

/* Mobile/tablet continue to stack naturally; no changes needed below 1100px */

.case-timeline .timeline__item {
    padding-left: 72px;
}

.case-timeline .timeline__marker {
    width: 36px;
    height: 36px;
}

.case-timeline ul {
    margin: 0;
    padding-left: 1.1rem;
    display: grid;
    gap: 0.4rem;
    color: var(--muted);
}

.impact-card {
    text-align: left;
}

.case .cta-card {
    border-radius: 24px;
    border: 1px solid var(--line);
}

.dark .case__toc {
    background: var(--bg-2);
    border-color: rgba(148, 163, 184, 0.35);
    box-shadow: 0 24px 48px -35px rgba(0, 0, 0, 0.55);
}

.dark .case--logica .section__title {
    background: linear-gradient(90deg, #6fa3d6 0%, #0076ea 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
}

.dark .case--logica .case-overview__grid h3 {
    color: #6fa3d6;
}

.dark .case--logica .hero__title {
    background: linear-gradient(90deg, #6fa3d6 0%, rgb(0, 118, 234) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
}

.dark .case--logica p,
.dark .case--logica .figure__caption,
.dark .case--logica .hero__description {
    color: #94a3b8;
}

.dark .case--logica .case-hero__metric-value {
    color: #6fa3d6;
}

.dark .case--aegis .section__title,
.dark .case--timo .section__title,
.dark .case--timo-silver .section__title {
    background: linear-gradient(90deg, #6fa3d6 0%, #0076ea 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
}

.dark .case--aegis .case-overview__grid h3,
.dark .case--timo .case-overview__grid h3,
.dark .case--timo-silver .case-overview__grid h3 {
    color: #6fa3d6;
}

.dark .case--aegis .hero__title,
.dark .case--timo .hero__title,
.dark .case--timo-silver .hero__title {
    background: linear-gradient(90deg, #6fa3d6 0%, rgb(0, 118, 234) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
}

.dark .case--aegis p,
.dark .case--aegis .figure__caption,
.dark .case--aegis .hero__description,
.dark .case--timo p,
.dark .case--timo .figure__caption,
.dark .case--timo .hero__description,
.dark .case--timo-silver p,
.dark .case--timo-silver .figure__caption,
.dark .case--timo-silver .hero__description {
    color: #94a3b8;
}

.dark .case--aegis .case-hero__metric-value,
.dark .case--timo .case-hero__metric-value,
.dark .case--timo-silver .case-hero__metric-value {
    color: #6fa3d6;
}

.dark .case-card,
.dark .solution-card,
.dark .impact-card {
    background: var(--surface-dark);
    border-color: rgba(148, 163, 184, 0.25);
    box-shadow: none;
}

.dark .case-highlight {
    background: rgba(96, 165, 250, 0.16);
    border-color: rgba(96, 165, 250, 0.28);
    color: #e2e8f0;
}

.dark .case-hero__metric {
    background: #1e293b;
}

.dark .case-hero__metric-value {
    color: #60a5fa;
}

.dark .case-figure__img,
.dark .figure__img {
    background: var(--surface-dark);
    border-color: rgba(148, 163, 184, 0.35);
    box-shadow: none;
}

.dark .case-figure__caption,
.dark .figure__caption,
.dark .portfolio-figure__caption {
    color: #6b7280;
}

.dark .case-section + .case-section {
    border-color: rgba(51, 65, 85, 0.5);
}

@media (max-width: 1024px) {
    .case-hero__container {
        grid-template-columns: 1fr;
    }

    .case__toc {
        position: static;
        order: -1;
        padding: 1rem 1.25rem;
    }

    .case__toc-title {
        display: none;
    }

    .case__toc-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        gap: 0.5rem;
        border: none;
        background: transparent;
        color: var(--accent);
        font-weight: 600;
        font-size: 0.95rem;
        cursor: pointer;
    }

    .case__toc-body {
        margin-top: 1rem;
    }

    .case .case-section {
        padding: 5rem 0;
    }
}

@media (max-width: 640px) {
    .case .case-section {
        padding: 4.25rem 0;
    }

    .case .case-section__container {
        gap: 1.75rem;
    }

    .case__toc {
        box-shadow: none;
        border-radius: 16px;
    }

    .case__toc-body {
        display: none;
    }

    .case__toc.is-open .case__toc-body {
        display: block;
    }

    .case-grid.four,
    .case-grid.solution {
        grid-template-columns: 1fr;
    }

    .case-hero__meta {
        grid-template-columns: 1fr;
    }
}

.lucide-icon {
    width: 20px;
    height: 20px;
    color: currentColor;
    stroke-width: 1.5;
    transition: color 0.2s ease;
}

.header__icons .lucide-icon,
.footer__icons .lucide-icon {
    stroke-width: 2;
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 0.5rem 0.6rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: transparent;
    color: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.theme-toggle:hover {
    transform: translateY(-1px);
}

.theme-toggle:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.toggle-icons {
    position: relative;
    display: inline-block;
    width: 22px;
    height: 22px;
}

#sun-icon,
#moon-icon {
    position: absolute;
    inset: 0;
    width: 22px;
    height: 22px;
    transition: opacity 0.35s ease, transform 0.35s ease;
}

#sun-icon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

#moon-icon {
    opacity: 0;
    transform: rotate(-90deg) scale(0.9);
}

.dark #sun-icon {
    opacity: 0;
    transform: rotate(90deg) scale(0.9);
}

.dark #moon-icon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

.hamburger {
    display: none;
    width: 48px;
    height: 48px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: var(--white);
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 6px;
}

.hamburger__bar {
    width: 20px;
    height: 2px;
    border-radius: 999px;
    background: var(--accent);
}

.dark .hamburger {
    background: #0f152a;
    border-color: #1f2937;
    box-shadow: 0 12px 28px -20px rgba(0, 0, 0, 0.55);
}

.dark .hamburger__bar {
    background: #e5edff;
}

.mobile-menu {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    top: 84px;
    background: var(--bg);
    border-top: 1px solid var(--line);
    padding: 1.5rem;
    gap: 1.25rem;
    z-index: 90;
}

.mobile-menu.open {
    display: grid;
}

.mobile-menu__nav {
    display: grid;
    gap: 0.9rem;
    font-weight: 600;
    color: #6b7280;
}

.mobile-menu__icons {
    justify-content: flex-start;
    margin-bottom: 0.75rem;
    gap: 1rem;
}

.mobile-menu__nav ul {
    display: grid;
    gap: 0.9rem;
}

.mobile-menu__nav a {
    color: inherit;
    display: block;
}

.hero__container {
    display: grid;
    gap: 2.5rem;
    justify-items: center;
}

.hero__card {
    position: relative;
    background: var(--white);
    color: var(--ink-2);
    border-radius: 28px;
    padding: 3rem;
    box-shadow: 0 0px 96px -32px rgba(5, 10, 94, 0.12);
    display: grid;
    gap: 1.6rem;
    text-align: center;
    width: 100%;
    max-width: 840px;
    margin: 0 auto;
}

.dark .hero__card {
    background: var(--surface-dark);
    color: var(--muted-dark);
    box-shadow: 0 48px 96px -32px rgba(5, 10, 94, 0.35);
}

.hero__card-chrome {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-start;
    justify-self: start;
}

.hero__title {
    font-size: clamp(2.2rem, 4vw, 3.4rem);
    line-height: 1.05;
    font-weight: 800;
    margin: 0 auto;
    margin-top: 1.5rem;
    max-width: 20ch;

    span.hero__title-break {
        display: block;
    }
}

.case-hero .hero__title {
    margin-top: 2.5rem;
}

.hero__logo {
    width: 60%;
    max-width: 360px;
    margin: 0.75rem auto 0;
    display: block;
    border: none;
}

.hero__description {
    font-size: 1.05rem;
    line-height: 1.7;
    margin: 0 auto;
    max-width: 42rem;
    color: #4b5563;
}

.hero__card-chrome span {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: transparent;
}

.hero__card-chrome span:nth-child(1) {
    background: #ff5f57;
}

.hero__card-chrome span:nth-child(2) {
    background: #febc2e;
}

.hero__card-chrome span:nth-child(3) {
    background: #28c840;
}

.hero__badge {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #6b7280;
    text-align: center;
    display: inline-block;
    margin-left: 0;
    justify-self: center;
    font-weight: 700;
}

@media (max-width: 640px) {
    .hero__card {
        padding: 2.25rem 1.75rem;
    }

    .hero__title {
        font-size: clamp(2rem, 8vw, 2.6rem);
        max-width: 16ch;
    }

    .hero__description {
        font-size: 0.98rem;
    }
}

.dark .hero__badge {
    color: #94a3b8;
}

.hero__title {
    font-size: clamp(2.5rem, 5vw, 3.4rem);
    font-weight: 700;
    margin: 0 0 0.5rem;
    text-align: center;
    justify-self: center;
    background: linear-gradient(90deg, #000f96 0%, #0076ea 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
}

.dark .hero__title {
    background: linear-gradient(90deg, #949fff 0%, rgb(0, 118, 234) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
}

/* Homepage dark-mode hero title override */
html.dark body.page:not(.case) .hero__title {
    background: linear-gradient(90deg, #6fa3d6 0%, #0076ea 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
}

.hero__description {
    color: var(--muted);
    font-size: 1.05rem;
    max-width: 640px;
    margin: 0 auto;
}

.dark .hero__description {
    color: #94a3b8;
}

.hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    margin-top: 1rem;
}

.hero__metrics {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    margin: 0 auto;
}

.metric {
    display: grid;
    gap: 0.5rem;
    text-align: center;
}

.metric__value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.metric__label {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--muted);
}

.metric p {
    margin: 0;
    font-size: 0.95rem;
    color: var(--muted);
}

.dark .metric__value {
    color: #60a5fa;
}

.dark .metric__label {
    color: #94a3b8;
}

.dark .metric p {
    color: #94a3b8;
}

.hero__panel {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    width: 100%;
    max-width: 840px;
    margin: 0 auto;
}

.dark .hero__panel {
    background: #111827;
    border-radius: 20px;
    padding: 1.25rem;
}

.panel-card {
    background: var(--bg);
    border-radius: 20px;
    border: 1px solid var(--line);
    padding: 2rem;
    box-shadow: 0 28px 70px -50px rgba(5, 10, 94, 0.25);
    color: var(--ink-2);
}

.panel-card__eyebrow {
    display: block;
    font-size: 14px;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--gray-dark);
    margin-bottom: 1rem;
}

.panel-card__logos {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.8rem;
    font-weight: 600;
    color: var(--accent);
}

.panel-card--quote {
    background: var(--bg);
    color: var(--ink-2);
    border: 0;
    box-shadow: 0 0px 70px -50px rgba(50, 10, 94, 0.25);
}

.panel-card__quote {
    font-size: 1.05rem;
    line-height: 1.6;
    margin-bottom: 1.25rem;
    color: var(--gray-dark);
    text-align: center;
}

.panel-card__author span {
    display: block;
    font-size: 0.88rem;
    color: var(--gray-mid);
}

.panel-card__author {
    text-align: right;
}

.section__header {
    display: grid;
    gap: 1rem;
    margin-bottom: 3rem;
    max-width: 780px;
}

.section__eyebrow {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 600;
    color: #000f96;
}

/* Targeted blue eyebrows */
#focus .section__eyebrow,
#services .section__eyebrow,
#testimonials .section__eyebrow,
#process .section__eyebrow,
#cases .section__eyebrow,
#about .section__eyebrow,
#faq .section__eyebrow {
    color: #000f96;
}

.dark #focus .section__eyebrow,
.dark #services .section__eyebrow,
.dark #process .section__eyebrow,
.dark #cases .section__eyebrow,
.dark #about .section__eyebrow,
.dark #faq .section__eyebrow {
    color: #6fa3d6;
}

#services .section__title {
    color: #0014c6;
}

.section__title {
    font-size: clamp(2rem, 3vw, 2.8rem);
    font-weight: 700;
}

.case .section__title {
    background: linear-gradient(90deg, rgb(0, 15, 150) 0%, rgb(0, 118, 234) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
}

.section__intro {
    color: var(--gray-mid);
    font-size: 1.02rem;
    max-width: 72ch;
    margin: 0.5rem auto 0;
}

.cta-card h2,
.surface-card h2,
.service-card h3,
.testimonial-card blockquote,
.timeline__body h3 {
    color: var(--accent);
}

.cta-card p,
.surface-card p {
    color: var(--gray-mid);
}

.surface-card h2,
.about-grid h2 {
    margin-top: 1.25rem;
    margin-bottom: 1rem;
}

.heading-about {
    margin-top: 1rem;
    margin-bottom: 1.25rem;
}

.pain-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.pain-card {
    background: #fafafa;
    border-radius: 18px;
    padding: 2rem;
    border: none;
    box-shadow: 0 24px 60px -48px rgba(15, 23, 42, 0.15);
    display: grid;
    gap: 1rem;
}

.pain-card h3 {
    color: var(--accent);
}

.pain-card__icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: rgba(52, 106, 255, 0.05);
    color: #050a5e;
    font-weight: 700;
    display: grid;
    place-items: center;
}

.dark .pain-card__icon {
    color: #6fa3d6;
}

.services-grid {
    display: grid;
    gap: 1.75rem;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.service-card {
    position: relative;
    padding: 2.5rem 2.25rem;
    border-radius: 26px;
    background: #fafafa;
    border: none;
    box-shadow: 0 30px 70px -50px rgba(15, 23, 42, 0.18);
    display: grid;
    gap: 1.2rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.service-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 24px 60px -30px rgba(15, 23, 42, 0.18);
}

.service-card__label {
    text-transform: uppercase;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 2px;
    color: #050a5e;
}

.dark .service-card__label {
    color: #6fa3d6;
}

.service-card__list {
    display: grid;
    gap: 0.45rem;
    color: var(--gray-mid);
    font-size: 0.95rem;
    padding-left: 1rem;
    list-style: disc;
}

.testimonials-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.testimonial-card {
    background: var(--white);
    border-radius: 22px;
    border: 1px solid var(--line);
    box-shadow: 0 24px 60px -48px rgba(15, 23, 42, 0.15);
    padding: 2.25rem;
    display: grid;
    gap: 1.5rem;
}

.testimonial-card blockquote {
    margin: 0;
    font-style: italic;
    color: var(--gray-dark);
}

.testimonial-card__author span {
    display: block;
    font-size: 0.9rem;
    color: var(--gray-mid);
}

.testimonial-highlight {
    margin-top: 2.5rem;
    padding: 1.6rem 2rem;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(52, 106, 255, 0.1) 0%, rgba(52, 106, 255, 0.08) 100%);
    border: 1px solid var(--line);
    color: var(--accent);
    font-weight: 700;
    line-height: 1.65;
    text-align: center;
}

.dark .testimonial-highlight {
    background: rgba(96, 165, 250, 0.16);
    border-color: rgba(96, 165, 250, 0.35);
    color: #e2e8f0;
}
.timeline {
    position: relative;
    display: grid;
    gap: 2.5rem;
    margin-top: 3rem;
}

.timeline__item {
    position: relative;
    padding-left: 56px;
    display: grid;
    gap: 1rem;
}

.timeline__marker {
    position: absolute;
    left: 0;
    top: 0.25rem;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    background: rgba(52, 106, 255, 0.05);
    color: var(--accent);
    font-weight: 700;
    display: grid;
    place-items: center;
    z-index: 2;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
    transition: background 0.25s ease, box-shadow 0.25s ease;
}

.timeline__marker:hover {
    background: #c7d9ff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.timeline__body ul {
    list-style: disc;
    padding-left: 1.2rem;
    color: var(--gray-mid);
    margin: 0;
}

.timeline__body h3 {
    margin: 0.25rem 0 0.875rem;
}

.timeline__body p {
    margin: 0.25rem 0 1.25rem;
}

.dark .timeline__marker {
    background: #1e293b;
    color: #e2e8f0;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.18);
}

.dark .timeline__marker:hover {
    background: #334155;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.dark .timeline__body ul {
    color: var(--muted-dark);
}

.portfolio-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.portfolio-grid--two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 960px) {
    .portfolio-grid--two {
        grid-template-columns: repeat(2, minmax(240px, 1fr));
    }
}

@media (max-width: 700px) {
    .portfolio-grid--two {
        grid-template-columns: 1fr;
    }
}

.portfolio-card {
    background: #fafafa;
    color: var(--gray-dark);
    border-radius: 20px;
    border: none;
    padding: 2rem;
    display: grid;
    gap: 1.25rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.portfolio-card:hover {
    transform: translateY(-6px);
    border-color: var(--line);
    box-shadow: 0 28px 70px -48px rgba(15, 23, 42, 0.2);
}

@media (max-width: 720px) {
    .surface-card,
    .service-card,
    .portfolio-card,
    .cta-card {
        padding: 2rem 1.6rem;
    }

    .service-grid,
    .portfolio-grid {
        gap: 1.25rem;
    }
}

.portfolio-figure {
    display: grid;
    gap: 0.5rem;
    margin: 1.2rem 0;
}

.portfolio-figure__img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 8px;
    border: 1px solid var(--line);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.portfolio-figure__img:not(img) {
    aspect-ratio: 16 / 9;
}

.portfolio-figure__img--logica {
    background-image: url('img/logica-thumbnail.jpg');
    background-color: #0f172a;
}

.portfolio-figure__img--timo-silver {
    background-image: url('img/timo-silver-thumbnail.jpg');
    background-color: #101f3f;
}

.portfolio-figure__img--timo {
    background-image: url('img/timo-thumbnail.jpg');
    background-color: #0f172a;
}

.portfolio-figure__img--aegis {
    background-image: url('img/aegis-thumbnail.jpg');
    background-color: #132234;
}

.portfolio-figure__caption {
    font-size: 14px;
    color: var(--muted);
    margin-top: 0.75rem;
    text-align: center;
}

.portfolio-thumb {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--accent);
}

.portfolio-body ul {
    list-style: disc;
    padding-left: 1.2rem;
    margin: 0;
    font-size: 0.92rem;
    color: var(--gray-mid);
}

.about-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 2rem;
}

.tag-pill {
    padding: 0.45rem 0.95rem;
    border-radius: 999px;
    background: rgb(242, 242, 247);
    border: 1px solid var(--line);
    color: rgb(58, 58, 60);
    font-weight: 400;
    font-size: 12px;
}

.dark .tag-pill {
    background: rgba(74, 74, 74, 0.25);
    border: 1px solid var(--line);
    color: #94a3b8;
}
.bullet-list {
    list-style: disc;
    padding-left: 1.2rem;
    color: var(--gray-mid);
    margin: 1.25rem 0;
    display: grid;
    gap: 0.5rem;
}

.dark .bullet-list {
    color: #94a3b8;
}

.faq-list {
    display: grid;
    gap: 1rem;
}

.faq-item {
    border-radius: 18px;
    border: 1px solid var(--line);
    background: var(--white);
    box-shadow: 0 20px 60px -50px rgba(15, 23, 42, 0.2);
    padding: 1.2rem 1.6rem;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.faq-item[open] {
    border-color: var(--line);
    background: rgba(52, 106, 255, 0.05);
}

.faq-item summary {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
    color: var(--accent);
    list-style: none;
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item__icon {
    display: inline-grid;
    place-items: center;
    width: 22px;
    height: 22px;
    margin-right: 4px;
    border-radius: 6px;
    color: #6b7280;
    transition: transform 220ms cubic-bezier(.2,.7,.4,1), color 220ms ease;
}

details[open] .faq-item__icon {
    transform: rotate(45deg);
    color: var(--primary);
}

.faq-item__content {
    overflow: clip;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 240ms ease, transform 240ms ease;
}

details[open] .faq-item__content {
    opacity: 1;
    transform: translateY(0);
}

.faq-item__content p {
    margin: 0.9rem 0 0;
    color: var(--gray-mid);
    font-size: 0.98rem;
}

.dark .faq-item summary {
    color: #e2e8f0;
}

.dark .faq-item__content p {
    color: var(--muted-dark);
}

.cta-card {
    background: var(--white);
    border-radius: 26px;
    border: none;
    padding: 3rem;
    box-shadow: 0 0px 80px -48px rgba(15, 23, 42, 0.18);
    display: flex;
    flex-wrap: wrap;
    gap: 2.5rem;
    align-items: center;
    justify-content: space-between;
}

.cta-card__content {
    max-width: 620px;
}

.cta-card__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.cta-card__content h2 {
    margin-bottom: 1.75rem;
}

.footer {
    background: transparent;
    border-top: 1px solid var(--line);
    padding: 1.5rem 0;
    color: #6b7280;
}

.footer__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.footer__inner > * {
    flex: 0 0 auto;
}

.footer__brand strong {
    display: block;
    color: #6b7280;
    font-weight: 700;
    margin-bottom: 0.4rem;
}

.footer__brand span {
    color: #6b7280;
    font-size: 0.92rem;
}

.footer__links {
    display: flex;
    gap: 1.25rem;
    font-weight: 600;
    color: #6b7280;
}

.footer__links a:hover {
    color: var(--primary);
}

.footer__meta {
    color: #6b7280;
    font-size: 0.9rem;
}

.fade-in {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.55s ease, transform 0.55s ease;
}

.fade-in.is-visible {
    opacity: 1;
    transform: translateY(0);
}

html:not(.dark) #cases .portfolio-grid--two.fade-in.is-visible p {
    color: #6b7280;
}

/* Index light-mode text tweaks */
html:not(.dark) #focus .pain-card p {
    color: #6b7280;
}

html:not(.dark) #services .service-card p,
html:not(.dark) #services .service-card__list {
    color: #6b7280;
}

html:not(.dark) #process .timeline__body p {
    color: #6b7280;
}

html:not(.dark) #services .service-card__list p,
html:not(.dark) #services .service-card__list ul,
html:not(.dark) #cases .portfolio-body p {
    color: #6b7280;
}

.footer__copy {
    font-size: 0.9rem;
    color: #6b7280;
    text-align: center;
    transition: opacity 0.2s ease;
    flex: 1 1 auto;
}

.footer__copy:hover {
    opacity: 0.75;
}

.text-muted {
    color: var(--gray-mid);
}

.text-muted-foreground {
    color: var(--gray-mid);
}

.text-sm {
    font-size: 0.875rem;
}

.dark .text-muted {
    color: var(--muted-dark);
}

.dark .text-muted-foreground {
    color: var(--muted-dark);
}

.dark .site-header {
    background: var(--surface-dark);
    border-bottom: 1px solid #1f2937;
}

.dark .nav__link {
    color: #94a3b8;
}

.dark .nav-link {
    color: #94a3b8;
}

.dark .nav-link:hover {
    color: var(--primary);
}

.dark .nav__button {
    color: #94a3b8;
}

.dark .header__icons .lucide-icon,
.dark .mobile-menu__icons .lucide-icon,
.dark .footer__icons .lucide-icon {
    color: #94a3b8;
}

.dark .header__icons a,
.dark .mobile-menu__icons a,
.dark .footer__icons a {
    color: #94a3b8;
}

.dark .header__icons a {
    color: #d7e0ff;
    text-shadow: 0 6px 18px rgba(5, 10, 94, 0.35);
}

.dark .header__icons a:hover {
    color: #8bb6ff;
}

.dark .header__icons .lucide-icon {
    color: currentColor;
}

.dark .section__eyebrow {
    color: #6fa3d6;
}

.dark .section__title {
    color: #e2e8f0;
}

.dark .case .section__title {
    background: linear-gradient(90deg, #6fa3d6 0%, #0076ea 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
}

.dark .section__intro {
    color: #94a3b8;
}

.dark .lucide-icon:hover {
    color: var(--primary);
}

.dark .theme-toggle {
    border-color: rgba(148, 163, 184, 0.4);
    color: var(--muted);
}

.dark .case--timo-silver .section__eyebrow {
    color: #6fa3d6;
}

.dark .theme-toggle:hover {
    transform: translateY(-1px);
}

.dark .mobile-menu {
    background: var(--surface-dark);
    border-top: 1px solid var(--line);
}

.dark .mobile-menu__nav {
    color: #94a3b8;
}

.dark .mobile-menu__nav a {
    color: #94a3b8;
}

.dark .hero__card-chrome span {
    background: transparent;
}

.dark .hero__card-chrome span:nth-child(1) {
    background: #ff5f57;
}

.dark .hero__card-chrome span:nth-child(2) {
    background: #febc2e;
}

.dark .hero__card-chrome span:nth-child(3) {
    background: #28c840;
}

.dark .panel-card {
    background: var(--surface-dark);
    border-color: rgba(148, 163, 184, 0.25);
    color: var(--muted-dark);
}

.dark .panel-card__logos span {
    color: #e2e8f0;
}

.dark .panel-card--quote {
    background: #111827;
    color: #e5e7eb;
    border-color: rgba(96, 165, 250, 0.35);
}

.dark .panel-card__quote {
    color: #e2e8f0;
}

.dark .panel-card__author span {
    color: var(--muted-dark);
}

.dark .pain-card,
.dark .service-card,
.dark .surface-card,
.dark .testimonial-card,
.dark .faq-item,
.dark .cta-card {
    background: var(--surface-dark);
    border-color: rgba(148, 163, 184, 0.2);
    color: var(--muted);
}

.dark .portfolio-card {
    background: var(--surface-dark);
    border-color: rgba(148, 163, 184, 0.25);
    color: #e5e7eb;
}

.dark .portfolio-thumb {
    color: #e5e7eb;
}

.dark .portfolio-body ul {
    color: var(--muted-dark);
}

.dark .faq-item[open] {
    background: rgba(52, 106, 255, 0.12);
    border-color: rgba(96, 165, 250, 0.35);
}

.dark .btn--outline {
    border-color: rgba(96, 165, 250, 0.35);
    color: #e2e8f0;
}

.dark .btn--outline:hover {
    border-color: rgba(96, 165, 250, 0.5);
    color: #60a5fa;
}

.dark .btn--ghost,
.dark .btn--ghost-light {
    background: rgba(96, 165, 250, 0.15);
    color: #60a5fa;
    border-color: rgba(96, 165, 250, 0.25);
}

.dark .cta-card h2,
.dark .surface-card h2,
.dark .service-card h3,
.dark .pain-card h3,
.dark .testimonial-card blockquote,
.dark .timeline__body h3 {
    color: #e2e8f0;
}

.dark .cta-card p,
.dark .surface-card p,
.dark .service-card__list,
.dark .testimonial-card__author span,
.dark .pain-card p,
.dark .timeline__body ul,
.dark .section__intro,
.dark .portfolio-body ul {
    color: #94a3b8;
}

.dark p {
    color: #94a3b8;
}

.dark .footer {
    background: transparent;
    border-top: 1px solid var(--line);
}

.dark .footer__copy {
    color: #6b7280;
}

/* -------------------------------------------------------------------------- */
/* Supporting layout for detail & résumé pages                                */
/* -------------------------------------------------------------------------- */

.navbar {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    z-index: 90;
    background: var(--white);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(12px);
}

.nav-container {
    width: min(1180px, 92vw);
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    padding: 1.25rem 0;
}

.nav-logo .logo-text {
    font-weight: 700;
    color: var(--accent);
}

.nav-menu {
    display: flex;
    gap: 1.25rem;
    font-weight: 500;
    font-size: 0.95rem;
}

.nav-link {
    color: rgba(30, 30, 35, 0.65);
    transition: color 0.2s ease;
}

.nav-link:hover {
    color: var(--primary);
}

.project-detail,
.resume {
    padding: 5rem 0;
}

.project-detail .container,
.resume .container {
    width: min(1040px, 92vw);
    margin: 0 auto;
    display: grid;
    gap: 3rem;
}

.project-header {
    display: grid;
    gap: 1.5rem;
}

.project-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    color: rgba(30, 30, 35, 0.56);
}

.project-image .image-placeholder {
    background: rgba(52, 106, 255, 0.08);
    border-radius: 20px;
    padding: 3rem;
    text-align: center;
    color: var(--accent);
    border: 1px dashed var(--line);
}

.overview-grid {
    display: grid;
    gap: 2rem;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.overview-text p {
    color: var(--gray-mid);
}

.overview-details {
    display: grid;
    gap: 1rem;
}

.detail-item {
    border-radius: 16px;
    border: 1px solid var(--line);
    background: var(--white);
    padding: 1.25rem 1.4rem;
}

.detail-item h3 {
    margin-bottom: 0.35rem;
    font-size: 14px;
    text-transform: uppercase;
    color: var(--gray-dark);
}

.features-grid,
.highlights-content,
.concept-content,
.tech-content,
.architecture-content,
.screenshots-grid,
.results-grid,
.project-list,
.resume-grid {
    display: grid;
    gap: 1.4rem;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.project-features h2,
.project-results h2,
.project-overview h2 {
    color: var(--accent);
}

.feature-card,
.concept-item,
.tech-item,
.architecture-item,
.highlight-item,
.results-grid .result-item,
.project-list > div,
.resume-grid > div {
    background: var(--white);
    border-radius: 18px;
    border: 1px solid var(--line);
    padding: 1.8rem;
}

.feature-card h3,
.concept-item h3,
.tech-item h3,
.highlight-item h3,
.results-grid .result-item h3 {
    margin-bottom: 0.5rem;
    color: var(--accent);
}

.back-to-portfolio {
    margin-top: 2.5rem;
}

.back-to-portfolio .btn {
    border-radius: 999px;
}

@media (max-width: 1024px) {
    .nav,
    .header__icons {
        display: none;
    }

    .hamburger {
        display: flex;
    }

    .hero__card {
        padding: 2.5rem;
    }

    .cta-card {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 768px) {
    .header__inner {
        padding: 1rem 0;
    }

    section {
        padding: 3.75rem 0;
    }

    .timeline__item {
        padding-left: 58px;
    }

    .timeline__marker {
        width: 36px;
        height: 36px;
        border-radius: 12px;
    }
}

@media (max-width: 520px) {
    .hero__card {
        padding: 2rem;
    }

    .hero__actions,
    .cta-card__actions {
        flex-direction: column;
        align-items: stretch;
    }

    .btn {
        width: 100%;
    }
}

/* --- Aegis readability tweaks --- */
.case--aegis .prose-narrow { max-width: 72ch; margin-inline: auto; }
.case--aegis .lead { font-size: clamp(1.05rem, 1.2vw, 1.15rem); color: var(--ink-2); }
.case--aegis .kicker { text-transform: uppercase; font-weight: 600; color: var(--muted); }
.case--aegis .bullet { margin: 0; padding-left: 1.1rem; }
.case--aegis .bullet li { margin: .25rem 0; }
.case--aegis .case-hero__metric { padding:.9rem 1.1rem; }
.case--aegis .figure-large .figure__caption { font-size: .95rem; }
.case--aegis .case-highlight { line-height:1.55; }

/* optional: narrow text columns inside heavy sections */
.case--aegis .section .copy { max-width: 78ch; }

/* --- Case table: compact variant that aligns with site scale --- */
.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--line);
    border-radius: 14px;
}

.case-table.compact {
    font-size: 0.95rem;
    width: 100%;
    border-collapse: collapse;
    background: var(--bg);
}

.case-table.compact thead th {
    position: sticky;
    top: 0;
    background: var(--bg-2);
    color: var(--accent);
}

.case-table.compact th,
.case-table.compact td {
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

.case-table.compact th:first-child { width: 160px; }
.case-table.compact th:nth-child(2) { width: 28%; }
.case-table.compact th:nth-child(3) { width: 28%; }
.case-table.compact th:nth-child(4) { width: 24%; }

.case-table.compact tbody tr:nth-child(even) td {
    background: color-mix(in srgb, var(--bg-2) 45%, transparent);
}

@media (max-width: 720px) {
    .case-table.compact thead {
        display: none;
    }
    .case-table.compact,
    .case-table.compact tbody,
    .case-table.compact tr,
    .case-table.compact td {
        display: block;
        width: 100%;
    }
    .case-table.compact tr {
        border: 1px solid var(--line);
        border-radius: 12px;
        background: var(--bg);
        padding: 0.9rem 0.9rem 0.75rem;
        margin-bottom: 0.9rem;
    }
    .case-table.compact td {
        border: 0;
        padding: 0.25rem 0;
    }
    .case-table.compact td:first-child {
        font-weight: 700;
        color: var(--accent);
        padding-top: 0;
    }
}

html.dark .case-table.compact thead th {
    background: var(--bg-2);
}

/* --- Impact: metric-first table refinements (theme-aware) --- */
.case-table.metric-first {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg);
    font-size: 0.95rem;
    line-height: 1.5;
}

.case-table.metric-first thead th {
    background: var(--bg-2);
    color: var(--accent);
    border: 1px solid var(--line);
    padding: 0.7rem 0.9rem;
    text-align: left;
    font-weight: 700;
}

.case-table.metric-first td {
    border: 1px solid var(--line);
    padding: 0.7rem 0.9rem;
    vertical-align: top;
}

.case-table.metric-first tbody tr:nth-child(even) td {
    background: color-mix(in srgb, var(--bg-2) 45%, transparent);
}

.case-table.metric-first td:first-child,
.case-table.metric-first th:first-child {
    width: 220px;
    white-space: nowrap;
}

.case-table.metric-first td:first-child strong {
    font-weight: 800;
}

.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--line);
    border-radius: 14px;
}

html.dark .case-table.metric-first thead th {
    background: var(--bg-2);
}

/* Aegis compact comparison table — inherits case study look & feel */
.aegis-compact-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow: hidden;
    background: var(--bg);
    font-size: 0.98rem;
}

.aegis-compact-table thead th {
    text-align: left;
    padding: 0.9rem 1rem;
    background: var(--bg-2);
    color: var(--ink);
    font-weight: 700;
    border-bottom: 1px solid var(--line);
}

.aegis-compact-table tbody th[scope="row"] {
    width: 16ch;
    padding: 0.9rem 1rem;
    color: var(--ink);
    font-weight: 700;
    border-right: 1px solid var(--line);
    vertical-align: top;
    text-align: left;
}

.aegis-compact-table td {
    padding: 0.9rem 1rem;
    color: var(--muted);
    vertical-align: top;
    border-left: 1px dashed var(--line);
}

.aegis-compact-table tbody tr + tr td,
.aegis-compact-table tbody tr + tr th {
    border-top: 1px solid var(--line);
}

.aegis-compact-table td strong {
    color: var(--accent);
    font-weight: 700;
}

html.dark .aegis-compact-table td strong {
    color: #6fa3d6;
}

.v1v2-compact {
    margin-bottom: 20px;
}
.v1v2-compact .case-figure {
    margin-top: 20px;
}

.dark #v1v2-title {
    color: #6fa3d6;
}

/* Responsive stacking on small screens */
@media (max-width: 760px) {
    .aegis-compact-table thead {
        display: none;
    }

    .aegis-compact-table,
    .aegis-compact-table tbody,
    .aegis-compact-table tr,
    .aegis-compact-table td,
    .aegis-compact-table th {
        display: block;
        width: 100%;
    }

    .aegis-compact-table tbody th[scope="row"] {
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .aegis-compact-table td {
        border-left: 0;
        padding-top: 0.5rem;
    }

    .aegis-compact-table tbody tr {
        border-bottom: 1px solid var(--line);
        padding: 0.6rem 0;
    }
}
