/* SynCards — styles de base, mobile-first */

@font-face {
    font-family: "Onest";
    src: url("../fonts/onest-latin-wght-normal.woff2") format("woff2");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "Onest";
    src: url("../fonts/onest-latin-ext-wght-normal.woff2") format("woff2");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
    --paper: #ffffff;
    --mist: #f3f5f8;
    --ink: #172036;
    --ink-2: #58627a;
    --line: #e1e5ec;
    --brand: #24366f;
    --brand-strong: #1a2856;
    --ok: #177a4a;
    --warn: #9a5b00;
    --danger: #b3261e;
    --foil: linear-gradient(115deg, #7fd3f5, #b9a6f2 35%, #f5b8d0 65%, #f7e08a);

    --font: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --step--1: 0.8125rem;
    --step-0: 1rem;
    --step-1: 1.1875rem;
    --step-2: 1.5rem;
    --step-3: clamp(1.75rem, 1.2rem + 2.6vw, 2.75rem);

    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 16px;
    --shadow: 0 1px 2px rgba(23, 32, 54, .06), 0 4px 14px rgba(23, 32, 54, .05);
    --gutter: 1rem;
    --max: 1240px;
    --tap: 44px;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: var(--step-0);
    line-height: 1.55;
    color: var(--ink);
    background: var(--paper);
    font-feature-settings: "tnum" 0;
    text-rendering: optimizeLegibility;
}

img, svg { display: block; max-width: 100%; }
h1, h2, h3, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: var(--brand); text-underline-offset: .18em; }
button, input { font: inherit; color: inherit; }

:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
    position: absolute; left: .5rem; top: -3rem; z-index: 100;
    padding: .6rem 1rem; background: var(--brand); color: #fff; border-radius: var(--radius-sm);
}
.skip-link:focus { top: .5rem; }

.container { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }

/* ---------- En-tête ---------- */

.site-header {
    position: sticky; top: 0; z-index: 40;
    background: rgba(255, 255, 255, .94);
    backdrop-filter: saturate(1.4) blur(8px);
    border-bottom: 1px solid var(--line);
}

.header-row {
    display: flex; align-items: center; gap: .25rem;
    min-height: 60px;
}

.brand {
    display: flex; align-items: center; gap: .55rem;
    margin-right: auto; padding: .25rem;
    color: var(--ink); text-decoration: none;
}
.logo-mark { width: 26px; height: 32px; }
.brand-name { font-weight: 700; font-size: var(--step-1); letter-spacing: -.01em; }

.icon-btn {
    position: relative;
    display: inline-grid; place-items: center;
    width: var(--tap); height: var(--tap);
    border: 0; border-radius: var(--radius); background: transparent;
    color: var(--ink); cursor: pointer; text-decoration: none;
}
.icon-btn:hover { background: var(--mist); }
.icon-btn svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.header-actions { display: flex; gap: .125rem; }

.cart-count {
    position: absolute; top: 4px; right: 2px;
    min-width: 18px; height: 18px; padding: 0 5px;
    border-radius: 9px; background: var(--brand); color: #fff;
    font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
}

.nav-desktop { display: none; }

.header-search { padding-bottom: .75rem; }

/* ---------- Menu mobile ---------- */

.drawer { position: fixed; inset: 0; z-index: 60; }
.drawer[hidden] { display: none; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(23, 32, 54, .38); }
.drawer-panel {
    position: absolute; inset: 0 auto 0 0;
    width: min(320px, 86vw); padding: .5rem 1rem 1.5rem;
    background: var(--paper); overflow-y: auto;
    box-shadow: 8px 0 30px rgba(23, 32, 54, .15);
    transform: translateX(-100%); transition: transform .22s ease;
}
.drawer.is-open .drawer-panel { transform: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; min-height: 60px; }
.drawer-title { font-weight: 700; font-size: var(--step-1); }
.drawer-links a {
    display: flex; align-items: center; min-height: 52px;
    border-bottom: 1px solid var(--line);
    color: var(--ink); text-decoration: none; font-size: var(--step-1);
}
.drawer-links a[aria-current="page"] { color: var(--brand); font-weight: 600; }

body.is-locked { overflow: hidden; }

/* ---------- Recherche : l'élément signature ---------- */

