:root {
  --space-1: 0.5rem;        /* ~8px */
  --space-2: 1rem;          /* ~16px */
  --space-3: 1.5rem;        /* ~24px */
  --space-4: 2rem;          /* ~32px */
  --space-6: 3rem;          /* ~48px */
  --page-padding: 4rem;     /* Desktop outer margins */
  --page-padding-mobile: 1.5rem;
  --max-width: 992px;

  --grid-gap: var(--space-3); /* vertical + horizontal gap */
}

/* ==========================
   Layout grid
========================== */

.page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-6) var(--page-padding);
  padding-top: 20px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  column-gap: var(--grid-gap);
  row-gap: var(--space-6);
}

.project {
  display: contents; /* children sit directly on the grid */
}

.project a { text-decoration: none; }
.project a:hover {  border-bottom: 0px solid }

.project-card a { text-decoration: none; }
.project-card a:hover { border-bottom: 0; }

.project-image {
  grid-column: 1 / span 7;
}

.project-image img {
  display: block;
  width: 100%;
  max-width: 400px;   /* plate-style on desktop */
  height: auto;
  margin-left: auto;  /* right-align within its column */
}

.project-text {
  grid-column: 8 / span 2;
}

/* margin utilities */
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }

.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }

/* ==========================
   Base typography
========================== */

body {
  margin: 0;
  font-family: "Inter", sans-serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.6;
}

p {
  font-family: "Inter", sans-serif;
  font-weight: 400;
  font-size: 1rem;
}

h1, h2, h3, h4, h5, h6,
p, ul, ol, blockquote, figure {
  margin-top: 0;
}

h1, h2 {


  font-family: "Inter", sans-serif;
  font-weight: 400;
  font-size: 1.2rem;
  letter-spacing: 0.05em;
  line-height: 1.3;
  display: inline-block;
  margin-bottom: 0;
  border-bottom: 1px solid black;
}

a {
  color: #444;
  text-decoration: underline;
}

a:hover { text-decoration: none; }

/* Treat the last line as metadata (year) */
.project-text p:last-child {
  font-weight: 500;
  font-size: 1rem;
  margin-top: 1rem;
  color:grey;
}

.wordmark {
  font-family: "Inter", sans-serif;
  font-weight: 300;
  font-size: 1.35rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  line-height: 1.3;
  display: inline-block;
  white-space: nowrap;
}

/* ==========================
   Info page
========================== */

.info-image {
  grid-column: 1 / span 4;
}

.info-image figure {
  margin: 0;
}

.info-image img {
  display: block;
  width: 100%;
  height: auto;
}

.info-content {
  grid-column: 5 / span 8;
  max-width: 60ch;
}

.info-content p {
  margin-bottom: 0.8rem;
}

/* ==========================
   Project layout (series pages)
========================== */

.project-layout {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  column-gap: var(--grid-gap);
  row-gap: var(--space-6);
}

/* Left rail: series names */
.series-rail {
  grid-column: 3 / span 2;
  align-self: start;
  position: sticky;
  top: 80px;
  font-size: 0.9rem;
  text-align: right;
}

.series-rail nav {
  display: block;
  padding: 0;
  margin: 0;
}

.series-rail nav a {
  display: block;
  text-decoration: none;
  font-weight: 500;
  color: #333;
  padding: 0.1rem 0;
  line-height: 1.5;
  margin-bottom: 0.15rem;
}

.series-rail nav a.is-active {
  font-weight: 700;
  text-decoration: none;
}

/* Main text column */
.series-content-main {
  grid-column: 5 / span 8;
  max-width: 40ch;
}

/* ==========================
   Landing page
========================== */

.work-intro {
  grid-column: 1 / -1;
  padding: 10px 0 0;
  text-align: center;
}

.work-intro p {
  line-height: 1.2;
  font-size: 35px;
  font-weight: 400;
  padding-top: 10px;  
}

.work-intro h1 {
  font-family: Garamond, "Adobe Garamond Pro", "Cormorant Garamond", Georgia, serif;
  text-decoration: none;
  border-bottom: 0;
  text-transform: none;
  padding-bottom: 0;
  font-size: 1.5rem;
  line-height: 1.2;
  letter-spacing: 0;
  color: black;
  display: block;
  max-width: none;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
  white-space: nowrap;
  text-wrap: balance;
}

