:root {
  --bg: #1a1612;
  --bg-raised: #1f1a16;
  --rule: #2a241e;
  --rule-strong: #3a3228;
  --text: #d8d0c0;
  --text-dim: #7a7268;
  --text-dimmer: #5a5249;
  --sage: #a3b48c;
  --sage-dim: #7e8c6a;

  --sans: "IBM Plex Sans", ui-sans-serif, system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --measure: 36rem;       /* ~576px body measure */
  --measure-wide: 44rem;  /* ~704px for the stream */
  --gutter: clamp(1.5rem, 4vw, 4rem);
}

* { box-sizing: border-box; }
html, body { background: var(--bg); }
body {
  margin: 0;
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  font-weight: 400;
  font-feature-settings: "ss01", "ss02";
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--sage);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in oklab, var(--sage) 25%, transparent);
  transition: border-color 120ms ease, color 120ms ease;
}
a:hover { border-bottom-color: var(--sage); }

::selection { background: color-mix(in oklab, var(--sage) 35%, transparent); color: #fff; }

/* ----- shell ----- */
.shell {
  max-width: var(--measure-wide);
  margin: 0 auto;
  padding: clamp(2.5rem, 6vw, 5rem) var(--gutter) 4rem;
}

/* ----- masthead ----- */
header.mast {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 2rem;
  padding-bottom: clamp(2rem, 5vw, 3rem);
}
.mast .mark {
  font-family: var(--mono);
  font-size: 0.9rem;
  color: var(--text);
  letter-spacing: 0;
  border-bottom: none;
  white-space: nowrap;
}
.mast .mark::before { content: "{ "; color: var(--text-dim); }
.mast .mark::after  { content: " }"; color: var(--text-dim); }

.mast nav {
  display: flex;
  gap: 1.75rem;
  font-size: 0.92rem;
}
.mast nav a {
  color: var(--text-dim);
  border-bottom: none;
}
.mast nav a:hover { color: var(--text); }
.mast nav a[aria-current="page"] {
  color: var(--text);
}

/* ----- portrait gallery ----- */
.gallery {
  position: relative;
  margin: 0 0 clamp(2rem, 5vw, 3rem);
}
/* Transform carousel, not a scroll container.
   Earlier attempts scrolled a `overflow-x:auto` reel and positioned by
   percentage widths. Every version left a sliver of the next photo, because
   when the container width is fractional (703.5px) the slide width and the
   scroll offset round independently and the remainder shows. There is no
   percentage-vs-scroll rounding here: .viewport clips, and .reel is exactly
   viewport-wide, so translateX(-100%) moves exactly one photo every time. */
.gallery .viewport {
  width: 100%;
  /* Fixed 4:1 letterbox, kept deliberately: a uniform strip matters more
     than showing each photo whole. */
  aspect-ratio: 4 / 1;
  overflow: hidden;
  background: #221d18;
}
.gallery .reel {
  display: flex;
  width: 100%;
  height: 100%;
  transition: transform 0.35s ease;
  will-change: transform;
}
.gallery .reel > .slide {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  overflow: hidden;
}
.gallery .reel > .slide > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}
@media (prefers-reduced-motion: reduce) {
  .gallery .reel { transition: none; }
}

.gallery-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-dimmer);
}
.gallery-dots {
  display: flex;
  gap: 0.5rem;
}
.gallery-dots button {
  appearance: none;
  background: var(--rule-strong);
  border: 0;
  padding: 0;
  width: 1.5rem;
  height: 2px;
  cursor: pointer;
  transition: background 120ms ease;
}
.gallery-dots button[aria-current="true"] {
  background: var(--sage);
}
.gallery-dots button:hover {
  background: var(--text-dim);
}
.gallery-count {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  color: var(--text-dimmer);
}
.gallery-arrows {
  display: flex;
  gap: 0.25rem;
}
.gallery-arrows button {
  appearance: none;
  background: none;
  border: 0;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0.15rem 0.4rem;
  line-height: 1;
}
.gallery-arrows button:hover { color: var(--text); }
.gallery-arrows button:disabled {
  color: var(--rule-strong);
  cursor: default;
}

