@import url("https://fonts.googleapis.com/css2?family=Instrument+Sans:wght@400;500;600;700&family=Fraunces:opsz,wght@9..144,500;9..144,600;9..144,700&display=swap");

:root {
    --bg: #0c0d0f;
    --bg-elev: #121418;
    --ink: #f5f4f1;
    --muted: rgba(245, 244, 241, 0.55);
    --coral: #e65c3b;
    --coral-soft: rgba(230, 92, 59, 0.85);
    --cobalt: #3b6ef5;
    --glass: rgba(12, 13, 15, 0.72);
    --line: rgba(255, 255, 255, 0.08);
    --gap: 3px;
    --header-h: 56px;
    --font: "Instrument Sans", system-ui, sans-serif;
    --display: Fraunces, Georgia, serif;
    --max: 1440px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font);
    color: var(--ink);
    background: var(--bg);
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select { font: inherit; }
button { cursor: pointer; }

.preview-banner {
    position: sticky; top: 0; z-index: 120;
    display: flex; flex-wrap: wrap; align-items: center; gap: .55rem 1rem;
    padding: .65rem 1.2rem;
    background: #1a100e; color: #fff; font-weight: 700; font-size: .88rem;
    border-bottom: 1px solid rgba(230, 92, 59, 0.4);
}
.preview-banner a { margin-left: auto; color: #ffb199; text-decoration: underline; }

/* —— Nav fine —— */
.ms-header {
    position: sticky; top: 0; z-index: 100;
    height: var(--header-h);
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 1rem;
    padding: 0 clamp(1rem, 3vw, 2rem);
    background: rgba(12, 13, 15, 0.55);
    border-bottom: 1px solid transparent;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}
.ms-brand {
    display: inline-flex; align-items: center; gap: .65rem;
    font-weight: 700; letter-spacing: .02em; font-size: .95rem;
}
.ms-brand-mark {
    width: 28px; height: 28px;
    border: 1px solid rgba(255,255,255,.35);
    border-radius: 2px;
    background: transparent;
}
.ms-nav {
    display: flex; flex-wrap: wrap; justify-content: center; gap: .1rem;
    list-style: none; margin: 0; padding: 0;
}
.ms-nav a {
    position: relative;
    padding: .45rem .85rem;
    font-size: .72rem;
    font-weight: 650;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--muted);
}
.ms-nav a:hover { color: var(--ink); }
.ms-nav a.is-active { color: var(--ink); }
.ms-nav a.is-active::after {
    content: "";
    position: absolute; left: .85rem; right: .85rem; bottom: .15rem;
    height: 1.5px;
    background: var(--coral);
}

.ms-tools { display: flex; align-items: center; gap: .4rem; position: relative; }
.ms-icon-btn {
    width: 34px; height: 34px; border-radius: 999px;
    border: 0; background: transparent; color: var(--ink);
    display: grid; place-items: center;
}
.ms-icon-btn:hover { background: rgba(255,255,255,.06); }
.ms-avatar {
    width: 30px; height: 30px; border-radius: 999px;
    border: 1px solid rgba(255,255,255,.2);
    background: linear-gradient(145deg, #3a3f4a, #1a1d24);
    display: grid; place-items: center;
    font-size: .65rem; font-weight: 700; color: var(--muted);
}
.ms-search {
    display: none;
    position: absolute; right: 0; top: calc(100% + .35rem);
    min-width: 220px;
    padding: .5rem .7rem;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--glass);
    backdrop-filter: blur(12px);
    z-index: 40;
}
.ms-search.is-open { display: flex; }
.ms-search input {
    width: 100%; border: 0; outline: none;
    background: transparent; color: var(--ink);
}
.mobile-toggle { display: none; }

.ms-main {
    width: min(var(--max), 100%);
    margin: 0 auto;
    padding: 0 0 3rem;
    position: relative;
}

/* —— Masonry wall —— */
.wall-stage {
    position: relative;
    padding: var(--gap);
    padding-right: clamp(4px, 1vw, 12px);
}

.mosaic {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-auto-rows: 78px;
    gap: var(--gap);
    min-height: 72vh;
}

.tile {
    position: relative;
    overflow: hidden;
    border: 0;
    padding: 0;
    background: #16181d;
    cursor: pointer;
    isolation: isolate;
    transition: transform .35s cubic-bezier(.2, .8, .2, 1), box-shadow .35s ease, z-index 0s;
    color: inherit;
    text-align: left;
    width: 100%;
    height: 100%;
    display: block;
}
.tile:focus-visible {
    outline: 2px solid var(--coral);
    outline-offset: 2px;
    z-index: 5;
}
.tile:hover {
    transform: scale(1.015);
    z-index: 4;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}
.tile.is-active {
    transform: scale(1);
    z-index: 6;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}
