/* ============================================================
   Thèmes
   ============================================================ */
:root, [data-theme="vert"] { --accent: #5ef2a0; --accent-rgb: 94, 242, 160; }
[data-theme="cyan"]   { --accent: #5ccfe6; --accent-rgb: 92, 207, 230; }
[data-theme="ambre"]  { --accent: #ffb454; --accent-rgb: 255, 180, 84; }
[data-theme="violet"] { --accent: #c3a6ff; --accent-rgb: 195, 166, 255; }
[data-theme="rose"]   { --accent: #ff7eb6; --accent-rgb: 255, 126, 182; }

:root {
  --bg: #0a0e14;
  --bg-2: #0d121a;
  --panel: #0f1620;
  --panel-2: #131b27;
  --line: #1d2735;
  --line-2: #273447;
  --text: #cdd6e4;
  --muted: #74839a;
  --dim: #56657b;
  --on-accent: #06120c;

  /* coloration syntaxique */
  --sx-key: #c792ea;
  --sx-str: #c3e88d;
  --sx-num: #f78c6c;
  --sx-prop: #82aaff;
  --sx-fn: #ffcb6b;
  --sx-com: #5c6f86;
  --sx-err: #ff6e6e;

  --mono: "JetBrains Mono", "Fira Code", "FiraCode Nerd Font", "Cascadia Code", ui-monospace, Menlo, Consolas, "DejaVu Sans Mono", monospace;
  --radius: 10px;
  --max: 1100px;
  --sb-h: 26px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 70px; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  padding-bottom: var(--sb-h);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
[hidden] { display: none !important; }
::selection { background: rgba(var(--accent-rgb), .3); }
.acc { color: var(--accent); }
.c { color: var(--sx-com); }
kbd {
  font: inherit; font-size: .9em; padding: 1px 7px; border-radius: 5px;
  border: 1px solid var(--line-2); border-bottom-width: 2px; background: var(--panel-2); color: var(--accent);
}

#bg {
  position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: -1;
  opacity: .16; pointer-events: none; transition: opacity .6s;
}
#bg.off { opacity: 0; }
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(1000px 600px at 80% -10%, rgba(var(--accent-rgb), .09), transparent 60%),
    radial-gradient(700px 500px at -10% 110%, rgba(130, 170, 255, .06), transparent 60%);
}

.skip {
  position: absolute; left: -9999px; top: 8px; z-index: 50;
  background: var(--accent); color: var(--on-accent); padding: 6px 12px; border-radius: 6px;
}
.skip:focus { left: 8px; }

/* ============================================================
   Barre du haut (onglets)
   ============================================================ */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: stretch; gap: 18px;
  padding: 0 max(16px, calc((100vw - var(--max)) / 2));
  background: rgba(10, 14, 20, .86);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); font-weight: 700; white-space: nowrap; padding: 12px 0; }
.brand:hover { text-decoration: none; }
.dots { display: inline-flex; gap: 6px; }
.dots i { width: 11px; height: 11px; border-radius: 50%; background: #ff5f57; }
.dots i:nth-child(2) { background: #febc2e; }
.dots i:nth-child(3) { background: #28c840; }

.tabs { display: flex; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  display: flex; align-items: center; gap: 8px; padding: 0 16px;
  color: var(--muted); font-size: .86rem; white-space: nowrap;
  border-left: 1px solid transparent; border-right: 1px solid transparent;
  border-top: 2px solid transparent;
  transition: color .15s, background .15s;
}
.tabs a:hover { color: var(--text); text-decoration: none; background: rgba(255, 255, 255, .02); }
.tabs a.active {
  color: var(--text); background: var(--bg);
  border-left-color: var(--line); border-right-color: var(--line); border-top-color: var(--accent);
}
.ico { font-size: .72rem; font-weight: 700; color: var(--accent); }
.ico.js { color: #f1e05a; }
.ico.dir { color: var(--sx-prop); }
.ico.json { color: var(--sx-fn); }
.ico.sh { color: #89e051; }

/* ============================================================
   Mise en page
   ============================================================ */
main { max-width: var(--max); margin: 0 auto; padding: 0 20px; }
.block { padding: 72px 0 24px; }
h2 { font-size: 1.15rem; font-weight: 600; margin: 0 0 26px; }
h2::after {
  content: ""; display: block; height: 1px; margin-top: 14px;
  background: linear-gradient(90deg, rgba(var(--accent-rgb), .5), var(--line) 30%, transparent);
}
.reveal.pre { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
.reveal.pre.in { opacity: 1; transform: none; }

/* ============================================================
   Accueil
   ============================================================ */
.hero { padding: 56px 0 8px; min-height: calc(100vh - 60px - var(--sb-h)); display: flex; flex-direction: column; }
.intro { margin-bottom: 26px; }
.intro .c { margin: 0 0 6px; font-size: .9rem; }
h1 {
  font-size: clamp(2.6rem, 8vw, 5rem); line-height: 1.02; margin: 0 0 10px; letter-spacing: -.04em;
  overflow-wrap: anywhere;
  background: linear-gradient(100deg, var(--text) 30%, var(--accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.caret {
  display: inline-block; width: .5em; height: .82em; margin-left: .08em; vertical-align: -.04em;
  background: var(--accent); animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
.tagline { color: var(--text); font-size: 1.12rem; margin: 0 0 6px; }
.hint { color: var(--muted); margin: 0; font-size: .92rem; }

/* fenêtres (terminal, éditeur) */
.term, .editor {
  background: rgba(13, 18, 26, .92);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .85), 0 0 0 1px rgba(var(--accent-rgb), .04);
  overflow: hidden; min-width: 0;
}
.term { box-shadow: 0 30px 90px -30px rgba(0, 0, 0, .9), 0 0 60px -30px rgba(var(--accent-rgb), .35); }
.win-bar {
  display: flex; align-items: center; gap: 12px; padding: 9px 14px;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.win-title { margin: 0 auto; color: var(--muted); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.win-tag { font-size: .7rem; color: var(--dim); border: 1px solid var(--line-2); border-radius: 4px; padding: 0 6px; }

/* ---------- Terminal ---------- */
.term { display: flex; flex-direction: column; flex: 1; min-height: 360px; max-height: 640px; height: 62vh; }
.term-body {
  flex: 1; overflow-y: auto; padding: 16px 18px 12px; cursor: text;
  font-size: 14px; line-height: 1.55;
  scrollbar-width: thin; scrollbar-color: var(--line-2) transparent;
}
.term-body::-webkit-scrollbar { width: 8px; }
.term-body::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 8px; }
.t-row { white-space: pre-wrap; overflow-wrap: anywhere; min-height: 1.55em; }
.t-row.t-pre { white-space: pre; overflow-wrap: normal; }
.t-echo { margin-top: 6px; }
.t-banner {
  color: var(--accent); white-space: pre; line-height: 1.05; font-size: 16px;
  margin: 4px 0 12px; text-shadow: 0 0 18px rgba(var(--accent-rgb), .45);
  overflow-x: auto; scrollbar-width: none;
}
.t-user { color: var(--accent); font-weight: 700; }
.t-path { color: var(--sx-prop); font-weight: 700; }
.t-dim { color: var(--muted); }
.t-acc { color: var(--accent); }
.t-bold { font-weight: 700; }
.t-err { color: var(--sx-err); }
.t-warn { color: var(--sx-fn); }
.t-head { color: var(--sx-fn); font-weight: 700; margin-top: 4px; }
.t-kw { color: var(--sx-key); }
.t-key { color: var(--sx-prop); }
.t-str { color: var(--sx-str); }
.t-dir { color: var(--sx-prop); font-weight: 700; }
.t-exe { color: var(--accent); font-weight: 700; }
.t-cmdline { color: var(--text); }
.t-row a { color: var(--sx-str); text-decoration: underline; text-decoration-color: rgba(195, 232, 141, .35); text-underline-offset: 3px; }
.t-link {
  font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer;
  text-decoration: underline dotted; text-decoration-color: rgba(205, 214, 228, .3); text-underline-offset: 3px;
}
.t-link:hover { background: rgba(var(--accent-rgb), .12); text-decoration-color: currentColor; }
.t-swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; }
[data-theme-swatch="vert"] { background: #5ef2a0; }
[data-theme-swatch="cyan"] { background: #5ccfe6; }
[data-theme-swatch="ambre"] { background: #ffb454; }
[data-theme-swatch="violet"] { background: #c3a6ff; }
[data-theme-swatch="rose"] { background: #ff7eb6; }
.t-swatches { display: inline-flex; gap: 0; }
.t-swatches i { width: 22px; height: 14px; }
.sw-red { background: var(--sx-err); } .sw-yellow { background: var(--sx-fn); } .sw-green { background: var(--sx-str); }
.sw-cyan { background: #89ddff; } .sw-blue { background: var(--sx-prop); } .sw-purple { background: var(--sx-key); }
.sw-fg { background: var(--text); }

.term-line { display: flex; align-items: baseline; margin-top: 6px; }
.t-prompt { white-space: pre; flex: none; }
.term-input {
  flex: 1; min-width: 0; background: transparent; border: 0; outline: none; padding: 0;
  color: var(--text); font: inherit; font-size: 16px; caret-color: var(--accent);
}
.term-input:focus-visible { outline: none; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chip {
  font: inherit; font-size: .82rem; cursor: pointer;
  padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line-2);
  background: rgba(15, 22, 32, .8); color: var(--muted); transition: all .15s;
}
.chip::before { content: "$ "; color: var(--dim); }
#filters .chip::before { content: none; }
.chip:hover { color: var(--text); border-color: rgba(var(--accent-rgb), .6); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 700; }

/* ============================================================
   Code (about.js, skills.json, contact.sh)
   ============================================================ */
.code {
  margin: 0; padding: 16px 0; overflow-x: auto; font-size: .9rem; line-height: 1.75;
  counter-reset: ln; font-family: var(--mono);
}
.code .ln { display: block; padding: 0 18px 0 0; white-space: pre; }
.code .ln::before {
  counter-increment: ln; content: counter(ln);
  display: inline-block; width: 3.2em; padding-right: 1.2em; margin-right: .6em; text-align: right;
  color: var(--dim); border-right: 1px solid var(--line); user-select: none;
}
.code .ln:hover { background: rgba(255, 255, 255, .025); }
.code .k { color: var(--sx-key); }
.code .s { color: var(--sx-str); }
.code .n { color: var(--sx-num); }
.code .p { color: var(--sx-prop); }
.code .f { color: var(--sx-fn); }
.code .c { color: var(--sx-com); font-style: italic; }
.code .v { color: var(--accent); }
.code .o { color: #89ddff; }
.code a.s:hover { text-decoration: underline; }

.about-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 28px; align-items: start; }
.avatar-box { margin: 0; text-align: center; }
.avatar-box img {
  display: block; width: 180px; height: 180px; border-radius: 14px; object-fit: cover;
  border: 1px solid var(--line-2); box-shadow: 0 0 0 4px rgba(var(--accent-rgb), .08), 0 20px 50px -20px #000;
}
.avatar-box figcaption { margin-top: 10px; color: var(--muted); font-size: .85rem; }
.editor.narrow { max-width: 760px; }

/* ============================================================
   Projets
   ============================================================ */
.toolbar { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.search {
  display: flex; align-items: center; gap: 10px; flex: 1 1 280px; max-width: 440px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px;
  transition: border-color .15s;
}
.search:focus-within { border-color: var(--accent); }
.search input { flex: 1; min-width: 0; background: none; border: 0; color: var(--text); font: inherit; outline: none; }
.search input::placeholder { color: var(--dim); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }

.status { color: var(--muted); margin: 0 0 16px; min-height: 1.6em; font-size: .9rem; }
.status.error { color: var(--sx-fn); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.card {
  position: relative; display: flex; flex-direction: column; gap: 10px;
  background: rgba(15, 22, 32, .9); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; min-width: 0; overflow: hidden;
  transition: border-color .2s, transform .2s, box-shadow .2s;
}
.card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent); opacity: 0; transition: opacity .2s;
}
.card:hover { border-color: rgba(var(--accent-rgb), .45); transform: translateY(-3px); box-shadow: 0 18px 40px -22px rgba(var(--accent-rgb), .5); }
.card:hover::before, .card.featured::before { opacity: 1; }
.perms { margin: 0; font-size: .72rem; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card h3 { margin: 0; font-size: 1.05rem; overflow-wrap: anywhere; }
.card h3 a { color: var(--sx-prop); }
.card h3 a:hover { color: var(--accent); }
.desc { margin: 0; color: var(--text); opacity: .85; font-size: .9rem; flex: 1; }
.desc.empty { color: var(--sx-com); font-style: italic; opacity: 1; }
.badges, .tags, .meta, .actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.badge { font-size: .7rem; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--muted); }
.badge.hot { color: var(--accent); border-color: rgba(var(--accent-rgb), .5); }
.tag { font-size: .74rem; color: var(--accent); background: rgba(var(--accent-rgb), .08); padding: 1px 8px; border-radius: 4px; }
.meta { color: var(--muted); font-size: .8rem; gap: 14px; }
.lang { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.actions { font-size: .84rem; gap: 14px; padding-top: 10px; border-top: 1px dashed var(--line-2); }
.linkish {
  font: inherit; background: none; border: 0; padding: 0; cursor: pointer; color: var(--muted);
}
.linkish:hover { color: var(--accent); }
.linkish.done { color: var(--accent); }

/* ============================================================
   Contact
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 18px;
  font: inherit; font-size: .9rem; cursor: pointer;
  padding: 9px 16px; border-radius: 8px; border: 1px solid var(--line-2);
  background: var(--panel); color: var(--text); transition: border-color .15s, transform .15s;
}
.btn:hover { border-color: var(--accent); transform: translateY(-1px); }

/* ============================================================
   Barre d'état
   ============================================================ */
.statusbar {
  position: fixed; inset: auto 0 0 0; z-index: 20; height: var(--sb-h);
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 10px; font-size: .74rem; color: var(--on-accent);
  background: var(--accent);
  transition: background .3s;
}
.sb-left, .sb-right { display: flex; align-items: center; gap: 2px; min-width: 0; }
.sb-item { padding: 0 8px; white-space: nowrap; font-weight: 600; }
.sb-branch { font-weight: 700; }
.sb-ico { margin-left: 4px; cursor: pointer; flex: none; transform-origin: 50% 100%; }
.sb-ico path:first-child { fill: #c9a2dd; stroke: rgba(6, 18, 12, .45); stroke-width: .6; }
.sb-ico circle { fill: #2a1b31; }
.sb-ico path:last-child { stroke: #2a1b31; fill: none; }
.sb-ico:hover { animation: wobble .6s ease-in-out; }
.sb-ico.morph { animation: shift 2.4s ease-in-out; }
@keyframes wobble {
  0%, 100% { transform: scale(1, 1); }
  30% { transform: scale(1.18, .82); }
  60% { transform: scale(.9, 1.12); }
}
@keyframes shift {
  0% { transform: scale(1); }
  15% { transform: scale(1.35, .6); }
  30% { transform: scale(.7, 1.4) rotate(-8deg); filter: hue-rotate(160deg); }
  50% { transform: scale(1.5) rotate(6deg); filter: hue-rotate(260deg); }
  75% { transform: scale(.85, 1.15); filter: hue-rotate(40deg); }
  100% { transform: scale(1); }
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 860px) {
  .about-grid { grid-template-columns: 1fr; }
  .avatar-box { order: -1; text-align: left; display: flex; align-items: center; gap: 14px; }
  .avatar-box img { width: 72px; height: 72px; }
  .avatar-box figcaption { margin: 0; }
}
@media (max-width: 720px) {
  .topbar { gap: 8px; }
  .brand-name { display: none; }
  .tabs a { padding: 0 11px; font-size: .8rem; }
  .tabs .ico { display: none; }
  .hero { padding-top: 32px; min-height: 0; }
  .term { height: 68vh; min-height: 340px; }
  .term-body { padding: 12px 12px 10px; font-size: 13px; }
  .t-banner { font-size: 12px; }
  .code { font-size: .8rem; }
  .code .ln::before { width: 2.4em; padding-right: .8em; }
  .grid { grid-template-columns: 1fr; }
  .sb-hide-sm { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before { animation: none !important; transition: none !important; }
}
