:root {
  --bg: #f6f7f9;
  --text: #1b1f24;
  --muted: #5c6570;
  --tile-bg: #ffffff;
  --tile-border: #dde1e6;
  --overlay: rgba(27, 31, 36, 0.88);
  --overlay-text: #ffffff;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111418;
    --text: #e6e9ed;
    --muted: #9aa3ad;
    --tile-bg: #1a1f25;
    --tile-border: #2c333b;
    --overlay: rgba(230, 233, 237, 0.92);
    --overlay-text: #111418;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 24px 24px 48px;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Same header on every page; the current page's link is marked with
   aria-current so it can be highlighted without any script. */
.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 24px;
  max-width: 960px;
  margin: 0 auto 48px;
}

.site-header a {
  text-decoration: none;
}

.site-name {
  color: var(--text);
  font-size: 18px;
  font-weight: 600;
}

.site-header nav {
  display: flex;
  gap: 20px;
}

.site-header nav a {
  color: var(--muted);
  font-size: 15px;
}

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

.site-header nav a[aria-current="page"] {
  text-decoration: underline;
  text-underline-offset: 6px;
  text-decoration-thickness: 2px;
}

h1,
h2 {
  margin: 0 0 24px;
  font-size: 28px;
  font-weight: 600;
  text-align: center;
}

section + section {
  margin-top: 56px;
}

.section-intro {
  max-width: 640px;
  margin: -12px auto 20px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
  text-align: center;
}

.story {
  max-width: 640px;
  margin: 0 auto;
  line-height: 1.6;
}

.story p {
  margin: 0;
}

.story p + p {
  margin-top: 16px;
}

/* Name and short pitch at the top of the landing page. */
.intro {
  max-width: 640px;
  margin: 0 auto;
  line-height: 1.6;
  text-align: center;
}

.intro h1 {
  margin-bottom: 16px;
}

.intro p {
  margin: 0;
}

.intro p + p {
  margin-top: 12px;
}

.skills {
  margin: 0;
}

.skills dt {
  font-weight: 600;
}

.skills dd {
  margin: 2px 0 12px;
  color: var(--muted);
}

/* chapter headings inside the story, smaller than the page heading */
.story h2 {
  margin: 40px 0 12px;
  font-size: 18px;
  text-align: left;
}

.story h2:first-child {
  margin-top: 0;
}

.story .story-next {
  margin-top: 40px;
  color: var(--muted);
}

/* centered as a block, with the rows left-aligned so labels line up */
.contact {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: fit-content;
  margin: 0 auto;
  padding: 0;
  list-style: none;
}

.contact-label {
  display: inline-block;
  width: 5.5em;
  color: var(--muted);
}

/* Resume: a slightly wider column than the story, with a rule under each
   section heading like the printed version. */
.resume {
  max-width: 720px;
  margin: 0 auto;
  line-height: 1.55;
}

.resume p {
  margin: 0 0 12px;
}

.resume h2 {
  margin: 36px 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--tile-border);
  font-size: 20px;
  text-align: left;
}

.resume h3 {
  margin: 24px 0 2px;
  font-size: 17px;
}

.resume h4 {
  margin: 16px 0 6px;
  font-size: 15px;
  font-style: italic;
}

.resume ul {
  margin: 0;
  padding-left: 1.25em;
}

.resume li + li {
  margin-top: 6px;
}

.resume .resume-contact {
  color: var(--muted);
  text-align: center;
}

.resume .resume-meta {
  color: var(--muted);
  font-size: 14px;
}

.resume-lede {
  font-style: italic;
}

/* default link blue is hard to read on the dark background */
.intro a,
.story a,
.contact a,
.resume a,
.section-intro a {
  color: inherit;
  text-decoration-color: var(--muted);
  text-underline-offset: 2px;
}

.intro a:hover,
.story a:hover,
.contact a:hover,
.resume a:hover,
.section-intro a:hover {
  text-decoration-color: currentColor;
}

/* Projects page: one row per project, icon then name and summary, with
   its links on the right (below the text on narrow screens). */
.project-list {
  max-width: 800px;
  margin: 0 auto;
  padding: 0;
  list-style: none;
}

.project-row {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px;
  border: 1px solid var(--tile-border);
  border-radius: 12px;
  background: var(--tile-bg);
}

.project-row + .project-row {
  margin-top: 12px;
}

.project-icon {
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.project-icon-pixelated {
  image-rendering: pixelated;
}

/* solid black icons would vanish on the dark background */
@media (prefers-color-scheme: dark) {
  .project-icon-dark {
    filter: invert(1);
  }
}

.project-row-text {
  flex: 1;
  min-width: 0;
}

.project-row h2 {
  margin: 0 0 4px;
  font-size: 19px;
  text-align: left;
}

.project-row h2 a {
  color: inherit;
  text-decoration: none;
}

.project-row h2 a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.project-row p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
}

/* Each action keeps its own column, so launch, details and GitHub line up
   down the list even when a project is missing one. */
