/* Ahmi Darrow — Dark Forest (redesign preview)
   The pixel forest is the page. Console panels float over it, and every
   project is a crystal wired into a circuit tree.
   Corners are stepped, not rounded: frames are drawn with four offset
   shadows so each box keeps a 2px pixel notch at every corner. */

/* Ahmi Pixel: the site's own 8-bit face (github.com/AhmiDarrow/AhmiPixelFont).
   One font pixel is 1/8 of the em, so it is only pixel-sharp at sizes that
   are multiples of 8px. Every size below that uses it follows that rule. */
@font-face {
  font-family: "Ahmi Pixel";
  src: url("../assets/fonts/AhmiPixel-Regular.woff2?v=1.1.0") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Ahmi Pixel";
  src: url("../assets/fonts/AhmiPixel-Bold.woff2?v=1.1.0") format("woff2");
  font-weight: 700;
  font-display: swap;
}
/* Remedy Sans (OFL-1.1): running text, interface, and code.
   https://github.com/AhmiDarrow/RemedySans — weights 400 and 700 only. */
@font-face {
  font-family: "Remedy Sans";
  src: url("../assets/fonts/RemedySans-Regular.woff2?v=1.1.0") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Remedy Sans";
  src: url("../assets/fonts/RemedySans-Bold.woff2?v=1.1.0") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  --void: #040a09;
  --glass: rgba(4, 10, 9, 0.84);
  --glass-soft: rgba(4, 10, 9, 0.6);
  --line: #24504a;
  --line-bright: #3a7d74;
  --ink: #e2f3ee;
  --ink-dim: #a9c4bd;
  --ink-mute: #86a39c;

  --cyan: #3be0d0;
  --magenta: #f257cb;
  --green: #6fdc86;

  /* Pixel face for headings and project names. Versions and running text
     stay in the plain faces. */
  --pixel: "Ahmi Pixel", "Remedy Sans", system-ui, sans-serif;
  --sans: "Remedy Sans", system-ui, sans-serif;
  --mono: "Remedy Sans", ui-monospace, monospace;

  --rail-w: 232px;
  --gem-h: 182px;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scrollbar-color: var(--line-bright) var(--void);
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--void);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
}

a {
  color: inherit;
}

p,
h1,
h2,
h3,
ul,
blockquote {
  margin: 0;
}

ul {
  padding: 0;
  list-style: none;
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -80px;
  z-index: 50;
  padding: 8px 14px;
  background: var(--cyan);
  color: #03110f;
  font-weight: 700;
  text-decoration: none;
}
.skip-link:focus {
  top: 12px;
}

/* Pixel-notched frame */
.glass,
.inspector,
.btn,
.rail-latest,
.ticker,
.links a {
  box-shadow:
    0 -2px 0 0 var(--frame, var(--line)),
    0 2px 0 0 var(--frame, var(--line)),
    -2px 0 0 0 var(--frame, var(--line)),
    2px 0 0 0 var(--frame, var(--line));
}

/* ---------- The forest ---------- */
/* The artwork is one frame followed by its mirror image, so it tiles without
   a seam. It is shown as a band across the screen (smaller than the screen,
   so more forest fits) and drifts sideways very slowly. */
.world {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: #020605;
}
.world-pan {
  --scene-h: clamp(480px, 80vh, 920px);
  --tile-w: calc(var(--scene-h) * 2.97959); /* 2336 / 784 */
  position: absolute;
  left: 0;
  top: calc(47% - var(--scene-h) / 2);
  width: calc(100vw + var(--tile-w));
  height: var(--scene-h);
  background: url("../assets/console/forest-wide.webp") left top / var(--tile-w) 100% repeat-x;
  image-rendering: pixelated;
  animation: world-pan 380s linear infinite;
  will-change: transform;
}
/* the band fades into the dark above and below */
.world-pan::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #020605 0%, rgba(2, 6, 5, 0) 17%, rgba(2, 6, 5, 0) 78%, #020605 100%);
}
@keyframes world-pan {
  to { transform: translate3d(calc(-1 * var(--tile-w)), 0, 0); }
}
.world::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 60% 40%, rgba(2, 6, 5, 0.2) 0%, rgba(2, 6, 5, 0.6) 85%);
}

/* the crystals painted into the artwork breathe */
.glow {
  position: absolute;
  width: calc(var(--scene-h) * var(--s, 0.15));
  height: calc(var(--scene-h) * var(--s, 0.15));
  margin: calc(var(--scene-h) * var(--s, 0.15) / -2) 0 0 calc(var(--scene-h) * var(--s, 0.15) / -2);
  border-radius: 50%;
  mix-blend-mode: screen;
  opacity: 0.2;
  animation: glow-pulse var(--d, 4s) ease-in-out infinite alternate;
}
.glow-m {
  background: radial-gradient(circle, rgba(242, 87, 203, 0.75) 0%, rgba(242, 87, 203, 0) 68%);
}
.glow-c {
  background: radial-gradient(circle, rgba(59, 224, 208, 0.75) 0%, rgba(59, 224, 208, 0) 68%);
}
@keyframes glow-pulse {
  from { opacity: 0.12; transform: scale(0.9); }
  to { opacity: 0.85; transform: scale(1.08); }
}

