:root {
  color-scheme: light dark;
  --background: #f5f5f3;
  --surface: #ffffff;
  --text: #171717;
  --muted: #666;
  --border: #d8d8d4;
  --max-width: 980px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #111;
    --surface: #181818;
    --text: #f2f2f2;
    --muted: #a0a0a0;
    --border: #303030;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.55;
}
a { color: inherit; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 18px max(20px, calc((100vw - var(--max-width)) / 2));
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--background) 94%, transparent);
  backdrop-filter: blur(8px);
}

.site-title {
  font-weight: 700;
  text-decoration: none;
}
nav { display: flex; flex-wrap: wrap; gap: 18px; }
nav a { text-decoration: none; color: var(--muted); }
nav a:hover { color: var(--text); }

main {
  width: min(var(--max-width), calc(100% - 40px));
  margin: 0 auto;
}

section {
  padding: 72px 0;
  border-bottom: 1px solid var(--border);
}

.intro { padding: 110px 0 90px; max-width: 720px; }
.intro h1 { margin: 8px 0 16px; font-size: clamp(2.7rem, 8vw, 5.6rem); line-height: .98; letter-spacing: -.055em; }
.intro p:last-child { max-width: 620px; font-size: 1.1rem; color: var(--muted); }
.eyebrow { margin: 0; color: var(--muted); font-size: .86rem; text-transform: uppercase; letter-spacing: .1em; }

.section-heading { margin-bottom: 28px; }
.section-heading h2 { margin: 0 0 6px; font-size: 1.8rem; }
.section-heading p { margin: 0; color: var(--muted); }

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
}
.gallery-item {
  margin: 0;
  border: 1px solid var(--border);
  background: var(--surface);
}
.gallery-item img,
.gallery-item video {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #000;
}
.gallery-item figcaption { padding: 14px; }
.gallery-item strong { display: block; margin-bottom: 3px; }
.gallery-item p { margin: 0; color: var(--muted); font-size: .94rem; }

.item-list { border-top: 1px solid var(--border); }
.content-item {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: start;
  padding: 20px 0;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: none;
  color: inherit;
  text-align: left;
  cursor: pointer;
  font: inherit;
}
.content-item:hover .item-title { text-decoration: underline; }
.item-title { display: block; font-weight: 700; font-size: 1.05rem; }
.item-summary { display: block; margin-top: 5px; color: var(--muted); }
.item-date { color: var(--muted); white-space: nowrap; font-size: .9rem; }

.about-card { max-width: 680px; }
.about-card p:first-child { margin-top: 0; }
.about-card p { color: var(--muted); }

footer {
  width: min(var(--max-width), calc(100% - 40px));
  margin: 0 auto;
  padding: 30px 0 60px;
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: .9rem;
}

.empty { color: var(--muted); }

#content-dialog {
  width: min(720px, calc(100% - 28px));
  max-height: 85vh;
  padding: 0;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}
#content-dialog::backdrop { background: rgba(0,0,0,.6); }
#dialog-content { padding: 34px; overflow-wrap: anywhere; }
#dialog-content h1 { margin-top: 0; line-height: 1.1; }
#dialog-content .meta { color: var(--muted); margin-top: -8px; }
#dialog-content img { max-width: 100%; height: auto; }
.dialog-close {
  position: sticky;
  float: right;
  top: 10px;
  margin: 10px 10px 0 0;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 1.4rem;
  cursor: pointer;
}

@media (max-width: 640px) {
  .site-header { align-items: flex-start; flex-direction: column; gap: 10px; }
  nav { gap: 14px; font-size: .94rem; }
  section { padding: 54px 0; }
  .intro { padding-top: 70px; }
  .content-item { grid-template-columns: 1fr; gap: 7px; }
}


html {
  scroll-behavior: smooth;
  scroll-padding-top: 6rem;
}

body {
  min-width: 0;
  overflow-x: hidden;
}

section {
  scroll-margin-top: 6rem;
}

/*
  Gives the last section enough room to scroll close to the top.
*/


.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
}

.site-title {
  min-width: 0;
}

/*
  Prevents gallery items and long file names from widening the page.
*/
.gallery-grid,
.item-list,
.about-card,
section,
main {
  min-width: 0;
}

.gallery-item img,
.gallery-item video,
#dialog-content img,
#dialog-content video {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
}

.item-title,
.item-summary,
.gallery-item p,
.about-card p {
  overflow-wrap: anywhere;
}

/* Mobile layout */
@media (max-width: 700px) {
  html {
    scroll-padding-top: 8rem;
  }

  section {
    scroll-margin-top: 8rem;
  }

  .site-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.75rem;
  }

  .site-header nav {
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 0.25rem;
    scrollbar-width: thin;
  }

  .site-header nav a {
    flex: 0 0 auto;
    white-space: nowrap;
  }


  .intro h1 {
    font-size: clamp(2rem, 10vw, 3.5rem);
  }

  .gallery-grid {
    grid-template-columns: 1fr;
  }

  .content-item {
    align-items: flex-start;
    flex-direction: column;
  }

  dialog {
    width: calc(100% - 1.5rem);
    max-width: none;
    max-height: calc(100vh - 1.5rem);
  }
}
