/* sotactic.app (hub) — styles de la page. Couleurs, police, rayons : seulement les
   variables --hub-* de tokens.css (chargée avant). Spec : sotactic-app-hub/DESIGN.md. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--hub-bg); }
body { min-height: 100vh; font-size: var(--hub-body); line-height: 1.7; overflow-x: hidden; }
a { color: var(--hub-green); }
h1, h2, h3, p { margin: 0; }
button, input, textarea { font: inherit; color: inherit; }
::selection { background: color-mix(in srgb, var(--hub-green) 30%, transparent); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: 16px; top: -60px; z-index: 10; padding: 10px 14px;
  border-radius: var(--hub-r-md); background: var(--hub-green); color: var(--hub-on-green);
  font-weight: 700; text-decoration: none;
}
.skip:focus { top: 12px; }

/* Couleurs de la coloration syntaxique */
.c-green { color: var(--hub-green); }
.c-cyan { color: var(--hub-cyan); }
.c-pink { color: var(--hub-pink); }
.c-yellow { color: var(--hub-yellow); }
.c-text { color: var(--hub-text); }
.c-mute { color: var(--hub-text-3); }

/* Décor : quadrillage de 32 px qui s'efface en descendant */
.page { position: relative; isolation: isolate; }
.page::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    linear-gradient(var(--hub-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--hub-grid) 1px, transparent 1px);
  background-size: 32px 32px;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, 0.6) 40%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, 0.6) 40%, transparent 100%);
}

.wrap { max-width: var(--hub-max); margin: 0 auto; padding-left: var(--hub-pad-x); padding-right: var(--hub-pad-x); }

/* Curseur bloc qui clignote */
@keyframes blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
.caret { display: inline-block; background: var(--hub-green); animation: blink 1s steps(1) infinite; }

/* Boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: var(--hub-touch); padding: 0 22px; border-radius: var(--hub-r-lg);
  font-size: 15.5px; font-weight: 800; text-decoration: none; cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn-lg { height: 54px; }
.btn-md { height: 50px; padding: 0 20px; font-size: 15px; }
.btn-primary { border: 0; background: var(--hub-green); color: var(--hub-on-green); }
.btn-primary:hover { background: var(--hub-green-hover); }
.btn-ghost { border: 1px solid var(--hub-border-strong); background: transparent; color: var(--hub-text); font-weight: 700; }
.btn-ghost:hover { background: color-mix(in srgb, var(--hub-green) 8%, transparent); border-color: var(--hub-green); color: var(--hub-green); }

/* ---------- En-tête ---------- */
.top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding-top: 22px; padding-bottom: 22px; }
.logo {
  display: inline-flex; align-items: center; min-height: var(--hub-touch);
  color: var(--hub-text); text-decoration: none; font-size: 20px; font-weight: 800; letter-spacing: -0.02em;
}
.logo .caret { width: 10px; height: 20px; margin-left: 8px; }
.nav { display: flex; gap: 4px; font-size: 14px; font-weight: 500; }
.nav a { display: inline-flex; align-items: center; min-height: var(--hub-touch); padding: 0 12px; color: var(--hub-text-3); text-decoration: none; }
.nav a:hover { color: var(--hub-green); }

/* ---------- Hero ---------- */
.hero {
  max-width: calc(var(--hub-hero-max) + 2 * var(--hub-pad-x)); margin: 0 auto; padding: 56px var(--hub-pad-x) 88px;
  display: flex; flex-direction: column; align-items: center; gap: 30px; text-align: center;
}
.comment { font-size: var(--hub-small); color: var(--hub-text-3); }
.hero h1 { font-size: var(--hub-h1); font-weight: 800; line-height: 1.04; letter-spacing: -0.045em; }

.window { border-radius: var(--hub-r-xl); background: var(--hub-surface); border: 1px solid var(--hub-border); overflow: hidden; }
.window-bar {
  display: flex; align-items: center; gap: 7px; padding: 10px 14px;
  background: var(--hub-surface-2); border-bottom: 1px solid var(--hub-border);
}
.dot { flex: none; width: 10px; height: 10px; border-radius: 50%; }
.dot-r { background: var(--hub-dot-red); }
.dot-y { background: var(--hub-dot-yellow); }
.dot-g { background: var(--hub-dot-green); }
.window-title { margin-left: 10px; font-size: 12px; color: var(--hub-text-3); }

