/* =========================================================
   CLIMAX STUDIO — common.css
   Styles partagés : reset, variables, header, nav, footer,
   accessibilité, mode jour/nuit.
   ========================================================= */

/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  /* Firefox : scrollbar masquée */
  scrollbar-width: none;
  /* IE / Edge legacy */
  -ms-overflow-style: none;
}

/* Chrome / Edge / Opera / Safari : scrollbar masquée */
html::-webkit-scrollbar,
body::-webkit-scrollbar,
*::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

img, svg, video { display: block; max-width: 100%; height: auto; }

/* ---------- Tokens ---------- */
:root {
  /* Mode clair (par défaut) */
  --paper:        #f0ebe1;
  --paper-soft:   #e6dfd1;
  --ink:          #181613;
  --ink-soft:     #57544c;
  --rule:         #c9c1b0;  
  --accent:       #b8421f;
  --accent-soft:  #d4502b;
  --focus:        #1a4fa3;

  /* Typo */
  --font-display: "Unbounded", system-ui, sans-serif;
  --font-meta:    "JetBrains Mono", ui-monospace, "Courier New", monospace;

  /* Espacements */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 64px;
  --s-9: 96px; --s-10: 128px;

  /* Layout */
  --maxw: 1440px;
  --gutter: clamp(20px, 4vw, 64px);
  --rule-w: 1px;
}

[data-theme="dark"] {
  --paper:        #131210;
  --paper-soft:   #1c1a17;
  --ink:          #f0ebe1;
  --ink-soft:     #a8a298;
  --rule:         #2e2a23;
  --accent:       #ff7a5c;
  --accent-soft:  #ff5e3a;
  --focus:        #6ea8ff;
}

/* ---------- Body ---------- */
body {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  background-image: radial-gradient(circle at 1px 1px, rgba(0,0,0,0.025) 1px, transparent 0);
  background-size: 4px 4px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color .35s ease, color .35s ease;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
[data-theme="dark"] body {
  background-image: radial-gradient(circle at 1px 1px, rgba(255,255,255,0.018) 1px, transparent 0);
}

/* ---------- Skip link (accessibilité) ---------- */
.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  background: var(--ink);
  color: var(--paper);
  padding: 12px 18px;
  z-index: 100;
  font-family: var(--font-meta);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-decoration: none;
}
.skip-link:focus {
  top: 12px;
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

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

::selection { background: var(--accent); color: var(--paper); }

/* ---------- Container ---------- */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ---------- HEADER (masthead magazine) ---------- */
.masthead {
  border-bottom: var(--rule-w) solid var(--ink);
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(8px);
}
.masthead__inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--s-5);
  padding: var(--s-4) 0;
}
.masthead__meta {
  font-family: var(--font-meta);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.masthead__meta--right {
  text-align: right;
  display: flex;
  gap: var(--s-4);
  justify-content: flex-end;
  align-items: center;
}
.masthead__brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: var(--ink);
}
.masthead__brand-img {
  height: 44px;
  width: auto;
  display: block;
  transition: opacity .2s;
}
/* Affichage conditionnel : logo noir en mode jour, logo couleur en mode nuit */
.masthead__brand-img--day { display: block; }
.masthead__brand-img--night { display: none; }
[data-theme="dark"] .masthead__brand-img--day { display: none; }
[data-theme="dark"] .masthead__brand-img--night { display: block; }

.masthead__brand:hover .masthead__brand-img { opacity: 0.85; }

.theme-toggle {
  background: transparent;
  border: var(--rule-w) solid var(--ink);
  border-radius: 999px;
  padding: 6px 14px;
  font-family: var(--font-meta);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
  cursor: pointer;
  transition: background .2s, color .2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.theme-toggle:hover {
  background: var(--ink);
  color: var(--paper);
}
.theme-toggle__icon {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ink);
  transition: background .2s;
}
.theme-toggle:hover .theme-toggle__icon { background: var(--paper); }

