/* ==========================================================================
   Coder page — terminal voice: sections, cards, repo list, timeline, palette
   ========================================================================== */

.code-page {
  font-size: var(--fs-sm);
  line-height: 1.65;
}
.code-page::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: linear-gradient(#000, transparent 85%);
  mask-image: linear-gradient(#000, transparent 85%);
  pointer-events: none;
}

.wrap {
  max-width: 76rem;
  margin-inline: auto;
  padding-inline: var(--pad);
}

/* ---------- Intro ---------- */
.intro {
  padding-top: var(--space-section);
}
.comment {
  color: var(--muted);
}
.intro__title {
  margin-top: 0.75rem;
  font-size: var(--fs-4xl);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.06em;
}
.intro__title em {
  font-style: normal;
  color: var(--accent);
}
.intro__title::after {
  content: "_";
  color: var(--accent);
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink {
  50% {
    opacity: 0;
  }
}
.intro__lead {
  max-width: 62ch;
  margin-top: 1.75rem;
  font-size: var(--fs-md);
  color: var(--ink);
}
.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 1px;
  margin-top: 2.5rem;
  border: 1px solid var(--line);
  background: var(--line);
}
.facts div {
  padding: 1rem 1.1rem;
  background: var(--bg);
}
.facts dt {
  font-size: var(--fs-xs);
  color: var(--muted);
}
.facts dd {
  margin: 0.15rem 0 0;
}

/* ---------- Sections ---------- */
.section {
  padding-top: var(--space-section);
  scroll-margin-top: 1rem;
}
.section__title {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 1.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--line);
  font-size: var(--fs-base);
  font-weight: 500;
}
.section__title::before {
  content: counter(section, decimal-leading-zero);
  color: var(--muted);
}
.section {
  counter-increment: section;
}
.wrap {
  counter-reset: section;
}
.section__title small {
  margin-left: auto;
  font-size: var(--fs-xs);
  font-weight: 400;
  color: var(--muted);
}

/* ---------- Cards ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.cards--wide {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 26rem), 1fr));
}
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  height: 100%;
  padding: 1.25rem 1.3rem;
  border: 1px solid var(--line);
  background: rgb(255 255 255 / 0.015);
  transition: border-color var(--t-fast), background-color var(--t-fast), translate var(--t-fast) var(--ease);
}
a.card:hover,
a.card:focus-visible {
  border-color: var(--accent);
  background: rgb(255 74 61 / 0.04);
  translate: 0 -2px;
}
.card__kind {
  font-size: var(--fs-xs);
  color: var(--muted);
}
.card__title {
  font-size: var(--fs-md);
  font-weight: 700;
  letter-spacing: -0.02em;
}
a.card .card__title::after {
  content: " ↗";
  font-weight: 400;
  color: var(--muted);
}
.card__text {
  color: var(--muted);
}
.card__meta {
  margin-top: auto;
  padding-top: 0.6rem;
  font-size: var(--fs-xs);
  color: var(--muted);
}

/* ---------- Stack ---------- */
.stack {
  display: grid;
  gap: 1.25rem;
}
.stack dt {
  margin-bottom: 0.5rem;
  font-size: var(--fs-xs);
  color: var(--muted);
}
.stack dd {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0;
}
.tag {
  padding: 0.2rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-box);
  font-size: var(--fs-xs);
}

/* ---------- Principles ---------- */
.principles {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: rule;
}
.principles li {
  display: flex;
  gap: 1rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--line);
  counter-increment: rule;
}
.principles li::before {
  content: counter(rule, decimal-leading-zero);
  color: var(--muted);
}

/* ---------- Timeline ---------- */
.timeline {
  margin: 0;
  padding: 0;
  list-style: none;
}
.timeline li {
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 1fr);
  gap: 0.25rem 1.5rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--line);
}
.timeline time {
  color: var(--muted);
}
.timeline strong {
  font-weight: 700;
}
.timeline span {
  color: var(--muted);
}
@media (max-width: 560px) {
  .timeline li {
    grid-template-columns: 1fr;
  }
}