.console { width: 100%; max-width: 620px; text-align: left; border-radius: 12px; box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.8); }
.console .window-bar { background: var(--hub-surface); }
.console-body { padding: 18px 20px; font-size: clamp(16px, 2.2vw, 22px); line-height: 1.6; }
.console-line { white-space: nowrap; overflow: hidden; }
/* Textes animés : leur mise à jour ne recalcule pas le reste de la page. */
.console-body, .code, .next { contain: layout paint; }
.console .caret { width: 0.55em; height: 1.05em; vertical-align: -0.15em; margin-left: 1px; }
.brk { display: none; }
.console-note { font-size: 0.72em; color: var(--hub-text-3); }

.lead { max-width: 680px; font-size: var(--hub-lead); line-height: 1.7; color: var(--hub-text-2); }
.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }

/* ---------- Ressources ---------- */
.section-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.section-head h2, .contact h2 { margin-top: 10px; font-size: var(--hub-h2); font-weight: 800; line-height: 1.08; letter-spacing: -0.04em; }
.section-head p { max-width: 400px; font-size: 15px; line-height: 1.65; color: var(--hub-text-3); }
.resources { display: flex; flex-direction: column; gap: 28px; padding-top: 8px; padding-bottom: 72px; scroll-margin-top: 16px; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 500px), 1fr)); gap: 24px; }
.card { display: flex; flex-direction: column; transition: transform .2s, box-shadow .2s, border-color .2s; }
.card:hover {
  transform: translateY(-3px); border-color: var(--hub-border-strong);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--hub-green) 25%, transparent), 0 24px 48px -16px color-mix(in srgb, var(--hub-green) 18%, transparent);
}
.tabbar { display: flex; align-items: center; height: 42px; background: var(--hub-surface-2); border-bottom: 1px solid var(--hub-border); font-size: 12.5px; }
.tab {
  display: inline-flex; align-items: center; gap: 8px; height: 100%; padding: 0 16px; min-width: 0;
  background: var(--hub-surface); border-right: 1px solid var(--hub-border); border-top: 2px solid var(--tab, var(--hub-green));
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tab-dot { color: var(--tab, var(--hub-green)); }
.state { margin-left: auto; padding: 0 14px; white-space: nowrap; }
.card-main { flex: 1; display: flex; }
.gutter {
  flex: none; width: 44px; padding: 20px 10px 0 0; text-align: right; font-size: 13px; line-height: 2;
  color: var(--hub-border-strong); border-right: 1px solid var(--hub-border-soft); user-select: none;
}
.card-body { flex: 1; min-width: 0; padding: 20px 22px 24px; display: flex; flex-direction: column; gap: 18px; }
.card-id { display: flex; align-items: baseline; gap: 14px; }
.ghost-num { font-size: 54px; font-weight: 800; line-height: 0.9; letter-spacing: -0.05em; color: var(--hub-ghost-num); }
.card-name { font-size: 15px; font-weight: 700; }
.card h3 { font-size: var(--hub-h3); font-weight: 800; line-height: 1.25; letter-spacing: -0.03em; }
.card p { font-size: 15px; line-height: 1.7; color: var(--hub-text-2); }
.code {
  padding: 14px 16px; border-radius: var(--hub-r-lg); background: var(--hub-code); border: 1px solid var(--hub-border-soft);
  font-size: var(--hub-small); line-height: 1.85; overflow-x: auto;
}
.code > div { white-space: pre-wrap; }
.code .in { padding-left: 18px; }
.code-cmt { color: var(--hub-text-3); }
.tags { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0; list-style: none; }
.tag {
  display: inline-flex; align-items: center; height: 28px; padding: 0 10px; border-radius: var(--hub-r-sm); font-size: 12.5px;
  color: var(--hub-cyan); background: color-mix(in srgb, var(--hub-cyan) 8%, transparent); border: 1px solid color-mix(in srgb, var(--hub-cyan) 22%, transparent);
}
.tags-pink .tag {
  color: var(--hub-pink-soft); background: color-mix(in srgb, var(--hub-pink) 8%, transparent); border-color: color-mix(in srgb, var(--hub-pink) 25%, transparent);
}
.card .btn { margin-top: auto; align-self: flex-start; }

.next {
  display: flex; align-items: center; flex-wrap: wrap; gap: 16px; padding: 18px 22px; border-radius: var(--hub-r-xl);
  border: 1px dashed var(--hub-border-strong); background: color-mix(in srgb, var(--hub-surface) 60%, transparent);
  font-size: 14px; color: var(--hub-text-3);
}
.next .ghost-num { font-size: 34px; line-height: 1; }
.next-dots { display: inline-block; min-width: 3ch; text-align: left; }
.next-bar { margin-left: auto; color: var(--hub-green); white-space: pre; }

/* ---------- Formulaire web404 ---------- */
.contact { display: flex; flex-wrap: wrap; gap: 48px; align-items: flex-start; padding-top: 24px; padding-bottom: 96px; scroll-margin-top: 16px; }
.contact-text { flex: 1 1 360px; min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.contact h2 { margin-top: 0; }
.contact-text > p { font-size: 15.5px; line-height: 1.7; color: var(--hub-text-2); }
.offers { display: flex; flex-direction: column; gap: 10px; padding: 0; margin: 0; list-style: none; }
.offer { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--hub-r-lg); background: var(--hub-surface); border: 1px solid var(--hub-border); }
.offer-ext { flex: none; width: 4ch; font-size: 13px; font-weight: 700; }
.offer strong { display: block; font-size: 15px; font-weight: 700; }
.offer span:last-child span { display: block; font-size: var(--hub-small); line-height: 1.55; color: var(--hub-text-3); }

.form-win { flex: 1.4 1 520px; min-width: 0; }
.form-body { padding: 26px; }
.form { display: flex; flex-direction: column; gap: 18px; }
.form fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.form legend { padding: 0; margin-bottom: 10px; font-size: 14px; font-weight: 700; color: var(--hub-text-2); }
.kinds { display: flex; flex-wrap: wrap; gap: 8px; }
.kind {
  display: inline-flex; align-items: center; gap: 8px; min-height: var(--hub-touch); padding: 0 14px; border-radius: var(--hub-r-md);
  border: 1px solid var(--hub-border-strong); background: transparent; color: var(--hub-text-2);
  font-size: 14px; font-weight: 700; cursor: pointer; white-space: pre;
}
.kind:hover { border-color: var(--hub-text-3); }
.kind[aria-checked="true"] { border-color: var(--hub-green); background: color-mix(in srgb, var(--hub-green) 10%, transparent); color: var(--hub-green); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
/* Grille des 4 champs : libellés, champs et erreurs alignés ligne à ligne (sous-grille),
   même quand un libellé passe sur deux lignes. */
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 14px; row-gap: 0; }
.fields .field { display: grid; grid-row: span 3; grid-template-rows: subgrid; row-gap: 6px; margin-bottom: 14px; }
.fields .field-label { align-self: end; }
.fields .field:nth-last-child(-n + 2) { margin-bottom: 0; }
.field-label { font-size: var(--hub-small); font-weight: 700; color: var(--hub-text-2); }
.field-opt { font-weight: 400; color: var(--hub-text-3); }
.field input, .field textarea {
  width: 100%; border-radius: var(--hub-r-md); border: 1px solid var(--hub-border-strong); background: var(--hub-code);
  color: var(--hub-text); font-size: 16px;
}
.field input { height: 50px; padding: 0 14px; }
.field textarea { min-height: 140px; padding: 12px 14px; line-height: 1.55; resize: vertical; }
.field input::placeholder, .field textarea::placeholder { color: var(--hub-text-3); opacity: 1; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--hub-green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--hub-green) 18%, transparent); }
.field [aria-invalid="true"] { border-color: var(--hub-yellow); }
.error { font-size: var(--hub-small); line-height: 1.5; color: var(--hub-yellow); }
.error:empty { display: none; }
.consent { display: flex; align-items: flex-start; gap: 12px; font-size: 13px; line-height: 1.5; color: var(--hub-text-3); cursor: pointer; }
.consent input { flex: none; width: 22px; height: 22px; margin: 0; accent-color: var(--hub-green); cursor: pointer; }
.consent-row { display: flex; flex-direction: column; gap: 6px; }
.form .btn[type="submit"] { align-self: flex-start; }
.form .btn[disabled] { opacity: 0.7; cursor: progress; }
.form-error { padding: 12px 14px; border-radius: var(--hub-r-md); border: 1px solid color-mix(in srgb, var(--hub-yellow) 45%, transparent); }
.form-error a { color: var(--hub-yellow); }
/* Champ piège : hors écran, invisible, jamais atteint au clavier */
.trap { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

.sent { min-height: 420px; display: flex; flex-direction: column; justify-content: center; gap: 10px; font-size: 15px; line-height: 1.8; }
.sent h3 { margin-top: 12px; font-size: 26px; line-height: 1.2; font-weight: 800; letter-spacing: -0.03em; outline: none; }
.sent p { color: var(--hub-text-2); }
.sent .btn { align-self: flex-start; margin-top: 10px; height: var(--hub-touch); padding: 0 16px; border-radius: var(--hub-r-md); font-size: 14px; }
[hidden] { display: none !important; }

/* ---------- Pied de page ---------- */
.foot { border-top: 1px solid var(--hub-border-soft); }
.foot .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding-top: 18px; padding-bottom: 18px; font-size: 13px; color: var(--hub-text-3); }
.foot-links { display: flex; flex-wrap: wrap; column-gap: 6px; padding: 0; margin: 0; list-style: none; }
.foot-links a { display: inline-flex; align-items: center; min-height: var(--hub-touch); padding: 0 6px; color: var(--hub-text-3); }
.foot-links a:hover { color: var(--hub-green); }

