/* Les murs respirent — styles */

:root {
  --bg: #050307;
  --fg: #f6f1e7;
  --dim: rgba(246, 241, 231, 0.62);
  --faint: rgba(246, 241, 231, 0.34);
  --amp: 0.012em;
  --serif: "Fraunces", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --mono: "Space Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(.2, .7, .1, 1);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  font-family: var(--mono);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

button { font: inherit; color: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }
.defs { position: absolute; width: 0; height: 0; overflow: hidden; }

#gl {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}
body.trip #gl { cursor: none; }

/* ───────────────────────────── seuil ───────────────────────────── */

#intro {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  overflow-y: auto;
  padding: calc(5vh + var(--safe-t)) 6vw calc(5vh + var(--safe-b));
  transition: opacity 1.4s ease .2s, filter 1.6s ease;
}
#intro.leaving { opacity: 0; filter: blur(10px); pointer-events: none; }

.intro-inner {
  width: 100%;
  max-width: 1040px;
  text-align: center;
  animation: introIn 2.6s var(--ease) both;
}
@keyframes introIn { from { opacity: 0; transform: translateY(14px); filter: blur(8px); } }

.kicker {
  margin: 0 0 2.4em;
  font-size: 11px;
  letter-spacing: .34em;
  text-transform: uppercase;
  color: var(--dim);
}

