/* ─── tokens ─────────────────────────────────────────────── */
:root {
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --serif: 'Lora', Georgia, serif;

  --ink:   #1a1a18;
  --ink-2: #4a4a46;
  --ink-3: #8a8a84;
  --paper: #f8f7f3;
  --rule:  #e0dfd8;
  --rule-strong: #c8c7be;
  --link:  #2255cc;

  --measure: 64ch;
  --gap: 2.5rem;

  --site-gutter: 1.5rem;

  /* hero dot grid — tweak in one place */
  --hero-dot-cols: 13;
  --hero-dot-cell: 18px;
  --hero-dot-min-rows: 4;
  --hero-grid-width: calc(var(--hero-dot-cols) * var(--hero-dot-cell));
  --hero-dot-size: 1.5px;
  --hero-dot-opacity: 0.55;
  --hero-dot-active-size: 1.75px;
  --hero-dot-active-color: #4ade80;
  --hero-dot-active-opacity: 1;
  --hero-hover-active-color: #f87171;
  --hero-hover-active-opacity: 1;
  --hero-dot-transition: 1s ease;          /* grow and shrink each take this long */
  --hero-dot-pulse-transition: 0.14s ease; /* autonomous heartbeat grow/shrink */
  --hero-dot-hover-transition: 0.14s ease; /* hover grow/shrink */
  --hero-dot-pulse-hold: 0.06s;              /* pause at peak, trough, and ends */
  --hero-dot-hover-hold: 0.06s;              /* pause on hover path when stationary */
  --hero-dot-pulse-gap-min: 0.8s;              /* random wait before a new chain */
  --hero-dot-pulse-gap-max: 1.6s;
  --hero-dot-dash-duration: 0.4s;          /* legacy fallback */
  --hero-dot-pulse-dash-duration: 0.14s;   /* line travel time for heartbeat */
  --hero-dot-hover-dash-duration: 0.14s;   /* line travel time for hover */
  --hero-dot-dash-width: 1px;
  --hero-dot-trail-duration: 3.4s;       /* completed segments fade out over this */
  --hero-pattern-opacity: 0.75;
  --hero-dot-mobile-max: 600px;          /* hide grid below this width */
  --hero-dot-mask-fade-at: 30%;          /* mask gradient mid stop */
  --hero-dot-mask-opaque-at: 62%;        /* mask gradient: fully visible from here right */
  --hero-dot-hover-radius: 28px;         /* pointer snap distance for hover path */

  /* icon mute: 0 = colour · 0.4 = soft · 1 = grey */
  --icon-mute: 0.3;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink:   #e8e7e0;
    --ink-2: #a8a79e;
    --ink-3: #68675e;
    --paper: #141412;
    --rule:  #2a2a26;
    --rule-strong: #3a3a36;
    --link:  #7aaaff;
  }
}

/* ─── reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--mono);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.6;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 0 var(--site-gutter);
  max-width: 760px;
  margin: 0 auto;
}

/* ─── header ─────────────────────────────────────────────── */
.site-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 2rem 0 1.25rem;
  border-bottom: 1px solid var(--rule-strong);
  margin-bottom: var(--gap);
  gap: 1rem;
  flex-wrap: nowrap;
}

.site-header nav {
  flex-shrink: 0;
}

.site-name {
  font-family: var(--mono);
  font-size: 21px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 1px;
}

.cursor {
  display: inline-block;
  width: 10px;
  height: 1em;
  background: var(--ink);
  animation: blink 1.1s step-end infinite;
  margin-left: 1px;
  flex-shrink: 0;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  list-style: none;
}

.nav-links a {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-2);
  text-decoration: none;
  letter-spacing: 0.03em;
  transition: color 0.15s;
}

.nav-links a:hover,
.nav-links a[aria-current="page"] { color: var(--ink); }

/* ─── main ───────────────────────────────────────────────── */
main { padding-bottom: 4rem; }

