:root {
  --bg: #f4f5e8;
  --paper: #fffef6;
  --ink: #1a1f14;
  --muted: #5d6652;
  --line: #d9dcc7;
  --accent: #0f7b5f;
  --accent-2: #d58c2b;
  --shadow: 0 10px 25px rgba(23, 26, 20, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 15%, rgba(15, 123, 95, 0.2), transparent 34%),
    radial-gradient(circle at 82% 78%, rgba(213, 140, 43, 0.2), transparent 33%),
    repeating-linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.3) 0,
      rgba(255, 255, 255, 0.3) 2px,
      rgba(255, 255, 255, 0.05) 2px,
      rgba(255, 255, 255, 0.05) 6px
    ),
    var(--bg);
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  line-height: 1.45;
  padding: 2rem 1rem 3rem;
  overflow-x: hidden;
}

.bg-shape {
  position: fixed;
  border-radius: 100%;
  filter: blur(8px);
  z-index: -1;
  animation: drift 12s ease-in-out infinite alternate;
}

.bg-shape-a {
  width: 260px;
  height: 260px;
  top: -80px;
  right: -90px;
  background: rgba(15, 123, 95, 0.18);
}

.bg-shape-b {
  width: 220px;
  height: 220px;
  left: -80px;
  bottom: -80px;
  background: rgba(213, 140, 43, 0.2);
  animation-delay: 1.5s;
}

.hero {
  max-width: 1240px;
  margin: 0 auto 1.5rem;
  animation: rise 500ms ease-out;
  scroll-margin-top: 5.5rem;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.13em;
  font-size: 0.78rem;
  font-weight: 700;
}

h1 {
  margin: 0.4rem 0 0;
  font-size: clamp(2rem, 4vw, 3.3rem);
  line-height: 1.05;
}

p {
  text-align: justify;
}

.subtitle {
  margin: 0.8rem 0 0;
  max-width: 60ch;
  color: var(--muted);
}

.container {
  max-width: 1240px;
  margin: 0 auto;
  scroll-margin-top: 5.5rem;
}

.controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px 220px;
  gap: 0.8rem;
  margin: 1.5rem 0 1rem;
}

.search-wrap,
.filter-wrap {
  display: block;
}

.search-label {
  display: block;
  margin: 0 0 0.35rem;
  font-size: 0.86rem;
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  padding: 0.8rem 0.9rem;
  font: inherit;
  color: var(--ink);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 123, 95, 0.18);
}

.view-toggle {
  display: inline-flex;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--paper);
}

.view-option {
  flex: 1 1 50%;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0.68rem 0.75rem;
  font: inherit;
  font-size: 0.92rem;
  cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease;
}

.view-option + .view-option {
  border-left: 1px solid var(--line);
}

.view-option.is-active {
  background: rgba(15, 123, 95, 0.14);
  color: var(--ink);
  font-weight: 600;
}

.view-option:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.results-head {
  margin: 0.6rem 0 0.8rem;
}

#resultsMeta {
  margin: 0;
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.85rem;
}

.results {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.result-group {
  list-style: none;
}

.group-title {
  margin: 0 0 0.65rem;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
}

.group-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 0.9rem;
}

.card {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.76));
  border: 1px solid rgba(217, 220, 199, 0.95);
  border-radius: 16px;
  padding: 1.1rem;
  box-shadow: var(--shadow);
  animation: rise 360ms ease both;
}

.card-top {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
}

.card-name-link {
  font-size: 2.04rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: left;
  padding: 0.2rem;
}

.pill {
  margin: 0;
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  font-size: 0.74rem;
  color: rgb(11, 90, 69);
  background: rgba(15, 123, 95, 0.14);
  font-family: "IBM Plex Mono", monospace;
  text-transform: uppercase;
}

.source-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.86rem;
}

.source-link:hover {
  text-decoration: underline;
}

.title {
  margin: 0.7rem 0 0;
  font-size: 1.1rem;
  line-height: 1.25;
}