.title {
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(3.4rem, 11.5vw, 10.5rem);
  line-height: .84;
  letter-spacing: -.02em;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.title span {
  display: block;
  padding: 0 .08em .1em;
  background: linear-gradient(100deg, #ffe2a8 0%, #ff9fd2 20%, #b9a6ff 40%, #7ff0d8 60%, #fff0b0 80%, #ff9fd2 100%);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-variation-settings: "opsz" 144, "SOFT" 100, "WONK" 1, "wght" 300;
  animation: flow 26s ease-in-out infinite alternate, breathe 8.4s ease-in-out infinite;
}
.title .t2 { margin-left: 1.1em; animation-delay: -9s, -4.2s; }
@keyframes flow { to { background-position: 100% 0; } }
@keyframes breathe {
  0%, 100% { font-variation-settings: "opsz" 144, "SOFT" 100, "WONK" 1, "wght" 250; letter-spacing: -.028em; }
  50%      { font-variation-settings: "opsz" 144, "SOFT" 100, "WONK" 1, "wght" 470; letter-spacing: .004em; }
}

.subtitle {
  margin: 1.1em 0 0;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(1.05rem, 2.1vw, 1.45rem);
  color: var(--dim);
  font-variation-settings: "SOFT" 100, "WONK" 1;
}

.choose {
  margin: clamp(2.2rem, 7vh, 4.4rem) 0 1rem;
  font-size: 11px;
  letter-spacing: .38em;
  text-transform: uppercase;
  color: var(--dim);
}

.doors {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: clamp(.6rem, 7vw, 7rem);
}

.door {
  appearance: none;
  -webkit-appearance: none;
  background: none;
  border: 0;
  border-radius: 26px;
  padding: 1rem 1.3rem 1.2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
  cursor: pointer;
  transition: transform .9s var(--ease), background-color .6s, opacity .6s;
}
.door:hover, .door:focus-visible { background: rgba(255, 255, 255, .045); transform: translateY(-5px); }
.door:focus-visible { outline: 1px solid rgba(255, 255, 255, .55); outline-offset: 4px; }
.door:disabled { opacity: .3; cursor: not-allowed; }

.door svg {
  width: clamp(82px, 12.5vw, 138px);
  height: auto;
  overflow: visible;
  animation: float 6.6s ease-in-out infinite;
  transition: filter .9s, transform 1.6s var(--ease);
}
.door[data-door="0"] svg { filter: drop-shadow(0 0 20px rgba(255, 190, 110, .28)); }
.door[data-door="1"] svg { filter: drop-shadow(0 0 20px rgba(255, 60, 200, .28)); animation-delay: -3.3s; }
.door[data-door="0"]:hover svg, .door[data-door="0"]:focus-visible svg { filter: drop-shadow(0 0 36px rgba(255, 190, 110, .65)); }
.door[data-door="1"]:hover svg, .door[data-door="1"]:focus-visible svg { filter: drop-shadow(0 0 36px rgba(255, 60, 200, .65)); }
@keyframes float {
  0%, 100% { transform: translateY(-5px) rotate(-1.6deg); }
  50%      { transform: translateY(5px) rotate(1.6deg); }
}

.door-name {
  margin-top: .7rem;
  padding-left: .34em;
  font-size: 12px;
  letter-spacing: .34em;
  text-transform: uppercase;
}
.door-kw {
  font-family: var(--serif);
  font-style: italic;
  font-size: 15px;
  color: var(--dim);
  font-variation-settings: "SOFT" 100, "WONK" 1;
}

#intro.leaving .door[data-chosen] svg {
  animation: none;
  transform: scale(1.6);
  filter: blur(6px) brightness(1.9) drop-shadow(0 0 40px #fff);
}
#intro.leaving .door:not([data-chosen]) { opacity: 0; }

.notes {
  margin: clamp(1.8rem, 5vh, 3rem) 0 .9rem;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: .45rem 1.6rem;
  font-size: 10.5px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--faint);
}
.warning, .nogl {
  max-width: 36em;
  margin: 0 auto;
  font-family: var(--serif);
  font-style: italic;
  font-size: 14px;
  line-height: 1.5;
  color: var(--dim);
}
.nogl { margin-top: 1rem; color: #ffb3c8; }
.legal {
  margin: 2.2rem 0 0;
  font-size: 10px;
  letter-spacing: .12em;
  color: var(--faint);
}

/* ───────────────────────────── HUD ───────────────────────────── */

.hud {
  position: fixed;
  z-index: 6;
  pointer-events: none;
  color: #fff;
  mix-blend-mode: difference;
  opacity: 0;
  transition: opacity 1.4s ease;
}
body.trip .hud { opacity: .92; }
body.trip.idle .hud { opacity: .3; }

.hud-tl { top: calc(20px + var(--safe-t)); left: calc(22px + var(--safe-l)); }
#clock { font-size: 15px; letter-spacing: .12em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hud-tl .sub { margin-top: 6px; font-size: 9.5px; letter-spacing: .26em; text-transform: uppercase; opacity: .7; }

.hud-tr { top: calc(16px + var(--safe-t)); right: calc(22px + var(--safe-r)); text-align: right; }
#chapter .num {
  display: block;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 300;
  font-size: 34px;
  line-height: 1;
  font-variation-settings: "SOFT" 100, "WONK" 1;
}
#chapter .ttl { display: block; margin-top: 5px; font-size: 10px; letter-spacing: .3em; text-transform: uppercase; }
#chapter.flash { animation: chapterIn 1.8s var(--ease); }
@keyframes chapterIn { from { opacity: 0; filter: blur(6px); transform: translateY(-6px); } }

.hud-bl {
  left: calc(22px + var(--safe-l));
  bottom: calc(22px + var(--safe-b));
  max-width: min(34rem, calc(100vw - 190px));
  font-size: 11.5px;
  line-height: 1.65;
  letter-spacing: .02em;
}
#log .txt { transition: opacity .9s; }
#log.fade .txt { opacity: 0; }
#log .caret {
  display: inline-block;
  width: .6em;
  height: 1.05em;
  margin-left: 2px;
  vertical-align: -.18em;
  background: currentColor;
  animation: blink 1.06s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ───────────────────────────── voix intérieure ───────────────────────────── */

#voice {
  position: fixed;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  color: #fff;
  mix-blend-mode: difference;
}
.vblock {
  --scatter: .7em;
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 14vh 10vw;
}
.vblock.pos-l { align-items: flex-start; text-align: left; }
.vblock.pos-r { align-items: flex-end; text-align: right; }
.vblock.dissolve { --scatter: 2.6em; }

.line {
  margin: 0;
  max-width: 13em;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(2.1rem, 6.3vw, 6.6rem);
  line-height: 1.04;
  letter-spacing: -.012em;
  text-wrap: balance;
  font-variation-settings: "opsz" 144, "SOFT" 100, "WONK" 1, "wght" 300;
  opacity: 0;
  filter: blur(16px);
  transform: translateY(.25em) scale(1.03);
  transition: opacity 2.6s var(--ease), filter 2.8s var(--ease), transform 3.2s var(--ease);
}
.line.on {
  opacity: 1;
  filter: blur(0);
  transform: none;
  animation: lineBreath 8.4s ease-in-out infinite;
}
.line.off {
  opacity: 0;
  filter: blur(22px);
  transform: translateY(.35em);
  transition-duration: 2.2s, 2.4s, 2.8s;
}
@keyframes lineBreath {
  0%, 100% { font-variation-settings: "opsz" 144, "SOFT" 100, "WONK" 1, "wght" 270; }
  50%      { font-variation-settings: "opsz" 144, "SOFT" 100, "WONK" 1, "wght" 430; }
}

