/* ============================================================
   Material State — one typeface, one size, hairline rules.
   Hierarchy comes from italic, spacing and position, not from
   changing fonts or sizes. Mono is reserved for counters and
   contact details.
   ============================================================ */

:root {
  --stone: #edebe6;
  --ink: #1c201d;
  --ink-soft: #55594f;
  --accent: #6f2a35;
  --rule: #1c201d;
  --concrete-soft: #d8d5cd;

  --serif: "EB Garamond", "Iowan Old Style", Georgia, serif;
  --mono: "Courier Prime", "Courier New", monospace;

  --margin: 20px;
  --gutter: 20px;
  --page-max: 1920px;
  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 40px;
  --space-5: 64px;
  --space-6: 96px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  background: var(--stone);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.25;
  -webkit-font-smoothing: antialiased;
}

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

a { color: inherit; text-decoration: none; }

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

h1, h2, h3 { margin: 0; font-weight: 400; font-size: inherit; }

.mono {
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.2;
}

.container {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 var(--margin);
}

/* ---------------- Rules ---------------- */

.topline {
  display: flex;
  align-items: center;
  width: 100%;
  height: 1px;
  margin: var(--space-3) 0;
}

.topline__line {
  flex: 1 1 auto;
  height: 1px;
  background: var(--rule);
}

.divider {
  display: flex;
  align-items: center;
  width: 100%;
  height: 1px;
  margin: var(--space-5) 0;
}

.divider--quiet { margin: var(--space-4) 0; }

.divider__smooth {
  flex: 0 0 58%;
  height: 1px;
  background: var(--rule);
}

.divider__rough {
  flex: 1 1 auto;
  height: 1px;
  background-image: repeating-linear-gradient(90deg, var(--rule) 0, var(--rule) 3px, transparent 3px, transparent 9px);
}

/* ---------------- Header ---------------- */

/* The header holds the large name, the top line and the nav. Its wrapper keeps its place in the
   page while the header itself turns into a fixed bar that slides away on scroll down and
   returns on the first scroll up (see js/header.js). */
.site-top-wrap { position: relative; z-index: 100; }

.site-top { padding: var(--space-3) 0 var(--space-2); }

.site-top__name {
  display: block;
  width: 50%;
  text-align: center;
  font-size: min(32px, calc((100vw - 2 * var(--margin)) / 10.6));
  line-height: 1;
  white-space: nowrap;
}

.site-top .topline { margin: var(--space-3) 0; }

.site-top.is-fixed {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--stone);
  border-bottom: 1px solid var(--rule);
  transform: translateY(-100%);
  transition: transform 0.2s ease;
}

.site-top.is-fixed.is-visible { transform: translateY(0); }

.wordmark { white-space: nowrap; }

.site-nav {
  list-style: none;
  margin: 0;
  padding: 0;
}

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

.site-nav a[aria-current="page"],
.site-nav a:hover,
.site-nav a:focus-visible {
  font-style: italic;
}

/* Space between the header and the first line of page content. */
.index-grid,
.project-frame,
.info-frame { margin-top: var(--space-4); }

/* ---------------- Home frame ---------------- */

/* The home page is exactly one screen tall and never scrolls: header, framed images, footer. */
body.home {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

body.home .site-top-wrap,
body.home .site-footer { flex: none; }

.frame {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: minmax(0, 1fr);
  flex: 1 1 0;
  min-height: 0;
  margin: 0 var(--margin);
}

/* Runs up through the gap beneath the nav to meet the top line. */
.frame__rule {
  position: absolute;
  top: -80px;
  bottom: -16px;
  left: 50%;
  width: 1px;
  background: var(--rule);
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 1;
}

.frame__pane {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 14% 64px;
  min-width: 0;
  min-height: 0;
}

.frame__pane a { display: contents; }

.frame__pane img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  opacity: 0;
  transition: opacity 1.1s ease;
}

.frame__pane img.is-active { opacity: 1; }

.frame__caption {
  position: absolute;
  left: 0;
  bottom: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 24px;
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.2;
  color: var(--ink);
  transition: opacity 0.5s ease;
  z-index: 3;
}

.frame__caption.is-hidden { opacity: 0; }

/* Only added by script for visitors who prefer reduced motion. */
.frame__next {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.frame__next:hover,
.frame__next:focus-visible { color: var(--accent); }

@media (max-width: 860px) {
  .site-top { padding: var(--space-2) 0 12px; }
  .site-top__name { width: 100%; }
  .site-top .topline { margin: 14px 0; }
  /* Single pane: centre the image and caption in the space between the nav and the footer. */
  .frame {
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
    margin-top: var(--space-3);
  }
  .frame__rule { display: none; }
  .frame__pane { padding: 0; display: block; }
  .frame__pane--right { display: none; }
  /* One pane shows every project here, so hold a fixed frame and keep the caption from jumping. */
  .frame__pane img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }
  .frame__caption { position: static; margin-top: var(--space-2); }
}

/* ---------------- Projects index ---------------- */

.index-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  column-gap: var(--gutter);
  row-gap: var(--space-5);
  align-items: start;
  border-top: 1px solid var(--rule);
  padding-top: var(--space-2);
}

.index-item {
  grid-column: span 3;
  display: block;
}

.index-item--wide { grid-column: span 6; }

.index-item__title {
  font-style: italic;
  margin-bottom: var(--space-2);
}

.index-item:hover .index-item__title { color: var(--accent); }

.index-item img {
  width: 100%;
  height: auto;
  margin-bottom: var(--space-2);
  background: var(--concrete-soft);
}

.index-item__meta { color: var(--ink-soft); margin-bottom: 0.5em; }

@media (max-width: 1100px) {
  .index-item { grid-column: span 4; }
  .index-item--wide { grid-column: span 6; }
}

