@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,600;9..144,700&family=Manrope:wght@400;500;600;700;800&display=swap");

:root {
  color-scheme: light;
  --bg: #f4f1ea;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-strong: rgba(255, 255, 255, 0.94);
  --surface-soft: rgba(255, 255, 255, 0.62);
  --text: #151515;
  --muted: #67635d;
  --line: rgba(21, 21, 21, 0.1);
  --line-strong: rgba(21, 21, 21, 0.18);
  --accent: #1f2937;
  --accent-2: #7b5d3c;
  --accent-soft: rgba(31, 41, 55, 0.06);
  --shadow-lg: 0 28px 80px rgba(21, 21, 21, 0.08);
  --shadow-md: 0 14px 32px rgba(21, 21, 21, 0.06);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(31, 41, 55, 0.08), transparent 30%),
    radial-gradient(circle at top right, rgba(123, 93, 60, 0.08), transparent 24%),
    linear-gradient(180deg, #f8f6f1 0%, var(--bg) 100%);
  font-family: "Manrope", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(21, 21, 21, 0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(21, 21, 21, 0.022) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.42), transparent 84%);
}

a {
  color: inherit;
}

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

button,
input {
  font: inherit;
}

.page {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 44px;
}

.hero,
.toolbar,
.inventory,
.detail,
.sources,
.card {
  border: 1px solid var(--line);
  background: var(--surface);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow-md);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.72fr);
  gap: 18px;
  align-items: stretch;
  border: 0;
  box-shadow: none;
  background: transparent;
  padding-bottom: 18px;
}

.hero-copy,
.hero-panel,
.toolbar,
.inventory,
.detail,
.sources {
  border-radius: var(--radius-xl);
}

.hero-copy {
  padding: 32px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.72)),
    radial-gradient(circle at right top, rgba(31, 41, 55, 0.05), transparent 32%);
  box-shadow: var(--shadow-lg);
}

.hero-panel {
  padding: 22px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.68));
  box-shadow: var(--shadow-lg);
}

.eyebrow,
.panel-title,
.pill,
.search-label,
.details dt,
.section-count {
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-size: 0.71rem;
  font-weight: 700;
}

.eyebrow,
.panel-title,
.search-label,
.details dt,
.section-count {
  color: var(--accent-2);
  margin: 0;
}

h1 {
  margin: 0;
  max-width: 10ch;
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(3.4rem, 7vw, 6.8rem);
  line-height: 0.92;
  letter-spacing: -0.08em;
  font-weight: 700;
}

.lede {
  margin: 18px 0 0;
  max-width: 64ch;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.85;
}

.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.stats div {
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(21, 21, 21, 0.07);
}

.stats strong {
  display: block;
  margin-bottom: 6px;
  font-size: 1.02rem;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.stats span {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px 12px;
  align-items: end;
  padding: 18px;
  margin-top: 8px;
}

.search {
  display: grid;
  gap: 10px;
}

.search input {
  width: 100%;
  appearance: none;
  border: 1px solid rgba(21, 21, 21, 0.12);
  border-radius: 16px;
  background: var(--surface-strong);
  padding: 15px 16px;
  color: var(--text);
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease, background 140ms ease;
}

.search input::placeholder {
  color: rgba(103, 99, 93, 0.72);
}

.search input:hover {
  background: #fff;
}

.search input:focus {
  outline: none;
  border-color: rgba(123, 93, 60, 0.35);
  box-shadow: 0 0 0 4px rgba(123, 93, 60, 0.12);
}

.toolbar button {
  appearance: none;
  border: 1px solid rgba(21, 21, 21, 0.12);
  border-radius: 14px;
  background: linear-gradient(180deg, #fff, #f2eee6);
  color: var(--text);
  padding: 14px 18px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.toolbar button:hover {
  transform: translateY(-1px);
  border-color: rgba(123, 93, 60, 0.26);
  box-shadow: 0 12px 24px rgba(21, 21, 21, 0.1);
}

.toolbar button:focus-visible,
.card-links a:focus-visible,
.sources a:focus-visible,
.inventory-list button:focus-visible {
  outline: 3px solid rgba(123, 93, 60, 0.18);
  outline-offset: 3px;
}

.results {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
}

.explorer {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(0, 1.1fr);
  gap: 18px;
  margin-top: 18px;
  align-items: start;
}

.inventory {
  padding: 18px;
}

.inventory .section-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.inventory .section-head + .section-head {
  margin-top: 18px;
}

.inventory-list {
  display: grid;
  gap: 10px;
}

.inventory-list:empty::before {
  content: "Loading entries...";
  display: block;
  padding: 14px 2px 6px;
  color: var(--muted);
}

.inventory-list button,
.inventory-list a {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  text-align: left;
  border: 1px solid rgba(21, 21, 21, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.7);
  padding: 14px;
  color: var(--text);
  text-decoration: none;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.directory-item {
  align-items: center;
}

.directory-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.directory-age {
  flex: 0 0 auto;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(21, 21, 21, 0.06);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

.inventory-list button:hover,
.inventory-list a:hover {
  transform: translateY(-1px);
  border-color: rgba(123, 93, 60, 0.2);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 12px 22px rgba(21, 21, 21, 0.08);
}

.inventory-list .item-title {
  display: block;
  font-size: 0.98rem;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.inventory-list .item-meta {
  display: block;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
}

.detail {
  min-height: 100%;
  padding: 20px;
}

.detail-card {
  display: grid;
  gap: 0;
  overflow: hidden;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(21, 21, 21, 0.08);
  box-shadow: 0 18px 48px rgba(21, 21, 21, 0.08);
}

.detail-hero {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(31, 41, 55, 0.08), rgba(123, 93, 60, 0.08));
  border-bottom: 1px solid rgba(21, 21, 21, 0.06);
}

.detail-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.detail-body {
  display: grid;
  gap: 14px;
  padding: 24px;
}

.detail-topline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.detail-body h2 {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(2rem, 3.5vw, 3rem);
  line-height: 0.98;
  letter-spacing: -0.06em;
}

.detail-summary {
  margin: 0;
  color: var(--muted);
  font-size: 1.03rem;
  line-height: 1.8;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.detail-fact {
  display: grid;
  gap: 6px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(21, 21, 21, 0.03);
  border: 1px solid rgba(21, 21, 21, 0.06);
}

.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.detail-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 6px;
}

.detail-empty {
  min-height: 360px;
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 14px;
  border-radius: 20px;
  border: 1px dashed rgba(21, 21, 21, 0.12);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.48)),
    radial-gradient(circle at top right, rgba(123, 93, 60, 0.08), transparent 36%);
}

.detail-empty h2 {
  margin: 0;
  max-width: 12ch;
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(1.85rem, 3vw, 2.6rem);
  line-height: 1.02;
  letter-spacing: -0.05em;
}

.detail-empty p:last-child {
  margin: 0;
  max-width: 46ch;
  color: var(--muted);
  line-height: 1.8;
}

.cards {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
}

.card {
  display: flex;
  flex-direction: column;
  border-radius: 24px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.78);
  transform: translateY(0);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
  cursor: pointer;
}

.card:hover {
  transform: translateY(-3px);
  border-color: rgba(123, 93, 60, 0.18);
  box-shadow: 0 24px 56px rgba(21, 21, 21, 0.12);
}

.card-media {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(31, 41, 55, 0.08), rgba(123, 93, 60, 0.08));
  border-bottom: 1px solid rgba(21, 21, 21, 0.06);
}

.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  filter: saturate(0.96) contrast(1.02);
}