.project-row-links {
  display: grid;
  grid-template-columns: repeat(3, 104px);
  gap: 8px;
}

.project-row-links .button {
  justify-content: center;
  padding: 6px 10px;
  font-size: 14px;
}

.slot-launch {
  grid-column: 1;
}

.slot-details {
  grid-column: 2;
}

.slot-github {
  grid-column: 3;
}

@media (max-width: 640px) {
  .project-row {
    flex-wrap: wrap;
  }

  .project-row-text {
    flex-basis: calc(100% - 68px);
  }

  .project-row-links {
    flex-basis: 100%;
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Project detail pages: back link, name and tagline, launch/GitHub
   buttons, then the summary in the same column as the story. */
.project-back {
  max-width: 640px;
  margin: 0 auto 16px;
  font-size: 14px;
}

.project-back a {
  color: var(--muted);
  text-decoration: none;
}

.project-back a:hover {
  color: var(--text);
}

.project h1 {
  margin-bottom: 8px;
}

.project-tagline {
  margin: 0 0 20px;
  color: var(--muted);
  text-align: center;
}

.project-links {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 0 0 40px;
}

.button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: 1px solid var(--tile-border);
  border-radius: 8px;
  background: var(--tile-bg);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
}

.button:hover,
.button:focus-visible {
  background: var(--overlay);
  border-color: transparent;
  color: var(--overlay-text);
}

.button svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.story ul {
  margin: 12px 0 0;
  padding-left: 1.25em;
}

.story li + li {
  margin-top: 8px;
}

.story code {
  font-size: 0.9em;
}

/* Readable line length for the prose list, while the tiles below use the
   full width. */
.looking-for {
  max-width: 640px;
  margin: 0 auto;
  padding-left: 1.5em;
  line-height: 1.55;
}

.looking-for li + li {
  margin-top: 12px;
}

.looking-for li::marker {
  color: var(--muted);
  font-weight: 600;
}

/* Fixed-size tiles that wrap and stay centered, including a partly
   filled last row. */
.tiles {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tile {
  flex: 0 0 180px;
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--tile-border);
  border-radius: 12px;
  background: var(--tile-bg);
}

/* Faded app icon behind the tile's text, set per tile with --tile-image.
   Tiny pixel-art favicons also set --tile-image-rendering: pixelated so
   they scale up crisp instead of blurry. */
.tile::before {
  content: "";
  position: absolute;
  inset: 20%;
  background: var(--tile-image, none) center / contain no-repeat;
  image-rendering: var(--tile-image-rendering, auto);
  opacity: 0.15;
  pointer-events: none;
}

/* solid black icons would vanish on the dark background */
@media (prefers-color-scheme: dark) {
  .tile-icon-dark::before {
    filter: invert(1);
  }
}

.tile-face {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 100%;
  padding: 16px;
  text-align: center;
}

.tile-name {
  font-size: 22px;
  font-weight: 600;
}

.tile-desc {
  color: var(--muted);
  font-size: 13px;
}

/* Each action is a transparent link covering part of the tile; its label
   only appears while that part is hovered or focused. Tiles stack their
   actions top to bottom as launch, details, GitHub: public repos use three
   bands, private repos (no GitHub) and repo-only tiles (no launch) two. */
.tile-action {
  position: absolute;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--overlay-text);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  opacity: 0;
  background: var(--overlay);
  transition: opacity 120ms ease;
}

.tile-action:hover,
.tile-action:focus-visible {
  opacity: 1;
  outline: none;
}

.tile-launch {
  top: 0;
  bottom: 50%;
}

.tile-github {
  top: 50%;
  bottom: 0;
}

/* private repo: launch on top, details below */
.tile-private .tile-details-band {
  top: 50%;
  bottom: 0;
}

/* no live app: details on top, GitHub below */
.tile-repo-only .tile-details-band {
  top: 0;
  bottom: 50%;
}

.tile-action svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* Small corner hints for what a tile offers (launch, GitHub, or both),
   hidden while the tile itself is hovered or focused since the full
   labels take over then. */
.tile-badges {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 6px;
  color: var(--muted);
  transition: opacity 120ms ease;
  pointer-events: none;
}

.tile-badges svg {
  width: 13px;
  height: 13px;
  fill: currentColor;
}

.tile:hover .tile-badges,
.tile:focus-within .tile-badges {
  opacity: 0;
}

/* Phones: two tiles per row instead of one oversized column. */
@media (max-width: 440px) {
  .tile {
    flex-basis: calc(50% - 8px);
  }
}

/* Touch screens can't hover, so keep both actions faintly visible. */
@media (hover: none) {
  .tile-action {
    opacity: 0.55;
  }

  /* the labels are already showing */
  .tile-badges {
    display: none;
  }
}

/* Public repos: three equal bands, launch on top, details in the middle,
   GitHub on the bottom. */
.tile-three .tile-launch {
  bottom: 66.667%;
}

.tile-three .tile-details-band {
  top: 33.333%;
  bottom: 33.333%;
}

.tile-three .tile-github {
  top: 66.667%;
}