/* ---------- NAVIGATION ---------- */
.nav-strip {
  border-bottom: var(--rule-w) solid var(--ink);
  background: var(--paper);
}
.nav-strip__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--s-3) 0;
  gap: var(--s-4);
  flex-wrap: wrap;
}
.nav-list {
  display: flex;
  list-style: none;
  gap: var(--s-6);
  flex-wrap: wrap;
}
.nav-list a {
  font-family: var(--font-meta);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  padding: 4px 0;
  border-bottom: 1px solid transparent;
  transition: border-color .2s, color .2s;
}
.nav-list a:hover, .nav-list a[aria-current="page"] {
  border-bottom-color: var(--accent);
  color: var(--accent);
}
.nav-list a[aria-current="page"] { font-weight: 700; }

.nav-strip__folio {
  font-family: var(--font-meta);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* ---------- MAIN ---------- */
main { flex: 1; }

/* ---------- SECTION HEAD partagé ---------- */
.section-head {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s-3);
  border-bottom: var(--rule-w) solid var(--ink);
  padding: var(--s-7) 0 var(--s-5);
  margin-bottom: var(--s-7);
}
@media (min-width: 768px) {
  .section-head {
    grid-template-columns: auto 1fr auto;
    align-items: end;
    gap: var(--s-6);
  }
}
.section-head__num {
  font-family: var(--font-meta);
  font-size: clamp(14px, 1.5vw, 18px);
  letter-spacing: 0.12em;
  color: var(--accent);
  text-transform: uppercase;
}
.section-head__title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(40px, 9vw, 130px);
  line-height: 0.85;
  letter-spacing: -0.03em;
  text-transform: uppercase;
}
.section-head__title .br {
  display: block;
  text-indent: clamp(20px, 6vw, 100px);
}
.section-head__caption {
  font-family: var(--font-meta);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  max-width: 280px;
  text-align: right;
}

/* ---------- FILTRES (partagé) ---------- */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin-bottom: var(--s-7);
  padding-bottom: var(--s-5);
  border-bottom: var(--rule-w) dashed var(--rule);
}
.filter-btn {
  font-family: var(--font-meta);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  background: transparent;
  border: var(--rule-w) solid var(--ink);
  color: var(--ink);
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: background .2s, color .2s;
}
.filter-btn:hover { background: var(--paper-soft); }
.filter-btn[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
}

/* ---------- FOOTER ---------- */
.footer {
  border-top: var(--rule-w) solid var(--ink);
  padding: var(--s-5) 0;
  margin-top: auto;
}
.footer__inner {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s-3);
  font-family: var(--font-meta);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
@media (min-width: 600px) {
  .footer__inner { grid-template-columns: 1fr 1fr 1fr; }
}
.footer__col--right { text-align: right; }
.footer__col--center { text-align: center; }
.footer a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

/* ---------- Animations entrée ---------- */
@media (prefers-reduced-motion: no-preference) {
  .reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity .8s cubic-bezier(.2,.7,.2,1), transform .8s cubic-bezier(.2,.7,.2,1);
  }
  .reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
  }
}



/* ---------- Transition de page (fade léger) ---------- */
@media (prefers-reduced-motion: no-preference) {
  body {
    animation: pageFadeIn .55s cubic-bezier(.2,.7,.2,1) both;
  }
  body.is-leaving {
    animation: pageFadeOut .35s cubic-bezier(.5,.2,.7,.2) both;
  }
}
@keyframes pageFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes pageFadeOut {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-8px); }
}

/* ---------- Mobile masthead ---------- */
@media (max-width: 600px) {
  .masthead__inner {
    grid-template-columns: auto 1fr auto;
    gap: var(--s-3);
  }
  .masthead__meta:not(.masthead__meta--right) { display: none; }
  .nav-strip__folio { display: none; }
  .masthead__brand-img { height: 36px; }
  /* Réapplique l'affichage conditionnel sur mobile */
  .masthead__brand-img--night { display: none; }
  [data-theme="dark"] .masthead__brand-img--day { display: none; }
  [data-theme="dark"] .masthead__brand-img--night { display: block; }

  /* Nav centrée et bien aérée en mobile */
  .nav-strip__inner {
    justify-content: center;
  }
  .nav-list {
    gap: var(--s-4);
    justify-content: center;
    width: 100%;
  }
  .nav-list a {
    font-size: 13px;
  }
}
