/*
Theme Name: Un singe en hiver
Theme URI: https://un-singe-en-hiver.com
Author: Webmaster
Description: Thème sur mesure du site du Fada du Singe en Hiver.
Version: 0.4.3
Requires at least: 6.4
Requires PHP: 8.0
Text Domain: un-singe-en-hiver
*/

:root {
  --bg: #f7f5f1;
  --text: #1f1d1a;
  --muted: #6b665e;
  --accent: #2f5d7c;
  --panel: #fffdf9;
  --border: #ddd6ca;
  --max: 960px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161514;
    --text: #ece8e1;
    --muted: #a39d93;
    --accent: #8cb8d6;
    --panel: #1e1d1b;
    --border: #3a3733;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.6 Georgia, "Times New Roman", serif;
}

a { color: var(--accent); }

img, video, iframe { max-width: 100%; height: auto; }

.site-header,
.layout,
.site-footer {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 16px;
}

/* En-tête */
.site-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-top: 24px;
  padding-bottom: 24px;
}

.logo {
  font-weight: bold;
  text-decoration: none;
  color: var(--text);
}

.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
}

.site-nav a { text-decoration: none; }

.site-nav a[aria-current="page"] {
  color: var(--text);
  font-weight: bold;
}

/* Mise en page : contenu + cadre menu à droite */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 40px;
  align-items: start;
}

/* Titre en image (lettres de la police du film) */
.titre-image {
  display: block;
  width: min(100%, 520px);
  height: auto;
}
.bientot .titre-image { margin: 0 auto; }

/* Bloc de titre : logo Confrérie | titre | logo Fadas */
.titre-bloc {
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  width: min(calc(100vw - 32px), 1000px);
  display: grid;
  grid-template-columns: 1fr minmax(0, 520px) 1fr;
  align-items: center;
  gap: 16px;
  margin-bottom: 32px;
}
/* Page d'accueil : le bloc reste dans la colonne de gauche, sans déborder
   sous le cadre « Rubriques » ni hors de l'écran */
.hero .titre-bloc {
  left: 0;
  transform: none;
  width: 100%;
  grid-template-columns: 1fr minmax(0, 3fr) 1fr;
}
.hero .logo-journal { height: auto; width: 100%; max-height: 180px; object-fit: contain; }
.titre-bloc h1 { margin: 0; }
.titre-bloc .titre-image { margin: 0 auto; }
.logo-journal {
  height: clamp(110px, 16vw, 200px);
  width: auto;
}
.logo-confrerie { justify-self: end; }
.logo-fadas { justify-self: start; }
/* Petits écrans : les deux logos côte à côte au-dessus du titre */
@media (max-width: 640px) {
  .titre-bloc {
    grid-template-columns: 1fr 1fr;
    grid-template-areas: "g d" "t t";
  }
  .titre-bloc h1 { grid-area: t; }
  .logo-confrerie { grid-area: g; }
  .logo-fadas { grid-area: d; }
  .logo-journal { height: 100px; }
  .hero .titre-bloc { grid-template-columns: 1fr 1fr; }
  .hero .logo-journal { height: 100px; width: auto; }
}

/* Effet « journal qui tournoie » des vieux films : le logo arrive du fond
   en tournant sur lui-même, puis s'arrête net face au lecteur. */
.logo-journal {
  animation: usih-journal 1.4s cubic-bezier(0.2, 0.7, 0.3, 1) 0.2s both;
}
@keyframes usih-journal {
  0%   { transform: scale(0) rotate(-1080deg); opacity: 0; }
  15%  { opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .logo-journal { animation: none; }
}
@media (prefers-color-scheme: dark) {
  /* dessin noir de la Confrérie passé en clair, en gardant la lanterne rouge */
  .logo-confrerie { filter: invert(0.92) hue-rotate(180deg); }
}

/* Titre tapé à la machine à écrire (voir js/titre-frappe.js) */
.titre-anime { position: relative; }
.titre-anime img { position: absolute; height: auto; }
.usih-js .titre-anime img { visibility: hidden; }
.usih-js .titre-anime img.frappee {
  visibility: visible;
  animation: usih-frappe 0.05s ease-out;
}
/* Le caractère frappe le papier : petit écrasement, comme le marteau de la machine */
@keyframes usih-frappe {
  from { transform: translateY(-4%) scale(1.06); opacity: 0.6; }
  to   { transform: none; opacity: 1; }
}
/* Bouton « Rejouer avec le son » : posé en haut à droite de l'écran, par-dessus
   la page, pour ne rien décaler (titre et logos restent à leur place). */
.titre-son {
  position: fixed;
  top: calc(var(--wp-admin--admin-bar--height, 0px) + 12px);
  right: 12px;
  z-index: 100;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--bg);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
  font: inherit;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  color: inherit;
  opacity: 0.85;
  border: 0;
  cursor: pointer;
}
.titre-son:hover, .titre-son:focus-visible { opacity: 1; text-decoration: underline; }
@media (prefers-reduced-motion: reduce) {
  .usih-js .titre-anime img { visibility: visible; animation: none; }
}

