:root {
  --bg: #f4f1eb;
  --text: #1a1a1a;
  --accent: #b89c5a;
  --surface: #f9f6f1;
  --line: #d9d1c2;
  --muted: #5f5a50;
  --radius: 14px;
  --ease: 220ms ease;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  line-height: 1.55;
  letter-spacing: 0.01em;
}

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

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

h1,
h2,
h3,
.brand,
.detail-title {
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.site-shell {
  width: min(1120px, 92vw);
  margin: 0 auto;
}

.site-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 1.3rem 0 0.5rem;
}

.index-header {
  background: #d9d2c4;
  border-bottom: 1px solid #c7bda9;
  border-radius: 0;
  padding: 1rem 4vw 0.85rem;
  margin: 0;
  width: 100%;
}

.brand {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.top-nav {
  display: flex;
  gap: 0.45rem;
}

.top-nav a {
  font-size: 0.86rem;
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0.5rem 0.72rem;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  transition: border-color var(--ease), color var(--ease), background-color var(--ease);
}

.top-nav a:hover,
.top-nav a.active {
  border-color: var(--accent);
  color: var(--text);
  background: #f3ecdf;
}

.hero {
  margin-top: 1.3rem;
  margin-bottom: 2.1rem;
  text-align: center;
  display: grid;
  justify-items: center;
  gap: 1rem;
}

.index-page .hero {
  margin-top: 1.4rem;
}

.hero-copy {
  max-width: 760px;
}

.hero-copy h1 {
  margin: 0;
  font-size: clamp(1.8rem, 6.4vw, 3.1rem);
  line-height: 1.04;
}

.hero-intro {
  margin: 1rem auto 0;
  font-size: clamp(0.94rem, 2.5vw, 1.08rem);
  color: var(--muted);
  max-width: 62ch;
}

.exhibition-info {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.info-item {
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--line);
}

.info-item:last-child {
  border-bottom: 0;
}

.info-label {
  display: block;
  font-size: 0.74rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.15rem;
}

.info-value {
  font-size: 0.98rem;
}

.map-button {
  display: inline-block;
  margin-top: 0.42rem;
  padding: 0.12rem 0.4rem;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 0.76rem;
  color: var(--muted);
  transition: border-color var(--ease), color var(--ease), background-color var(--ease);
}

.map-button:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: #f7f1e6;
}

.button-link {
  display: inline-block;
  margin-top: 0.4rem;
  border: 1px solid var(--text);
  border-radius: 10px;
  padding: 0.28rem 0.62rem;
  min-height: 0;
  font-size: 0.88rem;
  transition: border-color var(--ease), color var(--ease), background-color var(--ease);
}

.button-link:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: #f8f1e2;
}

.section-title {
  margin: 2.2rem 0 0.8rem;
  font-size: 0.9rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

.painting-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  padding-bottom: 2.5rem;
}

.painting-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8f5ef;
  padding: 0.68rem;
  transition: transform var(--ease), border-color var(--ease), box-shadow var(--ease);
}

.painting-card img {
  aspect-ratio: 1 / 1;
  width: 100%;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid #e2d9c8;
  height: auto;
}

.painting-card h3 {
  margin: 0.65rem 0 0.15rem;
  font-size: 1.08rem;
  line-height: 1.16;
}

.painting-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.89rem;
}

.painting-card:hover {
  transform: translateY(-2px);
  border-color: #cdb47b;
  box-shadow: 0 14px 26px rgba(60, 45, 22, 0.08);
}

.painting-card.is-loading {
  pointer-events: none;
}