@media (max-width: 720px) {
  .index-item,
  .index-item--wide { grid-column: span 12; }
}

/* ---------------- Project page ---------------- */

.project-frame {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  column-gap: var(--gutter);
  border-top: 1px solid var(--rule);
  padding-top: var(--space-2);
  margin-bottom: var(--space-4);
}

/* The left column follows the reader down the page, so Back is always in reach. */
.project-frame__left {
  grid-column: 1 / 3;
  position: sticky;
  top: calc(var(--space-3) + var(--hdr-offset, 0px));
  transition: top 0.2s ease;
  align-self: start;
}

.project-frame__left .back-link { display: inline-block; margin-bottom: var(--space-4); }
.back-link:hover,
.back-link:focus-visible { font-style: italic; }

.project-title { font-style: italic; margin-bottom: 0.25em; }
.project-meta { font-size: 13px; color: var(--ink-soft); }

.project-photos {
  grid-column: 3 / 9;
  display: flex;
  flex-direction: column;
  gap: 14px;
  border-left: 1px solid var(--rule);
  border-right: 1px solid var(--rule);
  padding: 0 14px 14px;
  margin-top: calc(var(--space-2) * -1);
  padding-top: var(--space-2);
}

.project-photo { margin: 0; }
.project-photo img { width: 100%; height: auto; }

.project-photo figcaption {
  display: none;
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.2;
  color: var(--ink-soft);
}

.project-photo figcaption.is-note { display: block; }

.project-detail__sidebar { grid-column: 9 / 13; }

/* Location, awards and press share one smaller size so they stay on one line where possible. */
.project-detail__award {
  font-size: 13px;
  font-style: italic;
  color: var(--accent);
  margin-bottom: 4px;
}

.project-detail__award:has(+ .project-detail__essay) { margin-bottom: var(--space-3); }

.project-detail__essay p + p { margin-top: 1em; }

.project-credits {
  margin-top: var(--space-5);
  color: var(--ink-soft);
}

.project-credits p { margin: 0; }
.project-credits__role::after { content: ": "; }

/* Employer attribution: present, but as quiet as it can be. */
.project-credits .project-credits__firm {
  margin-top: var(--space-2);
  font-size: 13px;
  opacity: 0.75;
}

/* Previous / next project, at the foot of every project page. */
.project-nav {
  display: flex;
  justify-content: space-between;
  gap: var(--gutter);
  border-top: 1px solid var(--rule);
  padding-top: var(--space-2);
  margin-bottom: var(--space-3);
}

.project-nav__link {
  display: block;
  width: calc(50% - (var(--gutter) / 2));
  max-width: 280px;
}

.project-nav__link--next { margin-left: auto; text-align: right; }

.project-nav__link img {
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  background: var(--concrete-soft);
  margin-bottom: var(--space-1);
}

.project-nav__dir {
  display: flex;
  align-items: center;
  gap: 8px;
}

.project-nav__link--next .project-nav__dir { justify-content: flex-end; }

.project-nav__chevron { flex: 0 0 auto; }

.project-nav__title { display: block; font-style: italic; }

.project-nav__link:hover .project-nav__title,
.project-nav__link:hover .project-nav__dir,
.project-nav__link:focus-visible .project-nav__title,
.project-nav__link:focus-visible .project-nav__dir { color: var(--accent); }

@media (max-width: 860px) {
  .project-frame { display: block; margin-bottom: var(--space-4); }
  /* Stacked layout: lift the left column's children into the tall frame so Back can stay pinned. */
  .project-frame__left { display: contents; }
  .project-frame__left .back-link {
    position: sticky;
    top: var(--hdr-offset, 0px);
    transition: top 0.2s ease;
    z-index: 5;
    display: block;
    margin-bottom: 0;
    padding: 12px 0;
    background: var(--stone);
  }
  .project-title { margin-top: var(--space-2); }
  .project-meta { margin-bottom: var(--space-4); }
  .project-detail__sidebar { margin-bottom: var(--space-4); }
  .project-photos {
    border-left: none;
    border-right: none;
    padding: 0;
    margin-top: 0;
  }
}

/* ---------------- Info page ---------------- */

.info-frame {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  column-gap: var(--gutter);
  border-top: 1px solid var(--rule);
  padding-top: var(--space-2);
  margin-bottom: var(--space-6);
}

.info-frame__rules {
  grid-column: 3 / 9;
  border-left: 1px solid var(--rule);
  border-right: 1px solid var(--rule);
  margin-top: calc(var(--space-2) * -1);
  min-height: 420px;
}

.info-frame__text { grid-column: 9 / 13; }

.info-frame__text section { margin-bottom: var(--space-5); }
.info-frame__text section:last-child { margin-bottom: 0; }

.info-label { font-style: italic; margin-bottom: var(--space-1); }

.info-label a:hover,
.info-label a:focus-visible { color: var(--accent); }

.info-list { list-style: none; margin: 0; padding: 0; }
.info-list li { margin-bottom: var(--space-2); }
.info-list em { font-style: italic; }

.info-contact {
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.3;
}

.info-contact a:hover,
.info-contact a:focus-visible { font-style: italic; }

@media (max-width: 860px) {
  .info-frame { display: block; }
  .info-frame__rules { display: none; }
}

/* ---------------- Footer ---------------- */

.site-footer { padding: var(--space-2) 0 var(--space-4); }

.site-footer .divider { margin: 0 0 var(--space-3); }

.footer-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  color: var(--ink-soft);
}

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

.footer-row a:hover,
.footer-row a:focus-visible {
  font-style: italic;
  color: var(--ink);
}

.email-button {
  display: inline-block;
}

.email-button:hover,
.email-button:focus-visible {
  color: var(--accent);
}