.card-body {
  display: grid;
  gap: 12px;
  padding: 22px;
  align-content: start;
}

.card-topline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.card-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 14px 0 4px;
  border-radius: 0;
  background: rgba(21, 21, 21, 0.03);
  border: 0;
  border-top: 1px solid rgba(21, 21, 21, 0.06);
}

.fact {
  display: grid;
  gap: 6px;
}

.fact-label {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.68rem;
  font-weight: 700;
}

.fact-value {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.35;
  letter-spacing: -0.02em;
}

.status {
  display: inline-flex;
  align-items: center;
}

.status.daily-mass {
  color: #16553d;
}

.status.only-feast {
  color: #7b5d3c;
}

.status.not-active-heritage-site {
  color: #6d4d1d;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(31, 41, 55, 0.06);
  color: var(--accent);
}

.heritage-badge {
  gap: 7px;
  align-items: center;
  background: rgba(31, 41, 55, 0.08);
  color: #243246;
  border: 1px solid rgba(31, 41, 55, 0.08);
  padding: 8px 12px;
  min-height: auto;
}

.heritage-mark {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  fill: currentColor;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.heritage-mark svg {
  width: 100%;
  height: 100%;
  display: block;
}

.heritage-copy {
  display: grid;
  gap: 2px;
  line-height: 1.05;
}

.heritage-label {
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  font-weight: 800;
}

.heritage-year {
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  font-weight: 700;
  color: rgba(36, 50, 70, 0.78);
}

.pill.muted {
  background: rgba(21, 21, 21, 0.06);
  color: var(--muted);
}

.card h2 {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.56rem;
  line-height: 1.05;
  letter-spacing: -0.05em;
}

.summary {
  margin: 0;
  color: var(--muted);
  line-height: 1.75;
}

.details {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  padding-top: 4px;
}

.details div {
  padding-top: 12px;
  border-top: 1px solid rgba(21, 21, 21, 0.08);
}

.details dd {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.card-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 2px;
}

.card-links a,
.sources a {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid rgba(21, 21, 21, 0.22);
  padding-bottom: 1px;
  transition: color 140ms ease, border-color 140ms ease, opacity 140ms ease;
}

.card-links a:hover,
.sources a:hover {
  color: var(--accent-2);
  border-bottom-color: rgba(123, 93, 60, 0.5);
}

.sources {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 18px;
  margin-top: 18px;
  padding: 22px 24px;
}

.sources > div {
  display: grid;
  gap: 10px;
}

.fineprint {
  margin: 0;
  max-width: 44ch;
  color: var(--muted);
  line-height: 1.7;
}

@media (max-width: 980px) {
  .hero,
  .explorer,
  .sources,
  .cards {
    grid-template-columns: 1fr;
  }

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

  .toolbar button {
    width: 100%;
  }

  .card-media {
    aspect-ratio: 4 / 3;
  }

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

@media (max-width: 640px) {
  .page {
    width: min(100% - 18px, 1240px);
    padding-top: 18px;
  }

  .hero-copy,
  .hero-panel,
  .toolbar,
  .inventory,
  .detail,
  .card,
  .sources {
    border-radius: 20px;
  }

  .hero-copy {
    padding: 22px;
  }

  .hero-panel,
  .toolbar,
  .inventory,
  .detail,
  .sources {
    padding: 16px;
  }

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

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

  .card-body {
    padding: 18px;
  }

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

  .detail-body {
    padding: 18px;
  }

  .card h2 {
    font-size: 1.4rem;
  }
}