/* low mist drifting across the forest floor */
.mist {
  position: absolute;
  left: -25%;
  width: 150%;
  height: 30%;
  filter: blur(26px);
  animation: mist 34s ease-in-out infinite alternate;
}
.mist-a {
  bottom: 12%;
  background: radial-gradient(ellipse at 40% 50%, rgba(59, 224, 208, 0.13), rgba(59, 224, 208, 0) 62%);
}
.mist-b {
  bottom: 30%;
  background: radial-gradient(ellipse at 65% 50%, rgba(242, 87, 203, 0.09), rgba(242, 87, 203, 0) 60%);
  animation-duration: 47s;
  animation-delay: -12s;
}
@keyframes mist {
  from { transform: translateX(-6%) scale(1); }
  to { transform: translateX(7%) scale(1.12); }
}

/* fireflies */
.fly {
  position: absolute;
  z-index: 1;
  width: 3px;
  height: 3px;
  background: var(--cyan);
  opacity: 0.8;
  animation:
    drift var(--d, 18s) ease-in-out infinite alternate,
    blink var(--b, 5s) steps(1) infinite;
}
.fly:nth-child(even) {
  background: var(--magenta);
}
@keyframes drift {
  to { transform: translate(var(--dx, 30px), var(--dy, -40px)); }
}
@keyframes blink {
  0%, 62% { opacity: 0.85; }
  63%, 100% { opacity: 0.15; }
}

/* Paused by the play/pause button; and paused by default for people who
   ask their system for reduced motion, until they press play. */
body.motion-off .world *,
body.motion-off .ticker.running .ticker-bar i {
  animation-play-state: paused;
}
@media (prefers-reduced-motion: reduce) {
  body:not(.motion-on) .world *,
  body:not(.motion-on) .ticker.running .ticker-bar i {
    animation-play-state: paused;
  }
}

/* play / pause button — last item in the rail, stuck to the bottom of it */
.motion {
  --frame: var(--line-bright);
  position: sticky;
  bottom: 0;
  z-index: 2;
  flex: none;
  align-self: stretch;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 44px;
  margin-top: auto;
  padding: 8px 13px;
  border: 0;
  background: #071412;
  color: var(--ink);
  font: 700 0.86rem/1 var(--sans);
  cursor: pointer;
  touch-action: manipulation;
  box-shadow:
    0 -2px 0 0 var(--frame),
    0 2px 0 0 var(--frame),
    -2px 0 0 0 var(--frame),
    2px 0 0 0 var(--frame);
}
.motion:hover {
  --frame: var(--cyan);
}
/* two bars while playing, a stepped triangle while paused */
.motion-icon {
  width: 10px;
  height: 12px;
  background: linear-gradient(90deg, var(--cyan) 0 4px, transparent 4px 6px, var(--cyan) 6px 10px);
}
.motion[aria-pressed="true"] .motion-icon {
  background: var(--cyan);
  clip-path: polygon(0 0, 4px 0, 4px 2px, 7px 2px, 7px 4px, 10px 4px, 10px 8px, 7px 8px, 7px 10px, 4px 10px, 4px 12px, 0 12px);
}

.top-anchor {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
}

/* ---------- Console rail ---------- */
.rail {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  width: var(--rail-w);
  display: flex;
  flex-direction: column;
  gap: 30px;
  padding: 22px 16px 20px;
  background: var(--glass);
  border-right: 2px solid var(--line);
  overflow-y: auto;
  scrollbar-width: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}
.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.brand-name {
  font-family: var(--pixel);
  font-weight: 700;
  font-size: 16px;
}
.brand-tag {
  color: var(--ink-dim);
  font-size: 0.85rem;
}

.rail-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.rail-nav a {
  display: block;
  padding: 9px 12px;
  border-left: 4px solid transparent;
  color: var(--ink-dim);
  font-weight: 400;
  text-decoration: none;
}
.rail-nav a:hover,
.rail-nav a[aria-current="page"] {
  color: var(--ink);
  border-left-color: var(--cyan);
  background: rgba(59, 224, 208, 0.08);
}
.rail-nav a.rail-biz[aria-current="page"] {
  border-left-color: var(--magenta);
  background: rgba(242, 87, 203, 0.1);
}

/* the business gets its own rail entry, marked in its crystal's colour */
.rail-nav a.rail-biz {
  color: var(--ink);
}
.rail-nav a.rail-biz::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 9px;
  background: var(--magenta);
  vertical-align: 1px;
}
.rail-nav a.rail-biz:hover {
  border-left-color: var(--magenta);
  background: rgba(242, 87, 203, 0.1);
}

