/* ==========================================================================
   Thèmes de Riant Voisins
   --------------------------------------------------------------------------
   Chaque thème redéfinit les mêmes jetons (fond, surfaces, texte, action,
   structure, texture, police des titres), en clair puis en sombre. Les
   sélecteurs portent sur [data-accent] et non sur :root seulement : ainsi une
   carte d'aperçu (Moi › Apparence) qui porte data-accent="…" s'affiche dans
   SON thème, quel que soit celui de la page.

   Règle commune : jamais de texte violet ou bleu sur fond violet ; en sombre,
   les intitulés sont clairs (--on-soft, --accent-bright).
   ========================================================================== */

/* ---------- Améthyste (défaut) : violet profond et bleu canard ---------- */
[data-accent="amethyste"] {
  --paper: #f5f3f8; --paper-2: #ece8f2; --card: #fffdfe; --line: #e2dcea;
  --ink: #1f1a2e; --muted: #5c566b;
  --green: #0b6b73; --on-action: #fff;
  --green-deep: #3d2a63; --green-soft: #ede7f6; --on-soft: #3d2a63;
  --accent-bright: #7fd3d9; --halo: #ebe5f5;
  --header-bg: linear-gradient(135deg, #3d2a63, #281b45);
  /* Facettes : un losange discret, comme la taille d'une pierre. */
  --texture: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='44' height='44'%3E%3Cpath d='M22 1L43 22L22 43L1 22Z' fill='none' stroke='%233d2a63' stroke-opacity='.07'/%3E%3C/svg%3E");
}
:root[data-theme="dark"][data-accent="amethyste"], :root[data-theme="dark"] [data-accent="amethyste"] {
  --paper: #15121c; --paper-2: #29233a; --card: #1d1927; --line: #342d47;
  --ink: #ece8f5; --muted: #a79fbb;
  --green: #0e8a94; --on-action: #fff;
  --green-deep: #3d2a63; --green-soft: #2e2547; --on-soft: #fff;
  --accent-bright: #f3effb; --halo: #241c33;
  --texture: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='44' height='44'%3E%3Cpath d='M22 1L43 22L22 43L1 22Z' fill='none' stroke='%23ffffff' stroke-opacity='.04'/%3E%3C/svg%3E");
}

/* ---------- Forêt : mousse, sapin et courbes de niveau ---------- */
[data-accent="foret"] {
  --paper: #f3f1e7; --paper-2: #e8e5d6; --card: #fdfcf6; --line: #dcd8c4;
  --ink: #1d2a1f; --muted: #5f6b5f;
  --green: #2f6b3a; --on-action: #fff;
  --green-deep: #1f3d27; --green-soft: #e3eddc; --on-soft: #1f3d27;
  --accent-bright: #b8dcae; --halo: #e6eedb;
  --header-bg: linear-gradient(180deg, #24472d, #16301c);
  /* Courbes de niveau, comme sur une carte de randonnée. */
  --texture: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cg fill='none' stroke='%231f3d27' stroke-opacity='.07'%3E%3Cpath d='M0 38c30-18 60 18 90 0s60-12 90 2'/%3E%3Cpath d='M0 92c36-22 66 22 100 0s50-10 80 6'/%3E%3Cpath d='M0 146c30-16 70 16 100-2s50-8 80 6'/%3E%3C/g%3E%3C/svg%3E");
}
:root[data-theme="dark"][data-accent="foret"], :root[data-theme="dark"] [data-accent="foret"] {
  --paper: #0f1510; --paper-2: #222c23; --card: #18201a; --line: #2c382d;
  --ink: #e4ebe0; --muted: #9aab98;
  --green: #3f8a4c; --on-action: #fff;
  --green-deep: #1f3d27; --green-soft: #243326; --on-soft: #eef6e9;
  --accent-bright: #c9e6bf; --halo: #17241a;
  --texture: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='.035'%3E%3Cpath d='M0 38c30-18 60 18 90 0s60-12 90 2'/%3E%3Cpath d='M0 92c36-22 66 22 100 0s50-10 80 6'/%3E%3Cpath d='M0 146c30-16 70 16 100-2s50-8 80 6'/%3E%3C/g%3E%3C/svg%3E");
}

/* ---------- Océan : bleu marine, sel et houle ---------- */
[data-accent="ocean"] {
  --paper: #eef4f6; --paper-2: #dfeaee; --card: #fbfdfe; --line: #d0dfe5;
  --ink: #102432; --muted: #52697a;
  --green: #0f6e8c; --on-action: #fff;
  --green-deep: #0d3048; --green-soft: #dbebf2; --on-soft: #0d3048;
  --accent-bright: #9fd8ec; --halo: #d9ecf3;
  --header-bg: linear-gradient(160deg, #0d3048, #0a4a63);
  /* Houle : des vagues régulières, à peine visibles. */
  --texture: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='28'%3E%3Cpath d='M0 14c10-9 20-9 30 0s20 9 30 0 20-9 20-9' fill='none' stroke='%230d3048' stroke-opacity='.08'/%3E%3C/svg%3E");
}
:root[data-theme="dark"][data-accent="ocean"], :root[data-theme="dark"] [data-accent="ocean"] {
  --paper: #08141c; --paper-2: #172a37; --card: #0f1f2a; --line: #203646;
  --ink: #e3eff5; --muted: #8fa8b8;
  --green: #1a8fb3; --on-action: #fff;
  --green-deep: #0d3048; --green-soft: #15303f; --on-soft: #e8f6fc;
  --accent-bright: #b6e4f3; --halo: #0e2432;
  --texture: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='28'%3E%3Cpath d='M0 14c10-9 20-9 30 0s20 9 30 0 20-9 20-9' fill='none' stroke='%23ffffff' stroke-opacity='.045'/%3E%3C/svg%3E");
}

/* ---------- Coucher de soleil : fin de journée d'été ---------- */
[data-accent="sunset"] {
  --paper: #fdf3ec; --paper-2: #f8e6da; --card: #fffaf6; --line: #f0d8c8;
  --ink: #2d1a14; --muted: #7a5b4f;
  --green: #c44d24; --on-action: #fff;
  --green-deep: #7a2944; --green-soft: #fbe0d2; --on-soft: #7a2944;
  --accent-bright: #ffb38a; --halo: #ffd9c2;
  /* Le ciel qui passe du bordeaux à l'or. */
  --header-bg: linear-gradient(90deg, #5b1f3c 0%, #a3334a 38%, #d8573a 72%, #eea24a 100%);
  --texture: none;
}
:root[data-theme="dark"][data-accent="sunset"], :root[data-theme="dark"] [data-accent="sunset"] {
  --paper: #1a0f10; --paper-2: #331d1f; --card: #251517; --line: #43272a;
  --ink: #f6e6df; --muted: #c0a098;
  --green: #e36a3c; --on-action: #fff;
  --green-deep: #5e1f36; --green-soft: #3a1f24; --on-soft: #ffe7dc;
  --accent-bright: #ffc7a8; --halo: #3a1716;
}

/* ---------- Néon : enseignes lumineuses, la nuit ---------- */
[data-accent="neon"] {
  --paper: #f4f2fb; --paper-2: #e9e5f7; --card: #fffeff; --line: #ddd7f0;
  --ink: #16122a; --muted: #5d5878;
  --green: #d6168b; --on-action: #fff;
  --green-deep: #1b1437; --green-soft: #fbe0f1; --on-soft: #7a0e52;
  --accent-bright: #3ce8ff; --halo: #f5dcf0;
  --header-bg: linear-gradient(180deg, #1b1437, #120d27);
  /* Un quadrillage fin, comme une vitrine la nuit. */
  --texture: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='30' height='30'%3E%3Cpath d='M30 0H0V30' fill='none' stroke='%23d6168b' stroke-opacity='.06'/%3E%3C/svg%3E");
  --glow: 0 0 14px rgba(214, 22, 139, .45);
  --font-display: "Hanken Grotesk", system-ui, sans-serif;
}
:root[data-theme="dark"][data-accent="neon"], :root[data-theme="dark"] [data-accent="neon"] {
  --paper: #0a0a14; --paper-2: #1b1b36; --card: #121226; --line: #2a2a52;
  --ink: #f1eeff; --muted: #a3a0c8;
  --green: #ff2fa6; --on-action: #fff;
  --green-deep: #120f2e; --green-soft: #221a44; --on-soft: #fff;
  --accent-bright: #3ce8ff; --halo: #2a0f3a;
  --texture: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='30' height='30'%3E%3Cpath d='M30 0H0V30' fill='none' stroke='%233ce8ff' stroke-opacity='.07'/%3E%3C/svg%3E");
  --glow: 0 0 16px rgba(255, 47, 166, .6);
}

/* ---------- Rose : poudre et bois de rose ---------- */
[data-accent="rose"] {
  --paper: #fbf3f4; --paper-2: #f4e4e7; --card: #fffafb; --line: #ecd6db;
  --ink: #2e1a20; --muted: #7c5d66;
  --green: #b0425f; --on-action: #fff;
  --green-deep: #6e2a3e; --green-soft: #f8e1e7; --on-soft: #6e2a3e;
  --accent-bright: #ffb6ca; --halo: #f8dde4;
  --header-bg: linear-gradient(160deg, #7a3048, #5a2233);
  /* Des pois fins, comme un papier peint ancien. */
  --texture: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22'%3E%3Ccircle cx='4' cy='4' r='1.3' fill='%236e2a3e' fill-opacity='.09'/%3E%3C/svg%3E");
}
:root[data-theme="dark"][data-accent="rose"], :root[data-theme="dark"] [data-accent="rose"] {
  --paper: #170f12; --paper-2: #2e1e24; --card: #22161b; --line: #3d2830;
  --ink: #f6e7ec; --muted: #c2a2ad;
  --green: #d0587a; --on-action: #fff;
  --green-deep: #5a2233; --green-soft: #3a2129; --on-soft: #ffe6ee;
  --accent-bright: #ffc3d3; --halo: #2e1219;
  --texture: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22'%3E%3Ccircle cx='4' cy='4' r='1.3' fill='%23ffffff' fill-opacity='.05'/%3E%3C/svg%3E");
}

/* ---------- Cyberpunk : jaune alerte, cyan et magenta ---------- */
[data-accent="cyberpunk"] {
  --paper: #f7f2cf; --paper-2: #efe8b4; --card: #fffbe3; --line: #2b2b22;
  --ink: #0a0a0a; --muted: #4a4a3a;
  --green: #0a0a0a; --on-action: #f3e600;
  --green-deep: #0a0a0a; --green-soft: #fff27a; --on-soft: #0a0a0a;
  --accent-bright: #00b8c4; --halo: #fff27a;
  --header-bg: #0a0a0a;
  --font-display: "Chakra Petch", "Hanken Grotesk", sans-serif;
  /* Lignes de balayage d'un vieil écran. */
  --texture: repeating-linear-gradient(0deg, rgba(10, 10, 10, .045) 0 1px, transparent 1px 4px);
}
:root[data-theme="dark"][data-accent="cyberpunk"], :root[data-theme="dark"] [data-accent="cyberpunk"] {
  --paper: #07080c; --paper-2: #171a24; --card: #0f1118; --line: #2a3044;
  --ink: #eafcff; --muted: #8b95a8;
  --green: #f3e600; --on-action: #000;
  --green-deep: #000; --green-soft: #1a1d2a; --on-soft: #00f0ff;
  --accent-bright: #00f0ff; --halo: #3a0a1e;
  --texture: repeating-linear-gradient(0deg, rgba(0, 240, 255, .05) 0 1px, transparent 1px 4px);
}

/* Ce qui n'est pas qu'une couleur : réservé à la page entière (:root), pour
   que les cartes d'aperçu restent des cartes. */
:root[data-accent="cyberpunk"] h1, :root[data-accent="cyberpunk"] h2,
:root[data-accent="cyberpunk"] .tuile-l, :root[data-accent="cyberpunk"] .brand {
  text-transform: uppercase; letter-spacing: .04em;
}
/* Titre « glitch » : deux fantômes, cyan et magenta. */
:root[data-accent="cyberpunk"] h1 { text-shadow: 2px 0 #ff2a6d, -2px 0 #00f0ff; }
:root[data-accent="cyberpunk"] .topbar { border-bottom: 5px solid transparent; border-image: repeating-linear-gradient(135deg, #f3e600 0 12px, #0a0a0a 12px 24px) 5; }
:root[data-accent="cyberpunk"] .brand { color: #f3e600; }
/* Angles coupés, comme un écran d'interface. */
:root[data-accent="cyberpunk"] button:not(.theme-carte), :root[data-accent="cyberpunk"] .btn-ajouter,
:root[data-accent="cyberpunk"] .btn-add {
  border-radius: 0; font-family: var(--font-display); text-transform: uppercase; letter-spacing: .05em;
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
}
:root[data-accent="cyberpunk"] .card, :root[data-accent="cyberpunk"] .tuile {
  border-radius: 0; clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 0 100%);
}
:root[data-accent="cyberpunk"] .card { border: 1px solid var(--line); border-left: 4px solid #00b8c4; }
:root[data-theme="dark"][data-accent="cyberpunk"] .card { border-left-color: #00f0ff; }
:root[data-accent="cyberpunk"] .tuile-prendre { background: #ff2a6d; color: #fff; border-color: #ff2a6d; }
:root[data-accent="cyberpunk"] .tuile-cours { background: #00f0ff; color: #000; border-color: #00f0ff; }
:root[data-theme="dark"][data-accent="cyberpunk"] .tuile-fait { border: 1px solid #ff2a6d; }
:root[data-accent="cyberpunk"] .btn-ajouter { background: #f3e600; color: #000; border-color: #f3e600; }

/* Néon : ce qui est actif s'allume. */
:root[data-accent="neon"] button:not(.secondary):not(.danger):not(.theme-carte),
:root[data-accent="neon"] .btn-ajouter, :root[data-accent="neon"] .tuile-faire { box-shadow: var(--glow); }
:root[data-accent="neon"] .topbar { box-shadow: 0 2px 0 #ff2fa6, 0 6px 22px rgba(255, 47, 166, .35); }
:root[data-theme="dark"][data-accent="neon"] h1 { text-shadow: 0 0 14px rgba(60, 232, 255, .55); }
:root[data-accent="neon"] h1, :root[data-accent="neon"] .tuile-n { font-weight: 800; letter-spacing: -.02em; }
/* Le second néon : cyan. */
:root[data-accent="neon"] .tuile-prendre { background: #d9fbff; color: #064652; border-color: #aef3fb; }
:root[data-theme="dark"][data-accent="neon"] .tuile-prendre { background: #3ce8ff; color: #07121a; border-color: #3ce8ff; box-shadow: 0 0 16px rgba(60, 232, 255, .5); }

/* Coucher de soleil : la tuile « À faire » prend le ciel. */
:root[data-accent="sunset"] .tuile-faire { background: linear-gradient(160deg, #e0663a 0%, #b53b45 60%, #7a2944 100%); }

/* Rose : des titres en italique, comme une carte d'invitation. */
:root[data-accent="rose"] h1 { font-style: italic; }

/* ---------- Moi › Apparence : une carte par thème, dans son propre thème ---------- */
.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .7rem; }
.theme-carte {
  display: flex; flex-direction: column; gap: .35rem; text-align: left; padding: .55rem .55rem .7rem;
  background: var(--card); color: var(--ink); border: 2px solid var(--line); border-radius: 14px;
  font-family: "Hanken Grotesk", system-ui, sans-serif; cursor: pointer; box-shadow: none;
}
.theme-carte:hover { filter: none; border-color: var(--green); }
.theme-carte[aria-pressed="true"] { border-color: var(--green); box-shadow: 0 0 0 2px var(--green); }
.theme-carte:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; }
.tc-ecran {
  display: block; height: 92px; border-radius: 9px; overflow: hidden; border: 1px solid var(--line);
  background-color: var(--paper); background-image: var(--texture), radial-gradient(160px 70px at 100% 0, var(--halo), transparent);
}
.tc-tete { display: block; height: 18px; background: var(--header-bg); }
.tc-corps { display: flex; flex-direction: column; gap: 6px; padding: 7px 8px; }
.tc-titre { font-family: var(--font-display); font-weight: 700; font-size: 1rem; line-height: 1; color: var(--ink); }
.tc-tuiles { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.tc-t1, .tc-t2 { display: block; height: 30px; border-radius: 6px; }
.tc-t1 { background: var(--green); }
.tc-t2 { background: var(--green-soft); }
.tc-nom { font-weight: 700; font-size: .95rem; }
.tc-mot { font-size: .78rem; color: var(--muted); line-height: 1.3; }
