:root {
  color-scheme: light;
  --paper: #f3eee4;
  --paper-2: #ebe4d6;
  --frame: #fffdf8;
  --ink: #1c1916;
  --ink-2: #4a433a;
  --muted: #7a7166;
  --line: #d8d0c2;
  --red: #b11226;
  --red-deep: #8c0e1e;
  --gold: #b8964a;
  --night: #0c1018;
  --serif: "Cormorant Garamond", "Iowan Old Style", Palatino, Georgia, serif;
  --sans: "Libre Franklin", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "SF Mono", Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 78px;
}

html,
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  line-height: 1.55;
}

a {
  color: var(--red);
}

button,
select,
input {
  font: inherit;
  color: inherit;
}

.visually-hidden,
.skip {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.skip:focus {
  width: auto;
  height: auto;
  clip: auto;
  top: 10px;
  left: 10px;
  z-index: 80;
  padding: 10px 14px;
  background: var(--red);
  color: #fff;
  text-decoration: none;
}

.kicker {
  margin: 0 0 10px;
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--red);
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(243, 238, 228, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.site-header-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 14px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.wordmark {
  text-decoration: none;
  color: var(--ink);
  line-height: 1.05;
}

.wordmark-small {
  display: block;
  font-family: var(--sans);
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}

.wordmark-large {
  display: block;
  font-size: 1.45rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.site-nav {
  display: flex;
  gap: 28px;
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.site-nav a {
  color: var(--ink);
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--red);
}

/* Hero */
.hero {
  position: relative;
  min-height: calc(100vh - 72px);
  min-height: calc(100svh - 72px);
  display: grid;
  align-items: end;
  color: #f6f1e6;
  overflow: hidden;
}

.hero-media,
.hero-media img,
.hero-media video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 28%;
}

.hero-fallback {
  z-index: 0;
}

.hero-media video {
  z-index: 1;
  background: transparent;
}

.hero-media video[hidden] {
  display: none;
}

.hero-veil {
  position: absolute;
  inset: 0;
  z-index: 2;
  background:
    linear-gradient(180deg, rgba(8, 10, 16, 0.18) 0%, rgba(8, 10, 16, 0.15) 40%, rgba(8, 10, 16, 0.78) 100%),
    linear-gradient(90deg, rgba(8, 10, 16, 0.45) 0%, transparent 55%);
}

.hero-copy {
  position: relative;
  z-index: 3;
  max-width: 820px;
  padding: 0 48px 92px;
}

.hero-copy .kicker {
  color: #e8c36a;
}

.hero h1 {
  margin: 0 0 18px;
  font-size: clamp(2.6rem, 6vw, 5.1rem);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.hero-lede {
  margin: 0 0 28px;
  max-width: 46ch;
  font-size: 1.2rem;
  font-weight: 400;
  color: #efe6d4;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.hero-credit {
  position: absolute;
  right: 32px;
  bottom: 22px;
  z-index: 3;
  margin: 0;
  max-width: 36ch;
  font-family: var(--sans);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  color: rgba(246, 241, 230, 0.7);
  text-align: right;
}

.hero-credit cite {
  font-style: italic;
}

.btn {
  display: inline-block;
  padding: 12px 22px;
  border: 1px solid currentColor;
  background: transparent;
  color: inherit;
  font: 600 0.74rem/1 var(--sans);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
}

.btn.primary {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

.btn.primary:hover {
  background: var(--red-deep);
  border-color: var(--red-deep);
}

.btn.ghost {
  color: #f6f1e6;
}

.btn.ghost:hover,
.btn:hover {
  background: #fff;
  color: var(--ink);
  border-color: #fff;
}

.btn.primary:hover {
  color: #fff;
}

/* Visit strip: Met-style info row */
.visit-strip {
  background: var(--night);
  color: #efe8db;
}

.visit-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 48px 32px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 36px;
}

.visit-strip h2 {
  margin: 0 0 10px;
  font-size: 1.55rem;
  font-weight: 500;
}

.visit-strip p {
  margin: 0 0 8px;
  font-size: 0.98rem;
  color: #cfc6b6;
}

.visit-strip strong {
  color: #f4ead4;
  font-weight: 600;
}

/* Sections */
.section-head {
  max-width: 1440px;
  margin: 0 auto 36px;
  padding: 0 32px;
}

.section-head h2,
.collection-head h2,
.on-view h2 {
  margin: 0 0 8px;
  font-size: clamp(2.1rem, 4vw, 3.4rem);
  font-weight: 500;
}

.section-lede {
  margin: 0;
  max-width: 52ch;
  color: var(--ink-2);
  font-size: 1.15rem;
}

#visit,
#on-view,
#collection {
  scroll-margin-top: 78px;
}

.on-view {
  padding: 80px 0 40px;
}

.featured-grid {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 32px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}

.featured-card {
  position: relative;
  display: block;
  padding: 0;
  border: 0;
  background: var(--night);
  cursor: pointer;
  text-align: left;
  overflow: hidden;
  min-height: 440px;
}

.featured-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  min-height: 440px;
  transition: transform 0.8s ease;
}

.featured-card:hover img,
.featured-card:focus-visible img {
  transform: scale(1.04);
}

.featured-card:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 3px;
}