/* ─── footer ─────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--rule);
  padding: 1.5rem 0 2rem;
  font-size: 12px;
  color: var(--ink-3);
  display: flex;
  gap: 0.75rem;
  flex-direction: column;
}

.site-footer a {
  color: var(--ink-3);
  text-decoration: none;
}

.site-footer a:hover { color: var(--link); }

/* ─── social row ───────────────────────────────────────────── */
.section--find-me {
  padding-bottom: 1rem;
  margin-bottom: 2rem;
}

.social-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.75rem;
  width: fit-content;
  max-width: 100%;
  margin-inline: auto 0;
}

.social-row-label {
  flex: 0 0 auto;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  white-space: nowrap;
}

.social-row-list {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.75rem;
  list-style: none;
}

.social-row-list li {
  display: flex;
  align-items: center;
  justify-content: center;
}

.social-link {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  color: var(--ink-2);
  text-decoration: none;
  cursor: default;
}

.social-link::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.social-link:hover { color: var(--ink); }

.social-icon,
.hero-tech-icon {
  opacity: calc(1 - var(--icon-mute) * 0.38);
  filter: saturate(calc(1 - var(--icon-mute) * 0.45)) grayscale(var(--icon-mute));
  transition: filter 0.15s, opacity 0.15s;
}

.social-icon {
  position: relative;
  z-index: 1;
  display: block;
  width: 1.1rem;
  height: 1.1rem;
  object-fit: contain;
  cursor: pointer;
}

.social-icon--github {
  background-color: currentColor;
  -webkit-mask: url('/icons/github.svg') center / contain no-repeat;
  mask: url('/icons/github.svg') center / contain no-repeat;
}

.social-link:hover .social-icon,
.hero-tech:hover .hero-tech-icon {
  filter: none;
  opacity: 1;
}

@media (prefers-color-scheme: dark) {
  .social-link[data-icon="github"] {
    color: color-mix(in srgb, var(--ink-2), white 100%);
  }

  .social-link:hover .social-icon {
    filter: none;
    opacity: 1;
  }
}

.status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4ade80;
  margin-right: 4px;
  vertical-align: 1px;
}

/* ─── hero ───────────────────────────────────────────────── */
.hero {
  position: relative;
  z-index: 1;
  isolation: isolate;
  margin-bottom: 1.5rem;
}

.hero-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.hero-main {
  position: relative;
  display: flex;
  flex-direction: column;
}

.hero-main > :not(.hero-pattern) {
  position: relative;
  z-index: 1;
}

.hero-main a {
  position: relative;
  z-index: 3;
}

.hero-pattern {
  position: absolute;
  right: 0;
  z-index: 2;
  width: var(--hero-grid-width);
  pointer-events: none;
  color: var(--ink-2);
  opacity: var(--hero-pattern-opacity);
  visibility: hidden;
}

.hero-pattern.is-ready {
  visibility: visible;
  pointer-events: auto;
  cursor: default;
}

