:root {
  --bg: #f4efe6;
  --bg-deep: #e3d9c7;
  --panel: rgba(255, 250, 242, 0.84);
  --panel-strong: rgba(255, 248, 237, 0.96);
  --text: #1f2d33;
  --muted: #5d6a6f;
  --line: rgba(44, 67, 79, 0.14);
  --accent: #c76834;
  --accent-deep: #7f3f23;
  --accent-soft: rgba(199, 104, 52, 0.12);
  --teal: #2e6f73;
  --shadow: 0 20px 60px rgba(45, 36, 28, 0.12);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background:
    radial-gradient(circle at top right, rgba(46, 111, 115, 0.18), transparent 30%),
    radial-gradient(circle at bottom left, rgba(199, 104, 52, 0.15), transparent 25%),
    linear-gradient(180deg, var(--bg) 0%, #efe5d6 100%);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Avenir Next", "Gill Sans", "Trebuchet MS", sans-serif;
}

body.modal-open {
  overflow: hidden;
}

.shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  height: 100vh;
  padding: 1.5rem;
  background: linear-gradient(180deg, rgba(33, 53, 62, 0.96), rgba(25, 40, 48, 0.92));
  color: #f7f1e8;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar__brand h1,
.hero h2,
.panel h3,
.section-title,
.gallery-card h4,
.review-card h4,
.selection-chip,
table th {
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;
}

.sidebar__brand h1 {
  margin: 0.25rem 0;
  font-size: 2rem;
}

.sidebar__run {
  margin: 0;
  color: rgba(247, 241, 232, 0.72);
  line-height: 1.5;
  white-space: pre-line;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  color: inherit;
  opacity: 0.75;
}

.sidebar__toggle {
  display: none;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: transparent;
  color: inherit;
  padding: 0.7rem 1rem;
  font: inherit;
}

.nav {
  display: grid;
  gap: 0.55rem;
}

.nav a {
  display: block;
  padding: 0.95rem 1rem;
  border-radius: 16px;
  color: rgba(247, 241, 232, 0.84);
  text-decoration: none;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.03);
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}

.nav a:hover,
.nav a.is-active {
  transform: translateX(4px);
  background: rgba(199, 104, 52, 0.16);
  border-color: rgba(199, 104, 52, 0.28);
  color: #fff7ef;
}

.content {
  padding: 1.5rem 1.5rem 3rem;
}

.hero {
  padding: 1.5rem 1.75rem;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: linear-gradient(135deg, rgba(255, 250, 242, 0.9), rgba(247, 238, 226, 0.8));
  box-shadow: var(--shadow);
}

.hero h2 {
  margin: 0.2rem 0 0.4rem;
  font-size: clamp(2rem, 4vw, 3rem);
}

.hero p:last-child {
  margin: 0;
  max-width: 62rem;
  color: var(--muted);
}

.page-root {
  display: grid;
  gap: 1.2rem;
  margin-top: 1.4rem;
}

