/* ---------- tokens ---------- */
:root {
  --paper: #f3ede1;
  --paper-deep: #ebe3d3;
  --ink: #221e19;
  --ink-soft: #5b5348;
  --ink-faint: #8c8374;
  --rule: #d8ccb7;
  --accent: #2f4a36;

  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;

  --measure: 44rem;
  --gutter: clamp(1.25rem, 5vw, 3rem);
}

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

html { scroll-behavior: smooth; }

body {
  position: relative;  /* the grain layer covers the whole page and scrolls with it */
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.1875rem;
  line-height: 1.6;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: color 0.15s, text-decoration-color 0.15s;
}
a:hover { color: var(--accent); text-decoration-color: currentColor; }

::selection { background: #cfd8c4; }

.wrap {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.label {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* ---------- nav ---------- */
.nav {
  position: fixed;
  inset: 0 0 auto;
  z-index: 60;  /* above the page grain, which would otherwise slide under the bar */
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}
.nav.scrolled { border-bottom-color: var(--rule); }
/* the bar stays put, so it gets its own grain that stays put with it */
.nav::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: url("images/grain.png");
  background-size: 240px 240px;
  opacity: 0.42;
}

.nav-inner {
  max-width: 64rem;
  margin: 0 auto;
  padding: 1rem var(--gutter);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.nav-name {
  font-size: 1.05rem;
  font-weight: 500;
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: clamp(0.9rem, 3vw, 1.75rem);
  list-style: none;
  margin: 0;
  padding: 0;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}
.nav-links a { text-decoration: none; color: var(--ink-soft); }
.nav-links a:hover,
.nav-links a[aria-current="page"] { color: var(--ink); }
.nav-links a[aria-current="page"] {
  text-decoration: underline;
  text-decoration-color: var(--accent);
}

/* ---------- hero ---------- */
.hero-stage { position: relative; overflow: hidden; background: var(--paper); }

/* Looping robot video. It is rendered on white, so multiply makes the white vanish into the paper. */
.robot {
  position: absolute;
  bottom: 0;
  /* starts where the hero text ends, and shrinks to fit the space that is left */
  left: calc(50% + 10rem);
  height: min(100%, 60rem, calc((50vw - 12rem) * 1.42));
  width: auto;
  aspect-ratio: 640 / 860;
  mix-blend-mode: multiply;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(to bottom, #000 82%, transparent 99%);
  mask-image: linear-gradient(to bottom, #000 82%, transparent 99%);
}
.robot-caption {
  position: absolute;
  right: var(--gutter);
  bottom: 1.25rem;
  margin: 0;
  font-size: 0.62rem;
  pointer-events: none;
}
.hero-stage .hero { position: relative; z-index: 1; }

/* film grain over the whole page; it scrolls with the content */
.grain {
  position: absolute;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  background: url("images/grain.png");
  background-size: 240px 240px;
  opacity: 0.42;
}

.hero {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-block: 4rem 6rem;
}

.hero h1 {
  font-size: clamp(2.75rem, 10vw, 4.75rem);
  font-weight: 400;
  white-space: nowrap;
  line-height: 1.02;
  letter-spacing: -0.025em;
  margin: 0 0 1.25rem;
}

.tagline {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  font-family: var(--mono);
  font-size: 0.85rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 1.5rem;
}
.tagline::before {
  content: "";
  width: 2.25rem;
  height: 1px;
  background: var(--accent);
}

.intro {
  font-size: 1.3rem;
  line-height: 1.55;
  color: var(--ink-soft);
  max-width: 36rem;
  margin: 0 0 2rem;
}
.intro em { color: var(--ink); }

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
  font-family: var(--mono);
  font-size: 0.8rem;
}
.links a { color: var(--ink-soft); }
.links a:hover { color: var(--accent); }

.scroll-cue {
  margin-top: 4.5rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  text-decoration: none;
}

/* ---------- sections ---------- */
.section { padding-block: 3rem 2rem; scroll-margin-top: 2.5rem; }

.section-head {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 2.25rem;
}
.section-head h2 {
  font-size: 2rem;
  font-weight: 400;
  font-style: italic;
  letter-spacing: -0.01em;
  margin: 0;
}
.section-head::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--rule);
  transform: translateY(-0.35rem);
}

/* ---------- entries (work + projects) ---------- */
.entry {
  padding-block: 2rem 2.5rem;
  border-top: 1px solid var(--rule);
}
.entry:first-of-type { border-top: 0; padding-top: 0; }

.entry-meta {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  margin-bottom: 0.35rem;
}

.entry h3 {
  font-size: 1.5rem;
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin: 0;
}
.entry h3 a { text-decoration: none; }
.entry h3 a:hover { text-decoration: underline; }

.entry-role {
  margin: 0.15rem 0 1rem;
  font-style: italic;
  color: var(--ink-soft);
}

.entry p { margin: 0 0 1rem; }
.entry .summary { color: var(--ink-soft); margin-bottom: 1.25rem; }
.entry .award {
  margin: 0.35rem 0 0.9rem;
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}
.entry h3 + .summary { margin-top: 0.6rem; }

.entry ul {
  margin: 0 0 1.25rem;
  padding: 0;
  list-style: none;
}
.entry li {
  position: relative;
  padding-left: 1.25rem;
  margin-bottom: 0.55rem;
  color: var(--ink-soft);
}
.entry li::before {
  content: "–";
  position: absolute;
  left: 0;
  color: var(--ink-faint);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem;
}
.tags li {
  padding: 0.1rem 0.55rem;
  margin: 0;
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--ink-soft);
}
.tags li::before { content: none; }
.tags li.tag-accent { border-color: var(--accent); color: var(--accent); }

/* ---------- photos ---------- */
.photos {
  display: grid;
  gap: 0.75rem;
  margin: 0;
}
.photos.two { grid-template-columns: 1.55fr 1fr; }
/* photos shown whole: column widths (set inline) follow each image's aspect ratio, so heights match */
.photos.fit .shot { height: auto; }
.photos.fit .shot img { height: auto; }

.shot {
  margin: 0;
  height: clamp(14rem, 32vw, 18rem);
  overflow: hidden;
  border-radius: 3px;
  background: var(--paper-deep);
}
.shot img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease;
}
.shot:hover img { transform: scale(1.02); }