.hero-dots {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--hero-dot-cols), var(--hero-dot-cell));
  grid-template-rows: repeat(var(--hero-grid-rows, 10), var(--hero-dot-cell));
  width: var(--hero-grid-width);
  height: 100%;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(to right, transparent 0%, rgba(0, 0, 0, 0.35) var(--hero-dot-mask-fade-at), #000 var(--hero-dot-mask-opaque-at));
  mask-image: linear-gradient(to right, transparent 0%, rgba(0, 0, 0, 0.35) var(--hero-dot-mask-fade-at), #000 var(--hero-dot-mask-opaque-at));
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}

.hero-dot {
  position: relative;
  display: block;
  place-self: center;
  width: var(--hero-dot-size);
  height: var(--hero-dot-size);
  aspect-ratio: 1;
  border-radius: 50%;
  background-color: currentColor;
  opacity: var(--hero-dot-opacity);
  transition:
    width var(--hero-dot-transition),
    height var(--hero-dot-transition),
    background-color var(--hero-dot-transition),
    opacity var(--hero-dot-transition);
}

.hero-dots.is-pulse-running .hero-dot:not(.is-hover-active) {
  transition:
    width var(--hero-dot-pulse-transition),
    height var(--hero-dot-pulse-transition),
    background-color var(--hero-dot-pulse-transition),
    opacity var(--hero-dot-pulse-transition);
}

.hero-dot.is-active {
  width: var(--hero-dot-active-size);
  height: var(--hero-dot-active-size);
  background-color: var(--hero-dot-active-color);
  opacity: var(--hero-dot-active-opacity);
}

.hero-dots.is-hover-running .hero-dot {
  transition:
    width var(--hero-dot-hover-transition),
    height var(--hero-dot-hover-transition),
    background-color var(--hero-dot-hover-transition),
    opacity var(--hero-dot-hover-transition);
}

.hero-dot.is-hover-active {
  width: var(--hero-dot-active-size);
  height: var(--hero-dot-active-size);
  background-color: var(--hero-hover-active-color);
  opacity: var(--hero-hover-active-opacity);
  transition:
    width var(--hero-dot-hover-transition),
    height var(--hero-dot-hover-transition),
    background-color var(--hero-dot-hover-transition),
    opacity var(--hero-dot-hover-transition);
}

.hero-dot.is-active.is-hover-active {
  background-color: var(--hero-hover-active-color);
  opacity: var(--hero-hover-active-opacity);
}

.hero-dash-svg,
.hero-hover-dash-svg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
}

.hero-dash {
  fill: none;
  stroke: var(--hero-dot-active-color);
  stroke-width: var(--hero-dot-dash-width);
  stroke-linecap: round;
  opacity: var(--hero-dot-active-opacity);
}

.hero-dash.is-trail {
  animation: hero-dash-trail-fade var(--hero-dot-trail-duration) ease-out forwards;
}

.hero-hover-dash {
  fill: none;
  stroke: var(--hero-hover-active-color);
  stroke-width: var(--hero-dot-dash-width);
  stroke-linecap: round;
  opacity: var(--hero-hover-active-opacity);
}

.hero-hover-dash.is-hover-trail {
  animation: hero-hover-trail-fade var(--hero-dot-trail-duration) ease-out forwards;
}

@keyframes hero-dash-trail-fade {
  from {
    opacity: var(--hero-dot-active-opacity);
  }

  to {
    opacity: 0;
  }
}

@keyframes hero-hover-trail-fade {
  from {
    opacity: var(--hero-hover-active-opacity);
  }

  to {
    opacity: 0;
  }
}

@media (prefers-color-scheme: dark) {
  .hero-pattern {
    color: var(--ink-2);
    opacity: 0.7;
  }
}

@media (max-width: 600px) {
  :root {
    --site-gutter: 1rem;
  }

  body {
    padding: 0 var(--site-gutter);
  }

  .site-header {
    padding-top: 1.5rem;
    gap: 0.5rem;
  }

  .nav-links {
    gap: 0.75rem;
  }

  .nav-links a {
    font-size: 11px;
  }

  .hero {
    margin-bottom: 1.25rem;
  }

  .hero-pattern {
    display: none;
  }

  .hero-body {
    max-width: none;
  }

  .social-row {
    width: 100%;
    margin-inline: 0;
  }

  .social-row-list {
    gap: 0.625rem;
  }
}

.hero-eyebrow {
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  text-transform: uppercase;
  margin-bottom: 1.25rem;
}

.hero-now {
  text-transform: none;
  letter-spacing: 0.02em;
}

.hero-now a {
  color: var(--ink-3);
  font-style: italic;
  text-decoration: underline;
  text-underline-offset: 0.15em;
  text-decoration-thickness: 1px;
  transition: color 0.15s;
}

.hero-now a:hover { color: var(--ink-2); }

.hero-title {
  font-family: var(--serif);
  font-size: clamp(26px, 1vw + 24px, 30px);
  font-weight: 400;
  line-height: 1.3;
  color: var(--ink);
  margin-bottom: 0.5rem;
}

