:root {
  color-scheme: dark;
  --bg: #08060c;
  --panel: #0f0b16;
  --panel-2: #171021;
  --ink: #f7f2ff;
  --display: #ded4eb;
  --muted: #a99db8;
  --faint: #6d6178;
  --line: rgba(226, 214, 244, 0.12);
  --purple: #7c3aed;
  --violet: #a855f7;
  --lilac: #d8b4fe;
  --radius: 7px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  overflow-x: clip;
  scrollbar-color: rgba(168, 85, 247, 0.74) rgba(15, 11, 22, 0.85);
  scrollbar-width: thin;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(168, 85, 247, 0.035) 1px, transparent 1px),
    linear-gradient(rgba(168, 85, 247, 0.035) 1px, transparent 1px),
    radial-gradient(circle at 12% 14%, rgba(124, 58, 237, 0.14), transparent 22rem),
    var(--bg);
  background-size: 34px 34px, 34px 34px, auto, auto;
  font-family: "Space Grotesk", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.35;
  overflow-x: clip;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: rgba(15, 11, 22, 0.88);
  border-left: 1px solid rgba(226, 214, 244, 0.08);
}

::-webkit-scrollbar-thumb {
  border: 2px solid rgba(15, 11, 22, 0.88);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(216, 180, 254, 0.86), rgba(124, 58, 237, 0.72));
}

::-webkit-scrollbar-thumb:hover {
  background:
    linear-gradient(180deg, rgba(237, 218, 255, 0.96), rgba(168, 85, 247, 0.86));
}

a {
  color: inherit;
  text-decoration: none;
}

a,
button {
  position: relative;
  overflow: hidden;
}

.click-ripple {
  position: absolute;
  z-index: 0;
  border-radius: 50%;
  background: rgba(216, 180, 254, 0.28);
  pointer-events: none;
  transform: scale(0);
  animation: click-ripple 460ms ease-out;
}

@keyframes click-ripple {
  to {
    opacity: 0;
    transform: scale(2.4);
  }
}

h1,
h2,
h3,
p,
dl,
dt,
dd,
strong {
  margin: 0;
  overflow-wrap: anywhere;
}

h1 {
  overflow-wrap: normal;
}

.page-shell {
  display: grid;
  grid-template-columns: minmax(300px, 25vw) minmax(0, 1fr);
  min-height: 100svh;
}

.rail {
  position: sticky;
  top: 0;
  align-self: start;
  display: grid;
  min-height: 100svh;
  padding: clamp(26px, 5vw, 62px) clamp(18px, 4vw, 54px);
  border-right: 1px solid var(--line);
}

.rail p,
.stamp,
.section-bar span,
.repo-row span,
.repo-row em,
.repo-row small,
.cluster-grid span,
.link-grid,
.rail-links {
  font-family: "IBM Plex Mono", monospace;
}

.rail p,
.stamp,
.section-bar span {
  color: var(--violet);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.rail h1 {
  align-self: center;
  color: var(--display);
  font-family: "Space Grotesk", system-ui, sans-serif;
  font-size: clamp(2.55rem, 3.45vw, 3.5rem);
  line-height: 0.86;
  letter-spacing: 0;
  font-weight: 700;
}

.rail h1 span {
  display: block;
}

.rail-links {
  align-self: end;
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  color: var(--muted);
  font-size: 0.76rem;
}

.rail-links a {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(168, 85, 247, 0.34);
  border-radius: 50%;
  color: var(--muted);
  transition: border-color 160ms ease, color 160ms ease, background 160ms ease;
}

.rail-links a:hover {
  border-color: rgba(216, 180, 254, 0.72);
  color: var(--lilac);
  background: rgba(124, 58, 237, 0.12);
}

.rail-links svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
}

.rail-links a:first-child svg,
.rail-links a:last-child svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.board {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  align-content: start;
  gap: 12px;
  padding: clamp(14px, 2.8vw, 34px);
  min-width: 0;
}

.note,
.projects-panel,
.scraps,
.clusters,
.links {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(15, 11, 22, 0.78);
  min-width: 0;
}

.note {
  min-height: 132px;
  padding: 16px;
}

.note.intro {
  grid-column: span 7;
}

.note.current {
  grid-column: span 5;
  display: flex;
  flex-direction: column;
  container-type: inline-size;
}

.note.intro p {
  max-width: 38rem;
  margin-top: 22px;
  color: var(--display);
  font-family: "Space Grotesk", system-ui, sans-serif;
  font-size: clamp(1.1rem, 1.85vw, 1.72rem);
  font-weight: 700;
  line-height: 1.06;
}

.note.current dl {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin-top: 18px;
  border: 1px solid var(--line);
  background: var(--line);
}

.note.current div {
  min-height: clamp(74px, 7vw, 88px);
  padding: 12px;
  background: var(--panel);
}

.note.current dd {
  overflow-wrap: normal;
  word-break: normal;
}

/* Prevent the 3-item coordinates grid from creating a visible empty cell
   at intermediate widths. The last item spans the full second row only
   when the Coordinates card itself gets too narrow for three clean columns. */