.panel {
  padding: 1.2rem 1.25rem;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.panel h3 {
  margin: 0 0 0.75rem;
  font-size: 1.35rem;
}

.panel p,
.panel li,
.panel dt,
.panel dd {
  color: var(--muted);
}

.metrics-grid,
.plot-grid,
.summary-grid,
.gallery-grid,
.review-grid {
  display: grid;
  gap: 1rem;
}

.metrics-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.plot-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.summary-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.gallery-grid {
  grid-template-columns: repeat(var(--grid-columns, 2), minmax(0, 1fr));
}

.review-grid {
  grid-template-columns: repeat(var(--grid-columns, 2), minmax(0, 1fr));
}

.metric-card,
.summary-card,
.gallery-card,
.review-card {
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  overflow: hidden;
}

.metric-card,
.summary-card {
  padding: 1rem;
}

.metric-card span,
.summary-card span {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.metric-card strong,
.summary-card strong {
  display: block;
  margin-top: 0.35rem;
  font-size: 1.6rem;
  color: var(--accent-deep);
}

.plot-card img,
.gallery-card img,
.review-card img {
  width: 100%;
  display: block;
  background: #e7ddcf;
}

.gallery-card img,
.review-card img {
  aspect-ratio: 4 / 3;
  object-fit: contain;
  object-position: center;
  cursor: zoom-in;
  transition: transform 180ms ease, filter 180ms ease;
}

.gallery-card:hover img,
.review-card:hover img {
  transform: scale(1.015);
  filter: saturate(1.03);
}

.plot-card__body,
.gallery-card__body,
.review-card__body {
  padding: 1rem;
}

.gallery-card h4,
.review-card h4 {
  margin: 0 0 0.4rem;
  font-size: 1.15rem;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.65rem;
}

.badge,
.selection-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.42rem 0.72rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  border: 1px solid rgba(199, 104, 52, 0.16);
  font-size: 0.88rem;
}

.selection-panel {
  position: sticky;
  top: 0.75rem;
  z-index: 5;
  border: 1px solid rgba(46, 111, 115, 0.2);
  background: linear-gradient(180deg, rgba(251, 246, 238, 0.97), rgba(245, 235, 221, 0.96));
}

.selection-panel__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.75rem;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  align-items: center;
  justify-content: space-between;
}

.toolbar__controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  align-items: center;
}

.toolbar input {
  width: min(100%, 420px);
  padding: 0.85rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.8);
  color: var(--text);
  font: inherit;
}

.control-group {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.35rem 0.45rem 0.35rem 0.85rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  color: var(--muted);
}

.control-group span {
  font-size: 0.88rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.control-group select {
  border: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  padding: 0.35rem 0.45rem;
}

.review-card button {
  width: 100%;
  margin-top: 0.9rem;
  padding: 0.85rem 1rem;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), #d89051);
  color: #fff8f1;
  font: inherit;
  cursor: pointer;
}

.review-card button.is-selected {
  background: linear-gradient(135deg, var(--teal), #3f8c84);
}

.empty-state {
  padding: 1.4rem;
  border: 1px dashed rgba(46, 111, 115, 0.3);
  border-radius: 18px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.45);
}

.image-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 2rem;
  background: rgba(19, 27, 31, 0.82);
  backdrop-filter: blur(10px);
}

.image-modal[hidden] {
  display: none;
}

.image-modal__close {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff7ef;
  padding: 0.75rem 1rem;
  font: inherit;
  cursor: pointer;
}

.image-modal__figure {
  margin: 0;
  width: min(96vw, 1600px);
  max-height: 92vh;
  display: grid;
  gap: 0.9rem;
}

.image-modal__img {
  width: 100%;
  max-height: calc(92vh - 4rem);
  object-fit: contain;
  border-radius: 24px;
  background: rgba(255, 248, 237, 0.96);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.28);
}

.image-modal__caption {
  color: #fff7ef;
  text-align: center;
  font-size: 0.98rem;
  line-height: 1.5;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 0.75rem 0.65rem;
  border-bottom: 1px solid rgba(44, 67, 79, 0.12);
  text-align: left;
  font-size: 0.94rem;
}

th {
  color: var(--accent-deep);
}

a.inline-link {
  color: var(--teal);
  text-decoration: none;
  font-weight: 600;
}

pre {
  margin: 0;
  padding: 1rem;
  overflow: auto;
  border-radius: 18px;
  background: rgba(28, 43, 51, 0.9);
  color: #f7f1e8;
}

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

  .sidebar {
    position: static;
    height: auto;
  }

  .sidebar__toggle {
    display: inline-flex;
    align-self: flex-start;
  }

  .nav {
    display: none;
  }

  .nav.is-open {
    display: grid;
  }

  .gallery-grid,
  .review-grid {
    grid-template-columns: 1fr;
  }
}