.hero-title em { font-style: italic; }

.hero-body {
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.8;
  color: var(--ink);
  max-width: 52ch;
  margin-bottom: 1.25rem;
}

.hero-body:last-child {
  margin-bottom: 0;
}

.hero-body a {
  color: var(--ink-2);
  font-style: italic;
  text-decoration: underline;
  text-underline-offset: 0.15em;
  text-decoration-thickness: 1px;
  transition: color 0.15s;
}

.hero-body a:hover { color: var(--ink); }

.hero-tech {
  position: relative;
  display: inline;
}

.hero-tech::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8rem;
  height: 8rem;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.hero-tech-icon-wrap {
  display: inline-block;
  isolation: isolate;
  margin-right: 0.12em;
  vertical-align: -0.15em;
}

.hero-tech-icon {
  position: relative;
  z-index: 1;
  display: block;
  width: 1.1em;
  height: 1.1em;
  object-fit: contain;
}

/* ─── section ────────────────────────────────────────────── */
.section {
  margin-bottom: 2.5rem;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid var(--rule);
}

.section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.section-title {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.section-more {
  font-size: 11px;
  color: var(--ink-3);
  font-style: italic;
  text-decoration: underline;
  text-underline-offset: 0.15em;
  text-decoration-thickness: 1px;
  transition: color 0.15s;
}

.section-more:hover { color: var(--ink-2); }

/* ─── post list ──────────────────────────────────────────── */
.post-list { list-style: none; }

.post-item {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 0 1rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--rule);
}

.post-item:first-child { padding-top: 0; }
.post-item:last-child  { border-bottom: none; padding-bottom: 0; }

.post-date {
  font-size: 11px;
  color: var(--ink-3);
  padding-top: 2px;
}

.cv-list .post-item {
  grid-template-columns: 88px 1fr;
}

.cv-note {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-3);
  margin-top: 5px;
  line-height: 1.4;
}

.post-item-title {
  font-family: var(--serif);
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
  text-decoration: none;
  display: block;
  margin-bottom: 3px;
}

.post-item-title:hover { color: var(--link); }

.post-tags { display: flex; gap: 6px; flex-wrap: wrap; }

.tag {
  font-size: 10px;
  color: var(--ink-3);
  font-family: var(--mono);
}

/* ─── project list ───────────────────────────────────────── */
.project-list { list-style: none; }

.project-item {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 0 1rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--rule);
}

.project-date {
  display: flex;
  flex-direction: column;
  line-height: 1.35;
}

.project-item:first-child { padding-top: 0; }
.project-item:last-child  { border-bottom: none; padding-bottom: 0; }

.project-item-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.project-item-head .post-item-title {
  margin-bottom: 0;
  min-width: 0;
}

.project-item-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  flex: 0 1 auto;
}

.project-item-desc {
  font-family: var(--serif);
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-2);
  margin-top: 0.35rem;
}

/* ─── prose (post body) ──────────────────────────────────── */
.post {
  max-width: var(--measure);
}

.post-header { margin-bottom: 2.5rem; }

.post-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

time {
  font-size: 11px;
  color: var(--ink-3);
}

.post-title {
  font-family: var(--serif);
  font-size: clamp(20px, 4vw, 28px);
  font-weight: 400;
  line-height: 1.3;
  color: var(--ink);
  margin-bottom: 0.75rem;
}

.post-lede {
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink-2);
  font-style: italic;
}

.prose {
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.8;
  color: var(--ink-2);
}

.prose p     { margin-bottom: 1.25em; }
.prose h2    { font-family: var(--mono); font-size: 13px; font-weight: 500; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-3); margin: 2.5em 0 0.75em; }
.prose h3    { font-family: var(--serif); font-size: 17px; font-weight: 600; color: var(--ink); margin: 2em 0 0.5em; }
.prose a {
  color: var(--ink-3);
  font-style: italic;
  text-decoration: underline;
  text-underline-offset: 0.15em;
  text-decoration-thickness: 1px;
  transition: color 0.15s;
}