@container (max-width: 560px) {
  .note.current dl {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .note.current dl > div:last-child {
    grid-column: 1 / -1;
  }
}

@container (max-width: 390px) {
  .note.current dl {
    grid-template-columns: 1fr;
  }

  .note.current dl > div:last-child {
    grid-column: auto;
  }
}

dt {
  color: var(--faint);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.68rem;
  text-transform: uppercase;
}

dd {
  margin: 12px 0 0;
  color: var(--lilac);
  font-weight: 800;
}

.projects-panel {
  grid-column: span 12;
  overflow: hidden;
}

.section-bar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.repo-ledger {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.repo-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  grid-template-areas:
    "repo language"
    "title title"
    "meta meta";
  column-gap: 14px;
  row-gap: 7px;
  align-items: start;
  min-height: 94px;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.repo-row > * {
  min-width: 0;
}

.repo-row:nth-child(-n + 2) {
  border-top: 0;
}

.repo-row:nth-child(odd) {
  border-right: 1px solid var(--line);
}

.repo-row:hover {
  background: rgba(124, 58, 237, 0.12);
  color: var(--ink);
}

.repo-row.major {
  background: rgba(124, 58, 237, 0.09);
}

.repo-row span {
  grid-area: repo;
  color: var(--lilac);
  font-size: 0.74rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.repo-row strong {
  grid-area: title;
  min-width: 0;
  color: var(--display);
  font-size: clamp(0.98rem, 1.15vw, 1.15rem);
  line-height: 1.08;
}

.repo-row small {
  grid-area: meta;
  min-width: 0;
  color: var(--faint);
  font-size: 0.68rem;
  line-height: 1.15;
}

.repo-row em {
  grid-area: language;
  justify-self: end;
  color: var(--faint);
  font-size: 0.7rem;
  font-style: normal;
  white-space: nowrap;
}

.scraps {
  grid-column: span 12;
}

.scrap-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.scrap-grid a {
  position: relative;
  min-height: 96px;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.scrap-grid a:not(:last-child) {
  border-right: 1px solid var(--line);
}

.scrap-grid a:hover {
  color: var(--ink);
  background: rgba(124, 58, 237, 0.12);
}

.scrap-grid span {
  color: var(--lilac);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.74rem;
  font-weight: 700;
}

.scrap-grid p {
  margin-top: 18px;
  font-size: 0.9rem;
}

.scrap-grid em {
  display: inline-block;
  margin-top: 14px;
  color: var(--faint);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.68rem;
  font-style: normal;
}

.clusters {
  grid-column: span 8;
}

.links {
  grid-column: span 4;
}

.cluster-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.cluster-grid article {
  min-height: 116px;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
}

.cluster-grid article:nth-child(odd) {
  border-right: 1px solid var(--line);
}

.cluster-grid span {
  color: var(--lilac);
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
}

.cluster-grid p {
  margin-top: 18px;
  color: var(--muted);
  font-size: 0.9rem;
}

.link-grid {
  display: grid;
}

.link-grid a {
  padding: 14px 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.78rem;
}

.link-grid a:hover {
  color: var(--lilac);
  background: rgba(124, 58, 237, 0.12);
}

@media (min-width: 1121px) and (max-width: 1320px) {
  .note.intro,
  .note.current {
    grid-column: span 6;
  }
}

@media (max-width: 1120px) {
  .repo-ledger {
    grid-template-columns: 1fr;
  }

  .repo-row:nth-child(odd) {
    border-right: 0;
  }

  .repo-row:nth-child(-n + 2) {
    border-top: 1px solid var(--line);
  }

  .repo-row:first-child {
    border-top: 0;
  }
}

@media (max-width: 1120px) {
  .page-shell {
    grid-template-columns: 1fr;
  }

  .rail {
    position: relative;
    top: auto;
    min-height: 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .rail h1 {
    margin: 48px 0;
  }

  .note.intro,
  .note.current,
  .scraps,
  .clusters,
  .links {
    grid-column: span 12;
  }

  .note.intro p {
    max-width: 100%;
  }
}

@media (max-width: 760px) {
  .rail h1 {
    font-size: clamp(2.85rem, 14vw, 4rem);
  }

  .board {
    gap: 10px;
    padding: 10px;
  }

  .section-bar {
    display: grid;
    gap: 8px;
    align-items: start;
    justify-content: stretch;
  }

  .note.current dl,
  .repo-ledger,
  .scrap-grid,
  .cluster-grid {
    grid-template-columns: 1fr;
  }

  .note.intro p {
    font-size: clamp(1rem, 4.6vw, 1.12rem);
    line-height: 1.14;
    max-width: 25ch;
  }

  .repo-row {
    grid-template-columns: 1fr;
    grid-template-areas:
      "repo"
      "title"
      "meta"
      "language";
    gap: 6px;
    min-height: 0;
  }

  .repo-row em {
    justify-self: start;
  }

  .repo-row span {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
  }

  .repo-row:nth-child(odd),
  .cluster-grid article:nth-child(odd),
  .scrap-grid a:not(:last-child) {
    border-right: 0;
  }
}
