/* benjaminguedj.eu — une page, un écran.
   Polices auto-hébergées, aucune requête vers un tiers, aucun script.
   Deux palettes : la page suit le réglage du système du visiteur. */

@font-face {
  font-family: "Cormorant";
  src: url("/assets/fonts/cormorant.woff2") format("woff2");
  font-weight: 300 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "InterVar";
  src: url("/assets/fonts/inter.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap;
}

/* ───────── palette claire (par défaut) ───────── */
:root {
  --bg:       #faf8f4;
  --bg-lift:  #ffffff;
  --text:     #191816;
  --muted:    #6a6358;
  --faint:    #a8a091;
  --line:     #e4dfd5;
  --accent:   #8a6a28;
  --veil:     rgba(250, 248, 244, .86);
  --shadow:   0 1px 40px rgba(25, 24, 22, .07);
  --sun:      none;
  --moon:     block;
  --serif: "Cormorant", "Iowan Old Style", Palatino, Georgia, serif;
  --sans: "InterVar", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

/* ───────── palette sombre ─────────
   Trois états. Sans attribut on suit le système ; `data-theme` est le choix
   explicite du visiteur et l'emporte dans les deux sens. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:      #0c0c0b;
    --bg-lift: #151513;
    --text:    #ece7dd;
    --muted:   #8b8375;
    --faint:   #565045;
    --line:    #24231f;
    --accent:  #c9ab6f;
    --veil:    rgba(6, 6, 5, .86);
    --shadow:  0 1px 40px rgba(0, 0, 0, .5);
    --sun:     block;
    --moon:    none;
  }
}
:root[data-theme="dark"] {
    --bg:      #0c0c0b;
    --bg-lift: #151513;
    --text:    #ece7dd;
    --muted:   #8b8375;
    --faint:   #565045;
    --line:    #24231f;
    --accent:  #c9ab6f;
    --veil:    rgba(6, 6, 5, .86);
    --shadow:  0 1px 40px rgba(0, 0, 0, .5);
    --sun:     block;
    --moon:    none;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ───────── un écran, jamais de scroll ───────── */

.page {
  min-height: 100svh;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: clamp(1.25rem, 4vh, 2.5rem) clamp(1.5rem, 6vw, 5rem);
  gap: 1rem;
}
.page > header { display: flex; justify-content: flex-end; align-items: center; gap: .3rem; }
.page > main   { display: flex; flex-direction: column; justify-content: center; }
.page > footer { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; }

/* ───────── bascule de langue ───────── */

.lang {
  display: flex; gap: .5rem; align-items: center;
  font-size: .68rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--faint);
}
.lang a { color: var(--muted); text-decoration: none; transition: color .25s; }
.lang a:hover { color: var(--accent); }
.lang [aria-current] { color: var(--text); }

.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.85rem; height: 1.85rem; margin-left: .35rem;
  padding: 0; background: none; border: 0; border-radius: 50%;
  color: var(--muted); cursor: pointer;
  transition: color .25s, background .25s;
  -webkit-tap-highlight-color: transparent;
}
.theme-toggle:hover { color: var(--accent); }
.theme-toggle:focus-visible { outline: 1px solid var(--accent); outline-offset: 3px; }
.theme-toggle svg { width: 1.05rem; height: 1.05rem; display: block; }
.theme-toggle .icon-sun  { display: var(--sun); }
.theme-toggle .icon-moon { display: var(--moon); }

/* ───────── bloc central ───────── */

h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.05;
  letter-spacing: -0.005em;
  margin: 0 0 clamp(1.1rem, 3.5vh, 2rem);
}

.tagline {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(1.35rem, 4.2vw, 2.35rem);
  line-height: 1.25;
  letter-spacing: -0.012em;
  max-width: 20ch;
  margin: 0 0 clamp(1rem, 2.5vh, 1.5rem);
}

.roles {
  margin: 0;
  /* Grille plutôt que flux : la coupure est décidée, pas subie. Trois
     colonnes donnent deux rangées nettes — l'identité académique au-dessus,
     l'entrepreneuriale en dessous — au lieu d'un mot esseulé en fin de bloc. */
  display: grid;
  grid-template-columns: repeat(3, max-content);
  column-gap: 1.5em;
  row-gap: .1em;
  font-size: clamp(.66rem, 1.5vw, .74rem);
  letter-spacing: .2em;
  text-transform: uppercase;
  line-height: 1.9;
  color: var(--muted);
}
/* Sous ~420 px, trois colonnes ne tiennent plus : on passe à deux. */
@media (max-width: 26.5rem) {
  .roles { grid-template-columns: repeat(2, max-content); }
}

