/* ==========================================================================
   Photos de Julien — feuille de style commune (portfolio public)
   Thèmes clair/sombre pilotés par [data-theme] sur <html>.
   Ambiance "mur de galerie" : fond chaud travaillé, grain photo, ombres douces.
   ========================================================================== */

/* ----- Tokens ----- */
:root,
[data-theme="light"] {
    --bg:        #ece8e1;
    --bg-gradient:
        radial-gradient(1100px 560px at 78% -12%, rgba(168,127,62,0.12), transparent 60%),
        radial-gradient(820px 480px at 12% -4%, rgba(255,255,255,0.65), transparent 55%),
        linear-gradient(180deg, #f3efe8 0%, #e9e4dc 58%, #e3ddd3 100%);
    --surface:   #faf8f3;
    --surface-2: #efebe3;
    --text:      #211f1b;
    --muted:     #6d685f;
    --border:    rgba(33, 30, 24, 0.10);
    --border-strong: rgba(33, 30, 24, 0.17);
    --accent:    #a87f3e;          /* laiton */
    --accent-2:  #c79a55;          /* laiton clair pour dégradés */
    --accent-soft: rgba(168, 127, 62, 0.12);
    --shadow:    0 1px 2px rgba(44, 38, 26, 0.06), 0 14px 32px -14px rgba(44, 38, 26, 0.26);
    --shadow-lift: 0 2px 6px rgba(44, 38, 26, 0.08), 0 26px 50px -18px rgba(44, 38, 26, 0.34);
    --grain:     0.05;
    --overlay:   rgba(26, 22, 16, 0.93);
    color-scheme: light;
}

[data-theme="dark"] {
    --bg:        #16130f;
    --bg-gradient:
        radial-gradient(1000px 600px at 74% -10%, rgba(214,179,112,0.14), transparent 58%),
        radial-gradient(760px 480px at 16% -6%, rgba(120,94,56,0.16), transparent 55%),
        linear-gradient(180deg, #1e1a15 0%, #161310 58%, #100e0b 100%);
    --surface:   #221e18;
    --surface-2: #2a251e;
    --text:      #f2ede4;
    --muted:     #a39a8b;
    --border:    rgba(255, 255, 255, 0.09);
    --border-strong: rgba(255, 255, 255, 0.17);
    --accent:    #d6b370;
    --accent-2:  #e6c98a;
    --accent-soft: rgba(214, 179, 112, 0.16);
    --shadow:    0 1px 2px rgba(0, 0, 0, 0.45), 0 20px 44px -18px rgba(0, 0, 0, 0.7);
    --shadow-lift: 0 2px 8px rgba(0, 0, 0, 0.5), 0 30px 56px -20px rgba(0, 0, 0, 0.82);
    --grain:     0.06;
    --overlay:   rgba(8, 7, 5, 0.94);
    color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    background-color: var(--bg);
    background-image: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text);
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    transition: background-color 0.4s ease, color 0.4s ease;
}

/* Grain photographique léger sur toute la page */
body::before {
    content: "";
    position: fixed; inset: 0; z-index: 0; pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    opacity: var(--grain);
}
/* Contenu au-dessus du grain */
.topbar, main, .center-wrap { position: relative; z-index: 1; }

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

a { color: inherit; }
.container { width: min(1240px, 92vw); margin-inline: auto; }
.display { font-family: "Fraunces", Georgia, serif; font-optical-sizing: auto; letter-spacing: -0.01em; }

/* ----- Top bar ----- */
.topbar {
    position: sticky; top: 0; z-index: 40;
    background: color-mix(in srgb, var(--bg) 78%, transparent);
    backdrop-filter: blur(16px) saturate(1.2); -webkit-backdrop-filter: blur(16px) saturate(1.2);
    border-bottom: 1px solid var(--border);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.85rem 0; }
.brand { display: inline-flex; align-items: baseline; gap: 0.55rem; text-decoration: none; color: var(--text); }
.brand .mark { font-size: 0.72rem; letter-spacing: 0.24em; text-transform: uppercase; color: var(--accent); font-weight: 600; }
.brand .name { font-family: "Fraunces", serif; font-size: 1.28rem; font-weight: 600; }
.topbar-actions { display: flex; align-items: center; gap: 0.5rem; }

/* ----- Buttons ----- */
.btn {
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.55rem 1rem; border-radius: 999px;
    font-size: 0.88rem; font-weight: 500; text-decoration: none; cursor: pointer;
    border: 1px solid var(--border-strong); background: transparent; color: var(--text);
    transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.btn:hover { background: var(--surface); transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-ghost { border-color: transparent; }
.btn-ghost:hover { border-color: var(--border-strong); }
.btn-accent {
    background: linear-gradient(135deg, var(--accent-2), var(--accent));
    border-color: transparent; color: #fff;
    box-shadow: 0 8px 22px -10px color-mix(in srgb, var(--accent) 70%, transparent);
}
[data-theme="dark"] .btn-accent { color: #1b1813; }
.btn-accent:hover { filter: brightness(1.04); }
.btn-icon { padding: 0.5rem; width: 40px; height: 40px; justify-content: center; }

.theme-toggle .moon { display: none; }
.theme-toggle .sun  { display: block; }
[data-theme="dark"] .theme-toggle .moon { display: block; }
[data-theme="dark"] .theme-toggle .sun  { display: none; }

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

/* ----- Masthead (index) ----- */
.masthead { padding: 5rem 0 2.75rem; }
.eyebrow {
    font-size: 0.74rem; letter-spacing: 0.26em; text-transform: uppercase;
    color: var(--accent); font-weight: 600; margin: 0 0 1rem; display: inline-flex; align-items: center;
}
.eyebrow::before { content: ""; width: 30px; height: 1px; background: var(--accent); opacity: 0.65; margin-right: 0.8rem; }
.masthead h1 {
    font-family: "Fraunces", serif; font-weight: 600;
    font-size: clamp(2.5rem, 6vw, 4.2rem); line-height: 1.03; margin: 0 0 0.9rem; letter-spacing: -0.02em;
}
.masthead h1 em {
    font-style: italic; font-weight: 500;
    background: linear-gradient(120deg, var(--accent-2), var(--accent));
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.masthead p { color: var(--muted); font-size: 1.08rem; max-width: 46ch; margin: 0; }
.masthead-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 2rem; flex-wrap: wrap; }
.count-tag {
    color: var(--muted); font-size: 0.85rem; white-space: nowrap;
    padding: 0.5rem 0.95rem; border-radius: 999px; background: var(--surface);
    border: 1px solid var(--border); box-shadow: var(--shadow);
}
.count-tag b { color: var(--text); font-variant-numeric: tabular-nums; }

/* ----- Album grid (index) ----- */
.album-grid { display: grid; gap: 1.7rem; padding-bottom: 5rem; grid-template-columns: repeat(auto-fill, minmax(272px, 1fr)); }
.album-card {
    display: flex; flex-direction: column; text-decoration: none; color: inherit;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 16px; overflow: hidden; box-shadow: var(--shadow);
    transition: transform 0.32s cubic-bezier(.2,.7,.2,1), box-shadow 0.32s ease, border-color 0.32s ease;
}
.album-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lift); border-color: color-mix(in srgb, var(--accent) 35%, var(--border-strong)); }
.album-card .cover { position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: var(--surface-2); }
.album-card .cover img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.65s cubic-bezier(.2,.7,.2,1); }
.album-card:hover .cover img { transform: scale(1.06); }
.album-card .cover .empty { width: 100%; height: 100%; display: grid; place-items: center; color: var(--muted); }
.chip {
    position: absolute; top: 11px; left: 11px;
    display: inline-flex; align-items: center; gap: 0.35rem;
    padding: 0.3rem 0.65rem; border-radius: 999px; font-size: 0.72rem; font-weight: 600;
    background: color-mix(in srgb, var(--surface) 82%, transparent);
    backdrop-filter: blur(6px); border: 1px solid var(--border); color: var(--text);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}
.album-card .body { padding: 1.15rem 1.2rem 1.3rem; display: flex; flex-direction: column; gap: 0.42rem; flex: 1; }
.album-card .title { font-family: "Fraunces", serif; font-size: 1.22rem; font-weight: 600; transition: color 0.25s ease; }
.album-card:hover .title { color: var(--accent); }
.album-card .meta { color: var(--muted); font-size: 0.82rem; display: flex; align-items: center; gap: 0.5rem; }
.album-card .meta .dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: 0.5; }
.album-card .desc { color: var(--muted); font-size: 0.9rem; }
.album-card .foot { margin-top: auto; padding-top: 0.8rem; font-size: 0.78rem; color: var(--muted); border-top: 1px solid var(--border); }
.foot .expire { color: #bb5a3d; }
[data-theme="dark"] .foot .expire { color: #e28e74; }

/* ----- Empty state ----- */
.empty-state { text-align: center; padding: 5rem 1rem; color: var(--muted); background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); }
.empty-state h3 { font-family: "Fraunces", serif; color: var(--text); margin: 0.5rem 0 0.3rem; }

/* ----- Back link ----- */
.back { display: inline-flex; align-items: center; gap: 0.45rem; color: var(--muted); text-decoration: none; font-size: 0.88rem; padding: 1.5rem 0 0.5rem; }
.back:hover { color: var(--text); }

/* ----- Album hero ----- */
.hero {
    position: relative; border-radius: 20px; overflow: hidden; margin-top: 0.5rem;
    min-height: 340px; display: flex; align-items: flex-end;
    border: 1px solid var(--border); box-shadow: var(--shadow-lift);
}
.hero-bg { position: absolute; inset: -26px; background-size: cover; background-position: center; filter: brightness(0.6) saturate(1.05); z-index: 1; transform: scale(1.02); }
.hero-veil { position: absolute; inset: 0; z-index: 2; background: linear-gradient(to top, rgba(12,10,7,0.9), rgba(12,10,7,0.2) 55%, rgba(12,10,7,0.05)); }
.hero-veil::after { content: ""; position: absolute; inset: 0; box-shadow: inset 0 0 120px 20px rgba(0,0,0,0.45); }
.hero-inner { position: relative; z-index: 3; padding: 2.6rem; width: 100%; color: #f6f2ea; }
.pills { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.pill {
    display: inline-flex; align-items: center; gap: 0.4rem;
    padding: 0.32rem 0.75rem; border-radius: 999px; font-size: 0.74rem; font-weight: 600;
    background: rgba(0,0,0,0.38); backdrop-filter: blur(6px); border: 1px solid rgba(255,255,255,0.18); color: #f6f2ea;
}
.pill.danger { background: rgba(187,90,61,0.28); border-color: rgba(187,90,61,0.45); }
.hero h1 { font-family: "Fraunces", serif; font-weight: 600; font-size: clamp(2rem, 5vw, 3.2rem); margin: 0 0 0.45rem; letter-spacing: -0.02em; text-shadow: 0 2px 24px rgba(0,0,0,0.45); }
.hero .lede { color: #ece7dd; max-width: 60ch; margin: 0; text-shadow: 0 1px 12px rgba(0,0,0,0.4); }

/* ----- Usage note ----- */
.usage-note {
    display: flex; gap: 0.8rem; align-items: flex-start;
    margin-top: 1.6rem; padding: 1.05rem 1.2rem; border-radius: 14px; max-width: 70ch;
    background: var(--surface); border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border));
    box-shadow: var(--shadow); font-size: 0.88rem; color: var(--text);
}
.usage-note svg { flex: none; color: var(--accent); margin-top: 2px; }
.usage-note b { display: block; margin-bottom: 0.15rem; }

/* ----- Gallery (mosaïque sans recadrage) ----- */
.gallery { columns: 4; column-gap: 18px; margin: 3.2rem 0 4.5rem; }
@media (max-width: 1100px) { .gallery { columns: 3; } }
@media (max-width: 760px)  { .gallery { columns: 2; column-gap: 13px; } }
@media (max-width: 460px)  { .gallery { columns: 1; } }

.tile { break-inside: avoid; margin-bottom: 18px; }
.tile-frame {
    display: block; position: relative; border-radius: 14px; overflow: hidden;
    background: var(--surface-2); border: 1px solid var(--border); box-shadow: var(--shadow); cursor: zoom-in;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}
.tile-frame:hover { box-shadow: var(--shadow-lift); transform: translateY(-3px); }
.tile-frame img { width: 100%; height: auto; display: block; transition: transform 0.55s cubic-bezier(.2,.7,.2,1); }
.tile-frame:hover img { transform: scale(1.045); }
.tile-frame::after { content: ""; position: absolute; inset: 0; opacity: 0; background: linear-gradient(to top, rgba(0,0,0,0.32), transparent 45%); transition: opacity 0.3s ease; }
.tile-frame:hover::after { opacity: 1; }

/* Reactions */
.reactions { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.6rem; justify-content: center; }
.react-btn {
    display: inline-flex; align-items: center; gap: 0.3rem;
    padding: 0.26rem 0.62rem; border-radius: 999px; font-size: 0.82rem; cursor: pointer; user-select: none;
    background: var(--surface); border: 1px solid var(--border); color: var(--muted); box-shadow: var(--shadow);
    transition: transform 0.15s ease, border-color 0.2s ease, color 0.2s ease;
}
.react-btn:hover { transform: translateY(-1px); border-color: var(--border-strong); color: var(--text); }
.react-btn.is-active { border-color: var(--accent); color: var(--text); background: var(--accent-soft); }
.react-btn b { font-variant-numeric: tabular-nums; font-weight: 600; }

/* ----- Lightbox ----- */
.lb { position: fixed; inset: 0; z-index: 80; display: none; background: var(--overlay); backdrop-filter: blur(10px); }
.lb.open { display: grid; grid-template-rows: 1fr auto; }
.lb-stage { position: relative; display: grid; place-items: center; padding: clamp(1rem, 4vw, 3rem); }
.lb-stage img { max-width: min(94vw, 1400px); max-height: 78vh; border-radius: 8px; box-shadow: 0 40px 90px rgba(0,0,0,0.65); }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 50px; height: 50px; border-radius: 50%; cursor: pointer; display: grid; place-items: center; font-size: 1.6rem; color: #fff; background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.2); transition: background 0.2s ease; }
.lb-nav:hover { background: rgba(255,255,255,0.2); }
.lb-prev { left: clamp(0.5rem, 2vw, 1.5rem); }
.lb-next { right: clamp(0.5rem, 2vw, 1.5rem); }
.lb-close { position: absolute; top: 1.1rem; right: 1.1rem; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; color: #fff; background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.2); }
.lb-close:hover { background: rgba(255,255,255,0.2); }
.lb-foot { padding: 1.2rem clamp(1rem,4vw,3rem) 2rem; text-align: center; color: #d9d4ca; }
.lb-counter { font-variant-numeric: tabular-nums; font-size: 0.85rem; letter-spacing: 0.08em; color: #b6b0a4; margin-bottom: 0.55rem; }
.lb-usage { font-size: 0.84rem; color: #b6b0a4; max-width: 60ch; margin: 0 auto 0.95rem; }
.lb img { user-select: none; -webkit-user-drag: none; }

/* ----- Centered card (password gate) ----- */
.center-wrap { min-height: 100vh; display: grid; place-items: center; padding: 2rem 1rem; }
.gate { width: min(430px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow-lift); overflow: hidden; text-align: center; }
.gate .head { padding: 2.4rem 1.6rem 1.2rem; }
.gate .lockicon { width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 1.1rem; background: var(--accent-soft); color: var(--accent); }
.gate h1 { font-family: "Fraunces", serif; font-size: 1.55rem; margin: 0 0 0.4rem; }
.gate p { color: var(--muted); font-size: 0.92rem; margin: 0; }
.gate .body { padding: 0 1.7rem 2.1rem; }
.field { width: 100%; padding: 0.85rem 1rem; border-radius: 12px; border: 1px solid var(--border-strong); background: var(--bg); color: var(--text); font-size: 1rem; text-align: center; }
.field:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.alert { padding: 0.7rem 0.9rem; border-radius: 12px; font-size: 0.88rem; margin-bottom: 1rem; background: rgba(187,90,61,0.12); color: #bb5a3d; border: 1px solid rgba(187,90,61,0.3); }
[data-theme="dark"] .alert { color: #e7a08c; }

@media (max-width: 768px) {
    .masthead { padding: 3rem 0 2rem; }
    .hero-inner { padding: 1.7rem; }
}
