/* Habillage commun des starters : pas besoin d'y toucher.
   Chaque starter fonctionne aussi sans ce fichier (il sera juste moins joli). */
@import url("../assets/fonts.css");

:root {
  --paper: #ececec; --panel: #ffffff; --ink: #000000; --mute: #555555;
  --line: rgba(0, 0, 0, 0.14); --blend: multiply;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #141414; --panel: #1f1f1f; --ink: #f2f2f2; --mute: #a3a3a3;
    --line: rgba(255, 255, 255, 0.14); --blend: screen;
  }
}
:root[data-theme="dark"] {
  --paper: #141414; --panel: #1f1f1f; --ink: #f2f2f2; --mute: #a3a3a3;
  --line: rgba(255, 255, 255, 0.14); --blend: screen;
}

*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: "Bricolage Grotesque", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
main { max-width: 640px; margin: 0 auto; padding: 32px 16px 64px; }
.retour {
  display: inline-block; margin-bottom: 24px; padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px;
  font-family: "JetBrains Mono", monospace; font-size: 13px; color: var(--mute); text-decoration: none;
}
.retour:hover { color: var(--ink); border-color: var(--ink); }
.embed .retour { display: none; }
header .k { font-family: "JetBrains Mono", monospace; font-size: 13px; color: var(--mute); margin: 0 0 8px; }
header h1 { font-size: clamp(26px, 6vw, 40px); line-height: 1.05; font-weight: 800; margin: 0 0 12px; }
header p { font-family: "Source Serif 4", Georgia, serif; font-size: 17px; line-height: 1.5; color: var(--mute); margin: 0 0 24px; }
header code { font-family: "JetBrains Mono", monospace; font-size: 0.85em; color: var(--ink); }

#art { display: block; width: 100%; height: auto; background: var(--panel); border: 1px solid var(--line); }

.controls { display: grid; gap: 12px; margin-top: 20px; font-family: "JetBrains Mono", monospace; font-size: 13px; }
.controls label { display: grid; grid-template-columns: minmax(9ch, auto) 1fr 6ch; gap: 12px; align-items: center; }
.controls output { text-align: right; font-variant-numeric: tabular-nums; }
input[type="range"] { width: 100%; accent-color: var(--ink); }
.buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
button {
  font: inherit; padding: 9px 16px; border: 1px solid var(--ink); border-radius: 999px;
  background: none; color: var(--ink); cursor: pointer;
}
button:hover { background: var(--ink); color: var(--paper); }

/* Colonne « Le code de ce starter » (ajoutée par index.js) */
.code { background: var(--panel); border-top: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; }
.code-tete {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 14px 16px;
  border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel);
}
.code-titre { margin: 0; font-weight: 700; font-size: 16px; flex: 1 1 auto; }
.code-onglets { display: flex; gap: 4px; }
.code-onglets button, .code-codepen { padding: 5px 12px; font-family: "JetBrains Mono", monospace; font-size: 13px; }
.code-onglets button { border-color: transparent; }
.code-onglets button[aria-selected="true"] { border-color: var(--ink); }
.code-corps { position: relative; flex: 1; min-height: 0; min-width: 0; display: flex; }
.code-texte {
  margin: 0; padding: 16px 56px 16px 16px; overflow: auto; flex: 1; min-width: 0;
  font-family: "JetBrains Mono", monospace; font-size: 13px; line-height: 1.6; tab-size: 2;
}
.code-copier {
  position: absolute; top: 10px; right: 14px; width: 32px; height: 32px; padding: 0;
  display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel); color: var(--mute);
}
.code-copier:hover { background: var(--paper); color: var(--ink); }
.code-texte .c { color: var(--mute); }
.code-texte .m { color: #e4312b; font-weight: 700; }

@media (min-width: 1100px) {
  body.avec-code { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); }
  body.avec-code main { width: 100%; }
  .code { position: sticky; top: 0; height: 100vh; border-top: 0; border-left: 1px solid var(--line); }
}

/* Aperçu dans starters/index.html : on masque le texte, on garde le dessin et les réglages. */
.embed .code { display: none; }
.embed body.avec-code { display: block; }
.embed header { display: none; }
.embed main { padding: 12px; }
.embed #art { max-width: 340px; margin: 0 auto; }
.embed body { background: var(--panel); }