.tile.is-filtered-out { display: none !important; }

.tile-media {
    position: absolute; inset: 0;
    background-size: cover;
    background-position: center;
    transition: transform .5s cubic-bezier(.2, .8, .2, 1);
}
.tile:hover .tile-media,
.tile.is-active .tile-media { transform: scale(1.04); }

.tile-label {
    position: absolute;
    left: .7rem; right: .7rem; bottom: .65rem;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: rgba(255,255,255,.78);
    text-shadow: 0 2px 10px rgba(0,0,0,.7);
    opacity: 0;
    transform: translateY(4px);
    transition: opacity .25s ease, transform .25s ease;
    pointer-events: none;
    z-index: 2;
}
.tile:hover .tile-label { opacity: 1; transform: translateY(0); }
.tile.is-active .tile-label { opacity: 0; }

/* Size variants */
.tile-s  { grid-column: span 2; grid-row: span 2; }
.tile-m  { grid-column: span 3; grid-row: span 2; }
.tile-ml { grid-column: span 3; grid-row: span 3; }
.tile-l  { grid-column: span 4; grid-row: span 3; }
.tile-xl { grid-column: span 4; grid-row: span 4; }
.tile-wide { grid-column: span 4; grid-row: span 2; }
.tile-tall { grid-column: span 2; grid-row: span 4; }

.tile.is-active.tile-s,
.tile.is-active.tile-m,
.tile.is-active.tile-ml,
.tile.is-active.tile-l,
.tile.is-active.tile-wide,
.tile.is-active.tile-tall {
    grid-column: span 6;
    grid-row: span 5;
}