/* ---------- Updates ticker ---------- */
.ticker {
  --frame: var(--line);
  margin: 0 2px;
  padding: 10px 12px 10px;
  background: rgba(4, 10, 9, 0.6);
}
.ticker-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.ticker-label {
  font: 700 16px/1.25 var(--pixel);
}
.ticker-count {
  color: var(--ink-mute);
  font-size: 0.78rem;
  white-space: nowrap;
}
/* one update at a time; the next slides up from below */
.ticker-view {
  position: relative;
  height: 9.6em;
  margin-top: 8px;
  overflow: hidden;
}
.ticker-item {
  position: absolute;
  inset: 0;
  display: block;
  text-decoration: none;
}
.ticker-item.enter { animation: tick-enter 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.ticker-item.leave { animation: tick-leave 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.ticker-item.enter-back { animation-name: tick-enter-back; animation-duration: 0.5s; animation-fill-mode: both; }
.ticker-item.leave-back { animation-name: tick-leave-back; }
@keyframes tick-enter { from { transform: translateY(100%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes tick-leave { from { transform: none; opacity: 1; } to { transform: translateY(-100%); opacity: 0; } }
@keyframes tick-enter-back { from { transform: translateY(-100%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes tick-leave-back { from { transform: none; opacity: 1; } to { transform: translateY(100%); opacity: 0; } }
.ticker-date {
  display: block;
  color: var(--ink-mute);
  font-size: 0.8rem;
}
.ticker-title {
  display: block;
  margin-top: 2px;
  font-weight: 700;
  line-height: 1.3;
}
.ticker-item:hover .ticker-title {
  text-decoration: underline;
  text-decoration-color: var(--magenta);
  text-underline-offset: 3px;
}
.ticker-text {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  overflow: hidden;
  margin-top: 4px;
  color: var(--ink-dim);
  font-size: 0.84rem;
  line-height: 1.4;
}
/* countdown to the next update; when it fills, the ticker advances */
.ticker-bar {
  height: 4px;
  margin-top: 8px;
  background: var(--line);
}
.ticker-bar i {
  display: block;
  width: 0;
  height: 100%;
  background: var(--magenta);
}
.ticker.running .ticker-bar i {
  animation: tick-bar 6s steps(30, end) forwards;
}
.ticker:hover .ticker-bar i,
.ticker:focus-within .ticker-bar i {
  animation-play-state: paused;
}
@keyframes tick-bar {
  to { width: 100%; }
}
.ticker-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.ticker-nav button {
  width: 30px;
  height: 26px;
  padding: 0;
  border: 0;
  background: var(--line);
  color: var(--ink);
  font: 700 16px/1 var(--pixel);
  cursor: pointer;
}
.ticker-nav button:hover {
  background: var(--line-bright);
}
.ticker-nav a {
  margin-left: auto;
  color: var(--ink-dim);
  font-size: 0.82rem;
  text-decoration: underline;
  text-decoration-color: var(--line-bright);
  text-underline-offset: 3px;
}
.ticker-nav a:hover {
  color: var(--ink);
}
@media (max-height: 640px) {
  .ticker {
    display: none;
  }
}

.rail-latest {
  --frame: var(--line);
  margin: 12px 2px 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 10px 12px 11px;
  background: rgba(4, 10, 9, 0.6);
  text-decoration: none;
}
.rail-latest:hover {
  --frame: var(--magenta);
}
.rail-latest-label {
  color: var(--ink-mute);
  font-size: 0.8rem;
}
.rail-latest-name {
  font-weight: 700;
}
.rail-latest-age {
  color: var(--ink-dim);
  font-size: 0.85rem;
}

/* ---------- Page ---------- */
main {
  margin-left: var(--rail-w);
  padding: 0 34px 40px;
  max-width: calc(1320px + var(--rail-w));
}

.hero {
  margin: 0 -34px;
  padding: clamp(56px, 13vh, 132px) 34px clamp(48px, 9vh, 96px);
  background: linear-gradient(90deg, rgba(4, 10, 9, 0.8) 0%, rgba(4, 10, 9, 0.52) 44%, rgba(4, 10, 9, 0) 78%);
}

.hero h1 {
  max-width: 9.5em;
  font-family: var(--pixel);
  font-weight: 700;
  font-size: 64px;
  line-height: 1.1;
  text-shadow: 4px 4px 0 rgba(0, 0, 0, 0.75);
}

.lede {
  max-width: 50ch;
  margin-top: 22px;
  font-size: 1.12rem;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.9);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 26px;
}

.btn {
  --frame: var(--line-bright);
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 8px 17px;
  border: 0;
  background: var(--glass);
  color: var(--ink);
  font: 700 0.94rem/1.2 var(--sans);
  text-decoration: none;
  cursor: pointer;
}
.btn:hover {
  --frame: var(--cyan);
}
.btn-solid {
  --frame: var(--cyan);
  background: var(--cyan);
  color: #03110f;
}
.btn-solid:hover {
  --frame: #c4fff7;
  background: #86f2e6;
}

.sec-head {
  display: flex;
  align-items: center;
  gap: 14px;
}
.sec-head h2 {
  font-family: var(--pixel);
  font-weight: 700;
  font-size: 32px;
  line-height: 1.2;
  text-shadow: 3px 3px 0 rgba(0, 0, 0, 0.7);
}
/* circuit trace running out of each heading, ending in a node */
.trace {
  position: relative;
  flex: 1;
  height: 2px;
  background: var(--line-bright);
}
.trace::after {
  content: "";
  position: absolute;
  right: 0;
  top: -3px;
  width: 8px;
  height: 8px;
  background: var(--cyan);
}
.sec-note {
  margin-top: 6px;
  color: var(--ink-dim);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.9);
}

.loading {
  padding: 20px 0;
  color: var(--ink-dim);
}

/* ---------- Projects: the circuit tree ---------- */
.projects {
  scroll-margin-top: 18px;
}

.proj-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 392px;
  gap: 30px;
  align-items: start;
  margin-top: 14px;
}

.tree {
  padding: 4px 22px 14px;
  background: linear-gradient(180deg, rgba(4, 10, 9, 0.66), rgba(4, 10, 9, 0.5));
}

.branch {
  --c: var(--cyan);
  padding-top: 20px;
}
.branch[data-group="agents"] { --c: var(--magenta); }
.branch[data-group="mods"],
.branch[data-group="minecraft"] { --c: var(--green); }
.branch[data-group="more"] { --c: var(--ink-dim); }

.branch-head {
  font: 700 1.02rem/1.2 var(--sans);
}
/* each branch heading is a button that folds the branch */
.branch-toggle {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  margin-left: 0;
  padding: 4px 10px 4px 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.branch-toggle .chev {
  color: var(--ink-mute);
  transition: transform 0.15s;
}
.branch-toggle:hover .chev {
  color: var(--ink);
}
.branch-toggle[aria-expanded="false"] .chev {
  transform: rotate(-90deg);
}
.branch-grid[hidden] {
  display: none;
}

/* the plain list that ships in the page, shown until the tree replaces it */
.plain-list {
  columns: 2;
  column-gap: 32px;
  padding: 18px 0 8px;
}
.plain-list li {
  margin-bottom: 9px;
  break-inside: avoid;
}
.plain-list a {
  margin-right: 10px;
  text-decoration: underline;
  text-decoration-color: var(--line-bright);
  text-underline-offset: 3px;
}
.branch-head .node {
  width: 10px;
  height: 10px;
  background: var(--c);
}
.branch-count {
  color: var(--ink-mute);
  font-weight: 400;
}

/* trunk drops from the group node; each row is a bus; each crystal hangs
   off the bus on its own stub */
.branch-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(126px, 1fr));
  row-gap: 14px;
  margin: 12px 0 0 4px;
}
.branch-grid::before {
  content: "";
  position: absolute;
  left: 0;
  top: -8px;
  bottom: calc(var(--gem-h) - 2px);
  width: 2px;
  background: var(--c);
  opacity: 0.6;
}
.branch-grid li {
  position: relative;
  height: var(--gem-h);
}
.branch-grid li::before,
.branch-grid li::after {
  content: "";
  position: absolute;
  background: var(--c);
  opacity: 0.6;
  pointer-events: none;
}
.branch-grid li::before {
  left: 0;
  right: 0;
  top: 0;
  height: 2px;
}
.branch-grid li::after {
  left: calc(50% - 1px);
  top: 0;
  width: 2px;
  height: 20px;
}

.gem {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  width: 100%;
  height: 100%;
  padding: 22px 4px 6px;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.gem-art {
  display: grid;
  place-items: center;
  width: 72px;
  height: 88px;
}
.gem-art svg {
  width: 48px;
  height: 72px;
  color: var(--c);
  --fill: 0.14;
  --lit: 0.3;
}

/* crystal facets: .body is the whole stone, .lit the facet catching light */
svg .body {
  fill: currentColor;
  fill-opacity: var(--fill, 0.14);
}
svg .lit {
  fill: currentColor;
  fill-opacity: var(--lit, 0.3);
  stroke: none;
}

.gem-name {
  padding: 1px 7px 2px;
  background: rgba(4, 10, 9, 0.78);
  font-weight: 700;
  font-size: 0.94rem;
  line-height: 1.25;
  border-bottom: 2px solid transparent;
}
.gem-ver {
  color: var(--ink-dim);
  font: 400 0.76rem/1.2 var(--mono);
  text-shadow: 0 1px 0 #000;
}

/* brightness = how recently the project shipped */
.gem[data-heat="hot"] .gem-art svg {
  --fill: 0.38;
  --lit: 0.7;
  filter: drop-shadow(0 0 7px var(--c));
  animation: glow 2.8s ease-in-out infinite alternate;
}
.gem[data-heat="cold"] .gem-art svg {
  --fill: 0;
  --lit: 0.08;
  opacity: 0.55;
}
.gem[data-heat="cold"] .gem-name {
  color: var(--ink-dim);
}
@keyframes glow {
  from { filter: drop-shadow(0 0 3px var(--c)); }
  to { filter: drop-shadow(0 0 11px var(--c)); }
}

/* targeting brackets: faint on hover, solid when picked */
.gem:hover .gem-art,
.gem.is-shown .gem-art {
  background:
    linear-gradient(var(--b), var(--b)) left top / 12px 2px,
    linear-gradient(var(--b), var(--b)) left top / 2px 12px,
    linear-gradient(var(--b), var(--b)) right top / 12px 2px,
    linear-gradient(var(--b), var(--b)) right top / 2px 12px,
    linear-gradient(var(--b), var(--b)) left bottom / 12px 2px,
    linear-gradient(var(--b), var(--b)) left bottom / 2px 12px,
    linear-gradient(var(--b), var(--b)) right bottom / 12px 2px,
    linear-gradient(var(--b), var(--b)) right bottom / 2px 12px;
  background-repeat: no-repeat;
}
.gem:hover .gem-art {
  --b: var(--ink-mute);
}
.gem.is-shown .gem-art {
  --b: var(--ink);
}
.gem.is-shown .gem-name {
  border-bottom-color: var(--c);
}

/* ---------- Inspector: the console panel for the picked project ---------- */
.inspector {
  --c: var(--cyan);
  --frame: var(--c);
  position: sticky;
  top: 20px;
  background: var(--glass);
}
.inspector[data-group="agents"] { --c: var(--magenta); }
.inspector[data-group="mods"],
.inspector[data-group="minecraft"] { --c: var(--green); }
.inspector[data-group="more"] { --c: var(--ink-dim); }

.insp-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 2px solid var(--line);
}
.insp-dots {
  display: inline-flex;
  gap: 4px;
}
.insp-dots i {
  width: 7px;
  height: 7px;
  background: var(--line-bright);
}
.insp-dots i:first-child {
  background: var(--c);
}
.insp-path {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-dim);
  font: 400 0.8rem/1.3 var(--mono);
}

.insp-shot {
  display: block;
  width: 100%;
  height: auto;
  border-bottom: 2px solid var(--line);
}

.insp-main {
  padding: 16px 18px 20px;
}
.insp-kind {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-dim);
  font-size: 0.86rem;
}
.insp-kind svg {
  flex: none;
  width: 12px;
  height: 18px;
  max-width: 12px;
  max-height: 18px;
  overflow: hidden;
  color: var(--c);
  --fill: 0.2;
  --lit: 0.45;
}
.insp-name {
  margin-top: 6px;
  font-family: var(--pixel);
  font-weight: 700;
  font-size: 24px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.insp-desc {
  margin-top: 10px;
  color: var(--ink);
}
.insp-status {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 2px solid var(--line);
  color: var(--ink-dim);
  font-size: 0.92rem;
}
.insp-status b {
  color: var(--ink);
  font: 400 0.95rem/1.2 var(--mono);
}
.insp-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}

/* ---------- About + Connect ---------- */
.pair {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 30px;
  align-items: start;
  margin-top: 56px;
}

.glass {
  padding: 18px 22px 22px;
  background: var(--glass);
  scroll-margin-top: 18px;
}
.glass .sec-head h2 {
  font-size: 24px;
  text-shadow: none;
}
.glass > p {
  max-width: 62ch;
  margin-top: 12px;
}
.glass > blockquote {
  margin-top: 16px;
  padding-left: 14px;
  border-left: 4px solid var(--magenta);
  font-family: var(--pixel);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.5;
}
.signoff {
  margin-top: 18px;
  font-family: var(--pixel);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
}

.links {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 18px;
}
.links a {
  --frame: var(--line-bright);
  display: flex;
  flex-direction: column;
  padding: 10px 14px 11px;
  background: rgba(4, 10, 9, 0.6);
  text-decoration: none;
}
.links a:hover {
  --frame: var(--cyan);
}
.links span {
  color: var(--ink-dim);
  font-size: 0.88rem;
}

.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 24px;
  margin-top: 40px;
  color: var(--ink-dim);
  font-size: 0.85rem;
  text-shadow: 0 1px 0 #000;
}

/* ---------- Inner pages: shared ---------- */
.page-project main,
.page-updates main,
.page-projects main {
  padding-top: 34px;
}
.page-head h1,
.proj-hero h1 {
  font-family: var(--pixel);
  font-weight: 700;
  font-size: 48px;
  line-height: 1.1;
  text-shadow: 4px 4px 0 rgba(0, 0, 0, 0.75);
  overflow-wrap: anywhere;
}
.page-head {
  margin: 0 -34px 26px;
  padding: 26px 34px 30px;
  background: linear-gradient(90deg, rgba(4, 10, 9, 0.8) 0%, rgba(4, 10, 9, 0.5) 46%, rgba(4, 10, 9, 0) 80%);
}
.page-head .lede {
  margin-top: 12px;
}

/* ---------- Project page ---------- */
.crumbs {
  display: flex;
  gap: 9px;
  color: var(--ink-dim);
  font-size: 0.9rem;
  text-shadow: 0 1px 0 #000;
}
.crumbs a {
  text-decoration: underline;
  text-decoration-color: var(--line-bright);
  text-underline-offset: 3px;
}
.crumbs a:hover {
  text-decoration-color: var(--cyan);
}

main[data-group] { --c: var(--cyan); }
main[data-group="agents"] { --c: var(--magenta); }
main[data-group="mods"],
main[data-group="minecraft"] { --c: var(--green); }
main[data-group="more"] { --c: var(--ink-dim); }

.proj-hero {
  display: flex;
  gap: 26px;
  align-items: flex-start;
  margin: 12px -34px 28px;
  padding: 22px 34px 30px;
  background: linear-gradient(90deg, rgba(4, 10, 9, 0.84) 0%, rgba(4, 10, 9, 0.6) 50%, rgba(4, 10, 9, 0) 86%);
}
.hero-gem {
  flex: none;
  display: grid;
  place-items: center;
  width: 104px;
  height: 148px;
  margin-top: 6px;
}
.hero-gem svg {
  width: 96px;
  height: 144px;
  color: var(--c);
  --fill: 0.16;
  --lit: 0.34;
}
.hero-gem[data-heat="hot"] svg {
  --fill: 0.38;
  --lit: 0.7;
  filter: drop-shadow(0 0 10px var(--c));
}
.hero-copy {
  min-width: 0;
}
.hero-kind {
  color: var(--ink-dim);
  font-size: 0.95rem;
}
.hero-blurb {
  max-width: 60ch;
  margin-top: 12px;
  font-size: 1.1rem;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.9);
}
.hero-status {
  margin-top: 14px;
  color: var(--ink-dim);
}
.hero-status b {
  color: var(--ink);
  font: 400 1.02rem/1.2 var(--mono);
}
.proj-hero .actions {
  margin-top: 18px;
}