.projects-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: calc(var(--space-6) + var(--space-1)) var(--space-4);
  align-items: start;
}

.projects-grid::after {
  content: "";
  grid-column: 1 / -1;
  order: 2;
  display: block;
  border-top: 1px solid #d8d8d8;
  margin-top: calc(-1 * var(--space-4));
  margin-bottom: 0.5rem;
}

.project-card {
  position: relative;
  display: grid;
  gap: var(--space-2);
  align-content: start;
}

.project-card-link {
  display: none;
}

.project-card:not(:first-child) {
  max-width: 30rem;
  order: 3;
  justify-self: center;
}

.project-card:first-child {
  grid-column: 1 / -1;
  grid-template-columns: minmax(0, 1.4fr) minmax(18rem, 1fr);
  column-gap: var(--space-4);
  align-items: center;
  margin-bottom: var(--space-2);
  padding: var(--space-4);
  background-color: #e9e9e9;
}

.project-card:first-child .project-card-link {
  display: block;
  position: absolute;
  inset: 0;
  z-index: 1;
}

.project-card:first-child .project-image,
.project-card:first-child .project-text {
  position: relative;
  z-index: 2;
}

.project-card .project-image,
.project-card .project-text {
  grid-column: auto;
}

.project-card .project-image img {
  width: 100%;
  max-width: 30rem;
  margin-left: 0;
}

.project-card .project-text {
  max-width: 34ch;
}

.project-card .project-text h2 {
  font-family: Garamond, "Adobe Garamond Pro", "Cormorant Garamond", Georgia, serif;
  font-size: 1.5rem;
  letter-spacing: 0;
  border-bottom: 0;
  margin-bottom: 0.75rem;
}

.project-card:first-child .project-image img {
  max-width: none;
}

.project-card:first-child .project-text {
  max-width: 30ch;
}


/* ==========================
   Navigation
========================== */

nav {
  position: relative;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  column-gap: var(--grid-gap);
  align-items: center;

  max-width: var(--max-width);
  margin: 0 auto;
  padding: 25px var(--page-padding) 10px var(--page-padding);
}

nav::after {
  content: "";
  position: absolute;
  left: 50%;
  width: 100vw;
  bottom: 0;
  border-top: 1px solid lightgrey;
  transform: translateX(-50%);
}

body:has(.project-layout) nav::after {
  display: none;
}

/* Left: name/logo block */
ul.logo {
  grid-column: 1 / span 4;
  list-style: none;
  padding: 0;
  margin: 0;
  text-align: left;
}

ul.logo li a {
  text-decoration: none;
  color: black;
}

ul.nav-menu {
  grid-column: 5 / span 3;
  list-style: none;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--space-2);
  padding: 0;
  margin: 0;
}

.nav-menu li {
  position: relative;
  font-size: 0.85rem;
}

.nav-menu a {
  display: block;
  font-family: "Inter", sans-serif;
  font-weight: 500;
  font-size: 0.9rem;
  letter-spacing: 0.1em;
  text-decoration: none;
  text-transform: uppercase;
}

.nav-menu li::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -13px;
  height: 1px;
  background: black;
  z-index: 1;
  opacity: 0;
}

.nav-menu li:hover::after,
.nav-menu li:focus-within::after {
  opacity: 1;
}


.nav-menu a:hover {
  text-decoration: none;
}

/* ==========================
   Footer
========================== */

footer {
  
  margin-top: 6rem;
  font-size: 0.9rem;
  line-height: 1.5;
}

/* ==========================
   MEDIA QUERIES
========================== */

@media (max-width: 980px) {
  .nav-menu li::after {
    bottom: -16px;
  }

  nav {
    display: block;
    padding: var(--space-3) var(--page-padding-mobile) var(--space-2);
    max-width: 100%;
    text-align: center;
  }

  ul.logo {
    margin: 0 0 var(--space-2) 0;
    text-align: center;
  }

  ul.nav-menu {
    justify-content: center;
    flex-direction: row;
    gap: var(--space-2);
  }
}

