:root {
  --cream: #f7f1e3;
  --cream-soft: #faf6ec;
  --paper: #fffdf7;
  --stone-50: #ece4d2;
  --stone-100: #ddd2bb;
  --stone-200: #c8b99c;
  --stone-300: #a3957a;
  --ink: #1c1f25;
  --ink-soft: #353a44;
  --muted: #6b6557;

  --lake-900: #0e2336;
  --lake-800: #143654;
  --lake-700: #1d4a6f;
  --lake-600: #2a6390;
  --lake-500: #3d80b3;
  --lake-100: #d8e6f0;

  --gold: #b58a3a;
  --gold-soft: #d9bb7a;

  --shadow-sm: 0 1px 2px rgba(20, 30, 50, 0.05);
  --shadow-md: 0 6px 24px -8px rgba(20, 30, 50, 0.18);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --serif: "Fraunces", "EB Garamond", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--cream);
  background-image:
    radial-gradient(1200px 600px at 80% -10%, rgba(45, 100, 144, 0.06), transparent 60%),
    radial-gradient(900px 500px at -10% 20%, rgba(181, 138, 58, 0.06), transparent 60%);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  margin: 0;
}

.container {
  max-width: 980px;
}

a {
  color: var(--lake-700);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
a:hover {
  color: var(--lake-800);
}

/* ---------- Header ---------- */

.site-header {
  background: linear-gradient(180deg, var(--lake-900) 0%, var(--lake-800) 100%);
  color: var(--cream-soft);
  padding: 3.5rem 0 3rem;
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.site-header::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(800px 300px at 100% 0%, rgba(217, 187, 122, 0.18), transparent 60%),
    radial-gradient(600px 300px at 0% 100%, rgba(61, 128, 179, 0.25), transparent 60%);
  pointer-events: none;
}

.site-header > .container {
  position: relative;
}

.header-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2.5rem;
  align-items: center;
}

.header-text {
  min-width: 0;
}

.lq-logo {
  display: block;
  width: 96px;
  height: auto;
  margin: 0 0 1.5rem;
  /* Source is black-on-white; invert to white-on-black, then screen blend
     drops the now-black background against the dark header. */
  filter: invert(1);
  mix-blend-mode: screen;
  opacity: 0.92;
}

.header-photo {
  flex: 0 0 auto;
}

.header-photo img {
  display: block;
  width: 240px;
  height: 240px;
  object-fit: cover;
  border-radius: 50%;
  border: 3px solid rgba(217, 187, 122, 0.35);
  box-shadow: 0 18px 40px -12px rgba(0, 0, 0, 0.55), 0 0 0 6px rgba(255, 255, 255, 0.04);
}

.eyebrow {
  font-family: var(--sans);
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold-soft);
  margin: 0 0 1rem;
  font-weight: 500;
}

.display-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2rem, 4.4vw, 3.1rem);
  line-height: 1.1;
  letter-spacing: -0.01em;
  margin: 0 0 1.25rem;
  color: var(--cream-soft);
  font-variation-settings: "opsz" 144;
}

.lede {
  font-family: var(--sans);
  font-size: 1.05rem;
  line-height: 1.7;
  color: rgba(247, 241, 227, 0.85);
  max-width: 60ch;
  margin: 0 0 1.25rem;
}

.updated {
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--gold-soft);
  letter-spacing: 0.04em;
  margin: 0;
  font-weight: 500;
}

/* ---------- Controls ---------- */

.controls {
  background: var(--paper);
  border-bottom: 1px solid var(--stone-50);
  padding: 1.25rem 0;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.controls-inner {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--muted);
  pointer-events: none;
}

