html {
    scroll-padding-top: 6.5rem;
}

@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.6;
}

a:focus-visible,
button:focus-visible {
    outline: 2px solid #1d1d1f;
    outline-offset: 4px;
    border-radius: 8px;
}

.section-divider {
    height: 1px;
    background: #e9ecef;
    margin: 4rem 0;
}

.hover-lift {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hover-lift:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

/* Header */

.nav-link {
    font-size: 0.95rem;
    color: #1d1d1f;
    transition: color 0.2s ease;
}

.nav-link:hover {
    color: #6c757d;
}

.nav-link[aria-current="page"] {
    text-decoration: underline;
    text-underline-offset: 6px;
    text-decoration-thickness: 1px;
}

.language-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: white;
    transition: all 0.2s ease;
}

.language-toggle:hover {
    border-color: #9ca3af;
    background: #f9fafb;
}

.flag {
    font-size: 16px;
    line-height: 1;
}

@media (max-width: 479px) {
    header nav.container {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    header nav.container > div.flex {
        gap: 0.625rem;
    }

    header nav.container > a img {
        height: 1.75rem;
    }

    header nav .nav-link {
        font-size: 0.8rem;
    }

    header nav .language-toggle {
        padding: 6px 8px;
    }

    header nav .flag {
        display: none;
    }

    header nav a.border {
        padding: 0.375rem 0.625rem;
        font-size: 0.8rem;
    }
}

/* Editorial elements */

.eyebrow {
    display: block;
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #86868b;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.tag {
    font-size: 0.8rem;
    color: #6c757d;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    padding: 4px 12px;
    line-height: 1.4;
}

/* Project media */

.media {
    position: relative;
    aspect-ratio: 16 / 9;
    background: #f5f5f7;
    border: 1px solid #eef0f2;
    border-radius: 12px;
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.media--4x3 {
    aspect-ratio: 4 / 3;
}

.media--dashboard {
    aspect-ratio: 1024 / 440;
    background: #0d1117;
    border-color: #1f2937;
}

.media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media img.media-contain {
    object-fit: contain;
}

.media-placeholder {
    display: flex;
    align-items: flex-end;
    height: 100%;
    padding: 20px 24px;
    font-size: 0.8rem;
    letter-spacing: 0.04em;
    color: #86868b;
}

/* Confidential horizon panel (Blue World) */

.horizon-panel {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 28px;
    min-height: 280px;
    padding: 24px;
    border-radius: 12px;
    background: #1d1d1f;
    color: #f5f5f7;
    transition: box-shadow 0.2s ease;
}

.horizon-panel-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px 16px;
    font-size: 0.8rem;
    color: #a1a1a6;
}

.horizon-panel .eyebrow {
    color: #a1a1a6;
}

.horizon-grid {
    display: grid;
    grid-template-columns: minmax(108px, 1.4fr) repeat(3, minmax(0, 1fr));
    align-items: center;
    gap: 16px 10px;
    font-size: 0.8rem;
}

.h-label {
    color: #d2d2d7;
}

.h-col {
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #a1a1a6;
}

.redact {
    display: block;
    height: 10px;
    border-radius: 3px;
    background: #f5f5f7;
    opacity: 0.85;
}

.redact--span {
    grid-column: span 3;
}

@media (min-width: 768px) {
    .horizon-panel--large {
        gap: 44px;
        padding: 48px;
    }

    .horizon-panel--large .horizon-grid {
        gap: 24px 24px;
        font-size: 0.95rem;
    }

    .horizon-panel--large .redact {
        height: 12px;
    }
}

/* Constraint panel (StockGPT Engine card) */

.constraint-panel {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 28px;
    min-height: 280px;
    padding: 24px;
    border: 1px solid #eef0f2;
    border-radius: 12px;
    background: #f5f5f7;
    transition: box-shadow 0.2s ease;
}

.constraint-panel ul {
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 1.35rem;
    font-weight: 300;
    line-height: 1.3;
}

.constraint-panel li {
    padding: 12px 0;
    border-top: 1px solid #d1d5db;
}

/* Evaluation measures */

.measures {
    list-style: none;
    margin: 0;
    padding: 0;
    border-top: 1px solid #e9ecef;
}

.measures li {
    padding: 14px 0;
    border-bottom: 1px solid #e9ecef;
    font-size: 1.05rem;
    color: #1d1d1f;
}

/* Beyond the state of the art */

.sota {
    display: grid;
    gap: 2rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.sota h3 {
    margin-bottom: 0.5rem;
    font-size: 1.125rem;
    font-weight: 500;
    color: #1d1d1f;
}

.sota p {
    font-size: 1.05rem;
    line-height: 1.65;
    color: #6c757d;
}

.project-link:hover .horizon-panel,
.project-link:hover .constraint-panel {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

/* Project links */

.project-link {
    display: block;
    border-radius: 12px;
}

.project-link:hover .media {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.project-cta {
    font-weight: 500;
    color: #1d1d1f;
}

.project-link:hover .project-cta,
.text-link:hover {
    text-decoration: underline;
    text-underline-offset: 5px;
    text-decoration-thickness: 1px;
}

/* Case study */

.case-row {
    display: grid;
    gap: 1rem;
    padding: 3rem 0;
    border-top: 1px solid #e9ecef;
}

@media (min-width: 768px) {
    .case-row {
        grid-template-columns: 1fr 2fr;
        gap: 3rem;
    }
}

.case-row h2 {
    font-size: 1.25rem;
    font-weight: 500;
}

.case-row p + p {
    margin-top: 1.25rem;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 300;
    line-height: 1.1;
}

/* Architecture flow */

.flow {
    list-style: none;
    margin: 0 0 0 6px;
    padding: 0;
    border-left: 1px solid #d1d5db;
}

.flow li {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0 0 22px 28px;
}

.flow li:last-child {
    padding-bottom: 0;
}

.flow li::before {
    content: '';
    position: absolute;
    left: -5px;
    top: 0.55em;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #1d1d1f;
}

.flow-name {
    font-size: 1.05rem;
}

.flow-step {
    display: inline-block;
    min-width: 2rem;
    color: #86868b;
    font-variant-numeric: tabular-nums;
}

.flow-kind {
    padding-left: 2rem;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #86868b;
}

@media (min-width: 640px) {
    .flow li {
        flex-direction: row;
        align-items: baseline;
        justify-content: space-between;
        gap: 16px;
    }

    .flow-kind {
        padding-left: 0;
        white-space: nowrap;
    }
}

/* Funding acknowledgement */

.funding-logos {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 24px 40px;
}

.funding-logos img {
    height: 44px;
    width: auto;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition: none !important;
        animation: none !important;
    }

    .hover-lift:hover {
        transform: none;
    }
}