.melt { display: inline-block; filter: url(#melt); }
html.no-melt .melt { filter: none; }
.w { display: inline-block; white-space: nowrap; }
.ch { display: inline-block; transition: transform 2.6s var(--ease); }
.line.on .ch { animation: wave 5.4s ease-in-out infinite; animation-delay: calc(var(--i) * -.17s); }
@keyframes wave {
  0%, 100% { transform: translateY(calc(var(--amp) * -1)); }
  50%      { transform: translateY(var(--amp)); }
}
.line.off .ch {
  transform: translate(calc(var(--r1) * var(--scatter)), calc(var(--r2) * var(--scatter) + .3em)) rotate(calc(var(--r1) * 34deg));
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ───────────────────────────── chronologie ───────────────────────────── */

#timeline {
  position: fixed;
  z-index: 7;
  right: calc(18px + var(--safe-r));
  top: 50%;
  width: 26px;
  height: min(50vh, 400px);
  transform: translateY(-50%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 1.2s;
}
body.trip #timeline { opacity: .85; pointer-events: auto; }
body.trip.idle #timeline { opacity: .22; }
#timeline .rail {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1px;
  background: linear-gradient(rgba(255, 255, 255, .06), rgba(255, 255, 255, .42), rgba(255, 255, 255, .06));
}
.tick {
  position: absolute;
  left: 0;
  width: 26px;
  height: 20px;
  margin-top: -10px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}
.tick::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .55);
  transform: translate(-50%, -50%);
  transition: transform .3s, background-color .3s;
}
.tick:hover::before, .tick:focus-visible::before { transform: translate(-50%, -50%) scale(1.9); background: #fff; }
.tick.current::before { background: #fff; }
.tick:focus-visible { outline: none; }
.tick .lbl {
  position: absolute;
  right: 32px;
  top: 50%;
  transform: translate(6px, -50%);
  white-space: nowrap;
  font-size: 10px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 0 10px rgba(0, 0, 0, .9), 0 0 2px rgba(0, 0, 0, .9);
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s, transform .3s;
}
.tick:hover .lbl, .tick:focus-visible .lbl { opacity: 1; transform: translate(0, -50%); }
#marker {
  position: absolute;
  left: 50%;
  top: 0;
  width: 11px;
  height: 11px;
  margin: -5.5px 0 0 -5.5px;
  border-radius: 50%;
  border: 1px solid #fff;
  box-shadow: 0 0 14px rgba(255, 255, 255, .8);
  pointer-events: none;
}

/* ───────────────────────────── contrôles ───────────────────────────── */

.ctrl {
  position: fixed;
  z-index: 7;
  right: calc(16px + var(--safe-r));
  bottom: calc(16px + var(--safe-b));
  display: flex;
  gap: 10px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1.2s;
}
body.trip .ctrl { opacity: .9; pointer-events: auto; }
body.trip.idle .ctrl { opacity: .22; }
.ctrl button {
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .3);
  background: rgba(8, 6, 14, .3);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background-color .3s, border-color .3s, transform .3s;
}
.ctrl button:hover, .ctrl button:focus-visible { background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .65); transform: scale(1.06); outline: none; }
.ctrl svg { width: 19px; height: 19px; fill: none; stroke: #fff; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
#btn-sound .off { display: none; }
#btn-sound.muted .on { display: none; }
#btn-sound.muted .off { display: inline; }

body.nohud .hud, body.nohud #timeline, body.nohud .ctrl { opacity: 0 !important; }

/* ───────────────────────────── indice ───────────────────────────── */

#hint {
  position: fixed;
  z-index: 5;
  left: 50%;
  bottom: calc(13vh + var(--safe-b));
  width: max-content;
  max-width: 86vw;
  transform: translateX(-50%);
  text-align: center;
  font-size: 10.5px;
  letter-spacing: .26em;
  line-height: 1.8;
  text-transform: uppercase;
  color: #fff;
  mix-blend-mode: difference;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.6s;
}
#hint.show { opacity: .9; }
#hint .drip {
  display: block;
  width: 1px;
  height: 38px;
  margin: 0 auto 14px;
  background: linear-gradient(rgba(255, 255, 255, 0), #fff);
  transform-origin: top;
  animation: drip 2.4s ease-in-out infinite;
}
@keyframes drip {
  0%   { transform: scaleY(0); opacity: 0; }
  40%  { opacity: 1; }
  100% { transform: scaleY(1); opacity: 0; }
}

/* ───────────────────────────── curseur ───────────────────────────── */