@media (prefers-color-scheme: dark) {
  .titre-image { filter: invert(0.92); }
}

.hero { padding: 64px 0 32px; }
.hero h1 { font-size: clamp(2rem, 6vw, 3.5rem); margin: 0 0 12px; }

.page-intro { padding: 48px 0 8px; }
.page-intro h1 { font-size: clamp(1.8rem, 5vw, 2.6rem); margin: 0 0 16px; }

/* Texte des pages */
.prose { max-width: 40em; padding-bottom: 48px; }
.prose p { margin: 0 0 1.2em; }
.prose h2 { font-size: 1.2rem; margin: 2em 0 0.5em; }
.prose h2:first-child { margin-top: 0; }
.prose .signature {
  margin-top: 2em;
  font-size: 1.2rem;
  font-style: italic;
}
.prose .signature strong { font-style: normal; }
.prose .suite { margin-top: 1.5em; }

/* Liste d'articles */
.post-list { list-style: none; margin: 0; padding: 0 0 48px; }
.post-list li { padding: 16px 0; border-bottom: 1px solid var(--border); }
.post-list h2 { margin: 0 0 4px; font-size: 1.3rem; }
.post-list time { color: var(--muted); font-size: 0.9rem; }

/* Cadre Rubriques */
.sidebar {
  margin-top: 48px;
  padding: 20px 20px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  position: sticky;
  top: 24px;
}

