@font-face { font-family: "JB Mono"; src: url(fonts/jbmono-400.woff2) format("woff2"); font-weight: 400; font-display: block; }
@font-face { font-family: "JB Mono"; src: url(fonts/jbmono-500.woff2) format("woff2"); font-weight: 500; font-display: block; }

:root {
  --bg: #101210;
  --ink: #e9ecdf;
  --muted: #7f877a;
  --faint: #3a4137;
  --green: #c4e59a;
  --orange: #f0a35e;
  --gutter: 48px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); }
body {
  font: 400 13px/1.65 "JB Mono", ui-monospace, "DejaVu Sans Mono", monospace;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button { font: inherit; }
:focus-visible { outline: 1px dashed var(--muted); outline-offset: 4px; }

canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: pan-y; }

/* ---- brand ---------------------------------------------------------------- */
.brand { position: fixed; top: var(--gutter); left: var(--gutter); z-index: 2; }
.brand a { text-decoration: none; color: var(--muted); letter-spacing: .02em; font-size: 14px; }
.brand b { color: var(--ink); font-weight: 500; }
.brand a:hover b { color: var(--green); }

/* ---- index ---------------------------------------------------------------- */
.index {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 1;
  width: 380px; padding: calc(var(--gutter) + 72px) var(--gutter) var(--gutter);
  background: linear-gradient(90deg, var(--bg) 58%, color-mix(in srgb, var(--bg) 0%, transparent));
  display: flex; flex-direction: column; gap: 26px;
}
.group h2 { margin: 0 0 6px; font: inherit; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); }
.group ol { list-style: none; margin: 0; padding: 0; }
.item {
  all: unset; box-sizing: border-box; cursor: pointer; width: 100%;
  display: grid; grid-template-columns: 3ch 1fr; column-gap: 1.2ch; padding: 4px 0;
  color: var(--muted); transition: color .2s;
}
.item .n { color: var(--faint); transition: color .2s; }
.item:hover, .item:focus-visible { color: var(--ink); }
.item[aria-current="true"] { color: var(--green); }
.item[aria-current="true"] .n { color: var(--orange); }

/* ---- card ----------------------------------------------------------------- */
.card {
  position: fixed; right: var(--gutter); bottom: var(--gutter); z-index: 1;
  width: min(460px, calc(100vw - 380px - var(--gutter) * 2));
  padding: 22px 24px 18px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  border: 1px solid color-mix(in srgb, var(--faint) 55%, transparent);
  border-radius: 2px;
}
.card p { margin: 0; }
.cat { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.name { margin: 6px 0 2px; font-size: 26px; line-height: 1.2; font-weight: 500; letter-spacing: -.01em; color: var(--ink); min-height: 1.2em; }
.line { color: var(--green); margin-bottom: 12px !important; }
.desc { color: #b7bdb0; max-width: 56ch; }
.row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 16px; }
.cta {
  display: inline-flex; align-items: center; gap: 1ch; padding: 7px 14px;
  background: var(--green); color: var(--bg); text-decoration: none; font-weight: 500; border-radius: 2px;
}
.cta::after { content: "↗"; }
.cta:hover { background: var(--ink); }
.cta[hidden] { display: none; }
.tags { list-style: none; margin: 0; padding: 0; display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 12px; }
.tags li::before { content: "+ "; color: var(--faint); }
.form { margin-top: 14px !important; font-size: 11px; color: var(--faint); }
.form::before { content: "// "; }
.swap { animation: swap .45s ease both; }
@keyframes swap { from { opacity: .15; } to { opacity: 1; } }

/* ---- meta ----------------------------------------------------------------- */
.meta {
  position: fixed; top: var(--gutter); right: var(--gutter); z-index: 2;
  display: flex; gap: 2ch; font-size: 11px; color: var(--muted);
  padding: 4px 10px; background: color-mix(in srgb, var(--bg) 85%, transparent); border-radius: 2px;
}
.meta button { all: unset; cursor: pointer; color: var(--muted); }
.meta button:hover, .meta button:focus-visible { color: var(--ink); }
.meta button[hidden] { display: none; }

/* ---- no-JS ---------------------------------------------------------------- */
.no-js canvas, .no-js .brand, .no-js .index, .no-js .card, .no-js .meta { display: none; }
.no-js body { overflow: auto; }
.plain { max-width: 60ch; padding: 48px 24px; overflow: auto; height: 100%; }
.plain li { margin: 8px 0; color: var(--muted); }
.plain a { color: var(--green); }

/* ---- mid widths: the card sits under the index column's gradient ---------- */
@media (max-width: 1100px) {
  .index { width: 300px; }
  .card { width: min(420px, calc(100vw - 300px - var(--gutter))); right: 24px; bottom: 24px; }
  .name { font-size: 22px; }
}

/* ---- shorter desktop screens: a more compact card, clear of the scenes ------ */
@media (min-width: 761px) and (max-height: 1000px) {
  .card { padding: 18px 20px 14px; }
  .name { font-size: 22px; }
  .line { margin-bottom: 8px !important; }
  .desc { display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
  .row { margin-top: 12px; }
  .form { display: none; }
}

/* ---- phones: brand and projects on top, the fine print at the bottom ------ */
@media (max-width: 760px) {
  :root { --gutter: 16px; --top: env(safe-area-inset-top); --bot: env(safe-area-inset-bottom); }
  body { font-size: 12px; }
  .brand { top: calc(14px + var(--top)); }

  .index {
    top: 0; bottom: auto; width: 100%; height: auto;
    padding: calc(44px + var(--top)) 16px 10px;
    background: linear-gradient(180deg, var(--bg) 82%, color-mix(in srgb, var(--bg) 0%, transparent));
    flex-direction: row; gap: 18px; overflow-x: auto; scrollbar-width: none;
    -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent);
            mask-image: linear-gradient(90deg, #000 88%, transparent);
  }
  .index::-webkit-scrollbar { display: none; }
  .group { flex: none; }
  .group h2 { display: none; }
  .group ol { display: flex; gap: 14px; }
  .item { display: flex; gap: .8ch; white-space: nowrap; padding: 4px 0; }

  .meta {
    top: auto; bottom: calc(10px + var(--bot)); left: 16px; right: 16px;
    justify-content: space-between; background: none; padding: 0; color: var(--faint);
  }
  .meta .keys { display: none; }

  .card {
    left: 16px; right: 16px; width: auto; bottom: calc(38px + var(--bot));
    padding: 14px 16px 12px;
  }
  .name { font-size: 20px; }
  .line { margin-bottom: 6px !important; }
  .desc { font-size: 12px; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
  .row { margin-top: 10px; }
  .tags, .form { display: none; }
}
