/* Systèmes Calibre — V2 (Phil the AI Guy) */

/* Self-hosted fonts — no Google Fonts CDN, no third-party requests */
@font-face {
    font-family: 'Inter';
    src: url('/assets/fonts/Inter-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Inter';
    src: url('/assets/fonts/Inter-Medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Inter';
    src: url('/assets/fonts/Inter-SemiBold.ttf') format('truetype');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Inter';
    src: url('/assets/fonts/Inter-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'JetBrains Mono';
    src: url('/assets/fonts/JetBrainsMono-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'JetBrains Mono';
    src: url('/assets/fonts/JetBrainsMono-Medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'JetBrains Mono';
    src: url('/assets/fonts/JetBrainsMono-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* Brand tokens — single source of truth lives in brand_kit/colors/colors.json */
:root {
    --primary: #1E40AF;
    --paper: #F8FAFC;
    --dark: #0F172A;
    --muted: #64748B;
    --gray: #CBD5E1;
    --amber: #D97706;

    --measure: 64ch;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--paper);
    color: var(--dark);
    line-height: 1.7;
    min-height: 100vh;
    font-size: 17px;
}

.container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 32px;
}

/* Header */
.site-header {
    background: var(--paper);
    border-bottom: 1px solid var(--gray);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}
.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}
.logo {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: 16px;
    color: var(--primary);
    text-decoration: none;
    letter-spacing: 0;
}
.logo__bracket {
    color: var(--amber);
}
.site-header nav {
    display: flex;
    gap: 22px;
    align-items: center;
}
.site-header nav a {
    color: var(--muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}
.site-header nav a:hover { color: var(--primary); }

/* Mobile nav toggle — CSS-only hamburger, no JS */
.nav-toggle { display: none; }
.nav-toggle-label { display: none; }

.lang-toggle {
    display: inline-flex;
    gap: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 500;
    border: 1.5px solid var(--gray);
    border-radius: 6px;
    padding: 4px 8px;
}
.lang-toggle a { color: var(--muted); text-decoration: none; }
.lang-toggle a:hover { color: var(--primary); }
.lang-toggle span[aria-current="true"] { color: var(--primary); font-weight: 700; }

/* Page content */
main {
    min-height: 60vh;
}
.page, .work {
    padding: 64px 32px 96px;
    max-width: 1080px;
    margin: 0 auto;
}
.page > h1, .work > h1 {
    font-size: 36px;
    font-weight: 800;
    line-height: 1.2;
    color: var(--dark);
    letter-spacing: -0.5px;
    max-width: var(--measure);
    margin-bottom: 24px;
}
.work .subtitle {
    font-size: 20px;
    color: var(--muted);
    margin-bottom: 40px;
    max-width: var(--measure);
}
.work__hero {
    margin: 0 0 40px;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    background: var(--gray);
}
.work__hero img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 3 / 2;
    object-fit: cover;
}
.work__figure {
    margin: 48px 0;
    width: 100%;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--paper);
    border: 1px solid var(--gray);
}
.work__figure img {
    display: block;
    width: 100%;
    height: auto;
}
.work__bridge {
    font-size: 17px;
    font-weight: 600;
    color: var(--dark);
    margin: 40px 0 12px;
    max-width: var(--measure);
    line-height: 1.5;
}

article p,
article ul,
article ol {
    max-width: var(--measure);
    margin-bottom: 20px;
    font-size: 17px;
    line-height: 1.8;
}
article h2 {
    font-size: 26px;
    font-weight: 700;
    color: var(--dark);
    margin-top: 48px;
    margin-bottom: 16px;
    max-width: var(--measure);
}
article h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--dark);
    margin-top: 32px;
    margin-bottom: 12px;
    max-width: var(--measure);
}
article a {
    color: var(--primary);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}
article a:hover {
    text-decoration-thickness: 2px;
}
article ul, article ol {
    padding-left: 24px;
}
article strong { color: var(--dark); }
article code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.92em;
    background: var(--gray);
    padding: 1px 6px;
    border-radius: 4px;
}

