/* =========================================================
   TSArt — feuille de style
   Identité tirée du logo : traits d'encre épais et couleurs
   primaires (bleu, jaune, rouge). Chaque couleur code une
   catégorie d'œuvre : bleu = portrait, rouge = fiction,
   jaune = expérimental.
   Refonte assistée par Claude (2026).
   ========================================================= */

/* ---------- 1. Jetons ----------
   Couleurs de marque fixes, puis couleurs de thème :
   light-dark(clair, sombre) suit color-scheme, défini par
   le réglage système ou par data-theme sur <html>. */
:root {
    --navy: #161a3a;
    --brand-blue: #3b5b92;
    --yellow: #f4c552;
    --red: #e5463a;
    --white: #ffffff;

    --paper: light-dark(#f3f4f7, #12152e);
    --surface: light-dark(var(--white), #1b1f42);
    --ink: light-dark(var(--navy), #eef0f8);
    --ink-soft: light-dark(#4a4f6e, #b4b8d4);
    --line: var(--ink);
    --blue: light-dark(var(--brand-blue), #7f9fd6);

    --font-display: "Archivo", "Arial Narrow", system-ui, sans-serif;
    --font-text: "Newsreader", Georgia, "Times New Roman", serif;

    --stroke: 3px;
    --radius: 14px;
    --gutter: clamp(16px, 4vw, 48px);
    --max: 1200px;
    --header-h: 72px;

    color-scheme: light dark;
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-h) + 16px);
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-text);
    font-size: 1.1875rem;
    line-height: 1.6;
    transition: background-color .3s, color .3s;
}

img { display: block; max-width: 100%; height: auto; }

a { color: inherit; }

h1, h2, h3 {
    font-family: var(--font-display);
    line-height: 1.05;
    margin: 0;
    text-wrap: balance;
}

p { margin: 0; }

/* Garantit que l'attribut hidden l'emporte sur display: grid/flex */
[hidden] { display: none !important; }

:focus-visible {
    outline: 3px solid var(--red);
    outline-offset: 3px;
}

.visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.skip-link {
    position: absolute;
    left: 16px; top: -60px;
    z-index: 100;
    padding: 10px 16px;
    background: var(--yellow);
    color: var(--navy);
    font-family: var(--font-display);
    font-weight: 700;
    border: var(--stroke) solid var(--navy);
    border-radius: 10px;
}
.skip-link:focus { top: 12px; }

svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- 3. Boutons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 52px;
    padding: 0 24px;
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    font-stretch: 110%;
    text-decoration: none;
    border: var(--stroke) solid var(--line);
    border-radius: 999px;
    cursor: pointer;
    transition: transform .15s, box-shadow .15s, background-color .2s;
}
.btn:hover { transform: translate(-2px, -2px); box-shadow: 4px 4px 0 var(--line); }
.btn:active { transform: none; box-shadow: none; }

.btn-primary { background: var(--ink); color: var(--paper); }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-accent { background: var(--yellow); color: var(--navy); border-color: var(--navy); }
.btn-accent:hover { box-shadow: 4px 4px 0 var(--navy); }

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 44px; height: 44px;
    padding: 0;
    background: transparent;
    color: var(--ink);
    border: 2px solid transparent;
    border-radius: 50%;
    cursor: pointer;
    transition: border-color .2s, background-color .2s;
}
.icon-btn:hover { border-color: var(--line); }

