/* the-root.org */
:root {
  --bg: #0a0e0a; --panel: #111811; --bar: #182118; --line: #233023;
  --fg: #b9f2ad; --dim: #66905f; --hi: #eaffe4; --acc: #7cf06a;
  --warn: #f2c94c; --err: #ff7a7a; --link: #8be9fd; --glow: rgba(124, 240, 106, .22);
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;

  /* human-mode paper */
  --paper: #fbfaf6; --ink: #1c1f1b; --muted: #61655e; --rule: #e4e1d8; --accent: #2e7d32; --chip: #eef3ea;
}
[data-theme="amber"] { --bg: #0f0b03; --panel: #171105; --bar: #221a08; --line: #33280e; --fg: #ffcf70; --dim: #9c7a3c; --hi: #fff2d1; --acc: #ffb000; --link: #ffe0a0; --glow: rgba(255, 176, 0, .22); }
[data-theme="mono"]  { --bg: #111; --panel: #171717; --bar: #1f1f1f; --line: #2c2c2c; --fg: #d8d8d8; --dim: #8a8a8a; --hi: #fff; --acc: #fff; --link: #9cd0ff; --glow: transparent; }
@media (prefers-color-scheme: dark) {
  :root { --paper: #121411; --ink: #e6e5de; --muted: #9da197; --rule: #262a24; --accent: #7cc46f; --chip: #1b2119; }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--fg);
  font: 15px/1.5 var(--mono);
  display: flex; flex-direction: column; height: 100dvh; overflow: hidden;
}
body::after {   /* CRT scanlines */
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 50;
  background: repeating-linear-gradient(to bottom, transparent 0 2px, rgba(0, 0, 0, .16) 2px 3px);
}
[data-theme="mono"] body::after, body.human::after { display: none; }
[hidden] { display: none !important; }

/* ── title bar ─────────────────────────────── */
.titlebar {
  flex: none; display: flex; align-items: center; gap: 12px;
  padding: 8px 16px; background: var(--bar); border-bottom: 1px solid var(--line);
  font-size: 13px; color: var(--dim); position: relative; z-index: 60;
}
.dots { display: flex; gap: 7px; }
.dots i { width: 12px; height: 12px; border-radius: 50%; background: #ff5f57; display: block; }
.dots i:nth-child(2) { background: #febc2e; }
.dots i:nth-child(3) { background: #28c840; }
.wtitle { flex: 1; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ctrl { display: flex; gap: 10px; align-items: center; }
.langs { display: flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.titlebar button {
  font: inherit; color: var(--dim); background: transparent; border: 0; cursor: pointer; padding: 3px 8px;
}
.langs button + button { border-left: 1px solid var(--line); }
.langs button[aria-pressed="true"] { color: var(--bg); background: var(--acc); }
.titlebar .sound { font-size: 16px; line-height: 1; padding: 3px 6px; position: relative; }
.titlebar .sound[aria-pressed="true"] { color: var(--acc); }
.titlebar .sound[aria-pressed="false"]::after { content: ''; position: absolute; left: 3px; right: 3px; top: 50%; border-top: 2px solid var(--err); transform: rotate(-35deg); }
.titlebar .mode { border: 1px solid var(--acc); color: var(--acc); border-radius: 6px; white-space: nowrap; }
.titlebar button:hover { color: var(--hi); }
.titlebar .mode:hover { background: var(--acc); color: var(--bg); }
.titlebar button:focus-visible, #chips button:focus-visible, .btn:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }

/* ── terminal ──────────────────────────────── */
#term {
  flex: 1; overflow-y: auto; overflow-x: hidden; padding: 16px 20px 24px;
  text-shadow: 0 0 6px var(--glow); cursor: text;
  scrollbar-color: var(--line) transparent;
}
.blk { white-space: pre-wrap; word-break: break-word; min-height: 1.5em; }
.blk + .blk { margin-top: 2px; }
.blk.echo { margin-top: 10px; color: var(--hi); }
.nowrap, .man, .vim { white-space: pre; overflow-x: auto; word-break: normal; }
.ps1 { color: var(--acc); }
.ok, .acc { color: var(--acc); }
.warn { color: var(--warn); }
.err { color: var(--err); }
.dim { color: var(--dim); }
.hi, b { color: var(--hi); font-weight: 700; }
.inv { background: var(--acc); color: var(--bg); text-shadow: none; }
.big { font-size: 1.6em; font-weight: 700; color: var(--hi); line-height: 1.3; }
.card { border-left: 3px solid var(--acc); padding: 4px 0 4px 14px; margin: 8px 0; }
.tag { color: var(--link); }
#term a { color: var(--link); text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 3px; }
#term a.cmd { color: var(--hi); text-decoration-style: solid; text-decoration-color: var(--dim); }
#term a.cmd.dir { color: var(--link); }
#term a:hover { color: var(--bg); background: var(--acc); text-decoration: none; text-shadow: none; }
.man u { text-decoration: underline; }
.skiphint { position: sticky; top: 0; text-align: right; }

.prompt { display: flex; gap: .6ch; align-items: baseline; margin-top: 10px; }
#ps1 { color: var(--acc); white-space: nowrap; }
#cmd {
  flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; padding: 0;
  color: var(--hi); font: inherit; caret-color: var(--acc); text-shadow: inherit;
}

.neofetch { display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: flex-start; }
.neofetch pre { margin: 0; font: inherit; white-space: pre; }
.neofetch .art { color: var(--acc); }
.sw { display: inline-block; }
.s1 { background: #ff5f57; } .s2 { background: #febc2e; } .s3 { background: #28c840; }
.s4 { background: #8be9fd; } .s5 { background: #bd93f9; } .s6 { background: #f8f8f2; }

.trainbox { overflow: hidden; }
.train { margin: 0; font: inherit; color: var(--hi); white-space: pre; display: inline-block; animation: train 5.5s linear forwards; }
@keyframes train { from { transform: translateX(100vw); } to { transform: translateX(-110%); } }

body.panic #term { animation: panic .12s steps(2) infinite; filter: hue-rotate(250deg) saturate(3); }
@keyframes panic { 50% { transform: translate(3px, -2px); } }

/* ── quick-command chips ───────────────────── */
#chips {
  flex: none; display: flex; gap: 8px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: var(--panel); border-top: 1px solid var(--line);
  overflow-x: auto; scrollbar-width: none;
}
#chips::-webkit-scrollbar { display: none; }
#chips button {
  flex: none; font: 13px var(--mono); color: var(--fg); background: transparent;
  border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; cursor: pointer;
}
#chips button:hover { border-color: var(--acc); color: var(--hi); }

/* ── human mode ────────────────────────────── */
body.human { display: block; height: auto; overflow: auto; background: var(--paper); }
body.human .titlebar { position: sticky; top: 0; }
#cv { scroll-margin-top: 60px; }
#cv {
  max-width: 880px; margin: 0 auto; padding: 40px 24px 64px;
  color: var(--ink); font: 16px/1.6 var(--sans);
}
#cv a { color: var(--accent); text-underline-offset: 3px; }
#cv h1 { font: 700 clamp(2rem, 6vw, 2.8rem)/1.1 var(--mono); margin: 4px 0 8px; letter-spacing: -.02em; }
#cv h2 {
  font: 700 .85rem var(--mono); text-transform: uppercase; letter-spacing: .12em; color: var(--accent);
  margin: 44px 0 16px; padding-bottom: 8px; border-bottom: 1px solid var(--rule);
}
#cv h2::before { content: '## '; color: var(--muted); }
#cv h3 { font-size: 1.02rem; font-weight: 600; margin: 0; line-height: 1.35; }
#cv p { margin: 6px 0; }
.cv-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px 32px; align-items: flex-end; }
.prompt-mini { font: .85rem var(--mono); color: var(--muted); margin: 0 !important; }
.role { font-size: 1.15rem; font-weight: 500; }
.at, .where, .sub { color: var(--muted); }
.where { font-size: .92rem; }
.contacts { list-style: none; margin: 0; padding: 0; text-align: right; font: .9rem/1.9 var(--mono); }
.btn {
  font: .85rem var(--mono); color: var(--ink); background: var(--chip); cursor: pointer;
  border: 1px solid var(--rule); border-radius: 6px; padding: 5px 12px;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline > li { display: grid; grid-template-columns: 10.5rem 1fr; gap: 4px 24px; padding: 14px 0; border-top: 1px dashed var(--rule); }
.timeline > li:first-child { border-top: 0; padding-top: 0; }
.timeline.compact > li { padding: 10px 0; }
.when { font: .82rem/1.5 var(--mono); color: var(--muted); padding-top: 2px; }
.when span { display: block; opacity: .8; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px !important; }
.tags span { font: .75rem var(--mono); background: var(--chip); border: 1px solid var(--rule); border-radius: 4px; padding: 1px 7px; }

.skills { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px 28px; }
.skill .tags { margin-top: 6px !important; }
.certs, .plain { list-style: none; margin: 0; padding: 0; }
.certs li { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 9px 0; border-top: 1px dashed var(--rule); }
.certs li:first-child { border-top: 0; }
.certs .sub, .plain .sub { display: block; font-size: .88rem; }
.badge { font: .72rem var(--mono); text-transform: uppercase; letter-spacing: .06em; padding: 2px 8px; border-radius: 4px; border: 1px solid currentColor; white-space: nowrap; }
.badge.active { color: var(--accent); }
.badge.expired, .badge.course { color: var(--muted); }
.plain li { padding: 6px 0; }
.two { display: grid; grid-template-columns: 1fr 2fr; gap: 0 40px; }
.cv-foot { margin-top: 56px; padding-top: 20px; border-top: 1px solid var(--rule); color: var(--muted); display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.printonly { display: none; }
.noscript { padding: 24px; }

/* ── small screens ─────────────────────────── */
@media (max-width: 640px) {
  body { font-size: 13px; }
  .titlebar { padding: 8px 12px; gap: 8px; }
  .dots, .wtitle { display: none; }
  .ctrl { width: 100%; justify-content: space-between; }
  #term { padding: 12px 16px 20px; }
  #cv { padding: 28px 16px 48px; font-size: 15px; }
  .contacts { text-align: left; }
  .timeline > li { grid-template-columns: 1fr; }
  .two { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .train { animation: none; transform: none; }
  body.panic #term { animation: none; }
}

/* ── print: always the human CV ────────────── */
@media print {
  @page { margin: 14mm; }
  body, body.human { display: block; height: auto; overflow: visible; background: #fff; }
  body::after, .titlebar, #term, #chips, .noprint { display: none !important; }
  #cv { display: block !important; color: #000; max-width: none; padding: 0; font-size: 10.5pt;
    --ink: #000; --muted: #555; --rule: #ccc; --accent: #1b5e20; --chip: #f2f2f2; }
  #cv h2 { margin-top: 22px; break-after: avoid; }
  .timeline > li, .certs li { break-inside: avoid; }
  #cv a { color: #000; text-decoration: none; }
  .printonly { display: block; }
}
