/* Gallery uses the landing page's type, palette, and spacing tokens. */
.gallery-intro { border-bottom: 1px solid var(--line); }
.gallery-intro-head { display: flex; align-items: start; justify-content: space-between; gap: 36px; }
.gallery-intro-head .section-head { max-width: 720px; }
.gallery-intro-head > .btn { flex-shrink: 0; margin-top: 6px; }
.gallery-featured { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.gallery-featured-card { border: 1px solid var(--line); border-radius: 16px; background: white; overflow: hidden; }
.gallery-featured-card img { width: 100%; height: 220px; object-fit: contain; padding: 18px; }
.gallery-featured-card span { display: block; padding: 16px 20px; border-top: 1px solid var(--line); font-size: 14px; }
.gallery-featured-card:hover span { color: var(--accent); }
.gallery-hero { padding: 64px 0 0; }
.gallery-hero h1 { font-family: var(--serif); font-weight: 600; font-size: clamp(2rem,4.5vw,3.4rem); line-height: 1.3; margin: 0 0 20px; text-wrap: balance; max-width: 850px; }
.gallery-hero .lead { color: var(--muted); font-size: 17px; line-height: 1.85; max-width: 730px; margin: 0 0 26px; }
.gallery-hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.gallery-source { display: flex; justify-content: space-between; align-items: center; gap: 20px; border-block: 1px solid var(--line); padding: 22px 0; margin-top: 42px; }
.gallery-source > div { display: flex; align-items: center; gap: 18px; }
.gallery-source a { font-size: 15px; font-weight: 600; }
.gallery-source a:hover { text-decoration: underline; text-underline-offset: 4px; }
.gallery-source-label { font: 11px var(--mono); color: var(--faint); }
.gallery-source p { color: var(--faint); font-size: 12px; margin: 0; }
.gallery-browser { padding: 34px 0 72px; }
.gallery-toolbar { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.gallery-search { width: min(460px, 100%); }
.gallery-search label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.gallery-search input { width: 100%; height: 48px; padding: 0 18px; font: 14px var(--font); color: var(--text); background: white; border: 1px solid var(--line); border-radius: 12px; }
.gallery-search input::placeholder { color: var(--faint); }
.gallery-count { margin: 0 0 12px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.gallery-filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 30px; }
.gallery-filter { font: 12px var(--font); padding: 9px 14px; min-height: 38px; border: 1px solid var(--line); background: transparent; color: var(--muted); border-radius: 999px; cursor: pointer; }
.gallery-filter:hover { background: var(--accent-soft); }
.gallery-filter[aria-pressed="true"] { background: var(--text); color: white; border-color: var(--text); }
.figure-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 24px; }
.figure-card { min-width: 0; border: 1px solid var(--line); border-radius: 18px; background: white; overflow: hidden; transition: box-shadow 0.2s, transform 0.2s; }
.figure-card:hover { box-shadow: 0 14px 35px -22px rgba(28,25,23,0.4); transform: translateY(-3px); }
.figure-card-button { display: flex; flex-direction: column; height: 100%; width: 100%; border: 0; padding: 0; text-align: left; color: var(--text); background: none; font: inherit; cursor: pointer; }
.figure-card:focus-within { outline: 3px solid var(--accent); outline-offset: 4px; }
.figure-card-button:focus-visible { outline: 0; }
.figure-card-visual { width: 100%; background: white; border-bottom: 1px solid var(--line); }
.figure-card-visual img { width: 100%; height: 245px; object-fit: contain; padding: 20px; }
.figure-card-body { padding: 20px 22px 22px; width: 100%; }
.figure-card-category { font-size: 10px; color: var(--accent); margin: 0 0 10px; letter-spacing: 0.02em; }
.figure-card h2 { font-size: 16px; line-height: 1.6; font-weight: 500; margin: 0 0 10px; overflow-wrap: anywhere; }
.figure-card-packages { color: var(--faint); font: 10px/1.7 var(--mono); margin: 0; overflow-wrap: anywhere; }
.gallery-empty, .gallery-error { text-align: center; padding: 60px 24px; border: 1px solid var(--line); border-radius: 16px; background: white; }
.gallery-empty h2 { font: 600 24px var(--serif); }
.gallery-empty p, .gallery-error p { color: var(--muted); font-size: 14px; }
.gallery-attribution { font-size: 12px; line-height: 1.9; color: var(--muted); margin: 28px 0 0; overflow-wrap: anywhere; }
.gallery-attribution a { text-decoration: underline; text-underline-offset: 3px; }
.gallery-snapshot { font: 11px/1.8 var(--mono); color: var(--faint); }
.gallery-snapshot a { text-decoration: underline; text-underline-offset: 3px; }
.dialog-open { overflow: hidden; }
.figure-dialog { width: min(1180px,calc(100% - 48px)); max-height: calc(100dvh - 48px); border: 1px solid var(--line); border-radius: 20px; padding: 0; color: var(--text); background: var(--bg); }
.figure-dialog::backdrop { background: rgba(28,25,23,0.55); backdrop-filter: blur(4px); }
.dialog-top { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 14px 24px; background: var(--bg); border-bottom: 1px solid var(--line); }
.dialog-top > span { font-size: 13px; font-weight: 500; }
.dialog-top .btn { font-size: 12px; }
.figure-detail-layout { display: grid; grid-template-columns: 1.35fr 1fr; }
.figure-detail-visual { min-width: 0; padding: 28px; background: white; text-align: center; }
.figure-detail-visual img { width: 100%; height: min(60vh,650px); object-fit: contain; }
.figure-detail-visual p { font-size: 12px; color: var(--faint); min-height: 20px; }
.figure-detail-copy { padding: 28px; min-width: 0; }
.figure-detail-copy .card-index { margin: 0 0 12px; }
.figure-detail-copy h2 { font-family: var(--serif); font-size: 25px; font-weight: 600; line-height: 1.5; margin: 0 0 20px; overflow-wrap: anywhere; }
.figure-detail-copy > p { font-size: 13px; color: var(--muted); line-height: 1.85; overflow-wrap: anywhere; white-space: pre-line; }
.figure-detail-copy h3 { font-size: 12px; font-weight: 600; margin: 24px 0 8px; }
.figure-detail-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 28px; }
.nav-links a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
@media (max-width: 1000px) {
  .figure-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .gallery-intro-head { display: block; }
  .gallery-intro-head > .btn { margin: 0 0 28px; }
}
@media (max-width: 760px) {
  .nav-links a { padding-inline: 9px; font-size: 12px; }
  .gallery-hero { padding-top: 38px; }
  .gallery-hero .lead { font-size: 15px; }
  .gallery-source { align-items: start; flex-direction: column; gap: 10px; margin-top: 28px; }
  .gallery-toolbar { flex-direction: column; align-items: start; gap: 14px; }
  .gallery-search { width: 100%; }
  .gallery-count { margin-bottom: 0; }
  .gallery-filters { gap: 7px; }
  .gallery-filter { font-size: 11px; padding: 9px 12px; }
  .figure-grid { gap: 16px; }
  .figure-card-visual img { height: 190px; padding: 14px; }
  .figure-card-body { padding: 16px; }
  .figure-card h2 { font-size: 14px; }
  .gallery-featured { gap: 12px; }
  .gallery-featured-card img { height: 160px; padding: 10px; }
  .gallery-featured-card span { padding: 12px; font-size: 12px; }
  .figure-detail-layout { grid-template-columns: 1fr; }
  .figure-dialog { width: calc(100% - 24px); max-height: calc(100dvh - 24px); border-radius: 16px; }
  .dialog-top { padding: 12px 16px; gap: 12px; }
  .figure-detail-copy, .figure-detail-visual { padding: 20px; }
  .figure-detail-visual img { height: 340px; }
}
@media (max-width: 480px) {
  .figure-grid { grid-template-columns: 1fr; }
  .figure-card-visual img { height: 260px; }
  .gallery-featured { grid-template-columns: 1fr; }
  .gallery-featured-card img { height: 220px; }
}
