/* Convergence. Tokens : design/DESIGN.md */

:root {
  --paper: #f2f0ea;
  --ink: #0e0f12;
  --text: #2a2c31;
  --soft: #5b5e64;
  --explore: #6b6e74;
  --signal: #ff4a1c;
  --hair: rgba(14, 15, 18, 0.14);
  --sans: "Inter Tight", "Inter", "Helvetica Neue", Arial, system-ui, sans-serif;
  --serif: "Instrument Serif", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --gutter: max(clamp(2rem, 8.33vw, 7.5rem), calc((100vw - 1600px) / 2));
  --ease: cubic-bezier(0.2, 0.75, 0.15, 1);
  --ease-io: cubic-bezier(0.7, 0, 0.2, 1);
}

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

[hidden] {
  display: none !important;
}

html {
  background: var(--paper);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1,
h2,
p {
  margin: 0;
  font-weight: inherit;
}

a,
button {
  color: inherit;
  font: inherit;
}

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

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

/* ---------- Page : un écran ---------- */

.page {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  min-height: 100svh;
  padding-inline: var(--gutter);
  overflow: hidden;
  overflow: clip;
}

.field {
  position: absolute;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.top {
  padding-top: max(2.6rem, env(safe-area-inset-top));
}

.wordmark {
  display: inline-block;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1;
}

.dot {
  color: var(--signal);
}

.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding-block: 2.5rem;
}

/* ---------- Titre : deux voix ---------- */

.title {
  font-weight: 400;
}

.line-explore,
.line-decide {
  display: block;
}

.line-explore {
  font-family: var(--sans);
  font-weight: 300;
  font-size: min(9vw, 14.4svh, 8.25rem);
  line-height: 1;
  letter-spacing: -0.045em;
  color: var(--explore);
  margin-left: -0.055em;
}

.line-decide {
  font-family: var(--serif);
  font-style: italic;
  font-size: min(12.8vw, 20.5svh, 11.75rem);
  line-height: 0.9;
  letter-spacing: -0.012em;
  margin: -0.02em 0 0 -0.035em;
}

.nowrap {
  white-space: nowrap;
}

/* Le point final : foyer des lignes. Inline-block vide, donc posé sur la ligne de base. */
.stop {
  position: relative;
  display: inline-block;
  width: 0.145em;
  height: 0.145em;
  margin-left: 0.055em;
  border-radius: 50%;
  background: var(--signal);
  vertical-align: baseline;
}

.stop::after {
  content: "";
  position: absolute;
  inset: -1px;
  border: 1.5px solid var(--signal);
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
}

.lede {
  margin-top: clamp(1.25rem, 4.6svh, 2.6rem);
  max-width: 36em;
  font-size: clamp(1.0625rem, 1.66vw, 1.5rem);
  line-height: 1.35;
  letter-spacing: -0.014em;
  color: var(--text);
}

/* ---------- Actions ---------- */

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 2.5rem;
  margin-top: clamp(1.5rem, 5.4svh, 3rem);
}

.cta {
  --dot-x: 34px;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  min-height: 4rem;
  padding: 0 2rem 0 54px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: 1.125rem;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.012em;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition:
    color 0.45s var(--ease),
    transform 0.2s ease,
    box-shadow 0.6s var(--ease);
}

/* Le point vermillon du bouton : un cercle de 5 px qui s'ouvre et remplit la pilule. */
.cta::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--signal);
  clip-path: circle(5px at var(--dot-x) 50%);
  transition: clip-path 0.7s var(--ease-io);
}

@media (hover: hover) {
  .cta:hover {
    color: var(--ink);
  }

  .cta:hover::before {
    clip-path: circle(142% at var(--dot-x) 50%);
  }
}

.cta:focus-visible,
.cta.is-done {
  color: var(--ink);
}

.cta:focus-visible::before,
.cta.is-done::before {
  clip-path: circle(142% at var(--dot-x) 50%);
}

.cta.is-done {
  box-shadow: 0 0 0 7px rgba(255, 74, 28, 0.2);
}

.cta:active {
  transform: scale(0.985);
}

.cta[aria-busy="true"] {
  cursor: progress;
}