/* ---------- Contact ---------- */
.connect {
  max-width: 62ch;
}
.connect__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1.5rem 0 0;
  padding: 0;
  list-style: none;
}

/* Screenshot at the top of a project card */
.card__shot {
  width: calc(100% + 2.6rem);
  max-width: none;
  height: auto;
  margin: -1.25rem -1.3rem 0.5rem;
  border-bottom: 1px solid var(--line);
  filter: saturate(0.85);
  transition: filter var(--t);
}
a.card:hover .card__shot,
a.card:focus-visible .card__shot {
  filter: none;
}

/* ==========================================================================
   Coder page, second layer: terminal, stats, case studies, language bar,
   timeline rail
   ========================================================================== */

/* ---------- Intro: text beside a terminal ---------- */
.intro {
  display: grid;
  grid-template-columns: minmax(0, 6fr) minmax(0, 5fr);
  align-items: center;
  gap: clamp(2rem, 5vw, 4rem);
}
.intro__title {
  font-size: var(--fs-3xl);
}
.stats {
  grid-column: 1 / -1;
}
@media (max-width: 900px) {
  .intro {
    grid-template-columns: 1fr;
  }
}

.term {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius-box);
  background: #0c0c0c;
  box-shadow: 0 30px 80px rgb(0 0 0 / 0.5);
  overflow: hidden;
  cursor: text;
}
.term__bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--line);
  font-size: var(--fs-xs);
  color: var(--muted);
}
.term__bar span {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  background: rgb(255 255 255 / 0.14);
}
.term__bar span:first-child {
  background: var(--muted);
}
.term__bar b {
  margin-left: auto;
  font-weight: 400;
}
.term__body {
  height: 17.5rem;
  padding: 0.9rem 1rem 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgb(255 255 255 / 0.15) transparent;
  font-size: var(--fs-xs);
  line-height: 1.7;
}
.term__line {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: color-mix(in srgb, var(--ink) 78%, var(--bg));
}
.term__line--cmd {
  margin-top: 0.4rem;
  color: var(--ink);
}
.term__line--cmd::before {
  content: "$ ";
  color: var(--muted);
}
.term__form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem 0.9rem;
  font-size: var(--fs-xs);
}
.term__prompt {
  color: var(--muted);
}
.term__form input {
  flex: 1;
  min-width: 0;
  padding: 0.25rem 0;
  border: 0;
  outline: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  caret-color: var(--accent);
}
.term__form input::placeholder {
  color: var(--muted);
}
.term:focus-within {
  border-color: rgb(255 74 61 / 0.5);
}

/* ---------- Stats ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 1px;
  border: 1px solid var(--line);
  background: var(--line);
}
.stats div {
  padding: 1.25rem 1.3rem;
  background: var(--bg);
}
.stats dt {
  font-size: var(--fs-xs);
  color: var(--muted);
}
.stats dd {
  margin: 0.3rem 0 0;
  font-size: var(--fs-2xl);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums;
}

/* ---------- Case studies ---------- */
.cases {
  display: grid;
  gap: clamp(2.5rem, 6vw, 5rem);
  margin-bottom: clamp(2rem, 4vw, 3rem);
}
.case {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  align-items: center;
  gap: clamp(1.5rem, 4vw, 3.5rem);
}
.case:nth-child(even) .case__shot {
  order: 2;
}
@media (max-width: 900px) {
  .case {
    grid-template-columns: 1fr;
  }
  .case:nth-child(even) .case__shot {
    order: 0;
  }
}
.case__shot {
  display: block;
  border: 1px solid var(--line);
  border-radius: var(--radius-box);
  overflow: hidden;
  box-shadow: 0 30px 70px rgb(0 0 0 / 0.55);
  transition: border-color var(--t);
}
.case__shot:hover {
  border-color: var(--accent);
}
.case__shot img {
  width: 100%;
  height: auto;
}
.case__text {
  position: relative;
  padding: 1.5rem;
  border-left: 1px solid var(--line);
}
.case__num {
  font-size: var(--fs-xs);
  color: var(--muted);
}
.case__title {
  margin-top: 0.5rem;
  font-size: var(--fs-2xl);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.05em;
}
.case__desc {
  margin-top: 1rem;
  color: var(--muted);
}
.case__meta {
  margin: 1rem 0 1.5rem;
  font-size: var(--fs-xs);
  color: var(--muted);
}