/* ---------- Pages légales et 404 ---------- */
.doc { max-width: 760px; margin: 0 auto; padding: 32px var(--hub-pad-x) 80px; }
.doc h1 { margin-top: 10px; font-size: var(--hub-h2); font-weight: 800; line-height: 1.08; letter-spacing: -0.04em; }
.doc h2 { margin-top: 36px; font-size: 19px; font-weight: 800; letter-spacing: -0.02em; color: var(--hub-cyan); }
.doc p, .doc li { color: var(--hub-text-2); }
.doc p { margin-top: 12px; }
.doc ul { margin: 12px 0 0; padding-left: 20px; }
.doc li + li { margin-top: 6px; }
.doc strong { color: var(--hub-text); font-weight: 700; }
.doc .updated { margin-top: 14px; font-size: var(--hub-small); color: var(--hub-text-3); }
.doc .back { margin-top: 40px; }
.lost { min-height: 60vh; display: flex; flex-direction: column; justify-content: center; gap: 22px; }
.lost .console { max-width: 560px; }

/* ---------- Tailles d'écran ---------- */
@media (max-width: 760px) {
  :root { --hub-pad-x: 20px; }
  .nav, .gutter { display: none; }
  .top { padding-top: 14px; padding-bottom: 14px; }
  .hero { padding-top: 32px; padding-bottom: 64px; gap: 26px; }
  .card-body { padding: 20px; }
  .next-bar { margin-left: 0; flex-basis: 100%; }
  .contact { gap: 36px; padding-bottom: 72px; }
  .form-body { padding: 20px; }
  .form .btn[type="submit"] { align-self: stretch; height: 54px; }
  .card .btn { align-self: stretch; }
}
@media (max-width: 520px) {
  .actions { flex-direction: column; align-items: stretch; width: 100%; }
  .actions .btn { width: 100%; }
}
@media (max-width: 480px) {
  .fields { grid-template-columns: minmax(0, 1fr); }
  .fields .field:nth-last-child(2) { margin-bottom: 14px; }
  .tab { padding: 0 12px; }
  .state { padding: 0 12px; }
}
@media (max-width: 440px) {
  .brk { display: inline; }
  .sp { display: none; }
}
@media (max-width: 380px) {
  .console-body { padding: 16px 14px; }
  .card-body { padding: 18px 16px 20px; }
  .code { padding: 12px; }
  .code .in { padding-left: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .caret { animation: none; }
  .card:hover { transform: none; }
}
.nw { white-space: nowrap; }