.search-field {
    position: relative;
    display: flex; align-items: center;
    background: var(--paper);
    border: 1.5px solid var(--line);
    border-radius: 14px;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.search-field:focus-within {
    border-color: transparent;
    background: linear-gradient(var(--paper), var(--paper)) padding-box, var(--foil) border-box;
    box-shadow: 0 6px 24px rgba(36, 54, 111, .12);
}
.search-icon {
    position: absolute; left: .85rem;
    width: 20px; height: 20px; fill: none; stroke: var(--ink-2); stroke-width: 2; stroke-linecap: round;
    pointer-events: none;
}
.search input {
    flex: 1; min-width: 0;
    height: 46px; padding: 0 .5rem 0 2.6rem;
    border: 0; background: transparent; outline: none;
    font-size: 16px; /* évite le zoom automatique iOS */
}
.search input::placeholder { color: #8a93a6; }
.search input::-webkit-search-cancel-button { cursor: pointer; }
.search-submit {
    flex: none; height: 36px; margin-right: 5px; padding: 0 .9rem;
    border: 0; border-radius: 10px; background: var(--brand); color: #fff;
    font-weight: 600; cursor: pointer;
}
.search-submit:hover { background: var(--brand-strong); }
.search--compact .search-submit { display: none; }

.search--hero .search-field { border-radius: 18px; border-width: 2px; }
.search--hero input { height: 58px; padding-left: 3rem; font-size: 17px; }
.search--hero .search-icon { left: 1rem; width: 22px; height: 22px; }
.search--hero .search-submit { display: none; height: 46px; margin-right: 6px; padding: 0 1.1rem; border-radius: 13px; }

/* Sous 480 px, le clavier mobile fournit la touche « Rechercher » : on laisse toute la place au champ */
@media (min-width: 480px) {
    .search--hero .search-submit { display: inline-flex; align-items: center; }
}

/* ---------- Accueil ---------- */

.hero { padding: 2.25rem 0 2rem; border-bottom: 1px solid var(--line); }
.hero .search, .hero-examples { max-width: 720px; }
.hero-title {
    font-size: var(--step-3); line-height: 1.08; font-weight: 750;
    letter-spacing: -.028em; max-width: 16ch;
}
.hero-lead { margin-top: .75rem; color: var(--ink-2); font-size: var(--step-1); max-width: 52ch; }
.hero .search { margin-top: 1.5rem; }

.hero-examples { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin-top: .9rem; color: var(--ink-2); font-size: var(--step--1); }
.chip {
    display: inline-flex; align-items: center; min-height: 34px; padding: 0 .75rem;
    border: 1px solid var(--line); border-radius: 999px;
    color: var(--ink); text-decoration: none; background: var(--paper);
}
.chip:hover { border-color: var(--brand); color: var(--brand); }

.section { padding: 2.25rem 0; }
.section--mist { background: var(--mist); }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .5rem 1rem; margin-bottom: 1.1rem; }
.section-head h2 { font-size: var(--step-2); line-height: 1.2; letter-spacing: -.015em; }
.section-link { font-weight: 600; }

.empty {
    padding: 1.5rem; border: 1px dashed #cbd2dd; border-radius: var(--radius-lg);
    color: var(--ink-2); background: var(--paper);
}
.empty-title { color: var(--ink); font-weight: 650; margin-bottom: .25rem; }

/* ---------- Grille de cartes ---------- */

.grid-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }

.tile { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.tile:hover { border-color: #c9d0dc; box-shadow: var(--shadow); }
.tile-link { display: flex; flex-direction: column; height: 100%; color: inherit; text-decoration: none; }
.tile-media { padding: .6rem .6rem 0; }
.tile-media img {
    width: 100%; height: auto; aspect-ratio: 63 / 88; object-fit: cover;
    border-radius: 4.6% / 3.3%; /* coins arrondis proportionnels d'une vraie carte */
    background: var(--mist);
}
.tile-body { display: flex; flex-direction: column; gap: .3rem; flex: 1; padding: .6rem .7rem .75rem; }
.tile-name { font-size: .9375rem; line-height: 1.3; font-weight: 650; }
.tile-set { font-size: var(--step--1); color: var(--ink-2); line-height: 1.35; }
.tile-number { white-space: nowrap; font-variant-numeric: tabular-nums; }
.tile-tags { display: flex; flex-wrap: wrap; gap: .25rem; }
.tag {
    padding: .05rem .4rem; border-radius: var(--radius-sm);
    background: var(--mist); color: var(--ink); font-size: .75rem; line-height: 1.5;
}
.tile-foot { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .1rem .5rem; margin-top: auto; padding-top: .35rem; }
.price { font-weight: 700; font-size: var(--step-1); font-variant-numeric: tabular-nums; }
.stock { font-size: .75rem; }
.stock--ok { color: var(--ok); }
.stock--last { color: var(--warn); }

/* ---------- Extensions ---------- */

.set-list { display: grid; gap: .5rem; }
.set-row {
    display: grid; grid-template-columns: 64px 1fr; align-items: center; gap: .25rem .9rem;
    padding: .75rem; min-height: var(--tap);
    background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
    color: inherit; text-decoration: none;
}
.set-row:hover { border-color: #c9d0dc; }
.set-logo { grid-row: span 2; display: grid; place-items: center; height: 44px; }
.set-logo img { max-height: 44px; width: auto; object-fit: contain; }
.set-name { display: block; font-weight: 650; line-height: 1.3; }
.set-meta { display: block; font-size: var(--step--1); color: var(--ink-2); }
.set-count { font-size: var(--step--1); color: var(--ink-2); }
.set-count strong { color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---------- Boutons, messages, erreurs ---------- */

.btn {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: var(--tap); padding: 0 1.1rem;
    border: 1.5px solid var(--brand); border-radius: var(--radius);
    background: var(--brand); color: #fff; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--brand-strong); border-color: var(--brand-strong); }
.btn--ghost { background: transparent; color: var(--brand); }
.btn--ghost:hover { background: var(--mist); color: var(--brand-strong); }

.flashes { display: grid; gap: .5rem; padding-top: 1rem; }
.flash { padding: .75rem 1rem; border-radius: var(--radius); border: 1px solid var(--line); background: var(--mist); }
.flash--success { border-color: #b7dcc7; background: #eef8f2; color: #0f5534; }
.flash--error { border-color: #efc2be; background: #fdf1f0; color: #8a1c16; }

.error-page { max-width: 620px; padding-block: 2rem; }
.error-code { font-size: 4rem; font-weight: 800; line-height: 1; letter-spacing: -.04em; background: var(--foil); -webkit-background-clip: text; background-clip: text; color: transparent; }
.error-page h1 { margin-top: .5rem; font-size: var(--step-2); }
.error-page > p { margin-top: .5rem; color: var(--ink-2); }
.error-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.25rem !important; }
.debug { margin-top: 1.5rem; padding: 1rem; overflow-x: auto; background: var(--mist); border-radius: var(--radius); font-size: .8rem; white-space: pre-wrap; }

/* ---------- Pied de page ---------- */

.site-footer { margin-top: 1rem; padding: 2rem 0 1.5rem; border-top: 1px solid var(--line); color: var(--ink-2); font-size: var(--step--1); }
.footer-grid { display: grid; gap: 1.25rem; }
.footer-brand { color: var(--ink); font-weight: 700; font-size: var(--step-0); }
.footer-note { margin-top: .25rem; max-width: 40ch; }
.footer-links { display: grid; gap: .1rem; }
.footer-links a { display: inline-flex; align-items: center; min-height: 36px; color: var(--ink-2); }
.footer-legal { display: grid; gap: .35rem; margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--line); font-size: .75rem; }

/* ---------- Points de rupture ---------- */

@media (min-width: 600px) {
    :root { --gutter: 1.5rem; }
    .grid-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
    .set-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .footer-grid { grid-template-columns: 1fr auto; }
    .hero { padding: 3.5rem 0 3rem; }
}

@media (min-width: 900px) {
    .menu-toggle { display: none; }
    .brand { margin-right: 1.5rem; }
    .nav-desktop { display: flex; gap: .25rem; margin-right: auto; }
    .nav-desktop a {
        display: inline-flex; align-items: center; min-height: 40px; padding: 0 .7rem;
        border-radius: var(--radius-sm); color: var(--ink-2); text-decoration: none; font-weight: 500;
    }
    .nav-desktop a:hover { color: var(--ink); background: var(--mist); }
    .nav-desktop a[aria-current="page"] { color: var(--ink); font-weight: 650; }
    .grid-cards { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .set-row { grid-template-columns: 96px 1fr auto; grid-template-rows: auto; }
    .set-logo { grid-row: auto; }
    .set-count { text-align: right; }
    .header-search { max-width: 640px; }
}

@media (min-width: 1200px) {
    .grid-cards { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

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