/* Related links on /work/ deep pages */
.related {
    margin-top: 64px;
    padding-top: 32px;
    border-top: 1px solid var(--gray);
}
.related h2 {
    font-size: 20px;
    margin-top: 0;
    margin-bottom: 16px;
}
.related ul { list-style: none; padding: 0; }
.related li { margin-bottom: 8px; }

/* Footer */
.site-footer {
    border-top: 1px solid var(--gray);
    padding: 48px 0;
    margin-top: 96px;
}
.site-footer .container {
    display: flex;
    flex-direction: column;
    gap: 24px;
    align-items: center;
    text-align: center;
}
.site-footer .contact p {
    font-size: 14px;
    color: var(--muted);
    margin-bottom: 4px;
}
.site-footer .contact a {
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    color: var(--primary);
    text-decoration: none;
}
.site-footer .legal p {
    font-size: 12px;
    color: var(--muted);
    margin: 0;
}
.site-footer .legal a {
    color: var(--muted);
    text-decoration: none;
}
.site-footer .legal a:hover {
    color: var(--primary);
}

/* Hero (homepage) */
.hero {
    background: var(--paper);
    padding: 72px 0 64px;
    border-bottom: 1px solid var(--gray);
}
.hero__grid {
    display: grid;
    grid-template-columns: 1.05fr 1fr;
    gap: 56px;
    align-items: center;
}
.hero__text h1 {
    font-size: 52px;
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: -1.5px;
    color: var(--dark);
    margin-bottom: 20px;
}
.hero__accent {
    color: var(--primary);
}
.hero__sub {
    font-size: 22px;
    line-height: 1.5;
    color: var(--muted);
    max-width: 36ch;
    margin-bottom: 16px;
}
.hero__kicker {
    font-size: 16px;
    line-height: 1.5;
    color: var(--muted);
    max-width: 40ch;
    margin-bottom: 32px;
    font-style: italic;
}
.hero__cta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}
.btn {
    display: inline-block;
    padding: 14px 24px;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    border-radius: var(--radius);
    border: 2px solid transparent;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
    font-family: inherit;
}
.btn--primary {
    background: var(--primary);
    color: #FFFFFF;
    box-shadow: var(--shadow);
}
.btn--primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}
.btn--ghost {
    color: var(--primary);
    border-color: var(--primary);
    background: transparent;
}
.btn--ghost:hover {
    background: var(--primary);
    color: #FFFFFF;
}
.hero__visual img {
    display: block;
    width: 100%;
    height: auto;
    max-width: 520px;
    margin-left: auto;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

/* Generic section spacing */
.section {
    padding: 80px 0;
}
.section + .section {
    border-top: 1px solid var(--gray);
}
.section--narrow .container > h2 {
    font-size: 30px;
    font-weight: 800;
    color: var(--dark);
    letter-spacing: -0.5px;
    margin-bottom: 20px;
    max-width: var(--measure);
}
.section--narrow .container > p {
    font-size: 18px;
    line-height: 1.75;
    color: var(--dark);
    max-width: var(--measure);
    margin-bottom: 16px;
}
.section--narrow .container > .section__cta {
    margin-top: 24px;
}
.section__cta a {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
    font-size: 16px;
}
.section__cta a:hover {
    text-decoration: underline;
}
.section--work > .container > h2 {
    font-size: 34px;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--dark);
    margin-bottom: 12px;
    text-align: center;
}
.section__lead {
    font-size: 18px;
    color: var(--muted);
    text-align: center;
    max-width: 60ch;
    margin: 0 auto 48px;
}