/* shown automatically when an image file is missing (see main.js) */
.shot.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border: 1px dashed var(--rule);
  background: transparent;
  text-align: center;
  padding: 1rem;
}
.shot.empty span {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--ink-faint);
  word-break: break-all;
}

/* ---------- skills ---------- */
.skills {
  display: grid;
  grid-template-columns: 11rem 1fr;
  gap: 0.9rem 1.5rem;
  margin: 0;
}
.skills dt { padding-top: 0.3rem; }
.skills dd { margin: 0; color: var(--ink-soft); }

/* ---------- landing ---------- */
.now {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0;
  list-style: none;
  margin: 0 0 2rem;
  padding: 0;
  font-size: 1.15rem;
  color: var(--ink-soft);
}
.now li + li::before {
  content: "·";
  margin: 0 0.7rem;
  color: var(--ink-faint);
}
.now .at { color: var(--accent); margin: 0 0.1em; }
.now a { color: var(--ink); }

/* ---------- about ---------- */
.about-text p {
  font-size: 1.25rem;
  line-height: 1.6;
  margin: 0 0 1.75rem;
}

/* ---------- footer ---------- */
.footer {
  margin-top: 3rem;
  padding-block: 2rem 3rem;
}
.footer .label { margin: 0; }

/* ---------- reveal ---------- */
.reveal { opacity: 0; transform: translateY(12px); transition: opacity 0.7s ease, transform 0.7s ease; }
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .shot img { transition: none; }
}

/* ---------- small screens ---------- */
@media (max-width: 900px) {
  /* no room beside the text: the robot sits behind it, faded */
  .robot {
    left: 50%;
    transform: translateX(-42%);
    height: 88%;
    opacity: 0.3;
  }
}

@media (max-width: 640px) {
  body { font-size: 1.0625rem; }
  .nav-name { font-size: 0.95rem; }
  .nav-links { font-size: 0.72rem; }
  .intro { font-size: 1.15rem; }
  .photos.two { grid-template-columns: 1fr; }
  .photos.fit { grid-template-columns: 1fr !important; }
  .shot { height: 15rem; }
  .skills { grid-template-columns: 1fr; gap: 0.2rem; }
  .skills dd { margin-bottom: 0.9rem; }
  .now { font-size: 1.05rem; flex-direction: column; }
  .now li + li::before { content: none; }
}