.prose a:hover { color: var(--ink-2); }
.prose code  { font-family: var(--mono); font-size: 13px; background: var(--rule); padding: 2px 5px; border-radius: 3px; color: var(--ink); }
.prose pre   { background: var(--rule); padding: 1.25rem; border-radius: 6px; overflow-x: auto; margin: 1.5em 0; }
.prose pre code { background: none; padding: 0; }
.prose blockquote { border-left: 2px solid var(--rule-strong); padding-left: 1rem; margin: 1.5em 0; font-style: italic; color: var(--ink-3); }
.prose ul, .prose ol { margin: 1em 0 1em 1.5em; }
.prose li    { margin-bottom: 0.4em; }
.prose hr    { border: none; border-top: 1px solid var(--rule); margin: 2.5em 0; }

.prose #emoji {
  display: inline-block;
  vertical-align: middle;
  width: 1.2em;
  height: 1.2em;
}

/* project page links */
.project-links { display: flex; gap: 1rem; margin-top: 1rem; flex-wrap: wrap; }

.project-link {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-3);
  font-style: italic;
  text-decoration: underline;
  text-underline-offset: 0.15em;
  text-decoration-thickness: 1px;
  transition: color 0.15s;
}

.project-link:hover { color: var(--ink-2); }

/* ─── index pages ────────────────────────────────────────── */
.page-header { margin-bottom: 2.5rem; }

.page-title {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 0.5rem;
}

.page-desc {
  font-family: var(--serif);
  font-size: 15px;
  color: var(--ink-2);
  line-height: 1.7;
}

/* post footer nav */
.post-footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  font-size: 12px;
}

.post-footer a { color: var(--ink-2); text-decoration: none; }
.post-footer a:hover { color: var(--link); }

/* ─── tag status variant ─────────────────────────────────── */
.tag--status { color: var(--ink); }

/* ─── media embeds (projects) ────────────────────────────── */
.media-embed {
  margin: 1.5em 0;
}

.media-embed--video {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--rule);
  border-radius: 6px;
  overflow: hidden;
}

.media-embed--video iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.media-embed--soundcloud {
  height: 166px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--rule);
}

.media-embed--soundcloud iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.media-video {
  display: block;
  width: 100%;
  max-width: 100%;
  border-radius: 6px;
  margin: 1.5em 0;
  background: var(--rule);
}

.media-figure {
  margin: 0;
}

.media-figure img {
  width: 100%;
  height: auto;
  border-radius: 6px;
  display: block;
}

.media-caption {
  margin-top: 0.5em;
  font-size: 13px;
  color: var(--ink-3);
  font-style: italic;
  text-align: center;
}

.media-row {
  display: grid;
  gap: 1rem;
  margin: 1.5em 0;
}

@media (min-width: 540px) {
  .media-row {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }

  .media-row--video {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  }
}

.prose .media-row + .media-caption,
.prose .media-embed + .media-caption {
  margin-top: -0.75em;
  margin-bottom: 1.5em;
}

.project-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 1.25em 0 1.75em;
}

.project-badge {
  display: inline-flex;
  line-height: 0;
  text-decoration: none;
  font-style: normal;
}

.project-badge img {
  display: block;
  height: 20px;
  width: auto;
  border-radius: 3px;
}

.prose .project-badges + .project-badges {
  margin-top: -1em;
}

/* ─── audio placeholder ──────────────────────────────────── */
.audio-embed {
  border: 1px dashed var(--rule-strong);
  border-radius: 6px;
  padding: 1.5rem;
  margin: 1.5em 0;
}

.audio-placeholder {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-3);
  text-align: center;
}

/* ─── accessibility ──────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 3px;
  border-radius: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .cursor { animation: none; opacity: 1; }
  * { scroll-behavior: auto !important; }
}