.description {
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.keywords {
  margin: 0.7rem 0 0;
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.keyword-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  font-size: 0.72rem;
  line-height: 1.2;
  color: #68491a;
  background: rgba(213, 140, 43, 0.18);
  border: 1px solid rgba(213, 140, 43, 0.35);
  font-family: "IBM Plex Mono", monospace;
}

.resource-types {
  margin: 0.55rem 0 0;
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.resource-type-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  font-size: 0.72rem;
  line-height: 1.2;
  color: #1f3f67;
  background: rgba(67, 120, 191, 0.16);
  border: 1px solid rgba(67, 120, 191, 0.34);
  font-family: "IBM Plex Mono", monospace;
}

.field-list {
  margin: 0.75rem 0 0;
  padding-top: 0.65rem;
  border-top: 1px dashed var(--line);
}

.field-row {
  display: grid;
  grid-template-columns: clamp(130px, 18vw, 210px) minmax(0, 1fr);
  gap: 0.5rem;
  margin-top: 0.35rem;
}

.field-key {
  margin: 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.74rem;
  color: var(--muted);
  text-transform: lowercase;
}

.field-value {
  margin: 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.78rem;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.empty-state {
  padding: 1.3rem;
  border: 1px dashed var(--line);
  border-radius: 14px;
  background: rgba(255, 254, 246, 0.7);
  color: var(--muted);
}

.table-wrap {
  width: 100%;
  overflow: auto;
  border: 1px solid rgba(217, 220, 199, 0.95);
  border-radius: 14px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.76));
  box-shadow: var(--shadow);
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1120px;
}

.results-table th,
.results-table td {
  text-align: left;
  vertical-align: top;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.86rem;
}

.results-table th {
  position: sticky;
  top: 0;
  background: var(--paper);
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  text-transform: lowercase;
}

.results-table td {
  font-family: "IBM Plex Mono", monospace;
  overflow-wrap: anywhere;
}

.results-table .col-name {
  min-width: 200px;
}

.results-table .col-description {
  min-width: 320px;
}

.results-table .col-keywords {
  min-width: 200px;
}
.results-table .col-educationallevel {
  min-width: 100px;
}

.results-table .col-learningresourcetype,
.results-table .col-resourcetype {
  min-width: 120px;
}

.dt-container {
  padding: 0.65rem;
}

.dt-container .dt-layout-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
  justify-content: space-between;
  margin: 0.35rem 0;
}

.dt-container .dt-input,
.dt-container .dt-length select {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
  padding: 0.35rem 0.5rem;
  font-family: "IBM Plex Mono", monospace;
}

.dt-container .dt-info,
.dt-container .dt-search label,
.dt-container .dt-length label {
  color: var(--muted);
  font-size: 0.78rem;
  font-family: "IBM Plex Mono", monospace;
}

@keyframes rise {
  from {
    transform: translateY(6px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes drift {
  from {
    transform: translateY(0) scale(1);
  }
  to {
    transform: translateY(10px) scale(1.06);
  }
}

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

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

.topnav {
  position: sticky;
  top: 0.7rem;
  z-index: 30;
  max-width: 1240px;
  margin: 0 auto 1rem;
  background: rgba(11, 90, 69, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 14px;
  box-shadow: 0 10px 20px rgba(20, 37, 31, 0.18);
  backdrop-filter: blur(8px);
}

.topnav-list {
  list-style: none;
  display: flex;
  gap: 0.35rem;
  margin: 0;
  padding: 0.35rem;
}

.topnav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #f2f2f2;
  text-decoration: none;
  border-radius: 10px;
  padding: 0.58rem 0.85rem;
  font-size: 0.94rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: background-color 120ms ease, color 120ms ease;
}

.topnav-link:hover,
.topnav-link:focus-visible {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  outline: none;
}

.topnav-link.is-active {
  background-color: #04aa6d;
  color: white;
}

@media (max-width: 740px) {
  .topnav {
    top: 0.5rem;
    margin-bottom: 0.9rem;
  }

  .topnav-list {
    width: 100%;
  }

  .topnav-list li {
    flex: 1 1 50%;
  }

  .topnav-link {
    width: 100%;
    font-size: 0.9rem;
    padding: 0.52rem 0.7rem;
  }
}