#cursor {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 30;
  width: 26px;
  height: 26px;
  margin: -13px 0 0 -13px;
  border-radius: 50%;
  border: 1px solid #fff;
  mix-blend-mode: difference;
  pointer-events: none;
  opacity: 0;
  transition: opacity .4s, width .35s var(--ease), height .35s var(--ease), margin .35s var(--ease);
  will-change: transform;
}
#cursor.on { opacity: .9; }
#cursor.press { width: 46px; height: 46px; margin: -23px 0 0 -23px; }

/* ───────────────────────────── fin ───────────────────────────── */

#end {
  position: fixed;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  padding: 6vh 5vw;
  opacity: 0;
  pointer-events: none;
  transition: opacity 2.6s var(--ease);
}
#end.show { opacity: 1; pointer-events: auto; }
#end .card {
  width: min(620px, 100%);
  padding: clamp(1.6rem, 4.5vw, 3rem);
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, .16);
  background: rgba(14, 9, 24, .34);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  backdrop-filter: blur(16px) saturate(1.2);
  box-shadow: 0 30px 90px rgba(10, 4, 20, .28);
  text-align: center;
  color: #fff;
  transform: translateY(12px);
  transition: transform 2.6s var(--ease);
}
#end.show .card { transform: none; }
.end-kicker { margin: 0; font-size: 10px; letter-spacing: .34em; text-transform: uppercase; opacity: .75; }
.end-title {
  margin: .35em 0 .3em;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(2.3rem, 6vw, 4rem);
  line-height: 1;
  font-variation-settings: "opsz" 144, "SOFT" 100, "WONK" 1;
}
.end-text {
  margin: 0 0 1.6em;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.05rem, 2.2vw, 1.3rem);
  line-height: 1.45;
  opacity: .9;
  font-variation-settings: "SOFT" 100, "WONK" 1;
}
.end-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; }
.end-actions button {
  padding: .95em 1.5em;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .55);
  background: transparent;
  font-size: 11px;
  letter-spacing: .2em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color .3s, color .3s, transform .3s;
}
.end-actions button:hover, .end-actions button:focus-visible { background: rgba(255, 255, 255, .16); transform: translateY(-2px); outline: none; }
.end-actions button.primary { background: #fff; color: #140b20; border-color: #fff; }
.end-actions button.primary:hover, .end-actions button.primary:focus-visible { background: #fff3dc; }
.end-note { margin: 1.8em 0 .5em; font-family: var(--serif); font-style: italic; font-size: 15px; }
.end-small { margin: 0; font-size: 10.5px; line-height: 1.65; letter-spacing: .02em; opacity: .7; -webkit-user-select: text; user-select: text; }

/* ───────────────────────────── divers ───────────────────────────── */

#lost {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-content: center;
  gap: 1rem;
  text-align: center;
  background: var(--bg);
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.2rem;
}
#lost button {
  justify-self: center;
  padding: .8em 1.4em;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .5);
  background: none;
  font-family: var(--mono);
  font-style: normal;
  font-size: 11px;
  letter-spacing: .2em;
  text-transform: uppercase;
  cursor: pointer;
}
#err {
  position: fixed;
  left: 10px;
  right: 10px;
  bottom: 10px;
  z-index: 99;
  max-height: 45vh;
  margin: 0;
  overflow: auto;
  padding: 10px;
  background: rgba(30, 0, 8, .9);
  color: #ffc0c8;
  font: 11px/1.4 var(--mono);
  white-space: pre-wrap;
  -webkit-user-select: text;
  user-select: text;
}
.noscript {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.4rem;
  background: var(--bg);
  z-index: 100;
}

@media (max-width: 640px) {
  .doors { flex-wrap: nowrap; gap: 0; }
  .door { flex: 1 1 0; min-width: 0; padding: .8rem .4rem 1rem; }
  .door svg { width: clamp(70px, 24vw, 110px); }
  .door-name { letter-spacing: .26em; }
  .door-kw { font-size: 13px; line-height: 1.35; }
  .sub-x { display: none; }
  .hud-bl { font-size: 10.5px; bottom: calc(18px + var(--safe-b)); max-width: calc(100vw - 150px); }
  #chapter .num { font-size: 27px; }
  #timeline { right: calc(6px + var(--safe-r)); height: 38vh; }
  .tick .lbl { display: none; }
  .vblock { padding: 16vh 9vw; }
  .vblock.pos-l, .vblock.pos-r { align-items: center; text-align: center; }
  .notes { letter-spacing: .14em; }
}

@media (max-height: 560px) {
  .kicker { margin-bottom: 1.2em; }
  .choose { margin-top: 1.4rem; }
  .notes { margin-top: 1.2rem; }
}

@media (prefers-reduced-motion: reduce) {
  .title span, .door svg, .line.on, .line.on .ch, #hint .drip, .intro-inner { animation: none !important; }
}
