/* --- tokens ------------------------------------------------------------ */
:root {
  --bg:        #faf9f7;
  --surface:   #ffffff;
  --ink:       #1c1a17;
  --ink-soft:  #6b655c;
  --line:      #e3ded6;
  --accent:    #8a6a3f;
  --shadow:    0 1px 2px rgba(28,26,23,.06), 0 8px 24px rgba(28,26,23,.06);
  --radius:    3px;
  --serif:     "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans:      -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

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

a { color: inherit; }

.wrap { max-width: 1240px; margin: 0 auto; padding: 0 24px; }

/* --- masthead ---------------------------------------------------------- */
.masthead {
  padding: 56px 0 36px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 40px;
  text-align: center;
}
.masthead h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2rem, 5vw, 3.1rem);
  letter-spacing: .01em;
  margin: 0;
}
.masthead h1 a { text-decoration: none; }
.masthead p {
  margin: 10px 0 0;
  color: var(--ink-soft);
  font-size: .95rem;
  letter-spacing: .09em;
  text-transform: uppercase;
}

/* --- gallery grid ------------------------------------------------------ */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 40px 28px;
  padding-bottom: 72px;
}
.card { text-decoration: none; display: block; }
.card-frame {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  transition: transform .22s ease, box-shadow .22s ease;
}
.card:hover .card-frame {
  transform: translateY(-3px);
  box-shadow: 0 2px 4px rgba(28,26,23,.08), 0 16px 36px rgba(28,26,23,.12);
}
.card-frame img {
  max-width: 100%;
  max-height: 100%;
  display: block;
  object-fit: contain;
}
.card h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.02rem;
  margin: 14px 0 2px;
  line-height: 1.35;
}
.card .meta { color: var(--ink-soft); font-size: .84rem; margin: 0; }

/* --- detail page ------------------------------------------------------- */
.back-link {
  display: inline-block;
  margin-bottom: 28px;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: .9rem;
}
.back-link:hover { color: var(--accent); }

.detail { display: grid; grid-template-columns: minmax(0,1.9fr) minmax(0,1fr); gap: 48px; padding-bottom: 80px; }

.stage {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 380px;
}
.stage img { max-width: 100%; max-height: 74vh; display: block; }