/* ───────── liens ───────── */

nav.links {
  margin-top: clamp(2rem, 6.5vh, 4rem);
  display: flex; flex-wrap: wrap;
  gap: clamp(1.5rem, 4vw, 2.75rem);
}
nav.links a {
  position: relative;
  color: var(--text);
  text-decoration: none;
  font-size: clamp(.88rem, 1.9vw, .97rem);
  padding-bottom: .35rem;
  transition: color .25s;
}
nav.links a::after {
  content: ""; position: absolute; left: 0; bottom: 0;
  width: 100%; height: 1px; background: var(--faint);
  transition: background .25s;
}
nav.links a:hover { color: var(--accent); }
nav.links a:hover::after { background: var(--accent); }
nav.links a:focus-visible { outline: 1px solid var(--accent); outline-offset: 6px; }

nav.links a[target]::before {
  content: "↗"; position: absolute; right: -.95rem; top: -.2rem;
  font-size: .66em; color: var(--faint); transition: color .25s;
}
nav.links a[target]:hover::before { color: var(--accent); }

/* ───────── pied ───────── */

footer {
  font-size: .66rem; letter-spacing: .16em;
  text-transform: uppercase; color: var(--faint);
}
footer p { margin: 0; }

/* ───────── voile modal — piloté par :target, sans JavaScript ───────── */

.veil {
  position: fixed; inset: 0; z-index: 20;
  display: grid; place-items: center; padding: 1.5rem;
  background: var(--veil);
  -webkit-backdrop-filter: blur(7px);
  backdrop-filter: blur(7px);
  opacity: 0; visibility: hidden;
  transition: opacity .3s ease, visibility .3s;
}
.veil:target { opacity: 1; visibility: visible; }
.veil-dismiss { position: absolute; inset: 0; cursor: default; }

.panel {
  position: relative;
  width: min(29rem, 100%);
  max-height: 90svh; overflow-y: auto;
  background: var(--bg-lift);
  border: 1px solid var(--line);
  border-radius: 3px;
  box-shadow: var(--shadow);
  padding: clamp(1.75rem, 5vw, 2.5rem);
}
.panel h2 {
  font-family: var(--serif); font-weight: 300;
  font-size: 1.85rem; line-height: 1.15; margin: 0 0 .5rem;
}
.panel .hint {
  margin: 0 0 1.6rem; font-size: .82rem; line-height: 1.6; color: var(--muted);
}
.close {
  position: absolute; top: .85rem; right: 1.05rem;
  color: var(--faint); text-decoration: none;
  font-size: 1.35rem; line-height: 1; transition: color .25s;
}
.close:hover { color: var(--text); }

/* ───────── formulaire ───────── */

.field { margin-bottom: 1.1rem; }
label {
  display: block; font-size: .64rem; letter-spacing: .18em;
  text-transform: uppercase; color: var(--muted); margin-bottom: .4rem;
}
input[type="text"], input[type="email"], textarea {
  width: 100%; background: transparent; border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--text); font-family: inherit; font-size: .95rem;
  padding: .5rem 0; border-radius: 0; transition: border-color .25s;
}
textarea { resize: vertical; min-height: 5.5rem; line-height: 1.55; }
input:focus, textarea:focus { outline: none; border-bottom-color: var(--accent); }
input::placeholder, textarea::placeholder { color: var(--faint); }

/* piège à robots — invisible pour un humain, rempli par un script */
.trap { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

button[type="submit"] {
  margin-top: .6rem; width: 100%;
  background: transparent; border: 1px solid var(--faint);
  color: var(--text); font-family: inherit;
  font-size: .7rem; letter-spacing: .2em; text-transform: uppercase;
  padding: .9rem 1rem; border-radius: 2px; cursor: pointer;
  transition: border-color .25s, color .25s;
}
button[type="submit"]:hover { border-color: var(--accent); color: var(--accent); }
button[type="submit"]:focus-visible { outline: 1px solid var(--accent); outline-offset: 3px; }

.panel .back {
  display: inline-block; margin-top: 1.2rem;
  font-size: .7rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--muted); text-decoration: none;
  border-bottom: 1px solid var(--faint); padding-bottom: .2rem;
  transition: color .25s, border-color .25s;
}
.panel .back:hover { color: var(--accent); border-color: var(--accent); }

/* ───────── confort ───────── */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* écrans très bas (téléphone en paysage) : autoriser le scroll plutôt que
   de tronquer le contenu. */
@media (max-height: 27rem) {
  .page { min-height: 0; }
  nav.links { margin-top: 1.5rem; }
}

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