/* Active editorial overlay */
.tile-editorial {
    position: absolute; inset: 0;
    z-index: 3;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 1.5rem 1.6rem 1.45rem;
    background: linear-gradient(180deg, rgba(12,13,15,.15) 0%, rgba(12,13,15,.45) 35%, rgba(12,13,15,.92) 100%);
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s ease;
}
.tile.is-active .tile-editorial {
    opacity: 1;
    pointer-events: auto;
}
.tile-editorial h2 {
    margin: 0 0 .45rem;
    font-family: var(--display);
    font-size: clamp(1.55rem, 2.6vw, 2.35rem);
    font-weight: 700;
    line-height: 1.08;
    letter-spacing: .01em;
}
.tile-genres {
    margin: 0 0 .2rem;
    color: var(--coral);
    font-size: .82rem;
    font-weight: 650;
}
.tile-meta {
    margin: 0 0 .65rem;
    color: rgba(245, 244, 241, 0.75);
    font-size: .82rem;
}
.tile-excerpt {
    margin: 0 0 1rem;
    max-width: 48ch;
    color: rgba(245, 244, 241, 0.82);
    font-size: .92rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.tile-actions {
    display: flex; flex-wrap: wrap; gap: .55rem;
}
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    border: 0; border-radius: 2px;
    background: var(--coral);
    color: #fff;
    padding: .7rem 1.15rem;
    font-size: .78rem; font-weight: 750;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.btn:hover { filter: brightness(1.08); }
.btn-ghost {
    background: transparent;
    border: 1px solid rgba(255,255,255,.55);
    color: #fff;
}
.btn-ghost:hover { border-color: #fff; background: rgba(255,255,255,.06); }
.btn-ghost.is-on {
    border-color: var(--coral);
    color: #ffb199;
}

/* Poster art fallbacks (fictional) */
.art-1 { background: linear-gradient(160deg, #1a2438, #0d1520 40%, #3d1a14), radial-gradient(circle at 70% 30%, rgba(230,92,59,.35), transparent 45%); }
.art-2 { background: linear-gradient(180deg, #0b1a14, #122820 50%, #06100c), radial-gradient(ellipse at 40% 70%, rgba(80,160,120,.35), transparent 50%); }
.art-3 { background: linear-gradient(135deg, #0a0e1a, #1a1040 60%, #05080f), radial-gradient(circle at 60% 20%, rgba(180,200,255,.25), transparent 40%); }
.art-4 { background: linear-gradient(180deg, #2a1810, #0f0a08 55%, #1a0c18), radial-gradient(circle at 30% 40%, rgba(212,140,80,.3), transparent 45%); }
.art-5 { background: linear-gradient(145deg, #101820, #0a1018), radial-gradient(circle at 80% 60%, rgba(59,110,245,.35), transparent 40%); }
.art-6 { background: linear-gradient(180deg, #1c1018, #0c0810), radial-gradient(ellipse at 50% 30%, rgba(160,60,100,.4), transparent 50%); }
.art-7 { background: linear-gradient(160deg, #12140c, #0a0c08), radial-gradient(circle at 20% 80%, rgba(180,160,60,.25), transparent 45%); }
.art-8 { background: linear-gradient(135deg, #180c0c, #0c0810 50%, #1a1420), radial-gradient(circle at 70% 70%, rgba(230,92,59,.28), transparent 40%); }
.art-9 { background: linear-gradient(180deg, #0c1420, #081018), radial-gradient(circle at 40% 20%, rgba(100,180,220,.3), transparent 45%); }
.art-10 { background: linear-gradient(150deg, #201810, #0e0a08), radial-gradient(ellipse at 60% 50%, rgba(100,60,40,.4), transparent 50%); }
.art-11 { background: linear-gradient(180deg, #14101c, #08060c), radial-gradient(circle at 30% 30%, rgba(120,80,200,.3), transparent 45%); }
.art-12 { background: linear-gradient(160deg, #0e1818, #060c0c), radial-gradient(circle at 75% 40%, rgba(40,160,140,.3), transparent 40%); }

.art-noise::before {
    content: "";
    position: absolute; inset: 0;
    background:
        radial-gradient(circle at 30% 40%, rgba(255,255,255,.06), transparent 25%),
        radial-gradient(circle at 70% 60%, rgba(0,0,0,.25), transparent 35%);
    z-index: 1;
    pointer-events: none;
}

/* —— Floating filters —— */
.filters {
    position: fixed;
    top: calc(var(--header-h) + 1.25rem);
    right: clamp(.75rem, 2vw, 1.5rem);
    width: 168px;
    z-index: 50;
    padding: .85rem .9rem;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 16px 40px rgba(0,0,0,.35);
}
.filter-group { margin-bottom: .55rem; }
.filter-group:last-of-type { margin-bottom: .35rem; }
.filter-group label {
    display: flex; align-items: center; gap: .4rem;
    margin-bottom: .3rem;
    font-size: .65rem;
    font-weight: 750;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--muted);
}
.filter-group label .ico { opacity: .7; font-size: .75rem; }
.filter-group select {
    width: 100%;
    appearance: none;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: rgba(255,255,255,.03) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23aaa' stroke-width='1.2'/%3E%3C/svg%3E") no-repeat right .65rem center;
    color: var(--ink);
    padding: .5rem .7rem;
    padding-right: 1.6rem;
    outline: none;
    font-size: .78rem;
}
.filter-group select:focus { border-color: rgba(230, 92, 59, 0.5); }
.filters-reset {
    width: 100%;
    margin-top: .25rem;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: .7rem;
    font-weight: 650;
    padding: .35rem 0;
    text-align: left;
}
.filters-reset:hover { color: var(--coral); }

/* —— Coups de cœur —— */
.hearts {
    width: min(var(--max), calc(100% - 2rem));
    margin: 1.75rem auto 0;
    padding: 0 0 0 .25rem;
}
.hearts-head {
    display: flex; align-items: center; gap: .55rem;
    margin-bottom: .85rem;
}
.hearts-head::before {
    content: "";
    width: 14px; height: 2px;
    background: var(--coral);
    flex: 0 0 auto;
}
.hearts-head h2 {
    margin: 0;
    font-size: .78rem;
    font-weight: 750;
    letter-spacing: .16em;
    text-transform: uppercase;
}
.hearts-rail-wrap { position: relative; }
.hearts-rail {
    display: flex;
    gap: .55rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: .5rem;
    scrollbar-width: none;
}
.hearts-rail::-webkit-scrollbar { display: none; }
.heart-card {
    flex: 0 0 160px;
    scroll-snap-align: start;
}
.heart-thumb {
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: #16181d;
    margin-bottom: .4rem;
}
.heart-thumb img,
.heart-thumb .cover-fallback {
    width: 100%; height: 100%; object-fit: cover;
    transition: transform .35s ease;
}
.heart-card:hover .heart-thumb img,
.heart-card:hover .heart-thumb .cover-fallback { transform: scale(1.04); }
.heart-card h3 {
    margin: 0;
    font-size: .78rem;
    font-weight: 650;
    line-height: 1.25;
    color: rgba(245,244,241,.85);
}
.rail-next {
    position: absolute; right: 0; top: 28%;
    width: 34px; height: 34px; border-radius: 999px;
    border: 1px solid rgba(255,255,255,.25);
    background: rgba(12,13,15,.65);
    color: #fff;
    display: grid; place-items: center;
    backdrop-filter: blur(8px);
}
.rail-next:hover { border-color: #fff; }

.cover-fallback {
    display: grid; place-items: center;
    width: 100%; height: 100%;
    background: linear-gradient(145deg, #1a1d24, #0e1014);
    color: rgba(245,244,241,.25);
    font-weight: 800; letter-spacing: .1em;
}

/* Search / category / article */
.ms-page {
    width: min(1100px, calc(100% - 2rem));
    margin: 1.5rem auto 2.5rem;
}
.section-head {
    display: flex; align-items: center; justify-content: space-between;
    margin: 0 0 1rem;
}
.section-head h2 {
    margin: 0;
    font-family: var(--display);
    font-size: 1.4rem;
}
.cards-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: .75rem;
}
.card {
    overflow: hidden;
    background: var(--bg-elev);
    transition: transform .25s ease;
}
.card:hover { transform: translateY(-2px); }
.card-media { aspect-ratio: 2 / 3; overflow: hidden; background: #16181d; }
.card-media img { width: 100%; height: 100%; object-fit: cover; }
.card-body { padding: .75rem; }
.card-title { margin: .3rem 0; font-family: var(--display); font-size: 1.05rem; line-height: 1.15; }
.meta { color: var(--muted); font-size: .78rem; }
.badge {
    display: inline-flex;
    padding: .18rem .45rem;
    font-size: .65rem; font-weight: 750;
    letter-spacing: .08em; text-transform: uppercase;
    color: #ffb199;
    background: rgba(230, 92, 59, 0.15);
}
.empty {
    padding: 2rem;
    border: 1px dashed var(--line);
    color: var(--muted);
    text-align: center;
}

.article-cover {
    width: min(var(--max), 100%);
    margin: 0 auto 1.2rem;
    max-height: 420px; overflow: hidden;
}
.article-cover img { width: 100%; max-height: 420px; object-fit: cover; }
.article-wrap {
    width: min(720px, calc(100% - 2rem));
    margin: 0 auto 2.5rem;
}
.breadcrumb {
    display: flex; flex-wrap: wrap; gap: .4rem;
    color: var(--muted); font-size: .85rem; margin-bottom: .85rem;
}
.breadcrumb a:hover { color: #ffb199; }
.article-wrap h1 {
    margin: .4rem 0 .75rem;
    font-family: var(--display);
    font-size: clamp(1.9rem, 4vw, 2.8rem);
    line-height: 1.12;
}
.article-content {
    margin-top: 1.4rem;
    line-height: 1.8;
    font-size: 1.05rem;
    color: rgba(245,244,241,.9);
}
.article-content a { color: #ffb199; }
.article-content h2, .article-content h3 { font-family: var(--display); color: var(--ink); }
.article-content blockquote {
    margin: 1.5rem 0;
    padding: 1rem 1.2rem;
    border-left: 2px solid var(--coral);
    background: rgba(230, 92, 59, 0.06);
    font-family: var(--display);
    font-style: italic;
}
.tags { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: 1.4rem; }
.related { width: min(1100px, calc(100% - 2rem)); margin: 2rem auto; }

.ms-footer {
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: .8rem;
}
.ms-footer-inner {
    width: min(var(--max), calc(100% - 2rem));
    margin: 0 auto;
    padding: 1.4rem 0;
    display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}
.ms-footer a:hover { color: #ffb199; }

@media (max-width: 1100px) {
    .mosaic { grid-template-columns: repeat(8, 1fr); grid-auto-rows: 70px; }
    .tile.is-active.tile-s,
    .tile.is-active.tile-m,
    .tile.is-active.tile-ml,
    .tile.is-active.tile-l,
    .tile.is-active.tile-wide,
    .tile.is-active.tile-tall {
        grid-column: span 5;
        grid-row: span 5;
    }
    .filters { width: 148px; }
    .cards-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 800px) {
    .ms-nav {
        display: none; position: absolute; left: .75rem; right: .75rem;
        top: calc(var(--header-h) + .3rem);
        flex-direction: column;
        background: var(--bg-elev);
        border: 1px solid var(--line);
        border-radius: 10px;
        padding: .65rem; z-index: 50;
    }
    .ms-nav.is-open { display: flex; }
    .mobile-toggle { display: inline-grid; }
    .filters {
        position: static;
        width: auto;
        margin: .75rem var(--gap);
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: .5rem .75rem;
    }
    .filters-reset { grid-column: 1 / -1; }
    .mosaic { grid-template-columns: repeat(4, 1fr); grid-auto-rows: 90px; }
    .tile-s, .tile-m, .tile-ml, .tile-l, .tile-wide { grid-column: span 2; grid-row: span 2; }
    .tile-tall, .tile-xl { grid-column: span 2; grid-row: span 3; }
    .tile.is-active.tile-s,
    .tile.is-active.tile-m,
    .tile.is-active.tile-ml,
    .tile.is-active.tile-l,
    .tile.is-active.tile-wide,
    .tile.is-active.tile-tall {
        grid-column: span 4;
        grid-row: span 5;
    }
}
@media (max-width: 560px) {
    .cards-grid { grid-template-columns: 1fr; }
    .filters { grid-template-columns: 1fr; }
}
