:root {
  --bg: #f7f4ed;
  --ink: #1c1b17;
  --muted: #6e665d;
  --accent: #294b1b;
  --line: rgb(28 27 23 / 18%);
  --measure: 48rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14120f;
    --ink: #e8e2d5;
    --muted: #a59b8e;
    --accent: #8fb07a;
    --line: rgb(232 226 213 / 20%);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: ui-serif, Georgia, "Iowan Old Style", "Apple Garamond", Baskerville, "Times New Roman", serif;
  font-size: 1.125rem;
  font-variant-numeric: oldstyle-nums;
  line-height: 1.55;
}

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

button {
  border: 0;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: text-decoration-thickness 120ms ease;
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  border-radius: 1px;
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

[hidden] {
  display: none !important;
}

.shell {
  width: min(var(--measure), calc(100% - 3rem));
  margin-inline: auto;
}

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

.skip-link {
  position: fixed;
  z-index: 20;
  top: 1rem;
  left: 1rem;
  padding: 0.35rem 0.55rem;
  background: var(--bg);
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: translateY(0);
}

.intro {
  padding: clamp(3rem, 12vh, 8rem) 0 3.5rem;
}

.intro h1 {
  margin: 0 0 1.25rem;
  font-size: clamp(3.5rem, 10vw, 6rem);
  font-weight: 300;
  letter-spacing: -0.03em;
  line-height: 0.95;
}

.intro h1.editorial {
  position: relative;
  display: inline-block;
  padding-bottom: 0.15em;
  font-family: "Crimson Pro", ui-serif, Georgia, "Times New Roman", serif;
}

.intro h1.editorial .swash {
  color: var(--accent);
  font-style: italic;
  font-weight: 400;
}

.intro h1.editorial::after {
  position: absolute;
  right: 0;
  bottom: 0.06em;
  left: 0;
  height: 1px;
  background: var(--ink);
  content: "";
  opacity: 0.6;
}

.intro p {
  max-width: 34rem;
  margin: 0;
  color: var(--muted);
}

#referrals {
  padding-bottom: 5rem;
}

.referral-disclosure {
  max-width: 40rem;
  padding: 0.85rem 1rem;
  border-left: 2px solid var(--accent);
  margin: 0 0 2rem;
  color: var(--ink);
  font-size: 0.9rem;
  line-height: 1.5;
}

.referral-disclosure strong {
  font-weight: 600;
}

.lookup {
  display: grid;
  gap: 1.25rem;
  margin-bottom: 2.25rem;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--line);
}

.search-field:focus-within {
  border-color: var(--accent);
}

.search-field svg {
  width: 1.1rem;
  flex: 0 0 auto;
  fill: none;
  stroke: var(--muted);
  stroke-linecap: round;
  stroke-width: 1.6;
}

.search-field input {
  width: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
}

.search-field input::placeholder {
  color: var(--muted);
  opacity: 0.85;
}

.category-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
}

.category-filters button {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  padding: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.25em;
}

.category-filters button:hover,
.category-filters button[aria-pressed="true"] {
  color: var(--accent);
  text-decoration-color: currentColor;
}

.category-filters button span {
  font-size: 0.75em;
}

.list-heading {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.65rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.list-heading p {
  margin: 0;
}

.referral-list {
  border-top: 1px solid var(--line);
}

.referral-list:empty {
  border-top: 0;
}

.referral-row {
  display: grid;
  grid-template-columns: 2.25rem minmax(0, 1fr) minmax(9rem, 0.65fr) auto;
  gap: 1.25rem;
  align-items: start;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--line);
}

.company-mark {
  color: var(--accent);
  font-family: "Crimson Pro", ui-serif, Georgia, serif;
  font-size: 1.45rem;
  font-style: italic;
  line-height: 1.1;
}

.company-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.65rem;
}

.company-name {
  margin: 0;
  font-family: "Crimson Pro", ui-serif, Georgia, serif;
  font-size: 1.25rem;
  font-weight: 400;
  letter-spacing: -0.015em;
  line-height: 1.2;
}

.category-label {
  color: var(--muted);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.product-name,
.eligibility-note {
  margin: 0;
  color: var(--muted);
}

.product-name {
  margin-top: 0.3rem;
  font-size: 0.92rem;
}

.eligibility-note {
  margin-top: 0.2rem;
  font-size: 0.75rem;
  line-height: 1.45;
}

.bonus-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.bonus-info span {
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.bonus-info strong {
  font-size: 0.9rem;
  font-weight: 400;
  line-height: 1.4;
}

.referral-button,
.secondary-button {
  display: inline-block;
  padding: 0;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1.4;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  white-space: nowrap;
}

.referral-button:hover,
.secondary-button:hover {
  text-decoration-thickness: 2px;
}

.empty-state {
  padding: 3.5rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.empty-state h2 {
  margin: 0;
  font-family: "Crimson Pro", ui-serif, Georgia, serif;
  font-size: 1.5rem;
  font-weight: 400;
}

.empty-state p {
  margin: 0.35rem 0 1rem;
  color: var(--muted);
  font-size: 0.95rem;
}

@media (max-width: 720px) {
  .referral-row {
    grid-template-columns: 2rem minmax(0, 1fr) auto;
    gap: 1rem;
  }

  .bonus-info {
    grid-column: 2;
  }

  .referral-button {
    grid-column: 3;
    grid-row: 1 / span 2;
  }
}

@media (max-width: 520px) {
  .shell {
    width: min(var(--measure), calc(100% - 2rem));
  }

  .intro {
    padding-top: 3.5rem;
  }

  .intro h1 {
    font-size: clamp(3.1rem, 17vw, 4.75rem);
  }

  .referral-row {
    grid-template-columns: 2rem minmax(0, 1fr);
  }

  .bonus-info {
    grid-column: 2;
  }

  .referral-button {
    grid-column: 2;
    grid-row: auto;
    justify-self: start;
    margin-top: 0.25rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0ms !important;
  }
}