/* Card grid (homepage + work index) */
.cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 32px;
}
.cards--related {
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-top: 56px;
}
.cards--related .card__img {
    aspect-ratio: 3 / 2;
}
.cards--related h3 {
    font-size: 18px;
    line-height: 1.3;
}
.cards--related p {
    font-size: 15px;
    line-height: 1.5;
}
.card {
    background: #FFFFFF;
    border: 1px solid var(--gray);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    display: flex;
    flex-direction: column;
}
.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}
.card__link {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 0;
    text-decoration: none !important;
    color: inherit;
}
.card__img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 3 / 2;
    object-fit: cover;
    border-bottom: 1px solid var(--gray);
}
.card__link h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--dark);
    line-height: 1.3;
    margin: 24px 24px 12px;
}
.card__link p {
    font-size: 15px;
    line-height: 1.65;
    color: var(--dark);
    margin: 0 24px 16px;
}
.card__subtitle {
    color: var(--muted) !important;
    font-size: 14px !important;
    font-style: italic;
    margin-bottom: 12px !important;
}
.card__more {
    display: inline-block;
    margin: auto 24px 24px;
    color: var(--primary);
    font-weight: 600;
    font-size: 14px;
}
.card__link:hover .card__more {
    text-decoration: underline;
}

/* Work index page */
.page--work-index .page__header {
    text-align: center;
    margin-bottom: 56px;
}
.page--work-index .page__header h1 {
    font-size: 42px;
    margin-bottom: 16px;
    max-width: none;
}
.page--work-index .page__lead {
    font-size: 19px;
    color: var(--muted);
    max-width: 64ch;
    margin: 0 auto;
}
.page__cta {
    margin-top: 80px;
    padding-top: 48px;
    border-top: 1px solid var(--gray);
    text-align: center;
}
.page__cta h2 {
    font-size: 26px;
    font-weight: 700;
    margin: 0 auto 16px;
    max-width: 44ch;
}
.page__cta p {
    max-width: 56ch;
    margin: 0 auto 20px;
}

/* Trust footer */
.trust {
    background: var(--dark);
    color: var(--paper);
    padding: 56px 0;
}
.trust__list {
    list-style: none;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px 48px;
    max-width: 900px;
    margin: 0 auto;
}
.trust__list li {
    font-size: 15px;
    line-height: 1.6;
}
.trust__list strong {
    color: #FFFFFF;
    font-weight: 700;
}
.trust__list a {
    color: #FFFFFF;
    text-decoration: underline;
    text-decoration-color: var(--muted);
    text-underline-offset: 3px;
}
.trust__list a:hover {
    text-decoration-color: #FFFFFF;
}

/* Contact form */
.contact-form {
    max-width: 560px;
    margin: 40px 0 0;
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.contact-form__row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.contact-form label {
    font-size: 14px;
    font-weight: 600;
    color: var(--dark);
    letter-spacing: 0.2px;
}
.contact-form input[type="text"],
.contact-form input[type="email"],
.contact-form select,
.contact-form textarea {
    font-family: inherit;
    font-size: 16px;
    line-height: 1.5;
    color: var(--dark);
    background: var(--paper);
    border: 1px solid var(--gray);
    border-radius: 8px;
    padding: 12px 14px;
    width: 100%;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.contact-form input[type="text"]:focus,
.contact-form input[type="email"]:focus,
.contact-form select:focus,
.contact-form textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.12);
}
.contact-form textarea {
    resize: vertical;
    min-height: 140px;
}
.contact-form select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'><path d='M0 0l5 6 5-6z' fill='%2364748B'/></svg>");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 10px 6px;
    padding-right: 36px;
}
.contact-form .btn {
    align-self: flex-start;
    cursor: pointer;
}
.contact-form .btn:disabled {
    opacity: 0.6;
    cursor: wait;
}
.contact-form__status {
    min-height: 1.5em;
    font-size: 15px;
    margin: 0;
}
.contact-form__status--success {
    color: #047857;
}
.contact-form__status--error {
    color: #B91C1C;
}