/* ---------- 4. En-tête ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: color-mix(in srgb, var(--paper) 88%, transparent);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: var(--stroke) solid var(--line);
}

.bar {
    display: flex;
    align-items: center;
    gap: 24px;
    max-width: var(--max);
    height: var(--header-h);
    margin: 0 auto;
    padding: 0 var(--gutter);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 900;
    font-stretch: 125%;
    letter-spacing: -.01em;
}
.brand img { width: 44px; height: 44px; transition: transform .4s; }
.brand:hover img { transform: rotate(-20deg); }

.nav { margin-left: auto; }
.nav ul { display: flex; gap: 8px; margin: 0; padding: 0; list-style: none; }
.nav a {
    display: block;
    padding: 8px 16px;
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    border: 2px solid transparent;
    border-radius: 999px;
    transition: border-color .2s, background-color .2s;
}
.nav a:hover { border-color: var(--line); }
.nav a[aria-current] { background: var(--ink); color: var(--paper); }

.bar-actions { display: flex; align-items: center; gap: 4px; }

.theme-toggle .i-sun { display: none; }
.theme-toggle[aria-pressed="true"] .i-sun { display: block; }
.theme-toggle[aria-pressed="true"] .i-moon { display: none; }
.i-moon { fill: currentColor; stroke: none; }

.menu-toggle { display: none; }

/* ---------- 5. Accueil ---------- */
.hero {
    display: grid;
    grid-template-columns: 1.05fr 1fr;
    align-items: center;
    gap: clamp(32px, 6vw, 80px);
    max-width: var(--max);
    margin: 0 auto;
    padding: clamp(40px, 8vw, 96px) var(--gutter) clamp(56px, 8vw, 112px);
}

.hero h1 {
    font-size: clamp(2.75rem, 6.2vw, 5.25rem);
    font-weight: 900;
    font-stretch: 118%;
    letter-spacing: -.025em;
    margin-bottom: 28px;
}

.lead {
    max-width: 34em;
    font-size: 1.3rem;
    line-height: 1.55;
    color: var(--ink-soft);
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 36px; }

/* La composition géométrique reprend les formes du logo */
.hero-art {
    position: relative;
    margin: 0;
    padding: 28px 28px 0 0;
}
.hero-art img {
    position: relative;
    z-index: 1;
    width: 100%;
    aspect-ratio: 4 / 5;
    object-fit: cover;
    object-position: 38% center;
    border: var(--stroke) solid var(--line);
    border-radius: var(--radius) var(--radius) 160px var(--radius);
}
.hero-art figcaption {
    margin-top: 12px;
    font-size: .95rem;
    font-style: italic;
    color: var(--ink-soft);
}
.shape { position: absolute; border: var(--stroke) solid var(--line); }
.shape-sun {
    top: 0; right: 0;
    width: 42%; aspect-ratio: 1;
    background: var(--red);
    border-radius: 50%;
}
.shape-tri {
    left: -36px; bottom: 22%;
    z-index: 2;
    width: 96px; height: 96px;
    border: 0;
    background: var(--line);
    clip-path: polygon(50% 0, 100% 100%, 0 100%);
}
.shape-tri::after {
    content: "";
    position: absolute;
    inset: 7px 5px 3px;
    background: var(--yellow);
    clip-path: polygon(50% 0, 100% 100%, 0 100%);
}
.shape-block {
    right: -12px; bottom: 34px;
    z-index: 2;
    width: 72px; height: 72px;
    background: var(--blue);
    border-radius: 6px;
}

/* Un seul moment d'animation, au chargement */
@media (prefers-reduced-motion: no-preference) {
    .hero h1, .lead, .hero-actions { animation: rise .7s cubic-bezier(.2, .7, .2, 1) both; }
    .lead { animation-delay: .08s; }
    .hero-actions { animation-delay: .16s; }
    .shape-sun { animation: pop .8s .25s cubic-bezier(.3, 1.4, .5, 1) both; }
    .shape-tri { animation: pop .8s .4s cubic-bezier(.3, 1.4, .5, 1) both; }
    .shape-block { animation: pop .8s .5s cubic-bezier(.3, 1.4, .5, 1) both; }
}
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }
@keyframes pop { from { opacity: 0; transform: scale(.4) rotate(-25deg); } }

/* ---------- 6. Sections ---------- */
.section {
    max-width: var(--max);
    margin: 0 auto;
    padding: clamp(48px, 7vw, 88px) var(--gutter);
    border-top: var(--stroke) solid var(--line);
}