.sidebar h2 {
  margin: 0 0 12px;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar li { margin: 0 0 8px; }
.sidebar a { text-decoration: none; }
.sidebar a:hover { text-decoration: underline; }
.sidebar a[aria-current="page"] { color: var(--text); font-weight: bold; }

/* Pied de page */
.site-footer {
  padding-top: 32px;
  padding-bottom: 32px;
  color: var(--muted);
  font-size: 0.9rem;
}

/* Accessibilité : lien « aller au contenu » */
.skip-link {
  position: absolute;
  left: -9999px;
}
.skip-link:focus {
  left: 16px;
  top: 8px;
  background: var(--panel);
  padding: 8px 12px;
}

/* Page d'attente « Bientôt » */
.page-bientot {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bientot {
  max-width: 36em;
  padding: 48px 16px;
  text-align: center;
}

.bientot-surtitre {
  margin: 0 0 8px;
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.bientot h1 {
  font-size: clamp(2.4rem, 9vw, 4.5rem);
  line-height: 1.1;
  margin: 0;
}

.bientot-texte p { margin: 0 0 1.2em; }

.bientot-texte p:last-child {
  margin-top: 2em;
  font-style: italic;
}

.bientot-signature {
  margin: 40px 0 0;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: inline-block;
  font-weight: bold;
}

.bandeau-bientot {
  background: var(--accent);
  color: var(--bg);
  text-align: center;
  font-size: 0.85rem;
  padding: 6px 16px;
}

@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; gap: 0; }
  .sidebar { position: static; margin: 0 0 32px; }
}

/* ==================================================================
   Ambiance « cinéma » (tout le site, sauf la page d'attente)
   Salle sombre, rideau rouge en haut, titres dorés, et à gauche une
   pellicule de film : logos de la Confrérie et des Fadas, puis Rubriques.
   ================================================================== */
.cinema {
  --bg: #14110f;          /* salle obscure */
  --text: #ece4d4;        /* lumière du projecteur */
  --muted: #a89d8a;
  --accent: #e0b85a;      /* dorure des fauteuils et des lettres */
  --panel: #1d1916;
  --border: #3b332b;
  --rideau: #7d1418;
  --film: #0d0c0b;        /* noir de la pellicule */
  --image: #efe6d2;       /* image claire sur la pellicule */
  --max: 1100px;
  background: radial-gradient(ellipse at 50% 0, #2a211b 0, var(--bg) 60%) fixed, var(--bg);
}

/* Rideau rouge plissé tout en haut */
.cinema::before {
  content: "";
  display: block;
  height: 26px;
  background:
    linear-gradient(to bottom, rgba(0, 0, 0, 0) 55%, rgba(0, 0, 0, 0.55)),
    repeating-linear-gradient(90deg, #5a0d10 0 6px, var(--rideau) 6px 20px, #a3242a 20px 26px, var(--rideau) 26px 36px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
}

.cinema .site-header {
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}
.cinema .logo {
  color: var(--accent);
  font-variant: small-caps;
  letter-spacing: 0.08em;
  font-size: 1.15rem;
}
.cinema .site-nav a { color: var(--text); letter-spacing: 0.03em; }
.cinema .site-nav a:hover,
.cinema .site-nav a[aria-current="page"] { color: var(--accent); }

.cinema .page-intro h1,
.cinema .prose h2 {
  color: var(--accent);
  font-variant: small-caps;
  letter-spacing: 0.04em;
}

/* Titre tapé : lettres claires sur l'écran sombre */
.cinema .titre-image { filter: invert(0.9) sepia(0.25); }
.cinema .hero { padding: 32px 0 24px; }
.cinema .hero h1 { margin: 0 auto 12px; }
.cinema .hero .titre-image { margin: 0 auto; }

/* Mise en page : pellicule à gauche, contenu à droite */
.cinema .layout {
  grid-template-columns: 230px minmax(0, 1fr);
  grid-template-areas: "pellicule contenu";
  gap: 48px;
}
.cinema .content { grid-area: contenu; }
.cinema .sidebar { grid-area: pellicule; }

/* Titres de pages composés avec les lettres du film (La Confrérie, Les Fadas) */
.titre-image.titre-page { width: min(100%, 640px); margin: 0 0 8px; }

/* La pellicule : bande noire avec perforations des deux côtés */
.cinema .pellicule {
  position: static;
  margin: 24px 0 48px;
  padding: 14px 30px;
  border: 0;
  border-radius: 3px;
  background-color: var(--film);
  background-image:
    repeating-linear-gradient(to bottom, transparent 0 7px, #cfc6b4 7px 19px, transparent 19px 28px),
    repeating-linear-gradient(to bottom, transparent 0 7px, #cfc6b4 7px 19px, transparent 19px 28px);
  background-size: 11px 100%, 11px 100%;
  background-position: 9px 0, calc(100% - 9px) 0;
  background-repeat: no-repeat;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}
/* Une image de la pellicule */
.cinema .vue {
  position: relative;
  background: var(--image);
  color: #1f1d1a;
  border-radius: 4px;
  margin: 0 0 14px;
  padding: 14px;
  box-shadow: inset 0 0 18px rgba(80, 60, 30, 0.35);
}
.cinema .vue:last-child { margin-bottom: 0; }
.cinema .vue-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 4 / 3;
}
.cinema .vue-logo img {
  max-height: 100%;
  width: auto;
  height: auto;
  max-width: 100%;
  filter: none;
}
.cinema .vue-rubriques h2 {
  margin: 0 0 10px;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #7a6f5f;
}
.cinema .vue-rubriques ul { list-style: none; margin: 0; padding: 0; }
.cinema .vue-rubriques li { margin: 0 0 6px; }
.cinema .vue-rubriques a { color: #5a1215; text-decoration: none; font-weight: bold; }
.cinema .vue-rubriques a:hover { text-decoration: underline; }
.cinema .vue-rubriques a[aria-current="page"] { color: #1f1d1a; }

.cinema .site-footer {
  border-top: 1px solid var(--border);
  text-align: center;
}

/* Logos cliquables : bulle d'info au survol, avec une chaise de réalisateur */
.cinema .vue-lien {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}
.cinema .vue-lien img { transition: transform 0.2s ease; }
.cinema .vue-lien:hover img,
.cinema .vue-lien:focus-visible img { transform: scale(1.06); }
.cinema .bulle {
  position: absolute;
  left: calc(100% + 40px);
  top: 50%;
  z-index: 20;
  width: max-content;
  max-width: 230px;
  padding: 28px 16px 10px;
  border-radius: 12px;
  background: var(--image);
  color: #1f1d1a;
  font-size: 0.9rem;
  font-weight: bold;
  line-height: 1.3;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.55);
  opacity: 0;
  visibility: hidden;
  transform: translate(-6px, -50%);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
  pointer-events: none;
}
/* petite pointe vers le logo */
.cinema .bulle::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 50%;
  margin-top: -7px;
  border: 7px solid transparent;
  border-left: 0;
  border-right-color: var(--image);
}
.cinema .bulle .bulle-chaise {
  position: absolute;
  max-width: none;
  max-height: none;
  transform: none !important;
  top: -18px;
  left: 6px;
  width: 42px;
  height: 42px;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.35));
}
.cinema .vue-lien:hover .bulle,
.cinema .vue-lien:focus-visible .bulle {
  opacity: 1;
  visibility: visible;
  transform: translate(0, -50%);
}
/* Écrans tactiles et petits écrans : pas de survol, le logo est un simple lien */
@media (hover: none), (max-width: 760px) {
  .cinema .bulle { display: none; }
}

/* Petits écrans : la pellicule passe en haut, couchée à l'horizontale */
@media (max-width: 760px) {
  .cinema .layout {
    grid-template-columns: 1fr;
    grid-template-areas: "pellicule" "contenu";
    gap: 0;
  }
  .cinema .pellicule {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    margin: 8px 0 24px;
    padding: 26px 12px;
    background-image:
      repeating-linear-gradient(to right, transparent 0 7px, #cfc6b4 7px 19px, transparent 19px 28px),
      repeating-linear-gradient(to right, transparent 0 7px, #cfc6b4 7px 19px, transparent 19px 28px);
    background-size: 100% 11px, 100% 11px;
    background-position: 0 8px, 0 calc(100% - 8px);
  }
  .cinema .vue { flex: 0 0 auto; margin: 0; }
  .cinema .vue-logo { width: 120px; padding: 8px; }
  .cinema .vue-rubriques { min-width: 160px; }
}
