/* achyl.studio — portfolio one-pager
   Noir plein écran, une forme 3D par projet, deux vues : Work / About. */

:root {
  --bg: #000;
  --fg: #fff;
  --muted: #b3b3b3;
  --dim: #9a9a9a;
  --faint: #666;
  --ghost: #3a3a3a;
  --rule: #444;

  --sans: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "SF Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --gutter: 40px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html,
body {
  height: 100%;
  background: var(--bg);
  overflow: hidden;
}

body {
  font-family: var(--sans);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a {
  color: var(--fg);
  text-decoration: none;
}

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

:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 4px;
}

/* ---------- scène ---------- */

.stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

.stage__canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

.stage__canvas.is-grabbing {
  cursor: grabbing;
}

/* ---------- header ---------- */

.topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 34px var(--gutter);
  mix-blend-mode: difference;
}

.brand {
  display: block;
  padding: 0;
  line-height: 0;
}

.brand__logo {
  display: block;
  width: 106px;
  height: auto;
}

.nav {
  display: flex;
  align-items: center;
  gap: 26px;
}

.nav__link {
  padding-bottom: 4px;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border-bottom: 2px solid transparent;
  opacity: 0.4;
  transition: opacity 0.3s var(--ease);
}

.nav__link:hover {
  opacity: 0.75;
}

.nav__link.is-active {
  opacity: 1;
  border-bottom-color: currentColor;
}

/* ---------- vues ---------- */

.view {
  position: absolute;
  inset: 0;
  z-index: 5;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

.view.is-visible {
  opacity: 1;
}

/* Seuls les éléments interactifs reprennent la main : le reste laisse
   passer le drag vers le canvas. */
.view.is-visible .visit,
.view.is-visible .arrow,
.view.is-visible .about {
  pointer-events: auto;
}

/* ---------- work ---------- */

.counter {
  position: absolute;
  top: 96px;
  left: var(--gutter);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--faint);
}

.arrow {
  position: absolute;
  top: 50%;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  margin-top: -32px;
  font-size: 32px;
  line-height: 1;
  mix-blend-mode: difference;
  transition: transform 0.3s var(--ease);
}

.arrow--prev { left: 24px; }
.arrow--next { right: 24px; }
.arrow--prev:hover { transform: translateX(-4px); }
.arrow--next:hover { transform: translateX(4px); }

.work {
  position: absolute;
  left: var(--gutter);
  right: var(--gutter);
  bottom: var(--gutter);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 40px;
}

.work__title {
  max-width: 62vw;
  font-weight: 800;
  font-size: clamp(48px, 11vw, 168px);
  line-height: 0.82;
  letter-spacing: -0.05em;
  text-transform: uppercase;
  text-wrap: balance;
}

.work__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 18px;
  max-width: 340px;
  padding-bottom: 8px;
  text-align: right;
}

.work__desc {
  font-size: 15px;
  line-height: 1.45;
  color: var(--muted);
  text-wrap: pretty;
}

.work__stack {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--faint);
}

.visit {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--bg);
  background: var(--fg);
  transition: transform 0.3s var(--ease), opacity 0.3s var(--ease);
}

.visit:hover {
  transform: translateY(-2px);
  opacity: 0.88;
}

.visit[hidden] {
  display: none;
}

.hint {
  position: absolute;
  bottom: var(--gutter);
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ghost);
  white-space: nowrap;
}

/* ---------- about ---------- */

.view--about {
  display: flex;
  align-items: flex-end;
  z-index: 6;
}

.about {
  max-width: 640px;
  padding: var(--gutter);
}

.eyebrow {
  margin-bottom: 22px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
}

.about__lead {
  font-weight: 600;
  font-size: clamp(20px, 2.4vw, 30px);
  line-height: 1.28;
  letter-spacing: -0.02em;
  text-wrap: pretty;
}

.about__body p {
  margin-top: 18px;
  font-size: 16px;
  line-height: 1.6;
  color: var(--dim);
  text-wrap: pretty;
}

.about__links {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  margin-top: 30px;
}

.about__links a {
  padding-bottom: 2px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--rule);
  transition: border-color 0.3s var(--ease);
}

.about__links a:hover {
  border-bottom-color: var(--fg);
}

/* ---------- ouverture ----------
   Le texte et les commandes n'existent qu'une fois la forme installée. La
   classe est posée dans le HTML et retirée par app.js : si le script échoue,
   c'est le bloc <noscript> qui prend le relais. */

.topbar,
.counter,
.work,
.hint,
.arrow {
  transition: opacity 0.85s var(--ease), transform 0.85s var(--ease);
}

body.is-booting .topbar,
body.is-booting .counter,
body.is-booting .work,
body.is-booting .hint,
body.is-booting .arrow {
  opacity: 0;
}

body.is-booting .work { transform: translateY(18px); }
body.is-booting .counter { transform: translateY(10px); }
body.is-booting .topbar { transform: translateY(-10px); }

/* Décalages : la barre d'abord, le titre ensuite, les commandes en dernier. */
body:not(.is-booting) .counter { transition-delay: 0.12s; }
body:not(.is-booting) .work { transition-delay: 0.2s; }
body:not(.is-booting) .arrow { transition-delay: 0.46s; }
body:not(.is-booting) .hint { transition-delay: 0.6s; }

/* Le survol des flèches garde sa propre durée, plus vive. */
.arrow:hover { transition: transform 0.3s var(--ease); }

/* ---------- noscript ---------- */

.noscript {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 16px;
  padding: var(--gutter);
  background: var(--bg);
}

.noscript h1 {
  font-size: 48px;
  font-weight: 800;
  letter-spacing: -0.04em;
  text-transform: uppercase;
}

.noscript p {
  max-width: 44ch;
  color: var(--dim);
  line-height: 1.6;
}

.noscript a {
  border-bottom: 1px solid var(--rule);
}

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  :root { --gutter: 22px; }

  .topbar { padding: 22px var(--gutter); }
  .counter { top: 74px; }

  .work {
    flex-direction: column;
    align-items: flex-start;
    gap: 22px;
    bottom: 76px;
  }

  .work__title {
    max-width: 100%;
    font-size: clamp(40px, 15vw, 84px);
  }

  .work__meta {
    align-items: flex-start;
    max-width: 100%;
    text-align: left;
  }

  .arrow {
    width: 48px;
    height: 48px;
    margin-top: -24px;
    font-size: 26px;
  }

  .arrow--prev { left: 4px; }
  .arrow--next { right: 4px; }

  .hint { bottom: 22px; }

  .about { padding: var(--gutter); }
  .about__body p { font-size: 15px; }
}

@media (max-width: 480px) {
  .work__desc { font-size: 14px; }
  .hint { font-size: 9px; }
}

/* Écrans courts en paysage : on allège pour éviter les chevauchements. */
@media (max-height: 520px) {
  .work__title { font-size: clamp(32px, 7vw, 56px); }
  .hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
