:root {
  --bg: #0a0907;
  --fg: #f4f1ea;
  --fg-dim: #b5afa3;
  --fg-mute: #6c665b;
  --line: #2a2722;
  --line-soft: #1a1814;
  --accent: #c8a456;
  --accent-dim: #8a7235;
  --serif: "Fraunces", Georgia, serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;

  /* ── Global UI scale fallback (overridden by data.php) ── */
  --ui-hud:     clamp(7px,  0.69vw, 13px);  /* 10px @ 1440px — chrome HUD  */
  --ui-label:   clamp(8px,  0.83vw, 15px);  /* 12px @ 1440px — labels, tags */
  --ui-body:    clamp(13px, 1.18vw, 22px);  /* 17px @ 1440px — bio, corps   */
  --ui-heading: clamp(20px, 1.94vw, 36px);  /* 28px @ 1440px — titres moyens*/
  --ui-title:   clamp(36px, 3.61vw, 68px);  /* 52px @ 1440px — grands titres*/
}

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

/* Chrome/Safari mobile peignent un rectangle bleu translucide sur tout élément
   tapé. Le site a déjà ses propres états actifs — ce flash ne fait que salir
   les boutons arrondis (switch FR/EN, LVL, cartes). */
* { -webkit-tap-highlight-color: transparent; }

html, body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--serif);
  font-feature-settings: "ss01", "ss02";
  overflow: hidden;
  height: 100%;
  width: 100%;
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }

#root { width: 100vw; height: 100vh; position: relative; overflow: hidden; }

/* ============== SCROLLBAR (page scroll containers) ============== */
.about, .grid, .deck-mobile-scroll {
  scrollbar-width: thin;
  scrollbar-color: var(--accent-dim) rgba(10,9,7,0.35);
}
.about::-webkit-scrollbar,
.grid::-webkit-scrollbar,
.deck-mobile-scroll::-webkit-scrollbar { width: 11px; }
.about::-webkit-scrollbar-track,
.grid::-webkit-scrollbar-track,
.deck-mobile-scroll::-webkit-scrollbar-track { background: rgba(10,9,7,0.35); }
.about::-webkit-scrollbar-thumb,
.grid::-webkit-scrollbar-thumb,
.deck-mobile-scroll::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--accent-dim), #6b5626);
  border-radius: 8px; border: 2px solid transparent; background-clip: padding-box;
}
.about::-webkit-scrollbar-thumb:hover,
.grid::-webkit-scrollbar-thumb:hover,
.deck-mobile-scroll::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--accent), var(--accent-dim));
  background-clip: padding-box;
}

/* ============== BACK-TO-TOP BUTTON ============== */
.scroll-top-btn {
  position: fixed; bottom: 22px; right: 26px; z-index: 60;
  width: 46px; height: 46px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(10,9,7,0.82); border: 1px solid var(--accent-dim);
  color: var(--accent); font-size: 19px; cursor: pointer;
  backdrop-filter: blur(6px);
  opacity: 0; pointer-events: none; transform: translateY(10px);
  transition: opacity .25s ease, transform .25s ease, background .2s, border-color .2s;
}
.scroll-top-btn.show { opacity: 1; pointer-events: auto; transform: translateY(0); }
.scroll-top-btn:hover { background: rgba(200,164,86,0.16); border-color: var(--accent); }

/* ============== UTILITY ============== */
.mono { font-family: var(--mono); letter-spacing: 0.02em; }
.tracked { letter-spacing: 0.18em; text-transform: uppercase; }
.dim { color: var(--fg-dim); }
.mute { color: var(--fg-mute); }
.accent { color: var(--accent); }

.clip-corners {
  clip-path: polygon(
    14px 0, calc(100% - 14px) 0, 100% 14px,
    100% calc(100% - 14px), calc(100% - 14px) 100%, 14px 100%,
    0 calc(100% - 14px), 0 14px
  );
}
.clip-corners-sm {
  clip-path: polygon(
    8px 0, calc(100% - 8px) 0, 100% 8px,
    100% calc(100% - 8px), calc(100% - 8px) 100%, 8px 100%,
    0 calc(100% - 8px), 0 8px
  );
}
.clip-corners-lg {
  clip-path: polygon(
    22px 0, calc(100% - 22px) 0, 100% 22px,
    100% calc(100% - 22px), calc(100% - 22px) 100%, 22px 100%,
    0 calc(100% - 22px), 0 22px
  );
}

/* ============== HUD ============== */
.hud {
  position: fixed; inset: 0; pointer-events: none; z-index: 50;
  font-family: var(--mono); font-size: var(--ui-hud); color: var(--fg-dim);
  letter-spacing: 0.12em; text-transform: uppercase;
}
.hud > * { pointer-events: auto; }

.hud-tl, .hud-tr, .hud-bl, .hud-br {
  position: absolute; padding: 22px 28px;
  display: flex; align-items: center; gap: 14px;
}
.hud-tl { top: 0; left: 0; }
.hud-tr { top: 0; right: 0; }
.hud-bl { bottom: 0; left: 0; }
.hud-br { bottom: 0; right: 0; }

.hud-kbd {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  background: rgba(10,9,7,0.7);
  color: var(--fg);
  font-size: var(--ui-hud);
}
.hud-kbd-key { color: var(--accent); }

.hud-logo {
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  background: none; border: none; padding: 0;
  transition: opacity .2s;
}
.hud-logo:hover { opacity: 0.7; }
/* White logo — no invert */
.hud-logo img { width: 100%; height: 100%; object-fit: contain; }

.hud-divider { width: 1px; height: 14px; background: var(--line); }