/* Mobile */
@media (max-width: 900px) {
    .container { padding: 0 24px; }
    .site-header nav { gap: 14px; }
    .site-header nav a { font-size: 13px; }
    .hero__grid { grid-template-columns: 1fr; gap: 40px; }
    .hero__text h1 { font-size: 42px; }
    .hero__sub { font-size: 19px; }
    .hero__kicker { font-size: 15px; }
    .hero__visual img { margin: 0 auto; max-width: 440px; }
    .cards { grid-template-columns: 1fr; gap: 24px; }
    .cards--related { grid-template-columns: 1fr; gap: 20px; margin-top: 40px; }
    .trust__list { grid-template-columns: 1fr; gap: 16px; }
    .section { padding: 64px 0; }
}
@media (max-width: 640px) {
    .container { padding: 0 20px; }
    body { font-size: 16px; }
    .page, .work { padding: 40px 20px 64px; }
    .work__figure { margin: 32px 0; border-radius: 6px; }
    .work__bridge { font-size: 16px; margin: 28px 0 10px; }
    .page > h1, .work > h1 { font-size: 28px; }
    .work .subtitle { font-size: 17px; }
    .site-header { padding: 12px 0; }

    /* Hamburger layout: logo | hamburger | lang-toggle on top row, nav collapses below */
    .site-header .container {
        flex-wrap: wrap;
        gap: 12px;
    }
    .nav-toggle-label {
        display: inline-flex;
        flex-direction: column;
        justify-content: center;
        gap: 5px;
        width: 28px;
        height: 28px;
        padding: 2px;
        cursor: pointer;
        margin-left: auto;
        order: 2;
    }
    .nav-toggle-bar {
        display: block;
        width: 22px;
        height: 2px;
        background: var(--muted);
        border-radius: 2px;
        transition: transform 0.2s ease, opacity 0.2s ease;
    }
    .nav-toggle:checked + .nav-toggle-label .nav-toggle-bar:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
        background: var(--primary);
    }
    .nav-toggle:checked + .nav-toggle-label .nav-toggle-bar:nth-child(2) {
        opacity: 0;
    }
    .nav-toggle:checked + .nav-toggle-label .nav-toggle-bar:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
        background: var(--primary);
    }
    .lang-toggle { order: 3; }
    .site-header nav {
        order: 4;
        flex-basis: 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.25s ease;
    }
    .nav-toggle:checked ~ nav {
        max-height: 400px;
        padding: 8px 0 4px;
    }
    .site-header nav a {
        display: block;
        width: 100%;
        padding: 10px 0;
        font-size: 16px;
        border-bottom: 1px solid var(--gray);
    }
    .site-header nav a:last-child { border-bottom: 0; }

    .lang-toggle { display: inline-flex; }
    article h2 { font-size: 22px; margin-top: 36px; }
    article h3 { font-size: 18px; margin-top: 24px; }
    article p, article ul, article ol { font-size: 16px; line-height: 1.7; }
    .site-footer { padding: 32px 0; margin-top: 64px; }
    .hero { padding: 48px 0 40px; }
    .hero__text h1 { font-size: 34px; }
    .hero__sub { font-size: 17px; }
    .hero__kicker { font-size: 14px; }
    .section { padding: 48px 0; }
    .section--narrow .container > h2 { font-size: 24px; }
    .section--work > .container > h2 { font-size: 26px; }
    .section__lead { font-size: 16px; margin-bottom: 32px; }
    .card__link h3 { font-size: 18px; margin: 20px 20px 10px; }
    .card__link p { font-size: 14px; margin: 0 20px 14px; }
    .card__more { margin: auto 20px 20px; }
    .page--work-index .page__header h1 { font-size: 30px; }
    .page--work-index .page__lead { font-size: 16px; }
    .trust { padding: 40px 0; }
}

/* Lightbox — tap-to-zoom for deep page images on mobile */
.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.9);
    cursor: zoom-out;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.lightbox.is-open { display: flex; }
.lightbox img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: var(--radius);
}
.work__figure img { cursor: zoom-in; }