.featured-card .caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 48px 22px 20px;
  background: linear-gradient(180deg, transparent, rgba(10, 12, 16, 0.88));
  color: #f6f1e6;
}

.featured-card .medium {
  margin: 0 0 4px;
  font-family: var(--sans);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #e8c36a;
}

.featured-card h3 {
  margin: 0;
  font-size: 1.7rem;
  font-weight: 500;
}

.featured-card .through {
  margin: 6px 0 0;
  font-family: var(--sans);
  font-size: 0.78rem;
  color: #d8cfc0;
}

/* Collection */
.collection {
  padding: 72px 0 40px;
}

.collection-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
}

.collection-layout {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 32px 20px;
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 40px;
  align-items: start;
}

.filters {
  position: sticky;
  top: 86px;
  padding-bottom: 20px;
}

.filters-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 14px;
}

.filters h3 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 500;
}

.link {
  background: none;
  border: 0;
  padding: 0;
  color: var(--red);
  cursor: pointer;
  font-family: var(--sans);
  font-size: 0.76rem;
  letter-spacing: 0.04em;
}

.link:hover {
  text-decoration: underline;
}

.search input {
  width: 100%;
  padding: 10px 0;
  border: 0;
  border-bottom: 1px solid var(--ink);
  background: transparent;
  font: 0.88rem var(--sans);
}

.search input:focus {
  outline: none;
  border-bottom-color: var(--red);
}

.facet {
  margin-top: 22px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.facet summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  font-family: var(--sans);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-2);
}

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

.facet summary::after {
  content: "–";
  color: var(--muted);
}

.facet:not([open]) summary::after {
  content: "+";
}

.facet-options {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.facet-options li {
  margin: 2px 0;
}

.facet-options label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
  cursor: pointer;
  font-size: 0.98rem;
}

.facet-options input {
  accent-color: var(--red);
  width: 14px;
  height: 14px;
  margin: 0;
}

.facet-options .name {
  flex: 1;
}

.facet-options .count {
  font-family: var(--sans);
  font-size: 0.7rem;
  color: var(--muted);
}

.facet-options label.zero {
  opacity: 0.4;
}

.filters-toggle {
  display: none;
}

.sort {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--sans);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.sort select {
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: var(--frame);
  font: 0.85rem var(--sans);
  text-transform: none;
  letter-spacing: 0;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 0;
  margin-bottom: 18px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--ink);
  background: transparent;
  font: 0.75rem var(--sans);
  cursor: pointer;
}

.chip:hover {
  border-color: var(--red);
  color: var(--red);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 36px 22px;
}

.card {
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-align: left;
}

.card:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 4px;
}

.card-frame {
  position: relative;
  background: var(--frame);
  padding: 10px 10px 28px;
  box-shadow: 0 18px 40px rgba(40, 28, 12, 0.08);
  border: 1px solid #e7dfd0;
}

.card-frame img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: #ddd6c8;
}

.card:hover .card-frame img {
  filter: saturate(1.05);
}

.card-body {
  padding: 16px 6px 0;
}

.card-body .medium {
  margin: 0 0 4px;
  font-family: var(--sans);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--red);
}

.card-body h3 {
  margin: 0 0 4px;
  font-size: 1.45rem;
  font-weight: 500;
}

.card-body .method {
  margin: 0;
  font-style: italic;
  color: var(--ink-2);
}

.empty {
  color: var(--muted);
  padding: 48px 0;
  text-align: center;
  font-size: 1.2rem;
}

/* Footer */
.site-footer {
  margin-top: 40px;
  padding: 56px 32px 72px;
  background: var(--night);
  color: #e8e0d2;
}

.footer-inner {
  max-width: 1440px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 40px;
  align-items: end;
}

.site-footer .wordmark-large {
  font-size: 2rem;
  color: #f6f1e6;
}

.site-footer a {
  color: #e8c36a;
}

.footer-attribution {
  max-width: 1440px;
  margin: 36px auto 0;
  font-family: var(--sans);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #9a9184;
}