/* Player level badge */
.hud-player-wrap {
  display: flex; flex-direction: column; align-items: center; gap: 0;
  position: relative;
}
.hud-player-lvl {
  color: var(--accent);
  background: rgba(200,164,86,0.1);
  border: 1px solid var(--accent-dim);
  border-radius: 7px;
  padding: 4px 10px; font-size: var(--ui-hud); letter-spacing: 0.2em;
  font-family: var(--mono);
  transition: background .3s, border-color .3s, color .3s;
  min-width: 62px; text-align: center;
  display: inline-flex; align-items: center; justify-content: center;
}
.hud-player-lvl.hud-lvlup {
  background: rgba(0,220,220,0.18);
  border-color: rgba(0,220,220,0.55);
  color: #00dcdc;
}
.hud-lvlup-arrow {
  display: inline-block;
  animation: lvlup-arrow .6s cubic-bezier(.2,.9,.4,1) forwards;
}
@keyframes lvlup-arrow {
  0%   { transform: translateY(4px); opacity: 0; }
  30%  { opacity: 1; }
  100% { transform: translateY(-2px); opacity: 1; }
}
.hud-lvlup-plus {
  position: absolute; top: calc(100% + 5px); left: 50%; transform: translateX(-50%);
  font-family: var(--mono); font-size: var(--ui-hud); letter-spacing: 0.2em;
  color: #00dcdc; white-space: nowrap; text-align: center;
  animation: lvlup-plus .4s ease forwards;
}
@keyframes lvlup-plus {
  0%   { opacity: 0; transform: translateY(-3px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* ============== GRID SLIDER ============== */
.grid-slider-wrap {
  flex: 1; min-height: 0;
  display: flex; align-items: stretch;
  gap: 14px;
}
/* Continuous horizontal scroll viewport */
.grid-viewport {
  flex: 1; min-width: 0;
  overflow-x: auto; overflow-y: hidden;
  cursor: grab; user-select: none;
  scrollbar-width: none;
}
.grid-viewport::-webkit-scrollbar { display: none; }
.grid-viewport.grabbing { cursor: grabbing; }
.grid-viewport img { -webkit-user-drag: none; user-drag: none; }
.grid-track {
  display: flex; gap: 20px; height: 100%; align-items: stretch;
}
.grid-track .grid-card { flex: 0 0 calc((100% - 60px) / 4); }
.grid-arrow {
  width: 44px; height: 56px; flex-shrink: 0; align-self: center;
  background: rgba(10,9,7,0.75); border: 1px solid var(--line);
  color: var(--fg-dim); font-size: 24px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: color .2s, border-color .2s, background .2s;
}
.grid-arrow:not(:disabled):hover { color: var(--accent); border-color: var(--accent-dim); background: rgba(200,164,86,0.06); }
.grid-arrow:disabled { opacity: 0; pointer-events: none; }
.grid-list {
  flex: 1; display: grid; gap: 20px; min-height: 0; min-width: 0;
}

/* Lang switch — FR / EN toggle */
.lang-switch {
  position: relative;
  display: inline-flex; align-items: stretch;
  font-family: var(--mono); font-size: var(--ui-hud); letter-spacing: 0.15em;
  border: 1px solid var(--line); border-radius: 999px;
  background: rgba(10,9,7,0.7);
  padding: 3px; cursor: pointer;
  transition: border-color .2s;
}
.lang-switch:hover { border-color: var(--fg-mute); }
.lang-switch-opt {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: center;
  min-width: 26px; padding: 3px 8px;
  color: var(--fg-mute); transition: color .25s ease;
  user-select: none;
}
/* FR active by default (first opt), EN active when .is-en */
.lang-switch:not(.is-en) .lang-switch-opt:first-child,
.lang-switch.is-en .lang-switch-opt:last-child { color: var(--bg); font-weight: 500; }
.lang-switch-thumb {
  position: absolute; z-index: 1; top: 3px; bottom: 3px;
  left: 3px; width: calc(50% - 3px);
  background: var(--accent); border-radius: 999px;
  transition: transform .28s cubic-bezier(.4,0,.2,1);
}
.lang-switch.is-en .lang-switch-thumb { transform: translateX(100%); }

/* Back button in HUD tl */
.hud-back-btn {
  font-family: var(--mono); font-size: var(--ui-hud);
  letter-spacing: 0.15em; text-transform: uppercase;
  color: var(--fg-mute);
  padding: 5px 9px;
  border: 1px solid var(--line);
  background: rgba(10,9,7,0.7);
  cursor: pointer;
  transition: color .2s, border-color .2s;
}
.hud-back-btn:hover { color: var(--fg); border-color: var(--fg-dim); }

/* ── Screen entrance animations ─────────────────────────────────── */

/* Text / label elements — float up cleanly */
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(32px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Heavy cards — materialize with blur, scale, big travel */
@keyframes materializeCard {
  0%   { opacity: 0; transform: translateY(60px) scale(0.94); filter: blur(6px); }
  50%  { filter: blur(0); }
  100% { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

/* Grid project cards — dealt from below, snappy */
@keyframes dealCard {
  0%   { opacity: 0; transform: translateY(48px) scale(0.96); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* text — soft quart ease-out */
.anim-in   { animation: fadeSlideUp    0.55s cubic-bezier(0.25, 1, 0.5, 1) both; }
/* cards — expo ease-out: fast snap, long settle */
.anim-card { animation: materializeCard 0.8s  cubic-bezier(0.16, 1, 0.3, 1) both; }
/* deal — same expo but shorter */
.anim-deal { animation: dealCard        0.52s cubic-bezier(0.16, 1, 0.3, 1) both; }

/* ============== HOME ============== */
.home {
  width: 100%; height: 100%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: clamp(20px, 4vh, 56px);
  position: relative;
  padding: clamp(60px, 10vh, 120px) 80px;
  background: radial-gradient(ellipse at center, #14110d 0%, #0a0907 60%, #050402 100%);
}

.home-watermark {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
  opacity: 0.018;
}
/* White watermark — no invert */
.home-watermark img { height: 92vh; }

.home-header {
  display: flex; flex-direction: column; align-items: center; gap: 18px;
  text-align: center; z-index: 2; width: 100%;
}
.home-header > * { width: 100%; }
.home-name {
  font-family: var(--serif); font-weight: 300; font-size: var(--ui-label);
  letter-spacing: 0.6em; text-transform: uppercase; color: var(--fg-dim);
}
.home-title {
  font-family: var(--serif); font-weight: 400; font-style: italic;
  font-size: var(--ui-title); line-height: 0.95;
  letter-spacing: -0.02em; color: var(--fg);
}
.home-title em { color: var(--accent); font-style: italic; }
.home-tagline {
  font-family: var(--mono); font-size: var(--ui-label);
  letter-spacing: 0.3em; text-transform: uppercase; color: var(--fg-mute);
}

.home-cards { display: flex; gap: 28px; z-index: 2; }

.home-card {
  width: clamp(240px, 24vw, 300px);
  height: clamp(280px, 48vh, 380px);
  background: linear-gradient(180deg, #16130e 0%, #0d0b08 100%);
  border: 1px solid var(--line);
  padding: clamp(20px, 3vh, 32px) clamp(20px, 2.5vw, 28px);
  display: flex; flex-direction: column; justify-content: space-between;
  position: relative;
  transition: translate .25s ease, border-color .25s ease, background .25s ease;
  cursor: pointer; text-align: left;
}
.home-card:hover, .home-card.focus {
  translate: 0 -6px;
  border-color: var(--accent);
  background: linear-gradient(180deg, #1d1810 0%, #0d0b08 100%);
}
.home-card:hover .home-card-glyph,
.home-card.focus .home-card-glyph { color: var(--accent); }

.home-card-tag { font-family: var(--mono); font-size: var(--ui-hud); letter-spacing: 0.25em; color: var(--fg-mute); }
.home-card-glyph {
  font-family: var(--serif); font-size: clamp(64px, 10vh, 110px); line-height: 1;
  font-weight: 300; color: var(--fg);
  transition: color .25s ease;
  margin: clamp(12px, 3vh, 30px) 0 clamp(8px, 2vh, 20px);
}
.home-card-label { font-family: var(--serif); font-size: var(--ui-heading); font-weight: 400; letter-spacing: -0.01em; }
.home-card-sub { font-family: var(--mono); font-size: var(--ui-label); color: var(--fg-dim); letter-spacing: 0.05em; margin-top: 6px; }
.home-card-foot {
  display: flex; justify-content: space-between; align-items: center;
  font-family: var(--mono); font-size: var(--ui-hud); letter-spacing: 0.2em; color: var(--fg-mute); margin-top: auto;
}
.home-card-foot .arrow { color: var(--accent); font-size: 14px; }

.home-press {
  position: absolute; bottom: clamp(36px, 6vh, 80px);
  font-family: var(--mono); font-size: var(--ui-hud);
  letter-spacing: 0.3em; color: var(--fg-mute);
  display: flex; align-items: center; gap: 12px;
  text-transform: uppercase; z-index: 2;
}
.home-press .blink { animation: blink 1.4s infinite; color: var(--accent); }

@keyframes blink { 0%, 50% { opacity: 1; } 51%, 100% { opacity: 0.2; } }

/* ============== ABOUT ============== */
.about {
  width: 100%; height: 100%;
  overflow-y: auto;
  background: radial-gradient(ellipse at 20% 30%, #14110d 0%, #0a0907 60%, #050402 100%);
}
.about-hero {
  position: relative;
  min-height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 80px;
}
.about-scroll-hint {
  position: absolute; bottom: 26px; left: 50%; transform: translateX(-50%);
  font-size: 10px; letter-spacing: 0.3em; color: var(--fg-mute);
  animation: hintBob 1.8s ease-in-out infinite;
}
@keyframes hintBob { 0%,100% { transform: translateX(-50%) translateY(0); opacity: 0.5; } 50% { transform: translateX(-50%) translateY(5px); opacity: 1; } }

/* ── Journey timeline ── */
.about-journey-section { max-width: 1060px; margin: 0 auto; padding: 20px 24px 120px; }
.about-journey-head { text-align: center; margin-bottom: 54px; }
.about-journey-title { font-family: var(--serif); font-size: clamp(32px, 4vw, 52px); font-weight: 400; }
.about-journey-title em { font-style: italic; color: var(--accent); }

.journey { position: relative; }
.journey-svg { position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: visible; }
.journey-path { fill: none; stroke: var(--accent-dim); stroke-width: 2; stroke-dasharray: 3 6; stroke-linecap: round; opacity: 0.7; }

/* Alternating layout: cards on both sides of the trace, content left-aligned */
.journey-item {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: 1fr 1fr;
  align-items: start; min-height: 44px; margin-bottom: 40px;
}
.journey-item:last-child { margin-bottom: 0; }
.journey-node {
  position: absolute; top: 50%; transform: translate(-50%, -50%);
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--accent); z-index: 2;
  box-shadow: 0 0 0 4px rgba(200,164,86,0.15), 0 0 12px rgba(200,164,86,0.4);
}
/* Node hugs the card's inner edge; alternating side → the trace undulates */
.journey-item.left  .journey-node { left: calc(50% - 14px); }
.journey-item.right .journey-node { left: calc(50% + 14px); }
.journey-node::before {
  content: ""; position: absolute; top: 50%; height: 2px; width: 16px;
  background: var(--accent-dim); opacity: 0.55; transform: translateY(-50%);
}
.journey-item.left  .journey-node::before { right: 50%; }
.journey-item.right .journey-node::before { left: 50%; }

.journey-card {
  display: flex; flex-direction: column; gap: 5px;
  align-items: flex-start; text-align: left;
  width: 100%; max-width: 410px; box-sizing: border-box;
  background: rgba(22,19,14,0.72); border: 1px solid var(--line);
  border-radius: 7px; padding: 18px 22px;
  transition: max-width .28s ease, border-color .2s, transform .2s;
}
.journey-card:hover { border-color: var(--accent-dim); transform: translateY(-2px); }
/* Card anchored to its inner edge, so opening grows it outward (node stays put) */
.journey-item.left  .journey-card { grid-column: 1; justify-self: end;   margin-right: 20px; }
.journey-item.right .journey-card { grid-column: 2; justify-self: start; margin-left: 20px; }
.journey-item.open .journey-card { max-width: 490px; }
.journey-type {
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.18em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 3px; align-self: inherit;
}
.journey-type.exp { color: var(--accent); background: rgba(200,164,86,0.12); border: 1px solid var(--accent-dim); }
.journey-type.edu { color: #7fb3d5; background: rgba(127,179,213,0.1); border: 1px solid rgba(127,179,213,0.35); }
.journey-title { font-family: var(--serif); font-size: 19px; font-weight: 500; color: var(--fg); line-height: 1.2; }
.journey-role { font-family: var(--mono); font-size: 12px; color: var(--fg-dim); letter-spacing: 0.03em; }
.journey-meta { display: flex; gap: 8px; flex-wrap: wrap; font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; color: var(--fg-mute); text-transform: uppercase; margin-top: 2px; justify-content: flex-start; }
.journey-city::before { content: "· "; }
/* Description collapses via the wrapper; text fades in AFTER the card has opened */
.journey-desc-wrap {
  max-height: 0; opacity: 0; overflow: hidden;
  transition: max-height .32s ease, opacity .18s ease;
}
.journey-item.open .journey-desc-wrap {
  max-height: 640px; opacity: 1;
  transition: max-height .32s ease, opacity .3s ease .3s;
}
.journey-desc { font-family: var(--serif); font-size: 15px; line-height: 1.6; color: var(--fg-dim); margin-top: 10px; text-wrap: pretty; white-space: pre-line; }
.journey-desc strong { color: var(--fg); font-weight: 500; }
.journey-desc .txt-gold { color: var(--accent); }
.journey-toggle {
  margin-top: 12px; align-self: flex-start;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--accent-dim);
  background: rgba(200,164,86,0.08); border: 1px solid var(--accent-dim); border-radius: 4px;
  padding: 5px 13px; cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.journey-toggle:hover { color: var(--accent); border-color: var(--accent); background: rgba(200,164,86,0.16); }
.about-card {
  width: fit-content;
  min-width: min(780px, 90vw);
  max-width: 90vw;
  display: grid; grid-template-columns: 220px auto;
  gap: 60px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #16130e 0%, #0d0b08 100%);
  padding: 56px;
}
.about-portrait {
  border: 1px solid var(--line);
  aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center;
  position: relative;
  background: repeating-linear-gradient(45deg, #14110d 0 8px, #100e0a 8px 16px);
}
/* White K — no invert */
.about-portrait img { width: 60%; }
.about-portrait::after {
  content: "PLAYER 01"; position: absolute; bottom: -22px; left: 0;
  font-family: var(--mono); font-size: var(--ui-hud); letter-spacing: 0.2em; color: var(--fg-mute);
}
.about-name { font-family: var(--serif); font-size: var(--ui-title); font-weight: 400; font-style: italic; letter-spacing: -0.02em; margin-bottom: 6px; }
.about-name em { color: var(--accent); }
.about-class { font-family: var(--mono); font-size: var(--ui-label); letter-spacing: 0.3em; text-transform: uppercase; color: var(--fg-mute); margin-bottom: 28px; }
.about-bio { font-family: var(--serif); font-size: var(--ui-body); line-height: 1.65; color: var(--fg-dim); margin-bottom: 32px; max-width: 64ch; text-wrap: pretty; white-space: pre-line; }
.about-bio strong { color: var(--fg); font-weight: 500; }
.txt-gold { color: var(--accent); font-style: normal; }

.stats-grid { display: grid; grid-template-columns: repeat(2, auto); min-width: 100%; gap: 14px 48px; margin-bottom: 32px; font-family: var(--mono); font-size: var(--ui-label); }
.stat-row { display: flex; justify-content: space-between; gap: 20px; border-bottom: 1px dashed var(--line); padding-bottom: 6px; letter-spacing: 0.08em; }
.stat-row .label { color: var(--fg-mute); text-transform: uppercase; white-space: nowrap; }
.stat-row .value { color: var(--fg); }
.stat-bar { display: inline-flex; gap: 2px; }
.stat-bar span { width: 8px; height: 10px; background: var(--line); }
.stat-bar span.on { background: var(--accent); }

.contact-row { display: flex; gap: 24px; font-family: var(--mono); font-size: var(--ui-label); letter-spacing: 0.15em; text-transform: uppercase; }
.contact-row a { color: var(--fg); text-decoration: none; border-bottom: 1px solid var(--line); padding-bottom: 4px; transition: color .2s, border-color .2s; }
.contact-row a:hover { color: var(--accent); border-color: var(--accent); }
.contact-row a::before { content: "→ "; color: var(--accent); }

/* ============== GRID ============== */
.grid {
  width: 100%; height: 100%;
  padding: clamp(60px, 8vh, 80px) clamp(40px, 5vw, 80px) clamp(60px, 9vh, 100px);
  display: flex; flex-direction: column;
  background: radial-gradient(ellipse at center, #14110d 0%, #0a0907 60%, #050402 100%);
}
.grid-head { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 48px; gap: 24px; }
.grid-head > *:first-child { flex: 1; min-width: 0; }
.grid-title { font-family: var(--serif); font-size: var(--ui-title); font-weight: 400; font-style: italic; letter-spacing: -0.02em; white-space: nowrap; }
.grid-title em { color: var(--accent); }
.grid-subtitle { font-family: var(--mono); font-size: var(--ui-label); letter-spacing: 0.3em; text-transform: uppercase; color: var(--fg-mute); margin-top: 12px; }
.grid-count { font-family: var(--mono); font-size: var(--ui-label); letter-spacing: 0.2em; text-transform: uppercase; color: var(--fg-dim); text-align: right; }
.grid-count strong { color: var(--accent); font-weight: 500; }

/* .grid-list dimensions and template-columns are set by JS slider */
.grid-card { position: relative; overflow: hidden; border: 1px solid var(--line); background: #100e0a; cursor: pointer; display: flex; flex-direction: column; transition: translate .25s ease, border-color .25s ease; }
.grid-card:hover, .grid-card.focus { translate: 0 -4px; border-color: var(--accent); }
.grid-card-img { flex: 1; min-height: 0; background: #100e0a; position: relative; overflow: hidden; }
.grid-card-img img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(0.3) brightness(0.7) contrast(1.05); transition: filter .3s, transform .4s; }
.grid-card:hover .grid-card-img img, .grid-card.focus .grid-card-img img { filter: grayscale(0) brightness(0.85) contrast(1.05); transform: scale(1.04); }
.grid-card-placeholder { width: 100%; height: 100%; background: repeating-linear-gradient(135deg, #16130e 0 12px, #100e0a 12px 24px); display: flex; align-items: center; justify-content: center; }
.grid-card-placeholder span { font-family: var(--mono); font-size: 10px; letter-spacing: 0.25em; color: var(--fg-mute); text-transform: uppercase; }
.grid-card-tag { position: absolute; top: 14px; left: 14px; font-family: var(--mono); font-size: var(--ui-hud); letter-spacing: 0.25em; color: var(--accent); background: rgba(10,9,7,0.9); padding: 4px 8px; border: 1px solid var(--accent-dim); }
.grid-card-num { position: absolute; top: 14px; right: 14px; font-family: var(--mono); font-size: var(--ui-label); letter-spacing: 0.1em; color: var(--fg); background: rgba(10,9,7,0.9); padding: 4px 8px; }
.grid-card-body { padding: 18px 18px 20px; border-top: 1px solid var(--line); background: #0d0b08; }
.grid-card-title { font-family: var(--serif); font-size: var(--ui-heading); font-weight: 400; font-style: italic; letter-spacing: -0.01em; margin-bottom: 6px; }
.grid-card-sub { font-family: var(--mono); font-size: var(--ui-hud); letter-spacing: 0.15em; color: var(--fg-mute); text-transform: uppercase; }
.grid-card-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; font-family: var(--mono); font-size: var(--ui-hud); letter-spacing: 0.15em; color: var(--fg-dim); }
.diff-bar { display: inline-flex; gap: 2px; }
.diff-bar span { width: 7px; height: 8px; background: var(--line); }
.diff-bar span.on { background: var(--accent); }

/* ============== DECK ============== */
.deck { width: 100%; height: 100%; position: relative; overflow: hidden; display: flex; flex-direction: column; }

.deck-bg {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  filter: brightness(0.55) saturate(0.85) blur(8px);
  transform: scale(1.04);
  z-index: 0;
}
.deck-bg-placeholder {
  position: absolute; inset: 0;
  background: repeating-linear-gradient(135deg, #16130e 0 14px, #100e0a 14px 28px);
  z-index: 0;
}
/* Lighter center, dark vignette edges for readability */
.deck-overlay {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse 85% 85% at center,
    rgba(10,9,7,0.18) 0%,
    rgba(10,9,7,0.62) 60%,
    rgba(10,9,7,0.88) 100%);
  z-index: 1;
}
.deck-grain {
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
  opacity: 0.08;
  background-image: repeating-linear-gradient(0deg, rgba(255,255,255,0.4) 0 1px, transparent 1px 3px);
}

/* Header — tag + title, flex item */
.deck-head {
  position: relative; flex-shrink: 0; z-index: 10;
  padding: clamp(14px, 2.5vh, 26px) 80px clamp(6px, 1vh, 10px);
  display: flex; flex-direction: column; align-items: center;
  gap: clamp(6px, 1vh, 12px);
  pointer-events: none;
}
.deck-head-tag {
  font-family: var(--mono); font-size: var(--ui-hud);
  letter-spacing: 0.3em; text-transform: uppercase; color: var(--fg-mute);
}
.deck-head-tag .num {
  color: var(--accent);
  border: 1px solid var(--accent-dim);
  padding: 3px 10px;
}
.deck-project-title {
  font-family: var(--serif); font-style: italic;
  font-size: var(--ui-heading);
  color: var(--fg); text-align: center;
}
.deck-project-logo {
  max-height: clamp(110px, 16vh, 220px);
  max-width: clamp(300px, 50vw, 640px);
  width: auto; height: auto;
  object-fit: contain;
  filter: drop-shadow(0 2px 12px rgba(0,0,0,0.7));
}

/* Stage — card + counter, flex item filling remaining space */
.deck-stage {
  position: relative; flex: 1; min-height: 0; z-index: 5;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 0 clamp(60px, 8vw, 100px);
  gap: 16px;
}

/* Card pile — hover zooms only the active (front) card */
.card-stack {
  position: relative;
  width: min(clamp(680px, 48vw, 1080px), calc(100% - 80px));
  height: min(clamp(420px, 54vh, 680px), calc(100% - 80px));
  flex-shrink: 0;
  perspective: 1400px;
  container-type: inline-size;

    /* ── Card type scale fallback (overridden by data.php) ── */
  --t-micro: clamp(7px,  0.69vw, 12px);
  --t-sm:    clamp(8px,  0.90vw, 16px);
  --t-kick:  clamp(8px,  0.83vw, 15px);
  --t-note:  clamp(8px,  0.90vw, 16px);
  --t-base:  clamp(11px, 1.18vw, 19px);
  --t-h2:    clamp(23px, 2.50vw, 42px);
  --t-h1:    clamp(34px, 4.03vw, 65px);
}
.card-stack:hover .card-anim .deck-card {
  transform: scale(1.022);
  transition: transform .32s cubic-bezier(.2,.8,.2,1);
}

/* Counter — below card with clear breathing room */
.deck-counter {
  margin-top: 26px;
  font-family: var(--mono); font-size: var(--ui-hud);
  letter-spacing: 0.25em; color: var(--fg-dim);
  text-transform: uppercase;
}

/* XP + chapter — flex item at bottom, padding clears HUD */
.deck-foot {
  position: relative; flex-shrink: 0; z-index: 10;
  padding: 8px 80px clamp(58px, 8vh, 72px);
  display: flex; flex-direction: column; gap: 10px;
}

/* ============== DECK CARD BASE ============== */
.deck-card {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, #f4f1ea 0%, #e8e2d4 100%);
  color: #14110d;
  padding: clamp(22px, 4cqi, 52px) clamp(26px, 4.5cqi, 60px);
  display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.7), 0 4px 14px rgba(0,0,0,0.5);
  font-family: var(--serif);
  transform-style: preserve-3d;
  will-change: transform, opacity;
  overflow: hidden;
  /* Smooth zoom on hover AND unhover */
  transition: transform .32s cubic-bezier(.2,.8,.2,1);
}

/* Pile effect — cream cards, alternating rotations for organic disorder */
.deck-card.behind-1 {
  transform: translateY(8px) translateX(14px) rotate(4deg);
  opacity: 0.75;
  filter: brightness(0.88);
  pointer-events: none;
}
.deck-card.behind-2 {
  transform: translateY(14px) translateX(-10px) rotate(-5deg);
  opacity: 0.45;
  filter: brightness(0.74);
  pointer-events: none;
}

/* ============== CARD ANIMATIONS ============== */
.card-anim {
  position: absolute; inset: 0;
  will-change: transform, opacity;
  transform-style: preserve-3d;
}

/* Stack: card drops onto pile from above */
.card-anim.enter-stack { animation: cardStackIn  .50s cubic-bezier(.2,.8,.2,1) both; }
.card-anim.exit-stack  { animation: cardStackOut .38s cubic-bezier(.6,.0,.8,.2) both; }

/* Flip: pure Y-axis rotation, no travel */
.card-anim.enter-flip  { animation: cardFlipIn  .58s cubic-bezier(.4,.0,.2,1) both; }
.card-anim.exit-flip   { animation: cardFlipOut .36s cubic-bezier(.6,.0,.8,.2) both; }

@keyframes cardStackIn {
  0%   { transform: translateY(-52px) scale(0.97); opacity: 0; }
  55%  { opacity: 1; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}
@keyframes cardStackOut {
  0%   { transform: translateY(0) scale(1); opacity: 1; }
  100% { transform: translateY(26px) scale(0.97); opacity: 0; }
}
@keyframes cardFlipIn {
  0%   { transform: rotateY(-90deg); opacity: 0; }
  40%  { opacity: 1; }
  100% { transform: rotateY(0deg); opacity: 1; }
}
@keyframes cardFlipOut {
  0%   { transform: rotateY(0deg); opacity: 1; }
  50%  { opacity: 0.4; }
  100% { transform: rotateY(90deg); opacity: 0; }
}

/* ============== CARD TYPE STYLING ============== */
.card-kicker {
  font-family: var(--mono); font-size: var(--t-kick);
  letter-spacing: 0.3em; text-transform: uppercase;
  color: var(--accent-dim); margin-bottom: clamp(10px, 1.6cqi, 18px);
}
.card-h2 {
  font-family: var(--serif); font-style: italic; font-weight: 400;
  font-size: var(--t-h2); letter-spacing: -0.01em;
}
.card-title-xl {
  font-family: var(--serif); font-size: var(--t-h1);
  font-weight: 400; font-style: italic;
  line-height: 1.0; letter-spacing: -0.02em; margin-bottom: clamp(12px, 1.8cqi, 20px);
}
.card-pitch {
  font-family: var(--serif); font-size: var(--t-base);
  line-height: 1.55; color: rgba(20,17,13,0.75); max-width: 62ch; text-wrap: pretty; white-space: pre-line;
}
/* Pitch subtitle (tag · genre) and footer row (role / continue) */
.card-subtitle { font-family: var(--mono); font-size: var(--t-sm); letter-spacing: 0.2em; text-transform: uppercase; color: rgba(20,17,13,0.55); margin-bottom: clamp(14px, 2cqi, 24px); }
.card-footer-row { font-family: var(--mono); font-size: var(--t-sm); letter-spacing: 0.15em; text-transform: uppercase; color: rgba(20,17,13,0.5); }
.pitch-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: flex-end; }
.card-pitch strong { font-weight: 600; color: rgba(20,17,13,0.95); }
.card-prose {
  font-family: var(--serif); font-size: var(--t-base);
  line-height: 1.65; color: rgba(20,17,13,0.8);
  white-space: pre-line; text-wrap: pretty; margin-top: 4px; max-width: 62ch;
}
.card-prose strong { font-weight: 600; color: rgba(20,17,13,0.95); }
.card-prose .txt-gold { color: var(--accent); font-style: normal; }

/* Character sheet */
.sheet { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 32px; font-family: var(--mono); font-size: var(--t-sm); margin-top: 12px; }
.sheet-row { display: flex; justify-content: space-between; align-items: center; padding: clamp(5px, 0.8cqi, 9px) 0; border-bottom: 1px dashed rgba(20,17,13,0.18); letter-spacing: 0.06em; }
.sheet-row .label { color: rgba(20,17,13,0.55); text-transform: uppercase; font-size: var(--t-micro); }
.sheet-row .value { font-weight: 500; }
.sheet-tools { margin-top: 22px; font-family: var(--mono); font-size: var(--t-sm); }
.sheet-tools-label { color: rgba(20,17,13,0.55); letter-spacing: 0.25em; text-transform: uppercase; margin-bottom: 8px; font-size: var(--t-kick); }
.sheet-tools-list { display: flex; flex-wrap: wrap; gap: 6px; }
.sheet-tools-list span { padding: 4px 10px; border: 1px solid rgba(20,17,13,0.2); letter-spacing: 0.1em; }
.sheet-link-btn {
  flex-shrink: 0; align-self: flex-start; margin-top: 16px;
  font-family: var(--mono); font-size: var(--t-sm); letter-spacing: 0.1em; text-transform: uppercase;
  color: rgba(20,17,13,0.85); text-decoration: none; white-space: nowrap;
  border: 1px solid rgba(20,17,13,0.3); border-radius: 4px; padding: 9px 16px;
  transition: color .2s, border-color .2s, background .2s;
}
.sheet-link-btn:hover { color: var(--accent); border-color: var(--accent); background: rgba(200,164,86,0.08); }

/* Media */
.media-card { padding: 0; overflow: hidden; }
.media-img { flex: 1; min-height: 0; background-size: cover; background-position: center; position: relative; }
.media-caption { padding: 16px 32px 22px; font-family: var(--mono); font-size: var(--t-sm); letter-spacing: 0.1em; color: rgba(20,17,13,0.7); display: flex; justify-content: space-between; align-items: center; border-top: 1px solid rgba(20,17,13,0.1); background: rgba(244,241,234,0.95); }
.doc-open {
  font-family: var(--mono); font-size: var(--t-micro); letter-spacing: 0.08em;
  color: rgba(20,17,13,0.6); text-decoration: none; white-space: nowrap;
  transition: color .15s;
}
.doc-open:hover { color: var(--accent); }
/* Document reader — vertical stack of boards, browsable like a PDF */
.doc-scroll.card-scroll { padding-right: 0; background: #ddd5c3; }
.doc-page {
  width: 100%; height: auto; display: block;
  cursor: zoom-in; transition: filter .2s;
}
.doc-page:hover { filter: brightness(1.04); }
.media-caption .dot-row { display: flex; gap: 4px; }
.media-caption .dot-row span { width: 6px; height: 6px; background: rgba(20,17,13,0.25); cursor: pointer; transition: background .2s, transform .2s; }
.media-caption .dot-row span:hover { background: rgba(20,17,13,0.5); transform: scale(1.3); }
.media-caption .dot-row span.on { background: var(--accent); }
.media-zoom-btn {
  position: absolute; top: 14px; right: 14px; z-index: 4;
  width: 34px; height: 34px;
  background: rgba(10,9,7,0.65); color: #f4f1ea;
  border: 1px solid rgba(244,241,234,0.25); cursor: pointer;
  font-size: 17px; line-height: 1; backdrop-filter: blur(4px);
  transition: background .15s, border-color .15s;
}
.media-zoom-btn:hover { background: rgba(10,9,7,0.9); border-color: var(--accent); color: var(--accent); }
.media-lightbox {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(5,4,2,0.93);
  display: flex; align-items: center; justify-content: center;
  cursor: zoom-out;
  animation: fadeIn .18s ease;
}
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
.media-lightbox img {
  max-width: 92vw; max-height: 90vh;
  object-fit: contain;
  box-shadow: 0 0 80px rgba(0,0,0,0.9);
  cursor: default;
}
.media-lightbox-close {
  position: absolute; top: 24px; right: 24px;
  width: 40px; height: 40px;
  background: rgba(20,17,13,0.75); color: #f4f1ea;
  border: 1px solid rgba(244,241,234,0.2);
  font-family: var(--mono); font-size: 14px; cursor: pointer;
  transition: border-color .15s, color .15s;
}
.media-lightbox-close:hover { border-color: var(--accent); color: var(--accent); }
.media-lightbox-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 52px; height: 52px;
  background: rgba(20,17,13,0.65); color: #f4f1ea;
  border: 1px solid rgba(244,241,234,0.2);
  font-size: 26px; cursor: pointer; backdrop-filter: blur(4px);
  transition: background .15s, border-color .15s, color .15s;
}
.media-lightbox-nav:hover { background: rgba(20,17,13,0.9); border-color: var(--accent); color: var(--accent); }
.media-lightbox-nav.left  { left: 24px; }
.media-lightbox-nav.right { right: 24px; }
.media-lightbox-cap {
  position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px;
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase;
  color: #f4f1ea; background: rgba(20,17,13,0.8); border: 1px solid rgba(244,241,234,0.18);
  border-radius: 4px; padding: 8px 14px; white-space: nowrap;
}
.media-lightbox-count { color: var(--accent); }

/* Thin custom scrollbar for card content */
.card-scroll {
  overflow-y: auto; flex: 1; min-height: 0; padding-right: 8px;
  scrollbar-width: thin; scrollbar-color: rgba(20,17,13,0.2) transparent;
}
.card-scroll::-webkit-scrollbar { width: 3px; }
.card-scroll::-webkit-scrollbar-track { background: transparent; }
.card-scroll::-webkit-scrollbar-thumb { background: rgba(20,17,13,0.2); border-radius: 2px; }
.card-scroll::-webkit-scrollbar-thumb:hover { background: rgba(20,17,13,0.35); }

/* Challenge / Solution */
.cs-grid { display: grid; grid-template-rows: auto auto; gap: 16px; margin-top: 6px; }
.cs-block { padding-left: 18px; border-left: 2px solid var(--accent); }
.cs-block .label { font-family: var(--mono); font-size: var(--t-sm); letter-spacing: 0.3em; text-transform: uppercase; color: rgba(20,17,13,0.55); margin-bottom: 8px; }
.cs-block .body { font-family: var(--serif); font-size: var(--t-base); line-height: 1.5; color: rgba(20,17,13,0.85); text-wrap: pretty; white-space: pre-line; max-width: 62ch; }
.cs-block .body strong { font-weight: 600; color: rgba(20,17,13,1); }
.challenge-entry { padding-bottom: 18px; margin-bottom: 18px; border-bottom: 1px dashed rgba(20,17,13,0.15); }
.challenge-entry:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.challenge-title {
  font-family: var(--mono); font-size: var(--t-sm); letter-spacing: 0.25em; text-transform: uppercase;
  color: var(--accent-dim); margin-bottom: 12px; padding-bottom: 8px;
  border-bottom: 1px solid rgba(200,164,86,0.25);
}

/* Process */
.process-list { display: flex; flex-direction: column; gap: clamp(12px, 1.6cqi, 20px); margin-top: 22px; font-family: var(--mono); font-size: var(--t-sm); }
.process-item { display: grid; grid-template-columns: clamp(40px, 5cqi, 58px) clamp(110px, 18cqi, 210px) 1fr auto; gap: clamp(10px, 1.5cqi, 18px); align-items: center; padding-bottom: clamp(10px, 1.4cqi, 16px); border-bottom: 1px dashed rgba(20,17,13,0.15); }
.process-item:last-child { border-bottom: none; }
.step-col { display: flex; flex-direction: column; gap: 3px; }
.process-item .step { color: var(--accent); font-weight: 500; letter-spacing: 0.1em; }
.step-date-lbl { font-size: var(--t-micro); letter-spacing: 0.06em; color: rgba(20,17,13,0.4); }
.process-item .phase { text-transform: uppercase; letter-spacing: 0.1em; color: rgba(20,17,13,0.9); font-weight: 500; padding-top: 1px; }
.process-item .note { font-family: var(--serif); font-style: italic; font-size: var(--t-note); color: rgba(20,17,13,0.7); }
.process-img-btn {
  background: none; border: none; color: var(--accent-dim); font-size: 17px;
  cursor: pointer; padding: 0; margin-right: 10px; opacity: 0.55;
  transition: opacity .15s, color .15s; line-height: 1; align-self: center;
}
.process-img-btn:hover { opacity: 1; color: var(--accent); }

/* Image hover tooltip (portal, position:fixed) */
.img-tooltip {
  position: fixed; z-index: 9999; pointer-events: none;
  background: rgba(10,9,7,0.96); border: 1px solid var(--line);
  padding: 4px; box-shadow: 0 12px 40px rgba(0,0,0,0.6);
}
.img-tooltip img { display: block; max-width: 240px; max-height: 180px; object-fit: contain; }

/* News (Steam patch notes) */
.news-scroll { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 16px; }
.news-list { display: flex; flex-direction: column; gap: 8px; }

/* Custom Steam store embed — site charter (paper / ink / gold) */
.steam-embed {
  display: flex; gap: 14px; flex-shrink: 0;
  padding: 12px; align-items: stretch;
  border: 1px solid rgba(20,17,13,0.16); border-radius: 4px;
  background: rgba(20,17,13,0.045);
}
.steam-embed-img {
  flex-shrink: 0; width: 38%; max-width: 220px; align-self: center;
  aspect-ratio: 460 / 215; overflow: hidden; border-radius: 3px;
  border: 1px solid rgba(20,17,13,0.12); background: rgba(20,17,13,0.08);
}
.steam-embed-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.steam-embed-body { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: space-between; gap: 10px; }
.steam-embed-top { display: flex; flex-direction: column; gap: 8px; }
.steam-embed-name { font-family: var(--serif); font-style: italic; font-weight: 500; font-size: var(--t-base); line-height: 1.15; color: rgba(20,17,13,0.92); }
.steam-embed-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.steam-tag {
  font-family: var(--mono); font-size: var(--t-micro); letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--accent-dim); background: rgba(200,164,86,0.08);
  border: 1px solid rgba(200,164,86,0.3); border-radius: 3px; padding: 2px 7px;
}
.steam-embed-date { font-family: var(--mono); font-size: var(--t-micro); letter-spacing: 0.06em; color: rgba(20,17,13,0.5); }
.steam-embed-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.steam-embed-price { display: inline-flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: var(--t-sm); }
.steam-discount { background: var(--accent); color: #14110d; font-weight: 600; padding: 2px 6px; border-radius: 3px; font-size: var(--t-micro); }
.steam-price-old { color: rgba(20,17,13,0.45); text-decoration: line-through; font-size: var(--t-micro); }
.steam-price-final { color: rgba(20,17,13,0.9); font-weight: 600; }
.steam-embed-btn {
  font-family: var(--mono); font-size: var(--t-sm); letter-spacing: 0.1em; text-transform: uppercase;
  color: rgba(20,17,13,0.85); text-decoration: none; white-space: nowrap;
  border: 1px solid rgba(20,17,13,0.3); border-radius: 3px; padding: 7px 14px;
  margin-left: auto; transition: color .2s, border-color .2s, background .2s;
}
.steam-embed-btn:hover { color: var(--accent); border-color: var(--accent); background: rgba(200,164,86,0.08); }
.news-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; border: 1px solid rgba(20,17,13,0.12);
  background: rgba(20,17,13,0.04); border-radius: 2px;
  text-decoration: none; color: inherit;
  transition: background .15s, border-color .15s;
}
.news-item:hover { background: rgba(20,17,13,0.09); border-color: rgba(20,17,13,0.22); }
.news-title {
  flex: 1; font-family: var(--mono); font-size: 11px; letter-spacing: 0.05em;
  color: rgba(20,17,13,0.85); line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.news-date {
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.1em;
  color: rgba(20,17,13,0.45); white-space: nowrap; flex-shrink: 0;
}

/* Learnings */
.learnings { margin-top: 12px; flex: 1; }
.learnings ol { list-style: none; display: flex; flex-direction: column; gap: 14px; max-width: 62ch; font-size: var(--t-base); }
.learnings li { display: grid; grid-template-columns: clamp(36px, 5cqi, 52px) 1fr; gap: clamp(14px, 2.5cqi, 28px); align-items: center; }
.learnings .lnum { font-family: var(--mono); font-size: var(--t-kick); letter-spacing: 0.15em; color: var(--accent); text-align: center; }
.learnings .ltext { display: block; font-family: var(--serif); font-size: var(--t-base); line-height: 1.55; color: rgba(20,17,13,0.85); text-wrap: pretty; }

/* Next-quest card — grid of prev / next projects (site charter) */
.next-grid {
  flex: 1; min-height: 0;
  display: grid; grid-template-columns: 1fr 1fr; gap: clamp(14px, 2cqi, 26px);
}
.next-card {
  display: flex; flex-direction: column;
  border: 1px solid rgba(20,17,13,0.16); border-radius: 5px;
  background: rgba(20,17,13,0.04);
  overflow: hidden; cursor: pointer; text-align: left;
  transition: translate .25s ease, border-color .25s ease, box-shadow .25s ease;
}
.next-card:hover { translate: 0 -4px; border-color: var(--accent); box-shadow: 0 10px 26px rgba(0,0,0,0.18); }
.next-card-img {
  position: relative; width: 100%; aspect-ratio: 16 / 9; overflow: hidden;
  background: rgba(20,17,13,0.08); flex-shrink: 0;
  border-bottom: 1px solid rgba(20,17,13,0.1);
}
.next-card-img img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .4s ease; }
.next-card:hover .next-card-img img { transform: scale(1.04); }
.next-card-ph {
  width: 100%; height: 100%;
  background: repeating-linear-gradient(135deg, rgba(20,17,13,0.06) 0 12px, rgba(20,17,13,0.02) 12px 24px);
  display: flex; align-items: center; justify-content: center;
}
.next-card-ph span { font-family: var(--mono); font-size: var(--t-micro); letter-spacing: 0.25em; color: rgba(20,17,13,0.4); text-transform: uppercase; }
.next-card-tag {
  position: absolute; top: 10px; left: 10px;
  font-family: var(--mono); font-size: var(--t-micro); letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--accent-dim); background: rgba(244,241,234,0.92);
  border: 1px solid rgba(200,164,86,0.35); border-radius: 3px; padding: 3px 7px;
}
.next-card-num {
  position: absolute; top: 10px; right: 10px;
  font-family: var(--mono); font-size: var(--t-micro); letter-spacing: 0.1em;
  color: rgba(20,17,13,0.75); background: rgba(244,241,234,0.92);
  border-radius: 3px; padding: 3px 7px;
}
.next-card-body { flex: 1; padding: clamp(12px, 1.8cqi, 18px); display: flex; flex-direction: column; }
.next-card-title { font-family: var(--serif); font-style: italic; font-size: var(--t-h2); font-weight: 400; letter-spacing: -0.01em; color: rgba(20,17,13,0.92); margin-bottom: 5px; }
.next-card-sub { font-family: var(--mono); font-size: var(--t-micro); letter-spacing: 0.15em; text-transform: uppercase; color: rgba(20,17,13,0.5); }
.next-card-meta { display: flex; justify-content: space-between; align-items: center; margin-top: auto; padding-top: clamp(10px, 1.5cqi, 16px); font-family: var(--mono); font-size: var(--t-micro); letter-spacing: 0.12em; color: rgba(20,17,13,0.6); }
.next-card-meta .diff-bar span { background: rgba(20,17,13,0.2); }
.next-card-meta .diff-bar span.on { background: var(--accent); }

/* Deck nav arrows */
.deck-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  z-index: 8;
  width: 56px; height: 56px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); color: var(--fg);
  border: 1px solid var(--line);
  background: rgba(10,9,7,0.6);
  backdrop-filter: blur(6px);
  cursor: pointer; transition: all .2s;
}
.deck-nav:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.deck-nav:disabled { opacity: 0.25; cursor: not-allowed; }
.deck-nav.left  { left: clamp(8px, 2vw, 28px); }
.deck-nav.right { right: clamp(8px, 2vw, 28px); }

/* XP bar */
.xp-row {
  display: flex; align-items: center; gap: 18px;
  font-family: var(--mono); font-size: var(--ui-hud);
  letter-spacing: 0.2em; color: var(--fg-dim); text-transform: uppercase;
}
.xp-label { color: var(--accent); }
.xp-bar { flex: 1; display: flex; gap: 4px; overflow: visible; }
.xp-seg {
  flex: 1; height: 7px; background: var(--line);
  transition: background .3s, flex-grow .22s ease;
  position: relative; cursor: pointer;
}
.xp-seg:hover { background: var(--fg-mute); }
.xp-seg.done { background: var(--accent); }
.xp-seg.cur  { background: var(--accent); box-shadow: 0 0 10px rgba(200,164,86,0.5); }
.xp-seg.done:hover, .xp-seg.cur:hover { background: var(--fg); }
.xp-tooltip {
  position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  font-family: var(--mono); font-size: var(--ui-hud); letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--fg-dim); background: rgba(10,9,7,0.92); border: 1px solid var(--line);
  padding: 3px 7px; white-space: nowrap; pointer-events: none; z-index: 10;
}
.xp-pct { color: var(--fg); min-width: 50px; text-align: right; }

/* ============== TRANSITION ============== */
.k-transition {
  position: fixed; inset: 0; z-index: 100;
  background: #050402;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
  animation: kFade 600ms ease both;
}
/* White K in transition — no invert, contain to preserve ratio */
.k-transition img { width: 120px; height: 120px; object-fit: contain; animation: kPulse 600ms ease both; }

@keyframes kFade {
  0%   { opacity: 0; }
  20%  { opacity: 1; }
  80%  { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes kPulse {
  0%   { transform: scale(0.85); opacity: 0; }
  30%  { transform: scale(1); opacity: 1; }
  70%  { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.08); opacity: 0; }
}

/* ============================================================
   MOBILE / PHONE  (≤ 768px)
   ============================================================ */
@media (max-width: 768px) {
  /* ---- HUD : keep top corners, drop keyboard hints ---- */
  .hud-bl, .hud-br { display: none; }
  .hud-tl, .hud-tr { padding: 12px 12px; gap: 8px; }
  .hud-divider { display: none; }
  .hud-kbd { display: none; }
  /* Keep only the back button + logo on the left — hide K.PORTFOLIO, version, etc. */
  .hud-tl > *:not(.hud-back-btn):not(.hud-logo) { display: none; }
  /* Solid bar behind the top HUD so scrolled content doesn't bleed through */
  .hud::before {
    content: ""; position: fixed; top: 0; left: 0; right: 0; height: 58px;
    background: linear-gradient(180deg, rgba(6,5,3,0.98) 0%, rgba(6,5,3,0.96) 55%, rgba(6,5,3,0.72) 82%, rgba(6,5,3,0) 100%);
    pointer-events: none;
  }

  /* ================= HOME ================= */
  .home {
    justify-content: flex-start;
    padding: 76px 18px 40px;
    gap: 34px;
    overflow-y: auto;
  }
  .home-watermark img { height: 46vh; opacity: 0.6; }
  .home-header { gap: 16px; }
  .home-name { font-size: 12px; letter-spacing: 0.35em; }
  .home-title { font-size: clamp(32px, 12vw, 52px); }
  .home-tagline { font-size: 10px; }
  .home-cards { flex-direction: column; width: 100%; gap: 18px; }
  .home-card {
    width: 100%; height: auto; min-height: 128px;
    flex-direction: row; align-items: center; gap: 20px;
    padding: 26px 22px;
  }
  .home-card-tag { display: none; }
  .home-card-glyph { font-size: 52px; margin: 0; flex-shrink: 0; }
  .home-card > div:nth-child(3) { flex: 1; }
  .home-card-label { font-size: 26px; }
  .home-card-sub { font-size: 11px; margin-top: 6px; }
  .home-card-foot { margin: 0; flex-shrink: 0; }
  .home-card-foot span:not(.arrow) { display: none; }
  .home-card-foot .arrow { font-size: 20px; }
  .home-press { display: none; }

  /* ================= ABOUT ================= */
  .about { display: block; }
  .about-hero { padding: 66px 16px 36px; min-height: calc(100% - 20px); }
  .about-scroll-hint { display: none; }
  .about-card {
    grid-template-columns: 1fr;
    min-width: 0; max-width: 100%; width: 100%;
    gap: 22px; padding: 26px 20px;
  }
  /* Journey: single column on phones (reset the desktop alternating grid) */
  .about-journey-section { padding: 10px 14px 60px; }
  .about-journey-head { margin-bottom: 34px; }
  .journey-item { display: block; padding-left: 52px; min-height: auto; margin-bottom: 24px; }
  .journey-node { top: 50%; width: 13px; height: 13px; }
  .journey-item.left  .journey-node { left: 16px; }
  .journey-item.right .journey-node { left: 32px; }
  .journey-item.left  .journey-node::before { left: 50%; right: auto; width: 30px; }
  .journey-item.right .journey-node::before { left: 50%; right: auto; width: 14px; }
  .journey-item.left  .journey-card,
  .journey-item.right .journey-card,
  .journey-item.open  .journey-card {
    margin: 0; max-width: 100%; justify-self: stretch;
  }
  .journey-title { font-size: 17px; }
  .about-portrait { width: 120px; }
  .about-portrait::after { bottom: -20px; }
  .about-name { font-size: clamp(34px, 11vw, 52px); }
  .about-class { margin-bottom: 20px; }
  .about-bio { font-size: 16px; margin-bottom: 24px; max-width: 100%; }
  .stats-grid { grid-template-columns: 1fr; gap: 10px; margin-bottom: 24px; }
  .contact-row { flex-wrap: wrap; gap: 14px 22px; }

  /* ================= GRID (projets) ================= */
  .grid {
    overflow-y: auto;
    padding: 66px 16px 36px;
  }
  .grid-head {
    flex-direction: column; align-items: flex-start;
    gap: 10px; margin-bottom: 24px;
  }
  .grid-title { font-size: clamp(34px, 11vw, 52px); white-space: normal; }
  .grid-count { text-align: left; }
  .grid-list {
    flex: none; min-height: 0;
    display: flex !important; flex-direction: column; gap: 16px;
  }
  .grid-card { height: auto; }
  .grid-card-img { flex: none; aspect-ratio: 16 / 9; }

  /* ================= DECK (projet) — vertical feed ================= */
  .deck-mobile { display: block; }
  .deck-mobile-scroll {
    position: relative; z-index: 5;
    height: 100%; overflow-y: auto;
    padding: 62px 14px 40px;
    -webkit-overflow-scrolling: touch;
  }
  .deck-mobile .deck-head {
    position: relative; padding: 6px 0 18px;
  }
  .deck-mobile .deck-project-logo { max-height: 92px; max-width: 70vw; }
  .deck-mobile-list { display: flex; flex-direction: column; gap: 26px; }

  .deck-mobile-card { width: 100%; height: auto; flex-shrink: 0; }
  .deck-mobile-chip {
    font-size: 10px; letter-spacing: 0.25em; text-transform: uppercase;
    color: var(--fg-mute); margin-bottom: 8px; padding-left: 2px;
  }
  /* Cards flow at natural height instead of filling a fixed stage */
  .deck-mobile-card .deck-card {
    position: relative; inset: auto; height: auto; min-height: 120px;
  }
  .deck-mobile-card .card-scroll {
    overflow: visible; flex: none; min-height: 0; padding-right: 0;
  }
  .deck-mobile-card .media-img { flex: none; aspect-ratio: 16 / 9; min-height: 0; }
  /* Video / trailer preview in proper 16:9 (was vertically crushed) */
  .deck-mobile-card .video-frame {
    flex: none !important; width: 100% !important;
    aspect-ratio: 16 / 9; height: auto !important; min-height: 0 !important;
  }
  /* PDF viewer stays tall (portrait) on mobile */
  .deck-mobile-card .deck-card > iframe:not(.video-frame) { flex: none !important; height: 70vh !important; min-height: 0 !important; }
  .deck-mobile-card .learnings,
  .deck-mobile-card .news-scroll { flex: none; }
  /* Pitch: breathing room above the RÔLE / CONTINUER footer */
  .deck-mobile-card .pitch-foot { margin-top: 28px; }
  /* Stack multi-column card content on narrow screens */
  .deck-mobile-card .sheet { grid-template-columns: 1fr; }
  .deck-mobile-card .next-grid { grid-template-columns: 1fr; flex: none; }
  .deck-mobile-card .steam-embed { flex-direction: column; }
  .deck-mobile-card .steam-embed-img { width: 100%; max-width: 100%; }

  .deck-mobile-back {
    display: block; width: 100%; margin-top: 28px; padding: 14px;
    font-family: var(--mono); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase;
    color: var(--fg-dim); border: 1px solid var(--line); border-radius: 4px;
    background: rgba(10,9,7,0.5);
  }
}
