/*
Theme Name: HELLLO.WORLD
Description: Socle minimal du thème autonome HELLLO.WORLD.
Author: PJ Verhoye
Version: 0.1.0
Requires at least: 6.0
Requires PHP: 8.2
Text Domain: helllo-world
*/

@font-face {
    font-family: "Jost";
    src: url("assets/fonts/jost-variable.woff2") format("woff2");
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
}

@font-face {
    font-family: "Jost";
    src: url("assets/fonts/jost-variable-italic.woff2") format("woff2");
    font-style: italic;
    font-weight: 100 900;
    font-display: swap;
}

:root {
    color-scheme: dark;
    color: #f5f6ff;
    background: #020919;
    font-family: "Jost", sans-serif;
    font-synthesis: none;
    line-height: 1.5;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100svh; display: flex; flex-direction: column; }
body.admin-bar { min-height: calc(100svh - 32px); }
button, input, select, textarea, code, pre, kbd, samp { font-family: inherit; }
button { font-size: inherit; }
img { max-width: 100%; height: auto; }
a { color: inherit; text-underline-offset: .25em; }
a:focus-visible, button:focus-visible { outline: 2px solid #fff; outline-offset: 5px; }
[tabindex="-1"]:focus { outline: none; }
.screen-reader-text {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
.skip-link { position: fixed; top: 8px; left: 16px; transform: translateY(-200%); z-index: 10; padding: 12px 18px; background: #020919; }
.skip-link:focus { transform: none; }
.unavailable { cursor: default; color: #c3cce2; }
.site-header, .site-footer { padding-inline: max(20px, env(safe-area-inset-left)) max(20px, env(safe-area-inset-right)); }
.site-header { padding-top: max(18px, env(safe-area-inset-top)); padding-bottom: 12px; }
.primary-nav { position: relative; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; max-width: 680px; margin: auto; background: #fff; border-radius: 6px; }
.nav-home { grid-column: 2; grid-row: 1; display: grid; place-items: center; min-height: 44px; padding: 5px 3px 10px; text-decoration: none; }
.nav-logo { display: block; width: 136px; }
/* Socle blanc des pages secondaires ; la home garde son rendu validé dans roman.css. */
body:not(.roman-page) .site-header,
body:not(.roman-page) .site-footer { position: relative; isolation: isolate; background: #fff; color: #111; }
body:not(.roman-page) .site-header::before,
body:not(.roman-page) .site-footer::before {
    content: "";
    position: absolute;
    z-index: 0;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 3px;
    transform: translateX(-50%);
    background: #0091ff;
    pointer-events: none;
}
body:not(.roman-page) :is(.primary-nav, .footer-groups, .copyright) { position: relative; z-index: 1; }
.nav-logo img { filter: brightness(0); }
body:not(.roman-page) .nav-home { background: #fff; }
body:not(.roman-page) .skip-link { background: #fff; color: #111; border: 1px solid #0091ff; }
body:not(.roman-page) .site-footer { padding-top: 24px; }
body:not(.roman-page) .footer-group { background: #fff; padding: 12px; }
body:not(.roman-page) .footer-group h2 { color: #111; }
body:not(.roman-page) .site-footer .unavailable { color: #555; }
body:not(.roman-page) .footer-group a:hover { color: #005baa; }
body:not(.roman-page) .copyright { width: fit-content; max-width: 100%; margin: 24px auto 0; padding: 4px 10px; background: #fff; color: #444; }
body:not(.roman-page) .site-header a:focus-visible,
body:not(.roman-page) .site-footer a:focus-visible { outline: 2px solid #0091ff; }
.home-background { position: fixed; inset: 0; z-index: -1; pointer-events: none; }
.home-background img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center; }
.home-main { flex: 1; display: grid; place-items: start center; padding: clamp(24px, 4svh, 44px) max(20px, env(safe-area-inset-right)) clamp(28px, 4svh, 44px) max(20px, env(safe-area-inset-left)); text-align: center; }
.home-introduction { position: relative; width: min(100%, 850px); }
.home-introduction::before { content: ""; position: absolute; inset: -22px -12px; z-index: -1; background: #020919; opacity: 0.7; filter: blur(28px); border-radius: 25%; }
/* Le cadre garde l’espace précédent ; le PNG est affiché entier et proportionnel. */
.logo-frame { position: relative; aspect-ratio: 625 / 115; }
.logo-frame > img { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 100%; max-width: none; height: auto; }
.home-logo { display: none; width: min(100%, 625px); margin: 0 auto; }
.home-main h1 { margin: 0; font-size: clamp(1.15rem, 5.25vw, 2rem); line-height: 1.5; font-weight: 400; letter-spacing: .13em; }
.home-main h1 span { display: block; }
.home-premise { margin: 18px 0 0; font-size: clamp(1.0625rem, 4.45vw, 1.3rem); line-height: 1.5; }
.home-cta { display: flex; align-items: center; justify-content: center; gap: 14px; width: fit-content; max-width: 100%; min-height: 56px; margin: 24px auto 0; padding: 13px 18px; border: 1px solid #82c9fa; border-radius: 18px; background: #071329; color: #d3dff0; font-size: 1rem; line-height: 1.5; letter-spacing: .09em; }
.cta-location { flex: none; display: block; width: 1.5em; height: 1.5em; color: #d7efff; }
.cta-label span { display: block; }
.site-footer { width: 100%; padding-top: 18px; padding-bottom: max(16px, env(safe-area-inset-bottom)); background: linear-gradient(transparent, #020919 32px); }
/* Une action de partage unique, dans le flux du footer commun. */
.footer-share { position: relative; z-index: 1; width: min(100%, 920px); margin: 0 auto 20px; text-align: center; }
.footer-share[hidden] { display: none; }
.footer-share-button { min-height: 44px; min-width: 12.5rem; max-width: 100%; padding: 10px 18px; border: 1px solid #b9dfff; border-radius: 5px; background: #edf6ff; color: #10213c; font-size: .9375rem; font-weight: 500; line-height: 1.5; letter-spacing: .06em; cursor: pointer; }
.footer-share-button:hover { background: #e0efff; }
.footer-share-button:focus-visible { outline: 2px solid #005baa; outline-offset: 4px; }
.footer-share-status:not(.screen-reader-text) { width: fit-content; max-width: 100%; margin: 8px auto 0; padding: 4px 8px; background: #fff; color: #10213c; font-size: .875rem; overflow-wrap: anywhere; }
.footer-groups { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 22px; width: min(100%, 920px); margin: 0 auto; }
.footer-group h2 { margin: 0 0 4px; color: #c8d7fa; font-size: .875rem; font-weight: 500; letter-spacing: .1em; }
.footer-group ul { list-style: none; margin: 0; padding: 0; }
.footer-group li > * { display: inline-flex; align-items: center; min-height: 32px; padding-block: 4px; font-size: .9375rem; line-height: 1.5; }
.footer-group a { text-decoration: underline; }
.footer-group a:hover { color: #9fdcff; }
.footer-about { grid-column: 1 / -1; }
.footer-about ul { display: flex; flex-wrap: wrap; gap: 0 20px; }
.copyright { margin: 16px 0 0; text-align: center; color: #c3cce2; font-size: .875rem; }
.content-main { flex: 1; width: min(100% - 40px, 850px); margin: 32px auto; overflow-wrap: anywhere; }
.content-main article { margin-block: 24px; }
@media (min-width: 48rem) and (min-height: 32rem) {
    .site-header { padding-top: 22px; padding-bottom: 16px; }
    .primary-nav { grid-template-columns: 1fr 140px 1fr; column-gap: 24px; }
    .nav-logo { width: 120px; }
    .home-main { place-items: center; padding-block: clamp(28px, 4svh, 56px); }
    .home-logo { display: block; }
    .home-main h1 { margin-top: 22px; letter-spacing: .25em; }
    .home-premise { letter-spacing: .055em; }
    .home-cta { min-width: 520px; margin-top: 26px; padding-inline: 28px; border-radius: 40px; letter-spacing: .14em; }
    .cta-label span { display: inline; }
    .footer-groups { grid-template-columns: 1fr 1fr 1.3fr; gap: 40px; }
    .footer-about { grid-column: auto; }
    .footer-about ul { display: block; }
}
@media (min-width: 48rem) and (min-height: 32rem) and (max-height: 850px) {
    .home-main { padding-block: 24px; }
    .home-logo { width: min(100%, 500px); }
    .footer-group li > * { min-height: 28px; }
}
@media (max-width: 782px) { body.admin-bar { min-height: calc(100svh - 46px); } }
@media (max-height: 600px) {
    .home-main { padding-block: 24px; }
    .home-logo { width: min(100%, 400px); }
}
@media (max-width: 350px) {
    .footer-groups { column-gap: 12px; }
    .home-main h1 { letter-spacing: .08em; }
}

/* Introduction uniquement : 750 ms d'émergence, sortie à 4 s, fin à 4,7 s. */
.home-entry { display: none; }
html.home-entry-active .home-entry {
    display: grid; place-items: center; position: fixed; inset: 0; z-index: 2;
    padding: max(24px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
    pointer-events: none; opacity: 0; visibility: hidden;
    animation: home-entry-auto-out 4700ms linear backwards;
}
.home-entry-content { width: fit-content; max-width: 100%; text-align: center; }
.home-entry-text {
    position: relative; isolation: isolate; width: fit-content; max-width: 100%; margin: 0 auto;
    text-align: center; font-size: clamp(1.125rem, 2vw, 1.5rem); line-height: 1.5;
}
.home-entry-text::before {
    content: ""; position: absolute; inset: -22px -12px; z-index: -1;
    background: #020919; opacity: .7; filter: blur(28px); border-radius: 25%;
}
/* Un seul texte : coupure entre groupes, repli interne possible aux petites largeurs. */
.home-entry-text > span { display: inline-block; max-width: 100%; vertical-align: top; }
.home-entry-enter {
    display: grid; place-items: center; width: 56px; height: 56px; margin: 24px auto 0;
    padding: 12px; border: 0; border-radius: 50%; background: #071329; color: #d7efff;
    cursor: pointer; pointer-events: auto;
}
.home-entry-enter .cta-location { width: 28px; height: 28px; }
html.home-entry-active .home-entry-text { animation: home-entry-emerge 750ms ease-out backwards; }
html.home-entry-active .home-entry-enter { animation: home-entry-target 400ms ease-out 1600ms backwards; }
html.home-entry-active body.home > :is(.site-header, .home-main, .site-footer) {
    animation: home-entry-reveal 700ms ease-in-out 4000ms backwards;
}
/* Une autre animation redémarre la transition à l'instant du clic. */
html.home-entry-active.home-entry-leaving .home-entry { animation: home-entry-out 700ms ease-in-out backwards; }
html.home-entry-active.home-entry-leaving body.home > :is(.site-header, .home-main, .site-footer) {
    animation: home-entry-reveal-now 700ms ease-in-out backwards;
}
html.home-entry-leaving .home-entry-enter { pointer-events: none; }
/* États normaux visibles pour la home : la fin CSS suffit même si le JS échoue. */
@keyframes home-entry-auto-out {
    0% { opacity: 1; visibility: visible; }
    85.106383% { opacity: 1; visibility: visible; animation-timing-function: ease-in-out; }
    100% { opacity: 0; visibility: hidden; }
}
@keyframes home-entry-out {
    from { opacity: 1; visibility: visible; }
    to { opacity: 0; visibility: hidden; }
}
@keyframes home-entry-emerge {
    from { opacity: .08; filter: blur(4px); }
    to { opacity: 1; filter: blur(0); }
}
@keyframes home-entry-target {
    from { opacity: 0; visibility: hidden; }
    to { opacity: 1; visibility: visible; }
}
@keyframes home-entry-reveal {
    from { opacity: 0; pointer-events: none; }
    to { opacity: 1; pointer-events: none; }
}
@keyframes home-entry-reveal-now {
    from { opacity: 0; pointer-events: none; }
    to { opacity: 1; pointer-events: none; }
}
/* Le focus dans l'introduction est permis ; celui de la home la révèle sans délai. */
html.home-entry-active:has(body > :not(.home-entry):focus, body > :not(.home-entry) :focus) .home-entry { display: none; }
html.home-entry-active:has(body > :not(.home-entry):focus, body > :not(.home-entry) :focus) body.home > :is(.site-header, .home-main, .site-footer) { animation: none; }
@media (prefers-reduced-motion: reduce) {
    html.home-entry-active .home-entry { animation: home-entry-still 3000ms step-end backwards; }
    html.home-entry-active .home-entry-text,
    html.home-entry-active .home-entry-enter { animation: none; }
    html.home-entry-active body.home > :is(.site-header, .home-main, .site-footer) {
        animation: home-entry-reveal 0s 3000ms backwards;
    }
    html.home-entry-active.home-entry-leaving .home-entry { display: none; }
    html.home-entry-active.home-entry-leaving body.home > :is(.site-header, .home-main, .site-footer) { animation: none; }
}
@keyframes home-entry-still {
    from { opacity: 1; visibility: visible; }
    to { opacity: 0; visibility: hidden; }
}

/* Liens désormais disponibles : conserver les dimensions des contrôles validés. */
a.home-cta { text-decoration: none; cursor: pointer; }

/* Les anciens libellés de retour deviennent des liens sans changer leur composition. */
.reader-map, .recit-ending > p > a { text-decoration: none; }

/* Découverte d’un autre roman, dans le footer partagé avec les lecteurs. */
.site-footer .footer-discovery {
    position: relative;
    z-index: 1;
    width: fit-content;
    max-width: 100%;
    margin: 28px auto 0;
    padding: 8px 12px;
    background: #fff;
    color: #111;
    text-align: center;
    overflow-wrap: anywhere;
}
.footer-discovery p { margin: 0 0 6px; font-size: .875rem; }
.footer-discovery a { display: inline-block; padding-block: 4px; font-size: .9375rem; font-weight: 500; text-decoration: underline; }
.footer-discovery img { width: 18px; height: auto; vertical-align: -.2em; margin-right: 4px; }

/* Page 404 : le header et le footer conservent leur ligne bleue existante. */
body.error404 { background: #fff; color: #111; }
.error-page-main { width: min(calc(100% - 40px), 680px); margin: clamp(40px, 10vh, 100px) auto; text-align: center; }
.error-page-main h1 { margin: 0 0 24px; font-size: clamp(1.75rem, 5vw, 2.5rem); font-weight: 500; }
.error-page-main p { margin: 0 0 24px; }
.error-page-main a { display: inline-block; padding: 10px 4px; color: #005baa; }
.error-page-main a:focus-visible { outline: 2px solid #0091ff; outline-offset: 4px; }