/* Modal */
.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 28px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 10, 8, 0.72);
}

.modal-card {
  position: relative;
  width: min(1240px, 100%);
  max-height: calc(100vh - 56px);
  overflow: auto;
  background: var(--paper);
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 1fr);
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.45);
  --code-bg: #1d1a17;
  --code-ink: #efe8da;
  --code-muted: #9c9385;
  --eq-bg: #fffdf8;
}

.modal-figure {
  margin: 0;
  background: #111;
  display: grid;
  place-items: center;
}

.modal-figure img {
  display: block;
  width: 100%;
  height: auto;
}

.modal-body {
  padding: 36px 32px 32px;
}

.modal-body h2 {
  margin: 0 0 4px;
  font-size: 2.2rem;
  font-weight: 500;
}

.subtitle {
  margin: 0 0 16px;
  color: var(--ink-2);
  font-style: italic;
  font-size: 1.1rem;
}

.desc {
  margin: 0 0 16px;
  color: var(--ink-2);
}

.modal-score {
  margin: 0 0 18px;
}

.score-plate {
  margin-bottom: 16px;
}

.score-plate:last-child {
  margin-bottom: 0;
}

.modal-score .entry {
  margin: 0 0 8px;
}

.modal-score .label {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--red-deep);
}

.modal-score .equation {
  margin-top: 0;
}

.modal-score pre.code {
  margin-bottom: 0;
  font-size: 0.74rem;
}

.formula {
  margin: 0 0 18px;
  padding: 14px 16px;
  background: var(--paper-2);
  border-left: 3px solid var(--gold);
  font: 0.8rem/1.55 var(--mono);
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
}

.meta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 16px;
  margin: 0 0 18px;
  font-size: 0.95rem;
}

.meta dt {
  font-family: var(--sans);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  align-self: center;
}

.meta dd {
  margin: 0;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 22px;
}

.tag {
  font-family: var(--sans);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2);
  border-bottom: 1px solid var(--line);
  padding-bottom: 2px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.modal .btn {
  color: var(--ink);
}

.modal .btn.primary {
  color: #fff;
}

.modal-close,
.modal-nav {
  position: absolute;
  z-index: 2;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(12, 10, 8, 0.55);
  color: #fff;
  cursor: pointer;
}

.modal-close {
  top: 14px;
  right: 14px;
  padding: 8px 12px;
  font: 600 0.68rem var(--sans);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.modal-nav {
  top: 50%;
  transform: translateY(-50%);
  width: 42px;
  height: 42px;
  font-size: 1.6rem;
  line-height: 1;
}

.modal-nav.prev {
  left: 12px;
}

.modal-nav.next {
  left: calc(59% - 54px);
}

.modal-close:hover,
.modal-nav:hover {
  background: var(--red);
  border-color: var(--red);
}

@media (max-width: 1100px) {
  .featured-grid {
    grid-template-columns: 1fr 1fr;
  }

  .featured-card,
  .featured-card img {
    min-height: 360px;
  }

  .visit-inner {
    grid-template-columns: 1fr 1fr;
  }

  .modal-card {
    grid-template-columns: 1fr;
  }

  .modal-nav.next {
    left: auto;
    right: 12px;
    top: 28vw;
  }

  .modal-nav.prev {
    top: 28vw;
  }
}

@media (max-width: 860px) {
  .site-header-inner {
    padding: 12px 18px;
    flex-direction: column;
    align-items: flex-start;
  }

  .site-nav {
    gap: 16px;
    flex-wrap: wrap;
  }

  .hero-copy {
    padding: 0 20px 88px;
  }

  .hero-credit {
    left: 20px;
    right: 20px;
    text-align: left;
  }

  .visit-inner,
  .section-head,
  .collection-layout,
  .featured-grid,
  .site-footer {
    padding-left: 18px;
    padding-right: 18px;
  }

  .visit-inner,
  .collection-layout,
  .footer-inner,
  .featured-grid {
    grid-template-columns: 1fr;
  }

  .collection-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .filters {
    position: relative;
    top: 0;
    padding-bottom: 56px;
    border: 1px solid var(--line);
    padding: 16px 16px 56px;
    background: var(--frame);
  }

  .filters:not(.open) #facets,
  .filters:not(.open) .search {
    display: none;
  }

  .filters-toggle {
    display: block;
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: 12px;
    padding: 10px;
    border: 1px solid var(--ink);
    background: var(--paper);
    cursor: pointer;
    font: 600 0.74rem var(--sans);
    letter-spacing: 0.1em;
    text-transform: uppercase;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .featured-card img,
  .card-frame img {
    transition: none;
  }
}

