:root {
  --wall:      #0b0d12;
  --pane:      #12151c;
  --pane-hi:   #181c26;
  --border:    #252a36;
  --text:      #c0caf5;
  --muted:     #6b7394;
  --dim:       #3b4261;

  --accent:    #d4814f;           /* matte orange */
  --green:     #9ece6a;
  --yellow:    #e0af68;
  --magenta:   #bb9af7;
  --cyan:      #7dcfff;
  --red:       #f7768e;

  --gap:       10px;          /* gaps inner */
  --outer:     12px;          /* gaps outer */
  --bw:        2px;           /* border width */
  --bar-h:     30px;
  --radius:    12px;          /* window corners (JankyBorders-style); 0 for i3 purists */
  --radius-sm: 7px;           /* buttons, photo, small bits */

  --font: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font: 14px/1.6 var(--font);
  color: var(--text);
  background: var(--wall);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}
body.has-fullscreen { overflow: hidden; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
strong { color: var(--text); }
.accent, .c-accent { color: var(--accent); }
.ok { color: var(--green); }

:focus-visible { outline: 1px dashed var(--accent); outline-offset: 2px; }

kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 0 .35em;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  font: inherit;
  font-size: .85em;
  line-height: 1.5;
  text-align: center;
  color: var(--text);
  background: var(--pane-hi);
}

/* ─── bars (i3bar / i3status) ───────────────────────────────────────── */
.bar {
  position: sticky;
  z-index: 45;                    /* above a fullscreen pane */
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--bar-h);
  padding: 0 var(--outer);
  font-size: 12px;
  background: var(--wall);
}
.bar--top { top: 0; }
.bar--bottom { bottom: 0; }

.bar__ws { display: flex; gap: 4px; }
.ws {
  padding: 1px 8px;
  border-radius: var(--radius-sm);
  color: var(--muted);
}
.ws:hover { color: var(--text); text-decoration: none; }
.ws.is-active { color: var(--wall); background: var(--accent); font-weight: 700; }

.bar__title {
  flex: 1;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
}
.bar__right { display: flex; align-items: center; gap: 12px; }
.bar__launch {
  padding: 1px 8px;
  font: inherit;
  color: var(--muted);
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.bar__launch:hover { color: var(--text); border-color: var(--accent); }
.bar__launch span { color: var(--accent); }
.bar__mode { color: var(--magenta); }

.status { display: flex; margin: 0; padding: 0; list-style: none; }
.status--right { margin-left: auto; }
.status__seg { padding: 0 10px; border-left: 1px solid var(--border); }
.status--left .status__seg { padding-left: 0; border-left: 0; }
.status__seg a { color: var(--text); }
.status__seg--mode { color: var(--accent); }
.status__seg--dim { color: var(--muted); }

/* ─── workspaces + tiling ───────────────────────────────────────────── */
.workspace {
  height: calc(100svh - var(--bar-h) * 2);
  min-height: 520px;
  padding: var(--outer);
  scroll-margin-top: var(--bar-h);
}
.workspace + .workspace { padding-top: 0; }

.tiles {
  display: grid;
  gap: var(--gap);
  height: 100%;
  min-width: 0;
}

/* ┌──────────┬─────┐
   │          │  2  │
   │    1     ├─────┤
   │          │  3  │
   └──────────┴─────┘ */
.tiles--hero,
.tiles--about {
  grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr);
  grid-template-rows: auto 1fr;
}
.tiles--hero  > :first-child { grid-row: 1 / span 2; }

/* about: about.md is the big pane, career sits top-right, stack.toml fills the rest
   ┌──────────┬────────┐
   │          │ career │
   │  about   ├────────┤
   │          │ stack  │
   └──────────┴────────┘ */
.tiles--about { grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr); }
.tiles--about > .pane--about { grid-column: 1; grid-row: 1 / span 2; }
.tiles--about > .pane--log   { grid-column: 2; grid-row: 1; }
.tiles--about > .pane--stack { grid-column: 2; grid-row: 2; }

