:root {
  --primary: #183b35;
  --background: #f8f9f7;
  --surface: #ffffff;
  --text: #1f2925;
  --muted: #65716b;
  --border: #d9e1dd;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: Arial, sans-serif;
  line-height: 1.6;
}

.container {
  width: min(100% - 32px, 1120px);
  margin-inline: auto;
}

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 18px 0;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.site-brand {
  color: var(--primary);
  font-size: 20px;
  font-weight: 700;
  text-decoration: none;
}

nav {
  display: flex;
  gap: 24px;
}

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

nav a:hover {
  color: var(--primary);
  text-decoration: underline;
}

.page-heading {
  padding: 48px 0 28px;
}

.page-heading h1 {
  margin: 0 0 8px;
  font-size: clamp(28px, 4vw, 38px);
}

.page-heading p {
  color: var(--muted);
  margin: 0;
}

.catalogue-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 24px;
}

input,
select {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 5px;
  font: inherit;
  background: white;
  max-width: 100%;
}

#search-input {
  flex: 1 1 260px;
}

a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}

@media (max-width: 600px) {
  .site-header .container {
    align-items: flex-start;
    flex-direction: column;
  }

  .catalogue-controls {
    align-items: stretch;
    flex-direction: column;
  }

  #search-input,
  .catalogue-controls select {
    width: 100%;
  }
}

#book-list {
  display: grid;
  gap: 16px;
  padding-bottom: 48px;
}

.resource-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
}

.resource-title {
  margin: 0 0 8px;
  font-size: 20px;
  line-height: 1.4;
}

.resource-author {
  color: var(--muted);
  margin: 0 0 6px;
}

.resource-category {
  color: var(--primary);
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 16px;
}

.resource-item a {
  color: var(--primary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
}

.resource-item a:hover {
  text-decoration: underline;
}

@media (max-width: 600px) {
  .resource-item {
    padding: 18px;
  }

  .resource-title {
    font-size: 18px;
  }
}

/* Resource catalogue */

#book-list {
  display: grid;
  gap: 16px;
  padding-bottom: 48px;
}

.resource-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
}

.resource-title {
  margin: 0 0 8px;
  font-size: 20px;
  line-height: 1.4;
}

.resource-author {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 14px;
}

.resource-category {
  margin: 0 0 20px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
}

/* Resource action links */

.resource-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.resource-actions a {
  display: inline-block;
  padding: 9px 14px;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--border);
  color: var(--primary);
  transition: background-color 0.15s;
}

.resource-actions a:hover {
  background: #eef3f0;
  text-decoration: none;
}

/* Highlight the primary resource action */

.resource-actions .resource-details-link {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.resource-actions .resource-details-link:hover {
  background: #245249;
}

/* Empty search results */

.empty-message {
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
}

/* Mobile adjustments */

@media (max-width: 600px) {
  .resource-item {
    padding: 18px;
  }

  .resource-title {
    font-size: 18px;
  }

  .resource-actions {
    gap: 8px;
  }

  .resource-actions a {
    padding: 8px 10px;
  }
}

/* Resource detail page */

.resource-page {
  padding-top: 36px;
  padding-bottom: 64px;
}

.breadcrumb {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 28px;
  font-size: 14px;
  color: var(--muted);
}

.breadcrumb a {
  color: var(--primary);
  text-decoration: none;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.resource-overview {
  margin-bottom: 40px;
}

.resource-overview h1 {
  font-size: clamp(28px, 4vw, 36px);
  line-height: 1.3;
  margin: 0 0 12px;
}

.resource-overview .resource-author {
  font-size: 16px;
  margin-bottom: 24px;
}

.resource-metadata {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.metadata-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.metadata-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.metadata-item span:last-child {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.reader-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.reader-header h2 {
  font-size: 22px;
  margin: 0;
}

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

.reader-actions a {
  display: inline-block;
  padding: 10px 16px;
  border-radius: 5px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.reader-actions .action-primary {
  background: var(--primary);
  color: white;
}

.reader-actions .action-secondary {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--primary);
}

.reader-actions a:hover {
  opacity: 0.88;
}

.reader-actions a:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}

.pdf-viewer {
  width: 100%;
  height: min(78vh, 850px);
  min-height: 420px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #e5e5e5;
}

@media (max-width: 600px) {
  .resource-page {
    padding-top: 22px;
  }

  .resource-metadata {
    grid-template-columns: 1fr;
  }

  .reader-actions {
    width: 100%;
  }

  .reader-actions a {
    flex: 1 1 auto;
    text-align: center;
  }

  .pdf-viewer {
    height: 65vh;
    min-height: 350px;
  }
}

/* Homepage */

.home-hero {
  padding: 90px 0 70px;
  max-width: 820px;
}

.home-eyebrow {
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.5px;
}

.home-hero h1 {
  font-size: clamp(36px, 5vw, 52px);
  line-height: 1.15;
  margin: 16px 0;
}

.home-description {
  font-size: 17px;
  color: var(--muted);
  max-width: 620px;
  margin-bottom: 30px;
}

.home-search {
  display: flex;
  gap: 10px;
}

.home-search input {
  flex: 1;
  min-width: 0;
  padding: 14px 16px;
}

.home-search button {
  background: var(--primary);
  color: white;
  border: 0;
  border-radius: 5px;
  padding: 12px 24px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.home-search button:hover {
  background: #245249;
}

.home-section {
  margin-bottom: 60px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 15px;
  margin-bottom: 20px;
}

.section-heading h2 {
  margin: 0;
  font-size: 24px;
}

.section-heading a {
  color: var(--primary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
}

.home-categories {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.home-categories a {
  background: var(--surface);
  padding: 25px 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
}

.home-categories a:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.home-search button:focus-visible,
.home-categories a:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}

@media (max-width: 768px) {
  .home-hero {
    padding: 55px 0 45px;
  }

  .home-categories {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .home-search {
    flex-direction: column;
  }

  .home-categories {
    grid-template-columns: 1fr;
  }
}