.proj-cols {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 30px;
  align-items: start;
}
.proj-side {
  display: grid;
  gap: 26px;
  position: sticky;
  top: 20px;
}
.side-card h2 {
  font-family: var(--pixel);
  font-weight: 700;
  font-size: 24px;
  line-height: 1.2;
}
.link-list,
.rel-list {
  margin-top: 10px;
}
.link-list li,
.rel-list li {
  padding: 8px 0;
  border-top: 2px solid var(--line);
}
.link-list li:first-child,
.rel-list li:first-child {
  border-top: 0;
}
.link-list a,
.rel-list a {
  text-decoration: underline;
  text-decoration-color: var(--line-bright);
  text-underline-offset: 3px;
}
.link-list a:hover,
.rel-list a:hover {
  text-decoration-color: var(--c);
}
.rel-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.rel-list a {
  font-family: var(--mono);
  font-size: 0.92rem;
}
.rel-list time {
  color: var(--ink-dim);
  font-size: 0.88rem;
  white-space: nowrap;
}

/* the project's own README, restyled for the forest */
.readme {
  padding: 22px 26px 22px;
}
.readme-body {
  max-width: 76ch;
  overflow-wrap: break-word;
}
.readme-body > :first-child {
  margin-top: 0;
}
.readme-body h2,
.readme-body h3,
.readme-body h4,
.readme-body h5,
.readme-body h6 {
  margin: 1.7em 0 0.5em;
  line-height: 1.25;
  font-weight: 700;
}
.readme-body h2 {
  font-family: var(--pixel);
  font-weight: 700;
  font-size: 24px;
}
.readme-body h3 {
  padding-bottom: 6px;
  border-bottom: 2px solid var(--line);
  font-size: 1.3rem;
}
.readme-body h4 {
  font-size: 1.1rem;
}
.readme-body h5,
.readme-body h6 {
  font-size: 1rem;
}
.readme-body p,
.readme-body ul,
.readme-body ol,
.readme-body pre,
.readme-body table,
.readme-body blockquote {
  margin: 0.85em 0;
}
.readme-body ul,
.readme-body ol {
  padding-left: 1.4em;
  list-style: revert;
}
.readme-body li {
  margin: 0.3em 0;
}
.readme-body li::marker {
  color: var(--c);
}
.readme-body a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--c);
  text-underline-offset: 3px;
}
.readme-body img {
  max-width: 100%;
  height: auto;
  vertical-align: middle;
}
.readme-body code {
  padding: 1px 5px;
  background: rgba(59, 224, 208, 0.1);
  font: 0.88em/1.4 var(--mono);
}
.readme-body pre {
  padding: 12px 14px;
  overflow-x: auto;
  background: rgba(2, 6, 5, 0.85);
  border-left: 4px solid var(--line-bright);
  font: 0.85rem/1.5 var(--mono);
}
.readme-body pre code {
  padding: 0;
  background: none;
  font: inherit;
}
.readme-body .pl-c { color: var(--ink-mute); }
.readme-body .pl-k,
.readme-body .pl-c1 { color: var(--cyan); }
.readme-body .pl-s,
.readme-body .pl-pds { color: var(--green); }
.readme-body blockquote {
  padding-left: 14px;
  border-left: 4px solid var(--c);
  color: var(--ink-dim);
}
.readme-body table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 0.94rem;
}
.readme-body th,
.readme-body td {
  padding: 7px 12px;
  border: 2px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.readme-body th {
  background: rgba(59, 224, 208, 0.07);
  font-weight: 700;
}
.readme-body hr {
  height: 2px;
  margin: 1.6em 0;
  border: 0;
  background: var(--line);
}
.readme-body details {
  margin: 0.85em 0;
}
.readme-body summary {
  cursor: pointer;
  font-weight: 700;
}
.readme-note {
  margin-top: 22px;
  padding-top: 12px;
  border-top: 2px solid var(--line);
  color: var(--ink-mute);
  font-size: 0.86rem;
}
.readme-note a {
  color: var(--ink-dim);
}

/* other projects in the same group */
.more-in {
  --c: var(--cyan);
  margin-top: 40px;
}
.more-in[data-group="agents"] { --c: var(--magenta); }
.more-in[data-group="mods"],
.more-in[data-group="minecraft"] { --c: var(--green); }
.more-in[data-group="more"] { --c: var(--ink-dim); }
.more-in h2 {
  font-family: var(--pixel);
  font-weight: 700;
  font-size: 24px;
  text-shadow: 3px 3px 0 rgba(0, 0, 0, 0.7);
}
.more-in ul {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 16px;
  margin-top: 14px;
}
.more-in a {
  --frame: var(--line);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px 8px 10px;
  background: var(--glass);
  font-weight: 700;
  text-decoration: none;
  box-shadow:
    0 -2px 0 0 var(--frame),
    0 2px 0 0 var(--frame),
    -2px 0 0 0 var(--frame),
    2px 0 0 0 var(--frame);
}
.more-in a:hover {
  --frame: var(--c);
}
.more-in svg {
  flex: none;
  width: 14px;
  height: 20px;
  max-width: 14px;
  max-height: 20px;
  overflow: hidden;
  color: var(--c);
  --fill: 0.16;
  --lit: 0.4;
}

/* ---------- Updates page ---------- */
.page-updates .page-head h1 {
  overflow-wrap: normal;
}
.page-updates .page-head .lede {
  max-width: 42ch;
  line-height: 1.55;
}
.blog-list {
  display: grid;
  gap: 28px;
  max-width: 68ch;
  margin-top: 4px;
}
.post-card {
  padding: 22px 26px 24px;
  background: var(--glass);
  box-shadow:
    0 -2px 0 0 var(--line),
    0 2px 0 0 var(--line),
    -2px 0 0 0 var(--line),
    2px 0 0 0 var(--line);
}
.post-meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  color: var(--ink-mute);
  font-size: 0.88rem;
  letter-spacing: 0.01em;
}
.post-card h2 {
  margin-top: 8px;
  font-family: var(--sans);
  font-weight: 700;
  font-size: 1.4rem;
  line-height: 1.35;
  letter-spacing: -0.01em;
  overflow-wrap: break-word;
}
.post-body {
  max-width: 62ch;
  margin-top: 14px;
  color: var(--ink-dim);
  font-size: 1.02rem;
  line-height: 1.65;
  overflow-wrap: break-word;
}
.post-body p {
  margin: 0;
}
.post-body p + p,
.post-body p + .post-points,
.post-body .post-points + p {
  margin-top: 0.85em;
}
.post-body a {
  color: var(--cyan);
  text-decoration: underline;
  text-decoration-color: rgba(59, 224, 208, 0.45);
  text-underline-offset: 3px;
  overflow-wrap: anywhere;
}
.post-body a:hover {
  text-decoration-color: var(--cyan);
}
.post-points {
  margin: 0.15em 0 0;
  padding-left: 1.25em;
  list-style: disc;
}
.post-points li {
  margin-top: 0.35em;
  padding-left: 0.15em;
}
.post-points li::marker {
  color: var(--cyan);
}
.footer-admin a,
.foot a {
  color: var(--ink-dim);
  text-decoration: underline;
  text-decoration-color: var(--line-bright);
  text-underline-offset: 3px;
}

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .hero h1 {
    font-size: 48px;
  }
  .proj-layout {
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 22px;
  }
  .proj-cols {
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 22px;
  }
}