/* ---------- Principles ---------- */
.principles li {
  font-size: var(--fs-lg);
  letter-spacing: -0.03em;
  transition: color var(--t-fast), padding-left var(--t) var(--ease);
}
.principles li:hover {
  padding-left: 0.75rem;
  color: var(--accent);
}

/* ---------- Language bar ---------- */
.langs {
  margin-bottom: 1.75rem;
}
.langs__title {
  margin-bottom: 0.6rem;
  font-size: var(--fs-xs);
  color: var(--muted);
}
.langs__bar {
  display: flex;
  gap: 2px;
  height: 0.6rem;
}
.langs__seg {
  min-width: 0.4rem;
  border-radius: 1px;
}
.langs__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.25rem;
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
  font-size: var(--fs-xs);
  color: var(--muted);
}
.langs__legend i {
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  margin-right: 0.45rem;
  border-radius: 1px;
}
.langs__seg--0 { background: var(--accent); }
.langs__seg--1 { background: var(--ink); }
.langs__seg--2 { background: rgb(236 232 225 / 0.62); }
.langs__seg--3 { background: rgb(255 74 61 / 0.5); }
.langs__seg--4 { background: rgb(236 232 225 / 0.36); }
.langs__seg--5 { background: rgb(236 232 225 / 0.2); }

/* ---------- Timeline rail ---------- */
ol.timeline {
  position: relative;
  padding-left: 1.5rem;
}
.timeline::before {
  content: "";
  position: absolute;
  inset: 0.5rem auto 0.5rem 0.2rem;
  width: 1px;
  background: linear-gradient(var(--accent), var(--line) 30%);
}
.timeline li {
  position: relative;
}
.timeline li::before {
  content: "";
  position: absolute;
  top: 1.35rem;
  left: -1.55rem;
  width: 0.55rem;
  height: 0.55rem;
  border: 1px solid var(--muted);
  border-radius: 50%;
  background: var(--bg);
  transition: background-color var(--t-fast);
}
.timeline li:hover::before {
  background: var(--accent);
}

/* What each project contains */
.case__label {
  margin-top: 1.25rem;
  font-size: var(--fs-xs);
  color: var(--muted);
}
.case__points {
  display: grid;
  gap: 0.45rem;
  margin: 0.6rem 0 0;
  padding: 0;
  list-style: none;
}
.case__points li {
  position: relative;
  padding-left: 1.25rem;
  color: color-mix(in srgb, var(--ink) 82%, var(--bg));
}
.case__points li::before {
  content: "";
  position: absolute;
  top: 0.75em;
  left: 0;
  width: 0.6rem;
  height: 1px;
  background: var(--muted);
}

/* Keep lines to a comfortable reading length */
.timeline li > div,
.principles li,
.connect,
.case__desc,
.case__points li,
.card__text {
  max-width: 68ch;
}

/* Phones: the terminal needs a keyboard, so the page goes straight to the work */
@media (max-width: 720px) {
  .term {
    display: none;
  }
}

/* Earlier work: the oldest entries sit behind a toggle */
.older {
  margin-top: 1.25rem;
}
.older summary {
  width: fit-content;
  font-size: var(--fs-sm);
  color: var(--muted);
  cursor: pointer;
}
.older summary:hover {
  color: var(--ink);
}
.older[open] summary {
  margin-bottom: 1rem;
}