/* ---------- TABLET / SMALL LAPTOP (<= 800px) ---------- */
@media (max-width: 800px) {

  .page {
    padding: var(--space-4) var(--page-padding-mobile);
  }

  /* collapse 12-col into one column */
  .grid,
  .project-layout {
    grid-template-columns: 1fr;
    column-gap: 0;
  }

  /* nav becomes simpler block layout */
  nav {
    display: block;
    padding: var(--space-3) var(--page-padding-mobile) var(--space-2);
    max-width: 100%;
    text-align: center;
  }

  ul.logo {
    margin: 0 0 var(--space-2) 0;
    text-align: center;
  }

  ul.nav-menu {
    justify-content: center;
    flex-direction: row;
    gap: var(--space-2);
  }

  /* homepage hero */
  .work-intro {
    grid-column: 1 / -1;
    max-width: 50ch;
    padding: 0;
    margin-bottom: var(--space-5);
    margin-left: auto;
    margin-right: auto;
    text-align: center;
  }

  .work-intro h1 {
    max-width: 24ch;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
    white-space: normal;
  }

  .work-intro p {
    font-size: 2.4rem;
    line-height: 1.25;
    max-width: 28ch;
  }

  .projects-grid {
    grid-template-columns: 1fr;
    gap: var(--space-5);
  }

  .projects-grid::after {
    display: none;
  }

  .project-card:first-child {
    grid-column: auto;
    grid-template-columns: 1fr;
    column-gap: 0;
    margin-bottom: 0;
    width: 100%;
    max-width: none;
    justify-self: stretch;
    padding: 0;
    background: transparent;
  }

  .project-card:not(:first-child) {
    width: 100%;
    max-width: none;
    justify-self: stretch;
  }

  .project-card .project-image img {
    width: 100%;
    max-width: none;
  }

  /* project rows
     (homepage + series pages) */
  .project-image,
  .project-text {
    grid-column: 1 / -1;
  }

  .project-image img {
    margin-left: 0;
    max-width: 100%;
  }

  /* info page */
  .info-image,
  .info-content {
    grid-column: 1 / -1;
    padding: 0;
  }

  .info-image {
    margin-bottom: var(--space-3);
  }

  /* series layout */
  .series-rail,
  .series-content-main {
    grid-column: 1 / -1;
    position: static;
  }

  .series-rail {
    text-align: left;
    margin-bottom: var(--space-3);
  }

  .series-rail nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
  }

  .series-content-main {
    max-width: 100%;
    padding: 0;
  }

  footer {
    padding:0;
    text-align: left;
  }
}

/* ---------- PHONE (<= 675px) ---------- */
@media (max-width: 675px) {

  /* hero gets smaller / tighter */
  .work-intro {
    padding:0;
    margin-bottom: var(--space-5);
  }

  .work-intro p {
    font-size: 1.7rem;
    line-height: 1.25;
    max-width: 20ch;
    margin: 0;
  }

  /* nav: same structure, just tighter padding */
  nav {
    padding: var(--space-3) var(--page-padding-mobile) var(--space-2);
  }

  .series-rail {
    display: block;
    margin-bottom: 0.25rem;
    padding-top: 0.75rem;
    border-top: 1px solid #d8d8d8;
    text-align: left;
  }

  .series-rail nav {
    display: block;
    max-width: none;
    margin: 0;
    padding: 0;
    text-align: left;
  }

  .series-rail nav a {
    display: none;
  }

  .series-rail nav a.is-active {
    display: inline-block;
    font-size: 1.1rem;
    font-weight: 600;
    color: #111;
    text-decoration: none;
    margin-bottom: 0;
    text-align: left;
  }

  .series-content-main .project-intro {
    margin-top: 0;
  }

  /* images: full-width column */
  .project-image img,
  .info-image img {
    width: 100%;
    max-width: 100%;
    margin: 0;
  }

  .project-text,
  .info-content {
    padding: 0;
    max-width: 100%;
  }

  footer {
    font-size: 0.9rem;
    padding: 0;
    text-align: left;
  }
}
