:root {
    --nuit: #102341;
    --nuit-fonce: #0c1b33;
    --creme: #f0e6cf;
    --papier: #f7f1e3;
    --or: #d8b24a;
    --grenat: #9a1c1c;
    --encre: #2b3346;
    --brume: #a8b6cd;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Lora', Georgia, serif;
    background: linear-gradient(180deg, var(--nuit-fonce) 0%, var(--nuit) 55%, var(--nuit-fonce) 100%);
    color: var(--creme);
    min-height: 100vh;
}

/* ---------- Masthead ---------- */
.mast {
    position: relative;
    z-index: 3;
    text-align: center;
    padding: 28px 20px 18px;
    border-bottom: 3px double var(--or);
}
body.home .mast { animation: fadeDown 1s ease both; }
.mast .name {
    font-family: 'Poiret One', cursive;
    font-size: 2rem;
    letter-spacing: 7px;
    text-transform: uppercase;
    color: var(--creme);
    text-decoration: none;
}
.mast .orn-line { color: var(--or); font-size: .8rem; letter-spacing: 8px; margin-top: 8px; }
.mast-compact { padding: 18px 20px 14px; }
.mast-compact .name { font-size: 1.3rem; }

.mast-footer {
    border-top: 3px double var(--or);
    text-align: center;
    padding: 18px 20px;
    color: var(--brume);
    font-style: italic;
    font-size: .85rem;
    position: relative;
    z-index: 3;
}

/* ---------- Ciel vivant ---------- */
.ciel { position: absolute; inset: 0; height: 480px; overflow: hidden; pointer-events: none; z-index: 1; }
.star {
    position: absolute;
    width: 2px; height: 2px;
    border-radius: 50%;
    background: var(--creme);
    animation: twinkle 3s ease-in-out infinite;
}
@keyframes twinkle { 0%, 100% { opacity: .15; } 50% { opacity: .95; } }
.shooting {
    position: absolute;
    top: 20%; left: -12%;
    width: 90px; height: 2px;
    border-radius: 2px;
    background: linear-gradient(90deg, transparent, var(--creme));
    transform: rotate(8deg);
    opacity: 0;
    animation: shoot 7s ease-in 1.6s infinite;
}
@keyframes shoot {
    0% { transform: translateX(0) rotate(8deg); opacity: 0; }
    3% { opacity: 1; }
    12% { transform: translateX(130vw) rotate(8deg); opacity: 0; }
    100% { transform: translateX(130vw) rotate(8deg); opacity: 0; }
}

/* ---------- Affiche (lever de rideau) ---------- */
.affiche { position: relative; z-index: 2; text-align: center; padding: 64px 20px 56px; }
.cadre {
    display: inline-block;
    position: relative;
    border: 1px solid var(--or);
    padding: 36px 48px;
    background: rgba(16, 35, 65, .55);
    animation: frameIn 1.4s cubic-bezier(.2, .8, .2, 1) both .3s;
}
.cadre::before {
    content: "";
    position: absolute;
    inset: 6px;
    border: 1px solid rgba(216, 178, 74, .35);
    pointer-events: none;
}
.cadre .tagline {
    font-family: 'Poiret One', cursive;
    font-size: clamp(1.6rem, 4.5vw, 2.6rem);
    line-height: 1.25;
    letter-spacing: 2px;
    color: var(--creme);
    max-width: 18ch;
    font-weight: 400;
}
.cadre .orn { position: relative; color: var(--or); letter-spacing: 9px; margin-top: 16px; }
.cadre .orn::after {
    content: "\2726 \2726 \2726";
    position: absolute;
    inset: 0;
    text-shadow: 0 0 12px var(--or);
    opacity: 0;
    animation: ornGlow 2.4s ease-in-out 1.8s infinite;
}
@keyframes ornGlow { 0%, 100% { opacity: 0; } 50% { opacity: 1; } }
@keyframes frameIn {
    from { opacity: 0; transform: translateY(18px) scale(.96); filter: blur(4px); }
    to { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}
@keyframes fadeDown {
    from { opacity: 0; transform: translateY(-12px); }
    to { opacity: 1; transform: translateY(0); }
}
/* ---------- Le train qui passe ---------- */
.convoi { position: relative; height: 44px; overflow: hidden; z-index: 2; }
.rail {
    position: absolute;
    bottom: 6px; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(216, 178, 74, .4) 15%, rgba(216, 178, 74, .4) 85%, transparent);
}
.train {
    position: absolute;
    bottom: 8px; left: 0;
    display: flex;
    gap: 5px;
    animation: cross 16s linear 2s infinite;
    transform: translateX(100vw);
}
@keyframes cross { from { transform: translateX(100vw); } to { transform: translateX(-110%); } }
.loco, .car {
    height: 26px;
    background: #081224;
    border-radius: 3px 3px 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 10px;
    position: relative;
}
.loco { width: 74px; border-radius: 12px 3px 0 0; }
.car { width: 96px; }
.win {
    width: 9px; height: 8px;
    background: #ffd87a;
    border-radius: 1px;
    box-shadow: 0 0 8px rgba(255, 216, 122, .65);
    animation: winFlicker 4s ease-in-out infinite;
}
.win:nth-child(2n) { animation-delay: 1.3s; }
@keyframes winFlicker { 0%, 100% { opacity: 1; } 50% { opacity: .75; } }
.smoke {
    position: absolute;
    top: -9px; left: 8px;
    width: 6px; height: 6px;
    border-radius: 50%;
    background: rgba(168, 182, 205, .2);
    animation: puff 2.6s ease-out infinite;
}
@keyframes puff {
    from { transform: translate(0, 0) scale(.6); opacity: .6; }
    to { transform: translate(26px, -20px) scale(2); opacity: 0; }
}

