:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --text: #0b1f33;
  --muted: #5b6775;
  --accent: #004f71;
  --accent-hover: #003d58;
  --border: #d8e0ea;
  --radius: 12px;
  --shadow: 0 8px 24px rgba(26, 35, 50, 0.08);
  --font: "DM Sans", system-ui, sans-serif;
  --font-serif: "Source Serif 4", Georgia, serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

.container {
  width: min(1120px, 92vw);
  margin-inline: auto;
}

.narrow {
  max-width: 560px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: 0.5rem 1rem;
  z-index: 100;
}

.skip-link:focus {
  left: 0;
}

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0;
}

.logo {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
  text-decoration: none;
}

.site-header nav {
  display: flex;
  gap: 1.25rem;
}

.site-header nav a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
}

.site-header nav a:hover,
.site-header nav a:focus {
  color: var(--accent);
}

.hero {
  padding: 3rem 0 2rem;
}

.hero h1 {
  font-family: var(--font-serif);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  margin: 0 0 0.5rem;
}

.lead {
  color: var(--muted);
  font-size: 1.1rem;
  max-width: 42rem;
}

.search-hero {
  display: flex;
  gap: 0.5rem;
  margin-top: 1.5rem;
  max-width: 520px;
}

.search-hero input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
}

.section {
  padding: 2rem 0 3rem;
}

.section h2 {
  font-family: var(--font-serif);
  margin: 0 0 1.25rem;
}

.poster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.5rem;
}

.featured-carousel {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(260px, 280px);
  gap: 1rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  scroll-snap-type: x mandatory;
}

.featured-carousel .poster-card {
  scroll-snap-align: start;
}

.poster-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.poster-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(26, 35, 50, 0.12);
}

.poster-card-link {
  color: inherit;
  text-decoration: none;
  display: block;
}

.poster-card-image-wrap {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #e8edf3;
  position: relative;
}

.poster-card-image-wrap.orientation-portrait {
  aspect-ratio: 3 / 4;
}

.poster-card-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.poster-card-body {
  padding: 1rem 1.1rem 1.2rem;
}

.poster-card-title {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  line-height: 1.3;
}

.poster-card-summary {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.poster-card-tag {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.75rem;
  background: #eef3f8;
  color: var(--accent);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.badge {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}

.badge-featured {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  background: #c9a227;
  color: #1a1508;
}

.collection-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 1rem;
}

.collection-card {
  display: block;
  background: var(--surface);
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--border);
}

.collection-card h3 {
  margin: 0 0 0.35rem;
}

.collection-meta {
  color: var(--muted);
  font-size: 0.85rem;
}

/* Collection listing cards only — public collection pages use collection.css + inline hero styles */
.collection-card .collection-hero,
.collections-index .collection-hero {
  padding: 2.5rem 0 1rem;
  background: linear-gradient(180deg, #e8f0f8 0%, var(--bg) 100%);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  color: var(--muted);
  margin: 0;
}

.collection-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0;
}

.category-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.category-filters a {
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  text-decoration: none;
  color: var(--muted);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.9rem;
}

.category-filters a.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.form-card {
  background: var(--surface);
  padding: 1.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: grid;
  gap: 0.75rem;
}

label {
  font-weight: 500;
  font-size: 0.9rem;
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 100%;
}

.btn {
  display: inline-block;
  padding: 0.65rem 1.1rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  font-weight: 600;
  text-align: center;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: #eef2f6;
  color: var(--text);
}

.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.page-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.data-table th,
.data-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.muted {
  color: var(--muted);
  font-size: 0.85rem;
}

.flash {
  padding: 0.75rem 0;
  font-weight: 500;
}

.flash-success {
  color: #0d6b4d;
}

.flash-error {
  color: #b42318;
}

.flash-info {
  color: #1a4d6e;
}

.empty-state {
  color: var(--muted);
}

.help {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0 0 0.5rem;
}

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  font: inherit;
  padding: 0;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.site-footer {
  padding: 2rem 0;
  color: var(--muted);
  font-size: 0.9rem;
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}

.site-footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-footer-text {
  margin: 0;
}

.btn-footer-staff {
  display: inline-flex;
  align-items: center;
  padding: 0.55rem 1.25rem;
  min-height: 44px;
  background: var(--accent, #001f3f);
  color: #fff;
  border-radius: 6px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.btn-footer-staff:hover,
.btn-footer-staff:focus {
  filter: brightness(1.15);
  color: #fff;
}

/* Branding presets */
.brand-ems300 {
  --accent: #6b2c5e;
  --accent-hover: #542348;
}

.brand-medical_school {
  --accent: #003366;
}

.brand-vet_school {
  --accent: #2d6a4f;
}

.brand-cmvm {
  --accent: #4a5568;
}

.brand-university {
  --accent: #1f3d7a;
}

.brand-ems300 .collection-hero {
  background: linear-gradient(180deg, #f3e8f1 0%, var(--bg) 100%);
}

/* Home hero */
.hero-home {
  padding: 3rem 0 2.5rem;
  background: linear-gradient(135deg, #e8f0f8 0%, var(--bg) 55%);
}

.hero-home-grid {
  display: grid;
  grid-template-columns: 1fr minmax(200px, 360px);
  gap: 2rem;
  align-items: center;
}

.hero-home-text h1 {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 4vw, 2.75rem);
  margin: 0 0 0.75rem;
  line-height: 1.15;
}

.hero-home-text .search-hero {
  margin: 1.25rem 0;
}

.hero-home-visual {
  display: flex;
  justify-content: center;
}

.hero-visual-card {
  width: 100%;
  aspect-ratio: 4/3;
  border-radius: var(--radius);
  background: linear-gradient(145deg, #c5d4e8 0%, #8fa8c4 100%);
  box-shadow: var(--shadow);
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 1.25rem;
}

.section-head a {
  color: var(--accent);
  font-weight: 500;
  text-decoration: none;
}

.collection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.collection-card-lg {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem 1.5rem;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease;
}

.collection-card-lg:hover {
  transform: translateY(-2px);
}

.collection-card-lg h3 {
  margin: 0 0 0.5rem;
}

.collection-card-lg p {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.collection-card-lg-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.88rem;
  color: var(--muted);
}

.prose-page {
  max-width: 65ch;
  line-height: 1.7;
}

.prose-page h2 {
  font-family: var(--font-serif);
  margin-top: 2rem;
}

/* Login */
.login-layout .site-header,
.login-layout .site-footer {
  display: none;
}

.login-page {
  min-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.login-card {
  width: min(400px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
}

.login-card h1 {
  margin: 0 0 0.35rem;
  font-family: var(--font-serif);
}

.login-lead {
  color: var(--muted);
  margin: 0 0 1.25rem;
  font-size: 0.95rem;
}

.login-form {
  border: none;
  padding: 0;
  box-shadow: none;
}

.btn-block {
  width: 100%;
  margin-top: 0.5rem;
}

.login-footer {
  text-align: center;
  margin-top: 1.25rem;
  font-size: 0.9rem;
}

.login-footer a {
  color: var(--accent);
}

.site-logo {
  vertical-align: middle;
  margin-right: 0.5rem;
  object-fit: contain;
}

.search-filters .search-filter-row {
  margin-top: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.search-filters select {
  min-width: 220px;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
}

.input-with-action {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.input-with-action input {
  flex: 1;
  min-width: 200px;
}

@media (max-width: 640px) {
  .search-hero {
    flex-direction: column;
  }

  .header-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .hero-home-grid {
    grid-template-columns: 1fr;
  }

  .hero-home-visual {
    display: none;
  }
}