.search-input {
  font-family: var(--sans);
  font-size: 1rem;
  padding: 0.7rem 2.5rem 0.7rem 2.6rem;
  border: 1px solid var(--stone-100);
  border-radius: var(--radius-md);
  background: var(--cream-soft);
  color: var(--ink);
  width: 100%;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

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

.search-input:focus {
  outline: none;
  border-color: var(--lake-600);
  background: var(--paper);
  box-shadow: 0 0 0 3px rgba(45, 99, 144, 0.15);
}

.btn-icon {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: 0;
  padding: 6px;
  cursor: pointer;
  color: var(--muted);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  color: var(--ink);
  background: var(--stone-50);
}

.btn-icon svg {
  width: 16px;
  height: 16px;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.chip {
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--stone-100);
  background: var(--cream-soft);
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.chip:hover {
  border-color: var(--lake-500);
  color: var(--lake-800);
}

.chip[aria-pressed="true"] {
  background: var(--lake-800);
  border-color: var(--lake-800);
  color: var(--cream-soft);
  box-shadow: var(--shadow-sm);
}

.chip[aria-pressed="true"]:hover {
  background: var(--lake-900);
}

.bulk-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.bulk-actions .divider {
  color: var(--stone-200);
}

.btn-link-quiet {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-size: 0.85rem;
  color: var(--lake-700);
  font-weight: 500;
  cursor: pointer;
}

.btn-link-quiet:hover {
  color: var(--lake-900);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.result-count {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
  min-height: 1.2em;
}

/* ---------- Content ---------- */

.content {
  padding: 2.5rem 0 4rem;
}

.category-section {
  margin-bottom: 3rem;
  scroll-margin-top: 220px;
}

.category-section:last-child {
  margin-bottom: 0;
}

.category-heading {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.4rem, 2.4vw, 1.8rem);
  color: var(--lake-900);
  margin: 0 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--stone-100);
  letter-spacing: -0.01em;
  font-variation-settings: "opsz" 96;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.category-heading .count {
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-transform: uppercase;
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.faq-item {
  background: var(--paper);
  border: 1px solid var(--stone-50);
  border-radius: var(--radius-md);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
  scroll-margin-top: 220px;
}

.faq-item:hover {
  border-color: var(--stone-100);
}

.faq-item[open] {
  border-color: var(--lake-500);
  box-shadow: var(--shadow-md);
}

.faq-item.target-flash {
  animation: targetFlash 1.6s ease;
}

@keyframes targetFlash {
  0% { box-shadow: 0 0 0 0 rgba(181, 138, 58, 0.5); }
  40% { box-shadow: 0 0 0 8px rgba(181, 138, 58, 0.15); }
  100% { box-shadow: var(--shadow-md); }
}

.faq-summary {
  list-style: none;
  cursor: pointer;
  padding: 1rem 1.25rem 1rem 1.25rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.08rem;
  color: var(--ink);
  line-height: 1.4;
  letter-spacing: -0.005em;
  font-variation-settings: "opsz" 36;
}

.faq-summary::-webkit-details-marker {
  display: none;
}

.faq-summary::marker {
  display: none;
  content: "";
}

.faq-summary:hover {
  color: var(--lake-800);
}

.faq-summary .chev {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin-top: 0.35rem;
  color: var(--lake-600);
  transition: transform 0.2s ease;
}

.faq-item[open] .faq-summary .chev {
  transform: rotate(90deg);
}

.faq-answer {
  padding: 0 1.25rem 1.25rem;
  color: var(--ink-soft);
  font-size: 0.98rem;
  line-height: 1.72;
  border-top: 1px solid var(--stone-50);
  padding-top: 1.1rem;
  margin-top: 0.25rem;
}

.faq-answer > *:first-child {
  margin-top: 0;
}

.faq-answer > *:last-child {
  margin-bottom: 0;
}

.faq-answer p {
  margin: 0 0 0.85rem;
}

.faq-answer ul,
.faq-answer ol {
  padding-left: 1.4rem;
  margin: 0 0 0.85rem;
}

.faq-answer li {
  margin-bottom: 0.3rem;
}

.faq-answer li::marker {
  color: var(--lake-600);
}

.faq-answer strong {
  color: var(--ink);
}

.faq-answer em {
  color: var(--ink-soft);
}

.faq-answer a {
  color: var(--lake-700);
  word-break: break-word;
}

.faq-answer table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.5rem 0 1rem;
  font-size: 0.95rem;
  background: var(--cream-soft);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.faq-answer th,
.faq-answer td {
  padding: 0.5rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--stone-50);
}

.faq-answer th {
  background: var(--stone-50);
  font-weight: 600;
  color: var(--ink);
}

.faq-answer tr:last-child td {
  border-bottom: 0;
}

.faq-answer mark.search-hit {
  background: rgba(217, 187, 122, 0.5);
  color: inherit;
  padding: 0 1px;
  border-radius: 2px;
}

.faq-permalink {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.5rem;
  font-size: 0.82rem;
  color: var(--muted);
  text-decoration: none;
  font-family: var(--sans);
  font-weight: 500;
}

.faq-permalink:hover {
  color: var(--lake-700);
}

.faq-permalink svg {
  width: 13px;
  height: 13px;
}

.faq-permalink.copied {
  color: var(--gold);
}

/* ---------- Empty state ---------- */

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 1.1rem;
  background: var(--paper);
  border: 1px dashed var(--stone-100);
  border-radius: var(--radius-md);
}

.empty-state p {
  margin: 0 0 0.75rem;
}

/* ---------- Footer ---------- */

.site-footer {
  background: var(--lake-900);
  color: rgba(247, 241, 227, 0.7);
  padding: 2rem 0;
  font-size: 0.85rem;
}

.site-footer a {
  color: var(--gold-soft);
}

.site-footer p {
  margin: 0;
  text-align: center;
}

/* ---------- Mobile ---------- */

@media (max-width: 760px) {
  .header-grid {
    grid-template-columns: 1fr;
    gap: 1.75rem;
    text-align: left;
  }

  .header-photo {
    order: -1;
  }

  .header-photo img {
    width: 180px;
    height: 180px;
    margin: 0 auto;
  }

  .lq-logo {
    width: 72px;
    margin-bottom: 1.1rem;
  }
}

@media (max-width: 600px) {
  .site-header {
    padding: 2.5rem 0 2.25rem;
  }

  .controls {
    padding: 0.85rem 0;
  }

  .action-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .bulk-actions {
    justify-content: flex-end;
  }

  .faq-summary {
    font-size: 1rem;
    padding: 0.85rem 1rem;
  }

  .faq-answer {
    padding: 1rem 1rem 1.1rem;
    font-size: 0.95rem;
  }

  .category-section,
  .faq-item {
    scroll-margin-top: 240px;
  }
}

/* ---------- Print ---------- */

@media print {
  :root {
    --paper: #fff;
    --cream: #fff;
    --cream-soft: #fff;
  }

  body {
    background: #fff;
    color: #000;
    font-size: 11pt;
  }

  .site-header {
    background: #fff;
    color: #000;
    border-bottom: 2px solid #000;
    padding: 0.5in 0 0.35in;
  }

  .site-header::before {
    display: none;
  }

  .header-grid {
    grid-template-columns: auto 1fr;
    gap: 0.4in;
  }

  .header-photo {
    display: none;
  }

  .lq-logo {
    filter: none;
    opacity: 1;
    width: 60px;
    margin: 0 0 0.15in;
  }

  .eyebrow {
    color: #555;
  }

  .display-title,
  .lede,
  .updated {
    color: #000;
  }

  .controls,
  .site-footer,
  .faq-permalink,
  .empty-state {
    display: none !important;
  }

  .content {
    padding: 0.25in 0;
  }

  .category-section {
    page-break-inside: avoid;
    margin-bottom: 0.4in;
  }

  .category-heading {
    color: #000;
    border-bottom: 1px solid #000;
    page-break-after: avoid;
  }

  .faq-item {
    border: 0;
    border-bottom: 1px solid #ccc;
    border-radius: 0;
    box-shadow: none;
    padding: 0.1in 0;
    page-break-inside: avoid;
    background: #fff;
  }

  .faq-item[open] {
    border-color: #ccc;
    box-shadow: none;
  }

  /* expand all questions for print */
  .faq-item:not([open]) .faq-answer {
    display: block;
  }

  .faq-summary {
    color: #000;
    cursor: default;
    padding: 0;
  }

  .faq-summary .chev {
    display: none;
  }

  .faq-answer {
    display: block !important;
    color: #222;
    padding: 0.1in 0 0;
    border-top: 0;
    margin-top: 0.05in;
    page-break-inside: avoid;
  }

  a {
    color: #000;
    text-decoration: underline;
  }

  .faq-answer a[href]::after {
    content: " (" attr(href) ")";
    font-size: 9pt;
    color: #555;
  }

  .faq-answer a[href^="#"]::after,
  .faq-answer a[href^="javascript:"]::after {
    content: "";
  }
}