/* grid: first (newest) pane spans two rows */
.tiles--grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: minmax(0, 1fr);
}
.tiles--grid > :first-child { grid-row: span 2; }

/* ┌──────────┬─────┐
   │    1     │  2  │
   └──────────┴─────┘ */
.tiles--split { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }

/* ─── pane (window) ─────────────────────────────────────────────────── */
.pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--pane);
  border: var(--bw) solid var(--border);
  border-radius: var(--radius);
  transition: border-color .15s;
}
.pane:focus, .pane:focus-visible { outline: none; }

.pane__title {
  flex: none;
  padding: 4px 14px;
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

.pane__body {
  flex: 1;
  padding: 18px 20px;
  overflow: auto;
}

.pane.is-focused { border-color: var(--accent); }
.pane.is-focused .pane__title { color: var(--text); }

/* ─── prompt ────────────────────────────────────────────────────────── */
.prompt { margin: 0 0 12px; color: var(--muted); }
.prompt__user { color: var(--green); }
.prompt__host { color: var(--cyan); }
.prompt__path { color: var(--magenta); }
.prompt__sym  { color: var(--accent); }
.typed { color: var(--text); }
.cursor {
  display: inline-block;
  width: .6em; height: 1.15em;
  margin-left: 2px;
  vertical-align: text-bottom;
  background: var(--accent);
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ─── hero ──────────────────────────────────────────────────────────── */
.hero {
  display: flex;
  flex-direction: column;
  padding: clamp(18px, 3.5vw, 44px);
}
.hero__reveal {
  margin-top: auto;
  margin-bottom: auto;
  transition: opacity .5s ease, transform .5s ease;
}
.js .hero__reveal:not(.is-shown) { opacity: 0; transform: translateY(8px); }

.hero__name {
  margin: 0 0 .35em;
  font-size: clamp(2.8rem, 8.5vw, 7.25rem);
  font-weight: 800;
  line-height: .92;
  letter-spacing: -.04em;
}
.hero__role {
  margin: 0 0 2rem;
  font-size: clamp(1rem, 1.5vw, 1.2rem);
  color: var(--muted);
}

.hero__cta { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 2rem; padding: 0; list-style: none; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: var(--pane-hi);
  transition: border-color .15s;
}
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn--primary { color: var(--wall); background: var(--accent); border-color: var(--accent); font-weight: 700; }
.btn--primary kbd { color: var(--wall); background: color-mix(in srgb, var(--wall) 15%, transparent); border-color: color-mix(in srgb, var(--wall) 35%, transparent); }
.hero__hint { margin: 0; font-size: 12px; color: var(--muted); }

/* ─── fetch ──────────────────────────────────────────────────────────── */
.fetch {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "info photo" "swatches photo";
  gap: 4px 22px;
  align-items: start;
}
.fetch__photo {
  grid-area: photo;
  display: block;
  width: clamp(140px, 16vw, 220px);
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  filter: saturate(.9) contrast(1.05);
  transition: filter .2s, border-color .2s;
}
.pane.is-focused .fetch__photo { filter: none; border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }
.fetch__info { grid-area: info; margin: 0; }
.fetch__info > div { display: flex; gap: 8px; }
.fetch__info dt { color: var(--accent); font-weight: 700; min-width: 6ch; }
.fetch__info dt::after { content: ":"; color: var(--muted); }
.fetch__info dd { margin: 0; }
.fetch__head { font-weight: 700; }
.fetch__rule { color: var(--dim); }
.fetch__swatches { grid-area: swatches; display: flex; margin-top: 10px; border-radius: 4px; overflow: hidden; width: max-content; }
.fetch__swatches span { width: 22px; height: 12px; }
.fetch__swatches span:nth-child(1) { background: var(--wall); }
.fetch__swatches span:nth-child(2) { background: var(--red); }
.fetch__swatches span:nth-child(3) { background: var(--green); }
.fetch__swatches span:nth-child(4) { background: var(--yellow); }
.fetch__swatches span:nth-child(5) { background: var(--accent); }
.fetch__swatches span:nth-child(6) { background: var(--magenta); }
.fetch__swatches span:nth-child(7) { background: var(--cyan); }
.fetch__swatches span:nth-child(8) { background: var(--text); }

/* ─── certs ──────────────────────────────────────────────────────────── */
.certs { display: flex; flex-direction: column; }
.certs__list { margin: 0; padding: 0; list-style: none; }
.cert {
  display: grid;
  grid-template-columns: 6.5ch 5.5ch minmax(0, 1fr);
  gap: 1.5ch;
  align-items: baseline;
  padding: 5px 0;
  border-bottom: 1px dashed var(--border);
}
.cert:last-child { border-bottom: 0; }
.cert__tag {
  --tag: var(--muted);
  font-size: 11px;
  text-align: center;
  color: var(--tag);
  border: 1px solid color-mix(in srgb, var(--tag) 45%, transparent);
  background: color-mix(in srgb, var(--tag) 12%, transparent);
  border-radius: 4px;
}
.cert--k8s .cert__tag { --tag: var(--cyan); }
.cert--aws .cert__tag { --tag: var(--yellow); }
.cert--gcp .cert__tag { --tag: var(--green); }
.cert--redhat .cert__tag { --tag: var(--red); }
.cert--zabbix .cert__tag { --tag: var(--magenta); }
.cert__code { font-weight: 700; color: var(--text); }
.cert__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.certs__total { margin: auto 0 0; padding-top: 12px; font-size: 12px; color: var(--muted); }

/* ─── about ──────────────────────────────────────────────────────────── */
.about { padding: clamp(18px, 3vw, 36px); max-width: none; }
.about > p, .about__list { max-width: 64ch; }
.pane.is-fullscreen .about > p, .pane.is-fullscreen .about__list { max-width: none; }
.about__h { margin: 1.4em 0 .5em; font-size: 1rem; color: var(--accent); }
.about__h:first-of-type { margin-top: .5em; }
.md-h { color: var(--magenta); }
.about__list { margin: 0; padding: 0; list-style: none; }
.md-b { color: var(--accent); }

/* ─── code (stack.toml) ──────────────────────────────────────────────── */
.code pre { margin: 0; font: inherit; font-size: 13px; line-height: 1.7; }
.t-com { color: var(--muted); font-style: italic; }
.t-sec { color: var(--magenta); }
.t-key { color: var(--cyan); }
.t-str { color: var(--green); }
/* Tiled: clamped with a fade when it outgrows its pane; fullscreen (f) shows all of it. */
.stack__toml { max-height: 20lh; overflow: auto hidden; }  /* long lines scroll sideways on narrow panes */
.stack__toml.is-clamped { mask-image: linear-gradient(to bottom, #000 calc(100% - 2lh), transparent); }
.pane.is-fullscreen .stack__toml { max-height: none; }
.stack__toml + .project__more { margin: .5rem 0 0; }

/* ─── log ────────────────────────────────────────────────────────────── */
.log { margin: 0; padding: 0; list-style: none; font-size: 13px; }
.log li { padding: 2px 0; }
.log__lvl { display: inline-block; width: 5ch; color: var(--muted); font-weight: 700; }
.log__lvl--run { color: var(--green); }

/* ─── projects ───────────────────────────────────────────────────────── */
.project__name {
  margin: .2rem 0 .5rem;
  font-size: clamp(1.15rem, 1.9vw, 1.5rem);
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--accent);
}
.project .pane__body { padding: 8px 10px; }
.project__desc { margin: 0 0 .75rem; }
/* Tiled: description is clamped with a fade; fullscreen (f) shows all of it. */
.project__about { max-height: 6lh; overflow: hidden; margin: 0 0 .75rem; }
.project__about > :last-child { margin-bottom: 0; }
.project__about.is-clamped { mask-image: linear-gradient(to bottom, #000 calc(100% - 2lh), transparent); }
.tiles--grid > .project:first-child .project__about,
.pane.is-fullscreen .project__about { max-height: none; }
.project__more {
  margin: -.25rem 0 .75rem;
  padding: 0;
  font: inherit;
  font-size: 12px;
  color: var(--accent);
  background: none;
  border: 0;
  cursor: pointer;
}
.project__more[hidden] { display: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 1rem; padding: 0; list-style: none; }
.chips li {
  padding: 0 8px;
  font-size: 12px;
  color: var(--cyan);
  border: 1px solid var(--border);
  border-radius: 4px;
}
.project__meta { margin: 0 0 .75rem; font-size: 13px; }
.project__meta > div { display: flex; gap: 8px; }
.project__meta dt { min-width: 7ch; color: var(--muted); }
.project__meta dt::after { content: ":"; }
.project__meta dd { margin: 0; }
.project__links { margin: 0; font-size: 13px; }

/* ─── table + describe (certs detail) ───────────────────────────────── */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { padding: 4px 12px 4px 0; font-weight: 400; text-align: left; color: var(--muted); border-bottom: 1px solid var(--border); }
.table td { padding: 4px 12px 4px 0; border-bottom: 1px dashed var(--border); }
.table tr:last-child td { border-bottom: 0; }
.table tr.is-selected td { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.row-btn { padding: 0; font: inherit; font-weight: 700; color: var(--accent); background: none; border: 0; cursor: pointer; }
.row-btn:hover { text-decoration: underline; }
.table__hint { margin: 12px 0 0; font-size: 12px; color: var(--muted); }

.describe { margin: 0; font-size: 13px; }
.describe > div { display: flex; gap: 8px; }
.describe dt { min-width: 12ch; color: var(--muted); }
.describe dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.describe__events { flex-direction: column; margin-top: 12px; }
.describe__events dd { color: var(--muted); white-space: pre; }

/* ─── floating windows (help, launcher) ─────────────────────────────── */
.floating {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: var(--outer);
  background: color-mix(in srgb, var(--wall) 60%, transparent);
}
.floating--top { align-items: start; padding-top: 15vh; }
.floating[hidden] { display: none; }
.pane--floating { width: min(440px, 100%); box-shadow: 0 20px 60px rgb(0 0 0 / .5); }

.keys { margin: 0; }
.keys > div { display: flex; justify-content: space-between; gap: 16px; padding: 3px 0; }
.keys dd { margin: 0; color: var(--muted); }

.pane--launcher { width: min(560px, 100%); max-height: 70vh; }
.launcher__field { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.launcher__field input {
  flex: 1; min-width: 0;
  padding: 0;
  font: inherit;
  color: var(--text);
  background: none;
  border: 0;
  outline: none;
}
.launcher__list { flex: 1; min-height: 0; margin: 0; padding: 6px; overflow: auto; list-style: none; }
.launcher__item { display: flex; align-items: baseline; gap: 10px; padding: 4px 8px; border-radius: 4px; cursor: pointer; }
.launcher__item.is-active { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.launcher__kind { flex: none; width: 7ch; font-size: 12px; color: var(--magenta); }
.launcher__label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.launcher__label mark { background: none; color: var(--accent); font-weight: 700; }
.launcher__hint-text { flex: none; font-size: 12px; color: var(--muted); }
.launcher__empty { padding: 4px 8px; color: var(--muted); }
.launcher__hint { margin: 0; padding: 6px 14px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--border); }

/* ─── fullscreen pane (i3 $mod+f) ───────────────────────────────────── */
.pane.is-fullscreen {
  position: fixed;
  inset: calc(var(--bar-h) + var(--outer)) var(--outer) var(--outer);
  z-index: 40;
  box-shadow: 0 0 0 100vmax var(--wall);  /* hide the tiles behind it */
}
.pane.is-fullscreen .pane__title { padding-right: 48px; }
.pane.is-fullscreen .pane__body { overscroll-behavior: contain; }
.pane__close {
  position: absolute;
  top: 0;
  right: 0;
  padding: 2px 14px;
  font: inherit;
  font-size: 12px;
  color: var(--muted);
  background: none;
  border: 0;
  cursor: pointer;
}
.pane__close:hover { color: var(--accent); }

/* ─── responsive: fall back to a vertical stack ─────────────────────── */
@media (max-width: 860px) {
  :root { --outer: 10px; --gap: 10px; --bar-h: 44px; }
  .workspace, .workspace:last-child { height: auto; min-height: 0; }
  .tiles--hero, .tiles--about, .tiles--grid, .tiles--split { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; grid-auto-rows: auto; }
  .tiles--hero > :first-child, .tiles--about > .pane, .tiles--grid > :first-child { grid-row: auto; grid-column: auto; }
  .tiles--grid > .project:first-child:not(.is-fullscreen) .project__about { max-height: 6lh; }
  .bar__title, .bar__mode, .hero__hint { display: none; }

  /* top bar: bigger tap targets, clear of the notch */
  .bar--top {
    height: calc(var(--bar-h) + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) max(var(--outer), env(safe-area-inset-right)) 0 max(var(--outer), env(safe-area-inset-left));
    border-bottom: 1px solid var(--border);
  }
  .workspace { scroll-margin-top: calc(var(--bar-h) + env(safe-area-inset-top)); }
  .bar__ws { gap: 2px; }
  .ws { display: inline-flex; align-items: center; min-width: 34px; min-height: 32px; justify-content: center; padding: 0 10px; font-size: 13px; }
  .ws__name { display: none; }
  .ws.is-active .ws__name { display: inline; white-space: pre; }
  .bar__launch { min-height: 32px; padding: 0 12px; font-size: 13px; }

  /* bottom bar: scrolls with the page instead of eating screen space */
  .bar--bottom {
    position: static;
    height: auto;
    flex-wrap: wrap;
    row-gap: 4px;
    padding: 10px max(var(--outer), env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) max(var(--outer), env(safe-area-inset-left));
  }
  .status__seg a { display: inline-block; padding: 6px 0; }

  .pane--hero { min-height: calc(100svh - var(--bar-h) - env(safe-area-inset-top) - var(--outer) * 2); }
  .hero__name { font-size: clamp(2.4rem, 13vw, 4.5rem); }
  .hero__role { margin-bottom: 1.5rem; }
  .hero__cta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .hero__cta .btn { justify-content: center; width: 100%; min-height: 44px; }

  .pane__body { padding: 16px; }
  .project .pane__body { padding: 12px 14px; }
  .project__more { padding: 8px 0; font-size: 13px; }
  .row-btn { padding: 6px 0; }
  .describe__events dd { white-space: pre-wrap; }

  .pane.is-fullscreen {
    inset: calc(var(--bar-h) + env(safe-area-inset-top) + var(--outer)) var(--outer) calc(var(--outer) + env(safe-area-inset-bottom));
  }
  .pane__close { padding: 6px 16px; font-size: 16px; line-height: 1; }

  /* launcher: 16px input stops iOS from zooming in on focus */
  .floating--top { padding-top: calc(var(--bar-h) + env(safe-area-inset-top) + 12px); }
  .pane--launcher { max-height: 70dvh; }
  .launcher__field input { font-size: 16px; }
  .launcher__item { padding: 10px 8px; }
}
@media (max-width: 520px) {
  .table th:nth-child(3), .table td:nth-child(3) { display: none; }  /* issuer is in describe */
  .fetch { grid-template-columns: 1fr; grid-template-areas: "photo" "info" "swatches"; }
  .fetch__photo { width: 140px; margin-bottom: 8px; }
  .status--right .status__seg--dim { display: none; }
  .hero__cta { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 380px) {
  .ws.is-active .ws__name { display: none; }
  .cert { grid-template-columns: 6.5ch minmax(0, 1fr); }
  .cert__name { display: none; }
}

/* touch: keyboard hints are noise without a keyboard */
@media (hover: none) and (pointer: coarse) {
  .btn kbd, .project__more kbd, .certs__total kbd, .launcher__hint, .launcher__hint-text { display: none; }
  a:hover { text-decoration: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
