:root {
  --paper: #f5f4ef;
  --paper-deep: #eceae3;
  --ink: #171816;
  --muted: #6c6e68;
  --line: #d9d7cf;
  --accent: #5546ff;
  --accent-soft: #dedaff;
  --white: #fbfaf7;
  --serif: "Instrument Serif", Georgia, serif;
  --sans: "DM Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button { color: inherit; }
a { color: inherit; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.shell { width: min(1480px, 100%); margin: 0 auto; padding: 0 34px; }

.topbar {
  height: 76px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  text-decoration: none;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.brand-mark {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 6px 0 0 var(--accent-soft);
}

.topbar-note, .resource-total {
  font-size: 13px;
  color: var(--muted);
}

.topbar-note { margin: 0; }
.resource-total { justify-self: end; }

.hero {
  min-height: 490px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 74px 0 68px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 28px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.hero h1 {
  max-width: 1000px;
  margin: 0;
  font-size: clamp(64px, 8vw, 122px);
  font-weight: 400;
  line-height: .82;
  letter-spacing: -.055em;
}

.hero h1 em {
  font-family: var(--serif);
  font-weight: 400;
  color: var(--accent);
}

.hero-copy {
  align-self: flex-end;
  max-width: 540px;
  margin: 58px 0 0;
  font-size: 19px;
  line-height: 1.55;
  color: var(--muted);
}

.explorer { padding: 38px 0 100px; }

.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  max-width: 780px;
  margin-bottom: 24px;
}

.search-wrap svg {
  position: absolute;
  left: 18px;
  width: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
}

.search-wrap input {
  width: 100%;
  height: 56px;
  padding: 0 54px 0 52px;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 2px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}

.search-wrap input::placeholder { color: #999a95; }
.search-wrap input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(85,70,255,.1); }

.search-wrap kbd {
  position: absolute;
  right: 16px;
  padding: 3px 7px;
  font: 12px var(--sans);
  color: var(--muted);
  background: var(--paper-deep);
  border: 1px solid var(--line);
  border-radius: 4px;
}

.filters { display: flex; gap: 8px; flex-wrap: wrap; }

.filter-button {
  padding: 9px 13px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 100px;
  cursor: pointer;
  font-size: 12px;
  transition: color .18s, background .18s, border-color .18s;
}

.filter-button:hover { border-color: var(--ink); }
.filter-button[aria-pressed="true"] { color: var(--white); background: var(--ink); border-color: var(--ink); }

.results-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 54px 0 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .1em;
}

.results-line p { margin: 0; }
.clear-button { padding: 0; border: 0; border-bottom: 1px solid currentColor; background: none; cursor: pointer; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; }

.resource-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}

.resource-card { min-width: 0; background: var(--paper); }

.card-button {
  width: 100%;
  min-height: 330px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  text-align: left;
  border: 0;
  background: transparent;
  cursor: pointer;
  transition: background .22s;
}

.card-button:hover, .card-button:focus-visible { background: var(--white); outline: none; }
.card-button:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }

.card-top, .card-bottom { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; }
.card-category { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .09em; }
.card-access { font-size: 11px; color: var(--accent); white-space: nowrap; }
.card-body { margin: auto 0; padding: 34px 0; }

.card-body h2 {
  margin: 0 0 17px;
  font-family: var(--serif);
  font-size: 38px;
  font-weight: 400;
  line-height: .95;
  letter-spacing: -.025em;
}

.card-use { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.format-list { display: flex; gap: 5px; flex-wrap: wrap; }
.format-list span { padding: 5px 8px; border-radius: 100px; background: var(--paper-deep); color: var(--muted); font-size: 10px; }
.arrow { font-size: 20px; transition: transform .2s; }
.card-button:hover .arrow { transform: translate(3px, -3px); color: var(--accent); }

.empty-state { padding: 100px 20px; text-align: center; border: 1px solid var(--line); }
.empty-state p { font: 40px var(--serif); margin: 0 0 24px; }
.empty-state button { padding: 10px 16px; border: 1px solid var(--ink); background: transparent; cursor: pointer; }

footer {
  min-height: 170px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

footer a { text-underline-offset: 4px; }

.resource-dialog {
  width: min(680px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  margin: auto 16px auto auto;
  padding: 0;
  color: var(--ink);
  background: var(--white);
  border: 0;
  box-shadow: -16px 0 80px rgba(20,20,18,.14);
}

.resource-dialog::backdrop { background: rgba(23,24,22,.26); backdrop-filter: blur(3px); }
.resource-dialog[open] { animation: slideIn .25s ease-out; }
@keyframes slideIn { from { transform: translateX(28px); opacity: 0; } }

.dialog-inner { position: relative; min-height: 100%; padding: 32px clamp(28px, 6vw, 64px) 56px; }
.dialog-close { position: sticky; top: 24px; z-index: 2; margin-left: auto; display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 50%; background: var(--white); cursor: pointer; }
.dialog-close svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.dialog-kicker { margin: 26px 0 18px; color: var(--accent); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }
.dialog-title { margin: 0; font: 64px/.92 var(--serif); letter-spacing: -.035em; }
.dialog-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 24px 0 45px; }
.dialog-tags span { padding: 7px 10px; border: 1px solid var(--line); border-radius: 100px; color: var(--muted); font-size: 11px; }
.detail-section { padding: 23px 0; border-top: 1px solid var(--line); }
.detail-section h3 { margin: 0 0 9px; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.detail-section p { margin: 0; font-size: 16px; line-height: 1.6; }
.visit-link { display: flex; align-items: center; justify-content: space-between; margin-top: 28px; padding: 17px 19px; color: var(--white); background: var(--accent); text-decoration: none; font-weight: 500; }
.visit-link:hover { background: #4434ee; }

@media (max-width: 940px) {
  .resource-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-copy { align-self: flex-start; }
}

@media (max-width: 640px) {
  .shell { padding: 0 18px; }
  .topbar { height: 64px; grid-template-columns: 1fr auto; }
  .topbar-note { display: none; }
  .hero { min-height: 430px; padding: 64px 0 54px; }
  .hero h1 { font-size: clamp(54px, 18vw, 82px); line-height: .86; }
  .hero-copy { margin-top: 42px; font-size: 16px; }
  .explorer { padding-top: 26px; }
  .resource-grid { grid-template-columns: 1fr; }
  .card-button { min-height: 290px; }
  .results-line { margin-top: 38px; }
  footer { align-items: flex-start; flex-direction: column; justify-content: center; gap: 14px; }
  .resource-dialog { width: 100%; max-height: 90vh; margin: auto 0 0; }
  .dialog-title { font-size: 52px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