/* ----- page title (sub-pages) ----- */
.page-title {
  margin: 0 0 clamp(2.5rem, 6vw, 4rem);
  max-width: var(--measure);
}
.page-title .kicker {
  display: block;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 0.75rem;
}
.page-title h1 {
  margin: 0 0 0.8rem;
  font-size: clamp(1.5rem, 3.4vw, 2rem);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.005em;
  color: var(--text);
}
.page-title .lede {
  margin: 0;
  color: var(--text-dim);
  font-size: 1rem;
  line-height: 1.6;
  text-wrap: pretty;
  max-width: var(--measure);
}

/* ----- intro (homepage) ----- */
.intro { max-width: var(--measure); }
.intro p {
  margin: 0 0 1.25em;
  text-wrap: pretty;
  font-size: 1.05rem;
  line-height: 1.7;
}
.intro p:last-child { margin-bottom: 0; }

/* ----- status block ----- */
.status {
  margin: clamp(1.5rem, 4vw, 2.25rem) 0 clamp(2rem, 5vw, 3rem);
  max-width: var(--measure);
  border-top: 1px solid var(--rule-strong);
  border-bottom: 1px solid var(--rule-strong);
  padding: 1.5rem 0;
}
.status dl {
  margin: 0;
  display: grid;
  grid-template-columns: minmax(11rem, max-content) 1fr;
  column-gap: 2rem;
  row-gap: 0.55rem;
  align-items: baseline;
}
.status dt {
  font-family: var(--sans);
  font-size: 0.88rem;
  color: var(--text-dim);
  font-weight: 400;
}
.status dd {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.92rem;
  color: var(--sage);
}
.status dd .muted { color: var(--sage-dim); }
.status .countdown { font-variant-numeric: tabular-nums; }

/* ----- section heading ----- */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin: clamp(2rem, 5vw, 3rem) 0 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--rule);
}
.section-head h2 {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.section-head .meta {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-dimmer);
}

/* ----- recent stream (homepage) ----- */
ul.stream {
  list-style: none;
  margin: 0;
  padding: 0;
}
ul.stream > li {
  display: grid;
  grid-template-columns: 7rem 5rem 1fr;
  column-gap: 1.5rem;
  align-items: baseline;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--rule);
}
ul.stream > li:last-child { border-bottom: none; }
ul.stream .date {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--text-dimmer);
  font-variant-numeric: tabular-nums;
}
ul.stream .kind {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-dim);
  letter-spacing: 0.02em;
}
ul.stream .title {
  color: var(--text);
  border-bottom: none;
  font-size: 1rem;
  line-height: 1.4;
  display: inline;
}
ul.stream .title:hover { color: var(--sage); }
ul.stream .desc {
  display: block;
  color: var(--text-dim);
  font-size: 0.92rem;
  line-height: 1.5;
  margin-top: 0.15rem;
}

.archive-link {
  margin-top: 1.5rem;
  font-family: var(--mono);
  font-size: 0.85rem;
}

/* ----- year-grouped list (writing, reviews) ----- */
.year-group { margin-bottom: clamp(2rem, 4vw, 3rem); }
.year-group:last-child { margin-bottom: 0; }
.year-group .year-mark {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--text-dimmer);
  letter-spacing: 0.02em;
  margin: 0 0 0.4rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--rule);
}
ul.entries {
  list-style: none;
  margin: 0;
  padding: 0;
}
ul.entries > li {
  display: grid;
  grid-template-columns: 5rem 4.5rem 1fr;
  column-gap: 1.5rem;
  align-items: baseline;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--rule);
}
ul.entries > li:last-child { border-bottom: none; }
ul.entries .date {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--text-dimmer);
  font-variant-numeric: tabular-nums;
}
ul.entries .kind {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-dim);
}
ul.entries .title {
  color: var(--text);
  border-bottom: none;
  font-size: 1rem;
  line-height: 1.4;
}
ul.entries .title:hover { color: var(--sage); }
ul.entries .desc {
  display: block;
  color: var(--text-dim);
  font-size: 0.92rem;
  line-height: 1.5;
  margin-top: 0.15rem;
}
/* writing list — no kind column */
ul.entries.no-kind > li { grid-template-columns: 5rem 1fr; }

/* ----- projects list ----- */
ul.projects {
  list-style: none;
  margin: 0;
  padding: 0;
}
ul.projects > li {
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--rule);
}
ul.projects > li:first-child { padding-top: 0; }
ul.projects > li:last-child { border-bottom: none; }
/* Deep-link target (projects.html#bud): keep the heading clear of the top
   edge, and flash the entry briefly so the jump is visible. */