@media (max-width: 960px) {
  :root {
    --gem-h: 170px;
  }
  .rail {
    position: sticky;
    inset: 0 0 auto 0;
    width: auto;
    gap: 6px;
    padding: 10px 14px 0;
    padding-top: max(10px, env(safe-area-inset-top, 0px));
    background: var(--void);
    border-right: 0;
    border-bottom: 2px solid var(--line);
  }
  .brand-mark {
    width: 18px;
    height: 27px;
  }
  .brand-text {
    flex-direction: row;
    align-items: baseline;
    gap: 10px;
  }
  .rail-nav {
    flex-direction: row;
    margin: 0 -14px;
    padding: 0 6px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .rail-nav a {
    flex: none;
    padding: 9px 10px 8px;
    border-left: 0;
    border-bottom: 4px solid transparent;
  }
  .rail-nav a:hover {
    border-bottom-color: var(--cyan);
  }
  .rail-nav a.rail-biz:hover {
    border-bottom-color: var(--magenta);
  }
  .rail-latest {
    display: none;
  }
  .ticker {
    margin: 0 -14px;
    padding: 7px 14px 8px;
    box-shadow: none;
    border-top: 2px solid var(--line);
    background: rgba(59, 224, 208, 0.06);
  }
  .ticker-head,
  .ticker-text,
  .ticker-nav {
    display: none;
  }
  .ticker-view {
    height: 1.5em;
    margin: 0;
  }
  .ticker-item {
    display: flex;
    align-items: baseline;
    gap: 10px;
    white-space: nowrap;
  }
  .ticker-title {
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .ticker-bar {
    height: 2px;
    margin-top: 6px;
  }
  main {
    margin-left: 0;
    padding: 0 14px 48px;
  }
  .hero h1 {
    font-size: 40px;
  }
  .sec-head h2 {
    font-size: 24px;
  }
  .hero {
    margin: 0 -14px;
    padding: 44px 14px 40px;
    background: linear-gradient(180deg, rgba(4, 10, 9, 0.7), rgba(4, 10, 9, 0.45));
  }
  .projects,
  .glass {
    scroll-margin-top: 210px;
  }
  .proj-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .tree {
    padding: 0 12px 10px;
  }
  .branch-grid {
    grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  }
  .gem-art {
    width: 60px;
    height: 74px;
  }
  .gem-art svg {
    width: 40px;
    height: 60px;
  }
  /* no pointer to preview with on a phone: a tap opens the project's page */
  .inspector {
    display: none;
  }
  .page-project main,
  .page-updates main,
  .page-projects main {
    padding-top: 20px;
  }
  .page-head,
  .proj-hero {
    margin-left: -14px;
    margin-right: -14px;
    padding-left: 14px;
    padding-right: 14px;
    background: linear-gradient(180deg, rgba(4, 10, 9, 0.74), rgba(4, 10, 9, 0.5));
  }
  .page-head h1,
  .proj-hero h1 {
    font-size: 32px;
  }
  .proj-hero {
    gap: 14px;
  }
  .hero-gem {
    width: 52px;
    height: 76px;
  }
  .hero-gem svg {
    width: 48px;
    height: 72px;
  }
  .proj-cols {
    grid-template-columns: minmax(0, 1fr);
    gap: 22px;
  }
  .proj-side {
    position: static;
    gap: 22px;
  }
  .readme {
    padding: 16px 14px 18px;
  }
  .motion {
    margin-top: 8px;
    margin-bottom: max(0px, env(safe-area-inset-bottom, 0px));
  }
  .post-card {
    padding: 16px 14px 18px;
  }
  .pair {
    grid-template-columns: minmax(0, 1fr);
    gap: 22px;
    margin-top: 36px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .ticker-item.enter,
  .ticker-item.leave {
    animation-duration: 0.01s;
  }
  .branch-toggle .chev {
    transition: none;
  }
  .gem[data-heat="hot"] .gem-art svg {
    animation: none;
  }
}

@media (max-width: 480px) {
  .hero h1 {
    font-size: 32px;
  }
}

/* ---------- Projects catalog only ----------
   The homepage keeps the circuit tree. Here each group is a glass panel
   and each crystal sits in a card, so wrapped names cannot shove the row. */
.group-alias {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.page-projects .page-head .sec-head h1 {
  flex: none;
}
.page-projects .tree {
  padding: 2px 0 8px;
  background: none;
}
.page-projects .branch {
  position: relative;
  margin-top: 16px;
  padding: 4px 16px 16px;
  background: var(--glass);
  box-shadow:
    0 -2px 0 0 var(--line),
    0 2px 0 0 var(--line),
    -2px 0 0 0 var(--line),
    2px 0 0 0 var(--line);
  scroll-margin-top: 18px;
}
.page-projects .branch:first-child {
  margin-top: 0;
}
.page-projects .branch-toggle {
  display: flex;
  width: 100%;
  min-height: 44px;
  padding: 8px 2px;
  text-align: left;
}
.page-projects .branch-count {
  margin-left: auto;
}
.page-projects .branch-toggle .chev {
  flex: none;
}
.page-projects .branch-grid {
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 12px 10px;
  margin: 4px 0 2px;
}
.page-projects .branch-grid::before,
.page-projects .branch-grid li::before,
.page-projects .branch-grid li::after {
  content: none;
}
.page-projects .branch-grid li {
  height: auto;
}
.page-projects .gem {
  height: 100%;
  min-height: 168px;
  justify-content: flex-start;
  padding: 12px 8px 10px;
  background: rgba(4, 10, 9, 0.55);
  box-shadow:
    0 -2px 0 0 var(--line),
    0 2px 0 0 var(--line),
    -2px 0 0 0 var(--line),
    2px 0 0 0 var(--line);
}
.page-projects .gem-art {
  width: 64px;
  height: 76px;
  flex: none;
}
.page-projects .gem-art svg {
  width: 42px;
  height: 64px;
}
.page-projects .gem-name {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  width: 100%;
  min-height: 2.5em;
  line-height: 1.25;
}
.page-projects .gem-ver {
  min-height: 1.2em;
  margin-top: auto;
}
.page-projects .gem-ver:empty::before {
  content: "\00a0";
}
.page-projects .plain-groups {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.page-projects details.branch > summary {
  display: flex;
  align-items: center;
  min-height: 44px;
  cursor: pointer;
  font: 700 1.02rem/1.2 var(--sans);
}
.page-projects .plain-groups ul {
  margin: 0;
  padding: 4px 0 6px;
}
.page-projects .plain-groups li {
  margin: 0 0 8px;
}
.page-projects .plain-groups a {
  margin-right: 10px;
  text-decoration: underline;
  text-decoration-color: var(--line-bright);
  text-underline-offset: 3px;
}

@media (max-width: 960px) {
  .page-projects .branch {
    scroll-margin-top: 220px;
  }
  .page-projects .branch-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .page-projects .gem {
    min-height: 156px;
  }
}

/* ---------- Updates in Ahmi Print (ticker + blog posts) ---------- */
@font-face {
  font-family: "Ahmi Print";
  src: url("../assets/fonts/AhmiPrint-Regular.woff2?v=1.1.0") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Ahmi Print";
  src: url("../assets/fonts/AhmiPrint-Bold.woff2?v=1.1.0") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
.ticker-item,
.ticker-date,
.ticker-title,
.ticker-text,
.post-card,
.post-card h2,
.post-meta,
.post-body,
.post-body p,
.post-body li,
.post-body a {
  font-family: "Ahmi Print", var(--sans);
}

/* Ahmi Print runs wider than Remedy Sans: keep each ticker update inside its box */
.ticker-item {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}
.ticker-date { font-size: 0.74rem; }
.ticker-title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  font-size: 0.9rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.ticker-text {
  -webkit-line-clamp: 3;
  line-clamp: 3;
  font-size: 0.76rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

/* Roomier ticker for Ahmi Print: taller box, smaller text */
.ticker-view { height: 12.5em; }
.ticker-date { font-size: 0.7rem; }
.ticker-title { font-size: 0.82rem; line-height: 1.25; -webkit-line-clamp: 3; line-clamp: 3; }
.ticker-text { font-size: 0.7rem; line-height: 1.35; -webkit-line-clamp: 6; line-clamp: 6; }