.kit {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  font-size: 1.0625rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.kit-text {
  padding-bottom: 0.2em;
  background: linear-gradient(currentColor, currentColor) left bottom / 100% 1px no-repeat;
  transition: background-size 0.3s var(--ease);
}

.kit-arrow {
  display: inline-block;
  margin-left: 0.4em;
  transition: transform 0.35s var(--ease);
}

.kit:hover .kit-text {
  background-size: 100% 2px;
}

.kit:hover .kit-arrow,
.kit:focus-visible .kit-arrow {
  transform: translateY(2px);
}

/* L'indication et la confirmation se remplacent au même endroit, hauteur réservée. */
.note {
  min-height: 1.5em;
  margin-top: 1.1rem;
  max-width: 38em;
  font-size: 1rem;
  line-height: 1.45;
}

.hint {
  color: var(--soft);
}

.status {
  color: var(--ink);
  font-weight: 500;
}

.status:empty,
.keep-status:empty {
  display: none;
}

.status::before,
.keep-status::before {
  content: "";
  display: inline-block;
  width: 0.45em;
  height: 0.45em;
  margin-right: 0.55em;
  border-radius: 50%;
  background: var(--signal);
  vertical-align: 0.1em;
}

.status a {
  color: var(--ink);
  text-underline-offset: 0.25em;
}

/* ---------- Pied ---------- */

.foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0 2rem;
  padding: 0.6rem 0 max(2.2rem, env(safe-area-inset-bottom));
  border-top: 1px solid var(--hair);
  font-size: 0.875rem;
  color: var(--soft);
}

.credit {
  padding-block: 0.7rem;
}

.keep {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 1.25rem;
}

.keep-status {
  color: var(--ink);
}

.keep-link {
  min-height: 2.75rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--soft);
  cursor: pointer;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.3em;
  transition: color 0.2s ease;
}

.keep-link:hover {
  color: var(--ink);
}

/* ---------- Mobile : les lignes tombent vers le point ---------- */

@media (max-width: 599px) {
  .page {
    --gutter: 1.5rem;
  }

  .top {
    padding-top: max(1.4rem, env(safe-area-inset-top));
  }

  .wordmark {
    font-size: 1.0625rem;
  }

  .hero {
    justify-content: flex-end;
    align-items: stretch;
    padding-block: 2rem 1.25rem;
  }

  .line-explore {
    font-size: min(15vw, 7.6svh);
  }

  .line-decide {
    font-size: min(21vw, 10.6svh);
  }

  .lede {
    font-size: 1.0625rem;
    margin-top: 1.1rem;
  }

  /* Ordre visuel : bouton, indication, lien du kit. */
  .actions {
    display: contents;
  }

  .cta {
    order: 1;
    --dot-x: 30px;
    min-height: 3.75rem;
    margin-top: 1.5rem;
    padding-left: 50px;
    font-size: 1.0625rem;
  }

  .note {
    order: 2;
    min-height: 2.9em;
    margin-top: 0.6rem;
    font-size: 0.9375rem;
  }

  .kit {
    order: 3;
    align-self: flex-start;
    margin-top: 0.15rem;
  }

  .foot {
    flex-direction: column;
    align-items: flex-start;
    padding-top: 0.4rem;
    font-size: 0.8125rem;
  }

  .credit {
    padding-block: 0.5rem 0;
  }
}

/* ---------- Mouvement ---------- */

@media (prefers-reduced-motion: no-preference) {
  .stop {
    animation: stop-pop 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) 0.95s both;
  }

  .stop.is-ring::after {
    animation: stop-ring 0.8s var(--ease);
  }
}

@keyframes stop-pop {
  from {
    transform: scale(0);
  }
}

@keyframes stop-ring {
  from {
    opacity: 0.9;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(4.4);
  }
}

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

/* ---------- Repli : copie manuelle ---------- */

.manual {
  width: min(calc(100% - 2rem), 34rem);
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: #fbfaf7;
  color: var(--ink);
  box-shadow: 0 40px 120px -30px rgba(14, 15, 18, 0.45);
}

.manual::backdrop {
  background: rgba(242, 240, 234, 0.72);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.manual-inner {
  display: grid;
  gap: 0.9rem;
  padding: 1.5rem;
}

.manual h2 {
  font-family: var(--serif);
  font-style: italic;
  font-size: 2rem;
  line-height: 1.05;
}

.manual p {
  color: var(--soft);
}

.manual textarea {
  width: 100%;
  min-height: 11rem;
  padding: 0.8rem;
  border: 1px solid var(--hair);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.5 ui-monospace, Menlo, Consolas, monospace;
  resize: vertical;
}

.manual-close {
  justify-self: start;
  min-height: 2.75rem;
  padding: 0.5rem 1.4rem;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-weight: 500;
  cursor: pointer;
}