.thumbs { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.thumbs button {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 5px;
  cursor: pointer;
  width: 94px;
  font: inherit;
  transition: border-color .18s ease;
}
.thumbs button img { width: 100%; height: 58px; object-fit: contain; display: block; }
.thumbs button span {
  display: block;
  font-size: .66rem;
  color: var(--ink-soft);
  margin-top: 4px;
  letter-spacing: .04em;
  text-transform: uppercase;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.thumbs button[aria-current="true"] { border-color: var(--accent); }

.detail h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  margin: 0 0 20px;
  line-height: 1.25;
}
.facts { border-top: 1px solid var(--line); margin: 0; }
.facts div {
  display: flex;
  gap: 16px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  font-size: .93rem;
}
.facts dt {
  color: var(--ink-soft);
  min-width: 104px;
  letter-spacing: .05em;
  text-transform: uppercase;
  font-size: .74rem;
  padding-top: 3px;
}
.facts dd { margin: 0; }
.note { margin-top: 24px; color: var(--ink-soft); font-size: .95rem; }

.empty { text-align: center; padding: 80px 20px; color: var(--ink-soft); }
.empty code {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 2px 7px;
  border-radius: var(--radius);
}

footer {
  border-top: 1px solid var(--line);
  padding: 28px 0 40px;
  color: var(--ink-soft);
  font-size: .84rem;
  text-align: center;
}
footer a { color: var(--ink-soft); }

@media (max-width: 860px) {
  .detail { grid-template-columns: 1fr; gap: 24px; }
  .masthead { padding: 30px 0 20px; margin-bottom: 24px; }
  .grid { gap: 30px 18px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }

  /* A tall frame around a landscape painting is mostly empty space on a
     phone, so let the frame follow the image instead. */
  .stage { min-height: 0; padding: 12px; }
  .stage img { max-height: 60vh; }

  .thumbs { gap: 8px; }
  .thumbs button { width: 84px; }
}

/* --- site navigation ---------------------------------------------------- */
.sitenav {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px 26px;
  margin-top: 20px;
}
.sitenav a {
  text-decoration: none;
  font-size: .84rem;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
}
.sitenav a:hover { color: var(--ink); border-bottom-color: var(--accent); }

/* --- welcome page ------------------------------------------------------- */
.welcome {
  display: grid;
  grid-template-columns: minmax(0,1.15fr) minmax(0,1fr);
  gap: 56px;
  align-items: center;
  padding: 18px 0 64px;
}
.welcome.nohero { grid-template-columns: 1fr; max-width: 640px; margin: 0 auto; text-align: center; }
.welcome-img {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.welcome-img img { width: 100%; display: block; max-height: 68vh; object-fit: contain; }
.welcome-text h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.9rem, 4vw, 2.8rem);
  line-height: 1.18;
  margin: 0 0 20px;
}
.prose p { margin: 0 0 15px; font-size: 1.02rem; line-height: 1.72; color: #3a3630; }
.prose p:last-child { margin-bottom: 0; }

.cta {
  display: inline-block;
  background: var(--ink);
  color: #fff;
  text-decoration: none;
  padding: 11px 26px;
  border-radius: var(--radius);
  font-size: .88rem;
  letter-spacing: .07em;
  text-transform: uppercase;
  border: 1px solid var(--ink);
}
.cta:hover { background: #000; }
.cta.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.cta.ghost:hover { background: #f0ede8; }

/* --- sections and category tiles ---------------------------------------- */
.section { padding: 46px 0; border-top: 1px solid var(--line); }
.sectionhead {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.05rem;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-align: center;
  margin: 0 0 34px;
}
.cats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 36px 26px;
}
.cat { text-decoration: none; display: block; }
.cat-frame {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: transform .22s ease, box-shadow .22s ease;
}
.cat:hover .cat-frame {
  transform: translateY(-3px);
  box-shadow: 0 2px 4px rgba(28,26,23,.08), 0 16px 36px rgba(28,26,23,.12);
}
.cat-frame img { max-width: 100%; max-height: 100%; object-fit: contain; }
.cat h3 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.14rem;
  margin: 15px 0 2px;
}
.cat .meta { color: var(--ink-soft); font-size: .84rem; margin: 0; }

/* --- category welcome --------------------------------------------------- */
.catwelcome {
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(0,1.05fr);
  gap: 48px;
  align-items: center;
  padding: 10px 0 54px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 44px;
}
.catwelcome-img {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.catwelcome-img img { width: 100%; display: block; max-height: 54vh; object-fit: contain; }
.catwelcome-text .count { margin-top: 20px; }
.catwelcome-text h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.7rem, 3.4vw, 2.4rem);
  margin: 0 0 18px;
  line-height: 1.2;
}

.pagehead { padding: 4px 0 30px; }
.pagehead h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  margin: 0 0 4px;
}
.count { color: var(--ink-soft); font-size: .88rem; margin: 0; }
.footnote { margin: 0 0 10px; color: var(--ink-soft); }

@media (max-width: 860px) {
  .welcome, .catwelcome { grid-template-columns: 1fr; gap: 28px; padding-bottom: 34px; }
  .welcome { text-align: left; }
  .section { padding: 32px 0; }
}

/* --- mobile overrides -----------------------------------------------------
   These come last on purpose: they have to outrank the base rules defined
   further up the file, which share their specificity. */
@media (max-width: 860px) {
  /* One swipeable row beats five stacked lines above the fold. */
  .sitenav {
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 20px;
    margin: 16px -24px 0;
    padding: 0 24px 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .sitenav::-webkit-scrollbar { display: none; }
  .sitenav a { white-space: nowrap; font-size: .78rem; }
}