.card-media-placeholder {
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  border: 1px solid #e2d9c8;
  background: linear-gradient(90deg, #ece3d3 0%, #f7f1e6 50%, #ece3d3 100%);
  background-size: 220% 100%;
  animation: shimmer 1.6s linear infinite;
}

.grid-feedback {
  margin: 0.6rem 0 2.2rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.is-hidden {
  display: none !important;
}

.poster-main {
  min-height: calc(100svh - 130px);
  display: grid;
  place-items: center;
  padding: 1.2rem 0 2rem;
}

.poster-panel {
  width: min(700px, 100%);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f9f6f1;
  padding: 1.2rem;
  text-align: center;
}

.poster-panel h1 {
  margin-top: 0;
  margin-bottom: 0.4rem;
  font-size: clamp(1.6rem, 6vw, 2.5rem);
}

.poster-panel p {
  margin: 0 auto;
  max-width: 52ch;
  color: var(--muted);
}

.site-footer {
  margin-top: 1.6rem;
  background: #d9d2c4;
  border-top: 1px solid #c7bda9;
}

.site-footer .site-shell {
  padding: 0.9rem 0 1rem;
}

.footer-title {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: #2a2722;
}

.footer-text {
  margin: 0.38rem 0 0;
  font-size: 0.78rem;
  line-height: 1.45;
  color: #433d33;
  max-width: 92ch;
}

.poster-preview {
  margin: 1rem auto;
  width: min(460px, 94%);
  border-radius: 10px;
  border: 1px solid #ded4c2;
}

.painting-page {
  overflow-x: hidden;
  overflow-y: auto;
}

.painting-shell {
  width: min(860px, 96vw);
  min-height: 100svh;
  height: auto;
  margin: 0 auto;
  padding: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 0.2rem;
}

.painting-topbar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.6rem;
  padding: 0.12rem 0.15rem;
}

.back-link {
  position: relative;
  font-size: 0.84rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.28rem 0.62rem 0.28rem 1.25rem;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  transition: border-color var(--ease), color var(--ease), background-color var(--ease);
}

.back-link::before {
  content: "";
  position: absolute;
  left: 0.55rem;
  top: 50%;
  width: 0.5rem;
  height: 0.5rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-50%) rotate(135deg);
}

.back-link:hover {
  border-color: var(--accent);
  color: var(--text);
  background: #f3ecdf;
}

.exhibition-label {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: var(--muted);
  white-space: nowrap;
  margin-left: auto;
}

.qr-open {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f4eee2;
  color: #2a2722;
  font-size: 1.02rem;
  line-height: 1;
  cursor: pointer;
  transition: border-color var(--ease), color var(--ease), background-color var(--ease), transform 120ms ease;
}

.qr-open img {
  width: 18px;
  height: 18px;
  display: block;
}

.qr-open:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: #f7f1e6;
}

.qr-open:active {
  transform: scale(0.98);
}

.detail-card {
  --card-pad: clamp(0.6rem, 2.2vw, 0.9rem);
  min-height: calc(100svh - 4.3rem);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f9f6f1;
  padding: 0 0 var(--card-pad);
  display: flex;
  flex-direction: column;
  gap: clamp(0.14rem, 0.7vh, 0.34rem);
  overflow: hidden;
}

.detail-card > :not(.image-wrap) {
  margin-left: var(--card-pad);
  margin-right: var(--card-pad);
}

.detail-title {
  margin: 0.32rem 0 0;
  line-height: 1.30;
  font-size: clamp(1.58rem, 5.2vw, 2.8rem);
}

.detail-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: clamp(0.82rem, 2.2vw, 0.95rem);
  white-space: pre-wrap;
}

.subtitle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.image-wrap {
  margin: 10px;
  width: calc(100% - 20px);
  aspect-ratio: 1 / 1;
  flex-shrink: 0;
  border-radius: 0;
  position: relative;
  overflow: hidden;
  align-self: center;
}

.image-wrap img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  min-width: 100%;
  min-height: 100%;
  object-fit: cover;
  object-position: 50% 50%;
  border-radius: 10px;
  cursor: zoom-in;
  transition: transform 160ms ease;
  transform: translateZ(0);
}

.image-wrap img:active {
  transform: scale(1.01);
}

.next-painting-link {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  width: fit-content;
  margin: 0.95rem 0 0;
  padding: 0.4rem 0.62rem;
  font-size: 0.8rem;
  line-height: 1.35;
  color: #2f2b24;
  background: #f7f1e6;
  border: 1px solid #d3c8b5;
  border-radius: 10px;
  transition: color var(--ease), border-color var(--ease), background-color var(--ease);
  align-self: flex-end;
  text-align: right;
}

.next-painting-link:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: #f6efe2;
}

.next-label {
  display: inline-block;
  white-space: pre-line;
  text-align: right;
}

