/* Name heading font: EB Garamond (SIL Open Font License) */
@font-face {
  font-family: "EB Garamond";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/eb-garamond-400.woff2") format("woff2");
}

:root {
  --bg: #f7f5f0;
  --ink: #26231f;
  --muted: #776f66;
  --rule: #dcd6cc;
  --accent: #7a4b2a;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --row: 260px;
  --gap: 28px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.6;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration-color: var(--rule); text-underline-offset: 3px; }
a:hover { color: var(--accent); text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* header */
.site-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  padding: 36px clamp(20px, 5vw, 64px) 24px;
}
.site-name {
  font-family: "EB Garamond", Garamond, var(--serif);
  font-size: 36px;
  letter-spacing: 0.01em;
  line-height: 1.2;
  text-decoration: none;
}
.site-header nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 22px;
}
.site-header nav a {
  font-size: 14px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--muted);
}
.site-header nav a:hover,
.site-header nav a[aria-current="page"] { color: var(--ink); }
.site-header nav a[aria-current="page"] { border-bottom: 1px solid var(--ink); }
.menu-toggle { display: none; }

main { padding: 0 clamp(20px, 5vw, 64px) 64px; }

.page-title {
  font-weight: normal;
  font-size: 15px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 16px 0 32px;
}
.intro { max-width: 40em; margin: -16px 0 32px; color: var(--muted); }

/* home */
.home {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: clamp(32px, 5vw, 80px);
  align-items: start;
  margin-top: 16px;
}
.home-image { margin: 0; }
.home-image img { width: 100%; }
.home-image figcaption, .home figcaption { font-size: 14px; color: var(--muted); margin-top: 12px; }
.home-text { max-width: 34em; }
.home-text p { margin: 0 0 1.1em; }
.epigraph { font-style: italic; }
.epigraph span { font-style: normal; color: var(--muted); margin-left: .4em; }
.home-text h2 {
  font-weight: normal;
  font-size: 14px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 2.4em 0 .8em;
}
.writing { list-style: none; padding: 0; margin: 0; font-size: 16px; }
.writing li { margin-bottom: .9em; }

.section-index {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 20px;
  margin-top: 72px;
  padding-top: 32px;
  border-top: 1px solid var(--rule);
}
.section-card { text-decoration: none; }
.section-card img { aspect-ratio: 1; object-fit: cover; width: 100%; filter: saturate(.92); transition: filter .2s; }
.section-card:hover img { filter: none; }
.section-card span {
  display: block;
  margin-top: 10px;
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* gallery: justified rows, each item sized by its aspect ratio */
.gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 40px var(--gap);
}
.gallery::after { content: ""; flex-grow: 999; }
.work {
  margin: 0;
  flex-grow: var(--ar);
  flex-basis: calc(var(--ar) * var(--row));
  min-width: 0;
}
.work a { display: block; cursor: zoom-in; }
.work img { width: 100%; aspect-ratio: var(--ar); object-fit: cover; background: #ebe7df; }
.work figcaption { margin-top: 10px; font-size: 14px; line-height: 1.4; }
.cap-title { display: block; }
.cap-meta, .cap-note { display: block; color: var(--muted); font-size: 13px; }
.work .cap-meta, .work .cap-note { display: none; }

/* lightbox */
.lightbox {
  border: 0;
  padding: 0;
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  background: rgba(247, 245, 240, .98);
  color: var(--ink);
}
.lightbox::backdrop { background: rgba(247, 245, 240, .98); }
.lightbox[open] { display: grid; grid-template-columns: 64px 1fr 64px; align-items: center; }
.lightbox figure {
  margin: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 0 24px;
  min-width: 0;
}
.lightbox img { max-height: calc(100vh - 170px); width: auto; max-width: 100%; object-fit: contain; }
.lightbox figcaption { text-align: center; margin-top: 18px; font-size: 15px; line-height: 1.45; }
.lightbox figcaption .cap-title { font-style: italic; }
.lightbox button {
  background: none;
  border: 0;
  font: inherit;
  color: var(--muted);
  cursor: pointer;
  font-size: 40px;
  line-height: 1;
  padding: 16px;
}
.lightbox button:hover { color: var(--ink); }
.lb-close { position: absolute; top: 12px; right: 16px; font-size: 36px; }

/* contact */
.contact { max-width: 36em; }
.contact .email { font-size: 22px; }
.contact h2 {
  font-weight: normal;
  font-size: 14px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 3em 0 1em;
}
.contact-form label { display: block; margin-bottom: 18px; font-size: 15px; color: var(--muted); }
.contact-form input,
.contact-form textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  font: inherit;
  font-size: 17px;
  color: var(--ink);
  background: #fffdf9;
  border: 1px solid var(--rule);
  border-radius: 2px;
}
.contact-form input:focus,
.contact-form textarea:focus { border-color: var(--muted); outline: none; }
.contact-form button {
  font: inherit;
  font-size: 14px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 10px 28px;
  background: var(--ink);
  color: var(--bg);
  border: 0;
  border-radius: 2px;
  cursor: pointer;
}
.contact-form button:hover { background: var(--accent); }
.hp { position: absolute; left: -9999px; }

.site-footer {
  padding: 24px clamp(20px, 5vw, 64px) 40px;
  font-size: 13px;
  color: var(--muted);
}

/* small screens */
@media (max-width: 820px) {
  body { font-size: 17px; }
  :root { --row: 160px; --gap: 16px; }
  .site-header { align-items: center; padding-top: 24px; }
  .site-name { font-size: 24px; }
  .menu-toggle {
    display: block;
    background: none;
    border: 1px solid var(--rule);
    font: inherit;
    font-size: 13px;
    letter-spacing: .14em;
    text-transform: uppercase;
    padding: 6px 12px;
    color: var(--ink);
  }
  .site-header nav { display: none; width: 100%; }
  .site-header nav.open { display: block; }
  .site-header nav ul { flex-direction: column; gap: 12px; padding: 8px 0; }
  .home { grid-template-columns: 1fr; }
  .section-index { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lightbox[open] { grid-template-columns: 40px 1fr 40px; }
  .lightbox button { padding: 6px; font-size: 32px; }
}
@media (max-width: 480px) {
  .work { flex-basis: 100%; }
}
