/* Tokens, base, and page layouts for every page. */

:root {
  color-scheme: light;

  --bg: #f2f2f3;
  --ink: #1d1f20;
  --ink-soft: #5d5d60;
  --rule: #98989b;
  --rule-box: #b7b7ba;
  --solid: #2b2b2d;
  --solid-hover: #424244;
  --solid-active: #1d1f20;

  --space-1: 3.4px;
  --space-2: 6.8px;
  --space-3: 10.2px;
  --space-4: 13.6px;
  --space-6: 20.4px;
  --space-8: 27.2px;

  --font-body: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --font-heading: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --font-heading-weight: 500;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* 6px dash, 5px gap, 1.5px thick. See .rule-* below. */
  --dash: linear-gradient(to right, var(--rule) 0 6px, transparent 6px 100%);
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  font-weight: 400;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--font-heading);
  font-weight: var(--font-heading-weight);
  line-height: 1.12;
  letter-spacing: -0.015em;
}

p {
  margin: 0;
  text-wrap: pretty;
}

a {
  color: var(--ink);
  text-underline-offset: 3px;
}

a:hover {
  color: var(--ink-soft);
}

:focus {
  outline: none;
}

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

::selection {
  background: color-mix(in srgb, var(--solid) 30%, transparent);
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

figure {
  margin: 0;
}

figcaption {
  margin-top: var(--space-3);
  font-size: 15px;
  color: var(--ink-soft);
  text-wrap: pretty;
}

/* ── the dashed rule ─────────────────────────────────────────────────── */

.rule-top,
.rule-bottom,
.rule-both {
  background-image: var(--dash);
  background-size: 11px 1.5px;
  background-repeat: repeat-x;
}

.rule-top {
  background-position: top left;
}

.rule-bottom {
  background-position: bottom left;
}

.rule-both {
  background-image: var(--dash), var(--dash);
  background-position: top left, bottom left;
}

/* ── page shell ──────────────────────────────────────────────────────── */

.page {
  min-height: 100vh;
  padding: calc(var(--space-6) * 1.4) var(--space-6) calc(var(--space-8) * 2);
  display: flex;
  justify-content: center;
}

.column {
  width: 100%;
  max-width: 720px;
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}

.column-home {
  gap: calc(var(--space-8) * 1.6);
}

.column-index {
  gap: calc(var(--space-8) * 1.4);
}

.nav {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  padding: 0 0 var(--space-3);
}

.nav a {
  color: inherit;
  text-decoration: none;
  font-size: 14px;
}

.nav a:hover {
  color: var(--ink-soft);
}

.nav .nav-brand {
  margin-right: auto;
  font-family: var(--font-heading);
  font-weight: var(--font-heading-weight);
  font-size: 15px;
  letter-spacing: 0.02em;
}

.stack {
  display: flex;
  flex-direction: column;
}

.gap-2 {
  gap: var(--space-2);
}

.gap-3 {
  gap: var(--space-3);
}

.gap-4 {
  gap: var(--space-4);
}

.soft {
  color: var(--ink-soft);
}

.btn {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: var(--space-2) calc(var(--space-3) * 1.2);
  border: 1px solid var(--solid);
  border-radius: 0;
  background: var(--solid);
  color: var(--bg);
  font-family: var(--font-heading);
  font-weight: var(--font-heading-weight);
  font-size: 14px;
  line-height: 1.2;
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
}

.btn:hover {
  background: var(--solid-hover);
  border-color: var(--solid-hover);
  color: var(--bg);
}

.btn:active {
  background: var(--solid-active);
  border-color: var(--solid-active);
}

/* ── home ────────────────────────────────────────────────────────────── */

.home-title {
  font-size: clamp(38px, 8vw, 62px);
  line-height: 1;
}

.identity {
  font-size: 19px;
  line-height: 1.45;
  max-width: 30em;
}

.contracting {
  font-size: 17px;
}

.section-title {
  margin: 0 0 var(--space-4);
  font-size: 26px;
}

.work-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-4) 0;
}

.work-item h3 {
  font-size: 21px;
}

.work-item p {
  font-size: 15px;
  max-width: 46em;
}

.work-item-last {
  gap: var(--space-3);
  padding-bottom: 0;
}

.hardware {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr));
  gap: var(--space-3) var(--space-6);
  margin-top: var(--space-2);
}

.hardware > div {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.hardware-title {
  font-family: var(--font-heading);
  font-weight: var(--font-heading-weight);
  font-size: 16px;
}

.hardware-desc {
  font-size: 14px;
  color: var(--ink-soft);
  text-wrap: pretty;
}

.post-list-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: var(--space-4) 0;
  color: var(--ink);
  text-decoration: none;
}

.post-list-title {
  font-family: var(--font-heading);
  font-weight: var(--font-heading-weight);
  font-size: 19px;
}

.post-list-date {
  font-size: 14px;
  color: var(--ink-soft);
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-6);
  font-size: 15px;
}

/* ── writing index ───────────────────────────────────────────────────── */

.index-title {
  font-size: clamp(34px, 7vw, 52px);
  line-height: 1;
}

.index-deck {
  font-size: 18px;
  max-width: 32em;
}

.index-item {
  gap: var(--space-2);
  padding: var(--space-6) 0;
}

.index-item-title {
  font-family: var(--font-heading);
  font-weight: var(--font-heading-weight);
  font-size: 26px;
  line-height: 1.1;
}

.index-item-meta {
  font-size: 15px;
  color: var(--ink-soft);
}

.index-item-summary {
  font-size: 15px;
  max-width: 44em;
  text-wrap: pretty;
}

/* ── post ────────────────────────────────────────────────────────────── */

.post-title {
  font-size: clamp(34px, 7vw, 54px);
  line-height: 1;
}

.post-deck {
  font-size: 19px;
  line-height: 1.45;
  max-width: 34em;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-6);
  padding-top: var(--space-2);
  font-size: 15px;
  color: var(--ink-soft);
}

.prose,
.prose-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.prose {
  max-width: 40em;
}

.prose h2 {
  font-size: 30px;
}

.prose p,
.prose-body {
  font-size: 16px;
  line-height: 1.6;
}

.prose code {
  font-family: var(--font-mono);
  font-size: 0.86em;
}

.split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: var(--space-8) var(--space-6);
  align-items: start;
}

.split > .prose {
  max-width: none;
}

.figure img {
  width: 100%;
}

/* A grid rather than a wrapping flex row, so the dashed dividers stay a
   closed lattice whatever the width: 3×2 in the narrow split column,
   one row of 6 when there's room. */
.packet-wrap {
  container-type: inline-size;
}

.packet {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px dashed var(--rule-box);
  border-left: 1px dashed var(--rule-box);
  font-family: var(--font-heading);
  font-size: 13px;
  line-height: 1.2;
}

.packet > span {
  padding: var(--space-2) var(--space-3);
  border-right: 1px dashed var(--rule-box);
  border-bottom: 1px dashed var(--rule-box);
  white-space: nowrap;
}

@container (min-width: 480px) {
  .packet {
    grid-template-columns: repeat(6, auto);
  }
}

.post-footer {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-6);
  padding-top: var(--space-4);
  font-size: 15px;
}