/* ---------- Cartes (Derniers departs) ---------- */
main { position: relative; z-index: 2; }
.section-title {
    font-family: 'Poiret One', cursive;
    text-align: center;
    color: var(--or);
    font-size: 1rem;
    letter-spacing: 5px;
    text-transform: uppercase;
    margin: 28px 0 6px;
}
.section-title::after { content: ""; display: block; width: 120px; height: 1px; background: rgba(216, 178, 74, .4); margin: 10px auto 0; }
.departs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 22px;
    max-width: 1020px;
    margin: 24px auto 48px;
    padding: 0 20px;
}
.card { background: var(--creme); display: flex; flex-direction: column; }
.card-img { display: block; height: 150px; overflow: hidden; background: var(--nuit-fonce); }
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.card-body { padding: 16px 16px 18px; }
.card-date {
    font-family: 'JetBrains Mono', monospace;
    font-size: .65rem;
    letter-spacing: 2px;
    color: var(--grenat);
    text-transform: uppercase;
}
.card h3 { margin: 6px 0 8px; }
.card h3 a {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 700;
    font-size: 1.25rem;
    line-height: 1.25;
    color: var(--nuit);
    text-decoration: none;
}
.card p { color: #5a6478; font-size: .9rem; line-height: 1.5; font-style: italic; }
.card-more {
    display: inline-block;
    margin-top: 10px;
    font-family: 'Poiret One', cursive;
    font-size: .75rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--grenat);
    text-decoration: none;
    border-bottom: 1px solid var(--or);
    padding-bottom: 2px;
}

/* ---------- Etats interactifs ---------- */
.mast .name:hover { color: var(--or); }
.card h3 a:hover { color: var(--grenat); }
.card-more:hover { color: var(--nuit); border-bottom-color: var(--grenat); }
.article-body a:hover { color: var(--nuit); border-bottom-color: var(--nuit); }
a:focus-visible { outline: 2px solid var(--or); outline-offset: 3px; }

/* ---------- Page article : papier creme ---------- */
.papier { background: var(--papier); padding: 40px 0 56px; }
.papier article { max-width: 680px; margin: 0 auto; padding: 0 24px; }
.papier h1 {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 700;
    font-size: clamp(1.8rem, 5vw, 2.4rem);
    line-height: 1.15;
    color: var(--nuit);
    text-align: center;
}
.papier article > time {
    display: block;
    text-align: center;
    font-style: italic;
    color: #5a6478;
    font-size: .9rem;
    margin-top: 10px;
}
.papier .orn { text-align: center; color: var(--or); letter-spacing: 7px; margin: 14px 0 6px; }
.hero { border: 1px solid var(--or); padding: 6px; margin: 22px 0 28px; }
.hero img { width: 100%; height: auto; display: block; }

.article-body { color: var(--encre); font-size: 1.05rem; line-height: 1.75; }
.article-body > p:first-of-type::first-letter {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 700;
    font-size: 3.4em;
    line-height: .85;
    color: var(--grenat);
    float: left;
    padding-right: 8px;
}
.article-body h2 {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 700;
    color: var(--nuit);
    font-size: 1.5rem;
    border-bottom: 1px solid rgba(216, 178, 74, .55);
    padding-bottom: 6px;
    margin: 32px 0 14px;
}
.article-body h3 {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 700;
    color: var(--nuit);
    font-size: 1.2rem;
    margin: 24px 0 10px;
}
.article-body p { margin: 0 0 16px; }
.article-body a { color: var(--grenat); text-decoration: none; border-bottom: 1px solid var(--grenat); }
.article-body ul, .article-body ol { margin: 0 0 16px 24px; }
.article-body li { margin-bottom: 6px; }
.article-body blockquote {
    border-left: 3px solid var(--or);
    margin: 20px 0;
    padding: 8px 18px;
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 1.2rem;
    color: #5a6478;
}
.article-body table { width: 100%; border-collapse: collapse; font-size: .92rem; margin: 20px 0; }
.article-body th {
    background: var(--nuit);
    color: var(--creme);
    font-family: 'Poiret One', cursive;
    font-weight: 400;
    letter-spacing: 2px;
    font-size: .75rem;
    text-transform: uppercase;
    text-align: left;
    padding: 9px 12px;
}
.article-body td { padding: 9px 12px; border-bottom: 1px solid rgba(216, 178, 74, .35); }
.article-body tr:nth-child(2n) td { background: var(--creme); }

/* Encart CTA / widget (utilise dans le contenu d'articles) */
.encart-carte {
    border: 1px solid var(--or);
    background: var(--creme);
    padding: 18px;
    margin: 26px 0;
    text-align: center;
}
.encart-carte .label {
    font-family: 'Poiret One', cursive;
    font-size: .75rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--nuit);
}
.encart-carte iframe { width: 100%; border: 0; margin-top: 12px; }

/* ---------- Responsive & accessibilite ---------- */
@media (max-width: 640px) {
    .mast .name { font-size: 1.4rem; letter-spacing: 4px; }
    .affiche { padding: 44px 16px 40px; }
    .cadre { padding: 26px 24px; }
    .departs { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    body.home .mast, .cadre, .cadre .orn, .cadre .orn::after, .star, .shooting, .train, .win, .smoke { animation: none !important; }
    .train { transform: translateX(20vw); }
}