ul.projects > li[id] { scroll-margin-top: 2rem; }
ul.projects > li:target {
  animation: proj-flash 1.6s ease-out 1;
}
@keyframes proj-flash {
  from { background: color-mix(in srgb, var(--sage) 14%, transparent); }
  to   { background: transparent; }
}
@media (prefers-reduced-motion: reduce) {
  ul.projects > li:target { animation: none; box-shadow: -0.75rem 0 0 var(--sage); }
}
.proj-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.4rem;
  flex-wrap: wrap;
}
.proj-name {
  font-family: var(--sans);
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--text);
  border-bottom: none;
}
.proj-name:hover { color: var(--sage); }
.proj-status {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}
.proj-status[data-state="active"]  { color: var(--sage); }
.proj-status[data-state="dormant"] { color: var(--text-dim); }
.proj-status[data-state="done"]    { color: var(--text-dimmer); }
.proj-status[data-state="archived"]{ color: var(--text-dimmer); }
.proj-desc {
  margin: 0 0 0.4rem;
  color: var(--text);
  font-size: 1rem;
  line-height: 1.6;
  text-wrap: pretty;
  max-width: var(--measure);
}
.proj-meta {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-dimmer);
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}
.proj-meta .sep { color: var(--rule-strong); }

/* ----- colophon ----- */
.colophon-section {
  margin: clamp(2.5rem, 5vw, 3.5rem) 0;
  max-width: var(--measure);
}
.colophon-section:first-of-type { margin-top: 0; }
.colophon-section h3 {
  margin: 0 0 1rem;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--rule);
}
.colophon-section p {
  margin: 0 0 1em;
  color: var(--text);
  text-wrap: pretty;
}
.colophon-section p:last-child { margin-bottom: 0; }
.colophon-section dl {
  margin: 0;
  display: grid;
  grid-template-columns: minmax(8rem, max-content) 1fr;
  column-gap: 2rem;
  row-gap: 0.5rem;
  align-items: baseline;
}
.colophon-section dt {
  font-family: var(--sans);
  font-size: 0.88rem;
  color: var(--text-dim);
}
.colophon-section dd {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.92rem;
  color: var(--text);
}
.colophon-section dd .swatch {
  display: inline-block;
  width: 0.7em;
  height: 0.7em;
  vertical-align: -0.05em;
  margin-right: 0.5em;
  border: 1px solid var(--rule-strong);
}

/* ----- footer ----- */
footer {
  margin-top: clamp(4rem, 9vw, 7rem);
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-dimmer);
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
}
footer a {
  color: var(--text-dim);
  border-bottom: none;
}
footer a:hover { color: var(--text); }
footer .sep { color: var(--rule-strong); }

/* ----- responsive ----- */
@media (max-width: 640px) {
  body { font-size: 16px; }
  .mast { flex-direction: column; align-items: flex-start; gap: 1.5rem; padding-bottom: 3rem; }
  .mast nav { gap: 1.25rem; flex-wrap: wrap; }
  .status dl {
    grid-template-columns: 1fr;
    row-gap: 0.15rem;
  }
  .status dt { margin-top: 0.6rem; }
  .status dt:first-child { margin-top: 0; }
  ul.stream > li {
    grid-template-columns: 5.5rem 1fr;
    grid-template-rows: auto auto;
    row-gap: 0.1rem;
    column-gap: 1rem;
  }
  ul.stream .kind { grid-column: 1; grid-row: 2; }
  ul.stream .entry { grid-column: 2; grid-row: 1 / 3; }

  ul.entries > li {
    grid-template-columns: 4.5rem 1fr;
    grid-template-rows: auto auto;
    row-gap: 0.1rem;
    column-gap: 1rem;
  }
  ul.entries .kind { grid-column: 1; grid-row: 2; }
  ul.entries .entry { grid-column: 2; grid-row: 1 / 3; }
  ul.entries.no-kind > li {
    grid-template-columns: 4.5rem 1fr;
    grid-template-rows: auto;
  }

  .colophon-section dl {
    grid-template-columns: 1fr;
    row-gap: 0.1rem;
  }
  .colophon-section dt { margin-top: 0.5rem; color: var(--text-dim); }
  .colophon-section dt:first-child { margin-top: 0; }
}