.section-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px 32px;
    margin-bottom: 40px;
}
.section-head h2 {
    font-size: clamp(2.25rem, 4.5vw, 3.5rem);
    font-weight: 900;
    font-stretch: 115%;
    letter-spacing: -.02em;
}
.section-head p { color: var(--ink-soft); font-style: italic; }

/* Cadre d'œuvre : trait d'encre + bloc de couleur décalé selon la catégorie */
.frame {
    --cat: var(--yellow);
    position: relative;
    display: block;
    border-radius: var(--radius);
}
.frame::before {
    content: "";
    position: absolute;
    inset: 0;
    transform: translate(10px, 10px);
    background: var(--cat);
    border: var(--stroke) solid var(--line);
    border-radius: inherit;
    transition: transform .25s;
}
.frame img {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border: var(--stroke) solid var(--line);
    border-radius: inherit;
    background: var(--surface);
}
[data-cat="portrait"] .frame { --cat: var(--blue); }
[data-cat="fiction"] .frame { --cat: var(--red); }
[data-cat="experimental"] .frame { --cat: var(--yellow); }

/* ---------- 7. Nouveautés ---------- */
.new-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: clamp(24px, 4vw, 48px);
    margin: 0;
    padding: 0;
    list-style: none;
}
.new-card { display: block; text-decoration: none; }
.new-card .frame { margin-bottom: 22px; }
.new-card:hover .frame::before { transform: translate(16px, 16px); }
.new-title {
    display: block;
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.2;
}
.new-meta { display: block; margin-top: 4px; color: var(--ink-soft); }
.new-card:hover .new-title { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }

/* ---------- 8. Barre de recherche et filtres ---------- */
.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 16px;
    margin-bottom: 48px;
    padding: 12px;
    background: var(--surface);
    border: var(--stroke) solid var(--line);
    border-radius: calc(var(--radius) + 12px);
}
.search {
    position: relative;
    flex: 1 1 280px;
    display: flex;
    align-items: center;
}
.search svg { position: absolute; left: 16px; color: var(--ink-soft); pointer-events: none; }
.search input {
    width: 100%;
    min-height: 48px;
    padding: 0 16px 0 48px;
    font: inherit;
    font-size: 1.05rem;
    color: var(--ink);
    background: var(--paper);
    border: 2px solid transparent;
    border-radius: 999px;
}
.search input:focus { outline: none; border-color: var(--line); }
.search input::placeholder { color: var(--ink-soft); opacity: .8; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    min-height: 44px;
    padding: 0 18px;
    font-family: var(--font-display);
    font-size: .95rem;
    font-weight: 600;
    color: var(--ink);
    background: transparent;
    border: 2px solid var(--line);
    border-radius: 999px;
    cursor: pointer;
    transition: background-color .2s, color .2s;
}
.chip:hover { background: var(--paper); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.chip:not([data-filter="all"])::before {
    content: "";
    display: inline-block;
    width: 10px; height: 10px;
    margin-right: 8px;
    border: 2px solid currentColor;
    border-radius: 50%;
    vertical-align: 0;
}
.chip[data-filter="portrait"]::before { background: var(--blue); }
.chip[data-filter="fiction"]::before { background: var(--red); }
.chip[data-filter="experimental"]::before { background: var(--yellow); }

.count {
    margin-left: auto;
    padding: 0 8px;
    font-family: var(--font-display);
    font-weight: 600;
    color: var(--ink-soft);
}

/* ---------- 9. Œuvres ---------- */
.works { display: grid; gap: clamp(56px, 8vw, 104px); }

.work {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    align-items: center;
    gap: clamp(28px, 5vw, 72px);
}

.work:nth-of-type(even) .zoom { order: 2; }

.zoom {
    padding: 0;
    margin: 0 10px 10px 0;
    background: none;
    border: 0;
    cursor: zoom-in;
}
.zoom:hover::before { transform: translate(16px, 16px); }

.work h3 {
    font-size: clamp(1.6rem, 2.6vw, 2.2rem);
    font-weight: 800;
    font-stretch: 110%;
    letter-spacing: -.01em;
    margin-bottom: 18px;
}

/* Cartel, comme dans un musée */
.cartel {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    margin: 0 0 22px;
    background: var(--line);
    border: 2px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
}
.cartel div {
    flex: 1 1 auto;
    padding: 8px 14px;
    background: var(--paper);
}
.cartel dt {
    font-family: var(--font-display);
    font-size: .8rem;
    font-weight: 600;
    color: var(--ink-soft);
}
.cartel dd {
    margin: 0;
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
}

.work p { max-width: 36em; }

.source {
    display: inline-block;
    margin-top: 18px;
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 5px;
    text-decoration-color: var(--red);
}
.source:hover { text-decoration-color: currentColor; }

.empty {
    padding: 40px 24px;
    text-align: center;
    font-style: italic;
    border: 2px dashed var(--line);
    border-radius: var(--radius);
}
.link-btn {
    display: block;
    margin: 12px auto 0;
    padding: 0;
    font: 700 1rem var(--font-display);
    color: inherit;
    background: none;
    border: 0;
    text-decoration: underline;
    text-underline-offset: 4px;
    cursor: pointer;
}

/* ---------- 10. Infolettre ---------- */
.newsletter {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    align-items: center;
    gap: clamp(28px, 5vw, 64px);
    width: min(100% - 2 * var(--gutter), var(--max) - 2 * var(--gutter));
    margin: clamp(24px, 4vw, 48px) auto clamp(56px, 8vw, 96px);
    padding: clamp(28px, 5vw, 56px);
    color: var(--white);
    background: var(--brand-blue);
    border: var(--stroke) solid var(--line);
    border-radius: calc(var(--radius) * 2);
    box-shadow: 10px 10px 0 var(--line);
}
.newsletter h2 {
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 900;
    font-stretch: 112%;
    letter-spacing: -.02em;
    margin-bottom: 14px;
}
.newsletter-text > p { max-width: 30em; opacity: .92; }

.newsletter-form { margin-top: 28px; }
.newsletter-form label {
    display: block;
    margin-bottom: 8px;
    font-family: var(--font-display);
    font-size: .95rem;
    font-weight: 600;
}
.field { display: flex; flex-wrap: wrap; gap: 10px; }
.field input {
    flex: 1 1 220px;
    min-height: 52px;
    padding: 0 20px;
    font: inherit;
    font-size: 1.05rem;
    color: var(--navy);
    background: var(--white);
    border: var(--stroke) solid var(--navy);
    border-radius: 999px;
}
.field input[aria-invalid="true"] { border-color: var(--red); box-shadow: 0 0 0 3px var(--red); }
.newsletter :focus-visible { outline-color: var(--yellow); }

.form-msg { min-height: 1.6em; margin-top: 12px; font-family: var(--font-display); font-weight: 600; }
.newsletter-form[data-state="error"] .form-msg { color: #ffd9d5; }
.newsletter-form[data-state="ok"] .form-msg { color: var(--yellow); }

.newsletter-img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border: var(--stroke) solid var(--navy);
    border-radius: 50%;
}

/* ---------- 11. Pied de page ---------- */
.site-footer {
    border-top: var(--stroke) solid var(--line);
    background: var(--surface);
}
.footer-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr 1fr;
    gap: 32px;
    max-width: var(--max);
    margin: 0 auto;
    padding: 56px var(--gutter) 40px;
}
.footer-brand img { width: 56px; height: 56px; margin-bottom: 14px; }
.footer-brand p { max-width: 22em; color: var(--ink-soft); }
.site-footer h3 { font-size: 1.05rem; font-weight: 800; margin-bottom: 14px; }
.site-footer ul { margin: 0; padding: 0; list-style: none; }
.site-footer nav li + li { margin-top: 8px; }
.site-footer nav a { text-decoration: none; color: var(--ink-soft); }
.site-footer nav a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }

.socials { display: flex; gap: 10px; }
.socials a {
    display: grid;
    place-items: center;
    width: 46px; height: 46px;
    border: 2px solid var(--line);
    border-radius: 50%;
    transition: background-color .2s, color .2s;
}
.socials a:hover { background: var(--ink); color: var(--paper); }
.socials .fill { fill: currentColor; stroke: none; }

.copyright {
    max-width: var(--max);
    margin: 0 auto;
    padding: 20px var(--gutter) 32px;
    font-size: .95rem;
    color: var(--ink-soft);
    border-top: 1px solid color-mix(in srgb, var(--line) 25%, transparent);
}

/* ---------- 12. Visionneuse ---------- */
.lightbox {
    width: min(92vw, 860px);
    max-height: 92vh;
    padding: 20px;
    color: var(--ink);
    background: var(--surface);
    border: var(--stroke) solid var(--line);
    border-radius: calc(var(--radius) + 6px);
    overflow: visible;
}
.lightbox::backdrop { background: rgba(14, 16, 38, .82); }
.lightbox figure { margin: 0; }
.lightbox img {
    width: 100%;
    max-height: calc(92vh - 110px);
    object-fit: contain;
    border-radius: 8px;
}
.lightbox figcaption {
    margin-top: 14px;
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 800;
    text-align: center;
}
.lightbox .icon-btn { background: var(--surface); border-color: var(--line); }
.lightbox .icon-btn:hover { background: var(--yellow); color: var(--navy); }
.lightbox-close { position: absolute; top: -18px; right: -18px; z-index: 2; }
.lightbox-nav { position: absolute; top: 50%; z-index: 2; transform: translateY(-50%); }
.lightbox-nav.prev { left: -22px; }
.lightbox-nav.next { right: -22px; }

@media (prefers-reduced-motion: no-preference) {
    .lightbox[open] { animation: zoom-in .25s cubic-bezier(.2, .8, .3, 1); }
}
@keyframes zoom-in { from { opacity: 0; transform: scale(.94); } }

/* ---------- 13. Responsive ---------- */
@media (max-width: 960px) {
    .hero { grid-template-columns: 1fr; }
    .hero-art { max-width: 520px; }
    .new-grid { grid-template-columns: repeat(2, 1fr); }
    .new-grid li:last-child { grid-column: span 2; max-width: calc(50% - 16px); }
    .newsletter { grid-template-columns: 1fr; }
    .newsletter-img { display: none; }
    .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 760px) {
    :root { --header-h: 64px; }
    body { font-size: 1.0625rem; }

    .menu-toggle { display: inline-grid; }
    .nav {
        position: absolute;
        top: 100%; left: 0; right: 0;
        display: none;
        padding: 12px var(--gutter) 20px;
        background: var(--paper);
        border-bottom: var(--stroke) solid var(--line);
    }
    .nav.is-open { display: block; }
    .nav ul { flex-direction: column; gap: 4px; }
    .nav a { padding: 12px 16px; font-size: 1.15rem; }
    .bar-actions { margin-left: auto; }

    .lead { font-size: 1.15rem; }
    .hero-art { padding: 20px 20px 0 0; }
    .shape-tri { left: -12px; width: 72px; height: 72px; }
    .shape-block { right: -4px; width: 52px; height: 52px; }

    .work { grid-template-columns: 1fr; }
    .work:nth-of-type(even) .zoom { order: 0; }
    .zoom { max-width: 480px; }

    .count { margin-left: 0; }

    .lightbox { padding: 12px; }
    .lightbox-close { top: -14px; right: -10px; }
    .lightbox-nav.prev { left: -10px; }
    .lightbox-nav.next { right: -10px; }
}

@media (max-width: 520px) {
    .new-grid { grid-template-columns: 1fr; }
    .new-grid li:last-child { grid-column: auto; max-width: none; }
    .hero-actions .btn { flex: 1 1 100%; }
    .cartel { flex-direction: column; }
    .field .btn { flex: 1 1 100%; }
    .newsletter { box-shadow: 6px 6px 0 var(--line); }
    .footer-grid { grid-template-columns: 1fr; }
}

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