:root {
  color-scheme: light;
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-strong: #f1f4f7;
  --text: #17202a;
  --muted: #5d6875;
  --subtle: #7a8491;
  --border: #d9dee5;
  --accent: #175a8f;
  --accent-strong: #0f426b;
  --featured: #7a4d00;
  --focus: #2878bd;
  --shadow: 0 10px 24px rgba(23, 32, 42, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}

body {
  min-width: 320px;
  margin: 0;
}

a {
  color: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 68px;
  padding: 14px clamp(18px, 4vw, 56px);
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  font-size: 1rem;
  font-weight: 750;
  text-decoration: none;
}

.brand-mark {
  display: inline-grid;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid #a9bfce;
  border-radius: 8px;
  color: #ffffff;
  background: var(--accent);
}

.admin-link {
  flex: 0 0 auto;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--accent-strong);
  font-weight: 650;
  text-decoration: none;
  background: var(--surface);
}

.admin-link:hover,
.admin-link:focus-visible {
  border-color: var(--accent);
}

.page-shell {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  padding: 34px 0 56px;
}

.catalog-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: end;
  padding: 0 0 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 760px;
  margin-bottom: 10px;
  font-size: clamp(2rem, 6vw, 4.25rem);
  line-height: 1.02;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1.2rem;
  line-height: 1.25;
  letter-spacing: 0;
}

.intro-copy {
  max-width: 620px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.catalog-count {
  min-width: 142px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  text-align: right;
}

#visible-count {
  display: block;
  font-size: 1.7rem;
  font-weight: 800;
  line-height: 1;
}

#visible-label {
  color: var(--muted);
  font-size: 0.86rem;
}

.controls {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 280px);
  gap: 14px;
  align-items: end;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.control-field {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  background: #ffffff;
  font: inherit;
}

input:focus,
select:focus {
  outline: 3px solid rgba(40, 120, 189, 0.2);
  border-color: var(--focus);
}

.status-region {
  min-height: 28px;
  margin: 18px 0 0;
  color: var(--muted);
}

.status-message {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.status-message.error {
  border-color: #d79d9d;
  color: #8f2424;
  background: #fff5f5;
}

.section-block {
  margin-top: 28px;
}

.section-heading {
  margin-bottom: 14px;
}

.catalog-grid,
.featured-grid {
  display: grid;
  gap: 16px;
}

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

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

.presentation-card {
  display: grid;
  gap: 14px;
  min-width: 0;
  min-height: 238px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(23, 32, 42, 0.04);
  cursor: pointer;
  text-align: left;
  transition:
    border-color 140ms ease,
    box-shadow 140ms ease,
    transform 140ms ease;
}

.presentation-card:hover,
.presentation-card:focus-visible {
  border-color: #8baec8;
  box-shadow: var(--shadow);
  transform: translateY(-1px);
  outline: none;
}

.presentation-card.featured-card {
  border-color: #c8a65e;
  background: #fffdf8;
}

.card-topline,
.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.pill {
  max-width: 100%;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface-strong);
  font-size: 0.78rem;
  font-weight: 750;
  overflow-wrap: anywhere;
}

.pill.featured {
  border-color: #d8b96d;
  color: var(--featured);
  background: #fff4d6;
}

.card-title {
  margin: 0;
  font-size: 1.17rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.card-description {
  margin: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.card-meta {
  align-self: end;
  color: var(--subtle);
  font-size: 0.86rem;
}

.empty-state {
  padding: 28px;
  border: 1px dashed #bdc6d0;
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.7);
}

.admin-shell {
  max-width: 980px;
}

.admin-intro {
  padding: 0 0 24px;
}

.admin-panel {
  margin-top: 22px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.admin-panel-heading {
  margin-bottom: 16px;
}

.admin-panel-heading h2,
.admin-presentation-details h3 {
  margin: 0;
}

.admin-console {
  display: grid;
  gap: 22px;
}

.admin-form {
  display: grid;
  gap: 14px;
}

.admin-shell textarea {
  width: 100%;
  min-height: 112px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  background: #ffffff;
  font: inherit;
  resize: vertical;
}

.admin-shell textarea:focus {
  outline: 3px solid rgba(40, 120, 189, 0.2);
  border-color: var(--focus);
}

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

.upload-description,
.admin-form-actions,
.admin-status-region {
  grid-column: 1 / -1;
}

.checkbox-field {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  min-height: 44px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 750;
}

.checkbox-field input {
  width: 18px;
  min-height: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
}

.admin-shell .button-primary,
.admin-shell .button-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: 8px;
  padding: 10px 14px;
  font: inherit;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
}

.admin-shell .button-primary {
  border: 1px solid var(--accent);
  color: #ffffff;
  background: var(--accent);
}

.admin-shell .button-primary:hover,
.admin-shell .button-primary:focus-visible {
  background: var(--accent-strong);
}

.admin-shell .button-secondary {
  border: 1px solid var(--border);
  color: var(--accent-strong);
  background: var(--surface);
}

.admin-shell .button-secondary:hover,
.admin-shell .button-secondary:focus-visible {
  border-color: var(--accent);
}

.admin-shell .button-primary:disabled,
.admin-shell .button-secondary:disabled,
.admin-shell input:disabled,
.admin-shell select:disabled,
.admin-shell textarea:disabled {
  cursor: not-allowed;
  opacity: 0.66;
}

.admin-shell .status-message.success {
  border-color: #9abf9a;
  color: #245f2b;
  background: #f3fbf3;
}

.admin-list-heading,
.admin-presentation-row {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
}

.admin-presentation-list {
  display: grid;
}

.admin-presentation-row {
  padding: 14px 0;
  border-top: 1px solid var(--border);
}

.admin-presentation-row:last-child {
  border-bottom: 1px solid var(--border);
}

.admin-presentation-details {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.admin-presentation-details h3 {
  font-size: 1rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.admin-presentation-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  color: var(--muted);
  font-size: 0.86rem;
}

.admin-presentation-meta strong {
  color: var(--text);
}

.admin-presentation-actions {
  flex: 0 0 auto;
}

@media (max-width: 720px) {
  .site-header {
    min-height: 62px;
    padding-inline: 18px;
  }

  .page-shell {
    width: min(100% - 28px, 1180px);
    padding-top: 24px;
  }

  .catalog-intro,
  .controls {
    grid-template-columns: 1fr;
  }

  .catalog-count {
    width: 100%;
    text-align: left;
  }

  .presentation-card {
    min-height: auto;
  }

  .upload-form,
  .admin-list-heading,
  .admin-presentation-row {
    grid-template-columns: 1fr;
  }

  .upload-form {
    display: grid;
  }

  .admin-list-heading,
  .admin-presentation-row {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-shell .admin-form-actions .button-primary,
  .admin-shell .admin-presentation-actions .button-secondary,
  .admin-shell #refresh-presentations {
    width: 100%;
  }
}