.next-chevron {
  width: 0.5rem;
  height: 0.5rem;
  display: inline-block;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  margin-left: 0.08rem;
}

.info-line {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  white-space: pre-wrap;
}

.error-box {
  margin: 0;
  font-size: 0.84rem;
  color: #7d2d2d;
  border-top: 1px solid #d8b5b5;
  padding-top: 0.48rem;
}

.accordion-row {
  display: grid;
  gap: 0.34rem;
  margin-top: auto;
}

details {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f4eee2;
  transition: border-color var(--ease), background-color var(--ease), box-shadow var(--ease);
  overflow: hidden;
}

details:hover {
  border-color: var(--accent);
  background: #f7f1e6;
}

summary {
  list-style: none;
  position: relative;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.58rem 2rem 0.58rem 0.8rem;
  user-select: none;
  min-height: 44px;
  display: flex;
  align-items: center;
}

summary::-webkit-details-marker {
  display: none;
}

summary::after {
  content: "";
  position: absolute;
  right: 0.55rem;
  top: 50%;
  width: 0.5rem;
  height: 0.5rem;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: translateY(-62%) rotate(45deg);
  transition: transform var(--ease);
}

details[open] summary::after {
  transform: translateY(-38%) rotate(-135deg);
}

details[open] {
  border-radius: 10px;
  background: #f8f2e7;
  box-shadow: 0 10px 20px rgba(60, 45, 22, 0.06);
}

details[open] summary {
  border-bottom: 1px solid #ddd3c2;
}

.details-body {
  padding: 0.48rem 0.75rem 0.72rem;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.7;
}

.narration-line {
  margin: 0.42rem 0 0;
  font-size: 0.76rem;
  color: #5a5248;
}

.details-body p {
  margin: 0;
  white-space: pre-wrap;
}

audio {
  width: 100%;
  height: 33px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
  place-items: center;
  background: rgba(0, 0, 0, 0.9);
  padding: 1rem;
}

.modal.open {
  display: grid;
}

.modal img {
  max-width: min(1200px, 96vw);
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  opacity: 0.84;
  transition: opacity 220ms ease;
}

.modal img.is-ready {
  opacity: 1;
}

.modal.is-qr img {
  max-width: min(92vw, 640px);
  max-height: 90vh;
  background: #ffffff;
  border-radius: 12px;
  padding: 0.5rem;
}

.modal-loader {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  color: #f1efe9;
  font-size: 0.86rem;
  letter-spacing: 0.02em;
  padding: 0.4rem 0.7rem;
  border: 1px solid rgba(241, 239, 233, 0.35);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.45);
}

.modal button {
  position: fixed;
  top: 0.7rem;
  right: 0.7rem;
  border: 1px solid #6f6554;
  border-radius: 10px;
  background: #f4f1eb;
  color: #1a1a1a;
  padding: 0.32rem 0.65rem;
  cursor: pointer;
}

.modal.is-loading img {
  opacity: 0.7;
}

body.modal-open {
  overflow: hidden;
}

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

@media (min-width: 700px) {
  .site-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .painting-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.15rem;
  }

  .exhibition-info {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.4rem;
    border-bottom: 1px solid var(--line);
  }

  .info-item {
    border-bottom: 0;
    padding: 1rem 0;
  }
}

@media (min-width: 980px) {
  .painting-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .hero {
    margin-top: 2.2rem;
  }
}

@media (max-height: 740px) {
  .painting-shell {
    padding: 0;
    gap: 0.18rem;
  }

  .detail-card {
    --card-pad: 0.5rem;
    min-height: calc(100svh - 3.6rem);
    padding: 0 0 0.5rem;
    gap: 0.18rem;
  }

/*
  .image-wrap {
    aspect-ratio: 1 / 1;
    width: 100%;
    margin: 0;
  }
*/

  .detail-title {
    font-size: clamp(1.3rem, 4.4vw, 2rem);
    line-height: 1.12;
  }

  .detail-subtitle,
  .info-line,
  .next-painting-link,
  summary {
    font-size: 0.78rem;
  }
}

@keyframes shimmer {
  from {
    background-position: 200% 0;
  }
  to {
    background-position: -20% 0;
  }
}
