:root {
  --navy: #10243a;
  --ink: #162435;
  --sea: #6f9d93;
  --sea-dark: #3f746c;
  --sand: #d9c3a1;
  --cream: #f7f2e9;
  --white: #fffdf8;
  --mist: #dbe6e8;
  --line: #e1d8c9;
  --muted: #687684;
  --shadow: 0 20px 60px rgba(16, 36, 58, 0.12);
  --serif: Georgia, "Times New Roman", serif;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--sans);
  letter-spacing: 0;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 14px clamp(18px, 4vw, 56px);
  background: rgba(247, 242, 233, 0.92);
  border-bottom: 1px solid rgba(16, 36, 58, 0.12);
  backdrop-filter: blur(18px);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--serif);
  font-size: 23px;
  color: var(--navy);
  white-space: nowrap;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--navy);
  border-radius: 50%;
  background: var(--white);
}
.brand-mark svg { width: 24px; height: 24px; fill: none; stroke: var(--navy); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.site-nav {
  display: flex;
  justify-content: center;
  gap: 18px;
  color: var(--navy);
  font-size: 14px;
}
.site-nav a { opacity: 0.82; }
.site-nav a:hover { opacity: 1; color: var(--sea-dark); }
.ebook-btn, .load-more, .chat-form button, .ebook-panel button[type="submit"], .form-card button, .mobile-gpt {
  border: 0;
  border-radius: 999px;
  background: var(--navy);
  color: white;
  padding: 12px 18px;
  box-shadow: 0 10px 24px rgba(16, 36, 58, 0.18);
}
.nav-toggle, .mobile-menu-fixed { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; background: var(--white); padding: 9px 12px; color: var(--navy); }
.mobile-menu-fixed {
  display: inline-flex;
  box-shadow: 0 8px 20px rgba(16, 36, 58, 0.18);
}

.hero {
  position: relative;
  min-height: 430px;
  margin: 18px clamp(16px, 4vw, 56px) 0;
  border-radius: 26px;
  overflow: hidden;
  box-shadow: var(--shadow);
  background: var(--navy);
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(16, 36, 58, 0.72), rgba(16, 36, 58, 0.18) 56%, rgba(16, 36, 58, 0.05));
}
.hero img { width: 100%; height: 100%; min-height: 430px; object-fit: cover; display: block; }
.hero-copy {
  position: absolute;
  z-index: 1;
  left: clamp(24px, 5vw, 76px);
  top: 50%;
  transform: translateY(-50%);
  max-width: 680px;
  color: white;
}
.eyebrow, .section-kicker {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
  font-weight: 800;
}
h1, h2, h3 { margin: 0; color: var(--navy); }
.hero h1 {
  color: white;
  font-family: var(--serif);
  font-size: clamp(46px, 8vw, 92px);
  line-height: 0.94;
  font-weight: 500;
}
.hero p:last-child { max-width: 520px; font-size: 20px; line-height: 1.4; color: rgba(255, 255, 255, 0.9); }

.category-strip {
  display: flex;
  gap: 10px;
  margin: 18px clamp(16px, 4vw, 56px);
  padding: 10px;
  overflow-x: auto;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.category-strip button, .filters button, .view-btn, .prompt-chips button, #clear-filters {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--navy);
  padding: 9px 13px;
  white-space: nowrap;
}
.category-strip button.active, .filters button.active, .view-btn.active {
  background: var(--sea);
  border-color: var(--sea);
  color: white;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 22px;
  align-items: start;
  padding: 0 clamp(16px, 4vw, 56px) 48px;
}
.filter-card, .panel-card, .page-card, .form-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 14px 36px rgba(16, 36, 58, 0.08);
}
.filter-card { padding: 20px; }
.filter-top { display: flex; justify-content: space-between; gap: 16px; align-items: start; }
.filter-top h2, .panel-card h2, .page-card h1 { font-family: var(--serif); font-weight: 500; font-size: 34px; }
.filters { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 18px; }
.sort-row { display: flex; align-items: center; gap: 10px; margin-top: 16px; color: var(--muted); }
select { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: white; color: var(--navy); }
.results-meta { display: flex; justify-content: space-between; align-items: center; margin: 18px 2px 12px; color: var(--muted); }
#clear-filters { padding: 7px 11px; }

.listing-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.listing-grid.list { grid-template-columns: 1fr; }
.listing-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--white);
  box-shadow: 0 12px 30px rgba(16, 36, 58, 0.08);
  transition: transform 160ms ease, box-shadow 160ms ease;
}
.listing-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.card-image { position: relative; aspect-ratio: 4 / 3; width: 100%; border: 0; padding: 0; background: var(--mist); display: block; }
.listing-grid.list .card-image { aspect-ratio: 16 / 7; }
.card-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-body { padding: 15px; }
.card-top { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.label {
  display: inline-flex;
  width: fit-content;
  border-radius: 999px;
  background: rgba(111, 157, 147, 0.18);
  color: var(--sea-dark);
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 800;
}
.heart { border: 0; background: transparent; color: var(--navy); font-size: 20px; }
.listing-card h3 { margin-top: 10px; font-family: var(--serif); font-size: 24px; font-weight: 500; }
.listing-card p { color: var(--muted); line-height: 1.45; }
.meta-line { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; font-size: 13px; color: var(--muted); }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.tag { border-radius: 999px; background: #f0ebe2; color: var(--navy); padding: 5px 8px; font-size: 12px; }
.sponsored { background: rgba(217, 195, 161, 0.35); }
.empty-state { padding: 34px; border: 1px dashed var(--line); border-radius: 20px; text-align: center; color: var(--muted); background: var(--white); }
.load-more { display: block; margin: 22px auto 0; }

.gpt-panel { position: sticky; top: 86px; }
.panel-card { padding: 20px; }
.panel-header { display: flex; gap: 12px; align-items: center; }
.mini-lighthouse { width: 32px; height: 42px; border: 2px solid var(--navy); border-radius: 12px 12px 4px 4px; background: linear-gradient(var(--sand), var(--white)); }
.gpt-copy, .gpt-greeting, .disclaimer { color: var(--muted); line-height: 1.45; }
.prompt-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.prompt-chips button { padding: 8px 10px; font-size: 13px; }
.chat-log { display: grid; gap: 10px; max-height: 320px; overflow: auto; margin: 14px 0; }
.chat-message { padding: 11px 12px; border-radius: 16px; line-height: 1.45; font-size: 14px; }
.chat-message.user { background: var(--navy); color: white; justify-self: end; max-width: 86%; }
.chat-message.assistant { background: #eef3f1; color: var(--ink); }
.chat-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 13px;
  background: #fff;
  color: var(--ink);
}
textarea { min-height: 150px; resize: vertical; }
.mobile-gpt { display: none; width: 100%; margin: 14px 0 0; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(16, 36, 58, 0.48);
  backdrop-filter: blur(8px);
}
.modal.open { display: flex; }
.modal-panel {
  position: relative;
  width: min(100%, 920px);
  max-height: 90vh;
  overflow: auto;
  background: var(--white);
  border-radius: 28px;
  box-shadow: var(--shadow);
}
.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  color: var(--navy);
  font-size: 25px;
}
.detail-hero { aspect-ratio: 16 / 7; }
.detail-hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.detail-body { padding: 26px; display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 26px; }
.detail-body h2 { font-family: var(--serif); font-size: 44px; font-weight: 500; }
.detail-copy { color: var(--muted); line-height: 1.65; }
.detail-side { background: var(--cream); border-radius: 18px; padding: 18px; }
.detail-side a { display: inline-flex; margin-top: 10px; color: var(--sea-dark); font-weight: 800; }
.ebook-panel { width: min(100%, 520px); padding: 30px; }
.ebook-panel h2 { font-family: var(--serif); font-size: 38px; font-weight: 500; }
.ebook-panel form, .form-card form { display: grid; gap: 12px; margin-top: 18px; }

.page-main { padding: 32px clamp(16px, 5vw, 70px) 70px; }
.page-card { max-width: 1040px; margin: 0 auto; padding: clamp(24px, 5vw, 54px); }
.page-card h1 { font-size: clamp(42px, 7vw, 78px); line-height: 0.98; }
.page-card .lede { max-width: 780px; font-size: 20px; line-height: 1.55; color: var(--muted); }
.content-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 30px; }
.content-tile { padding: 22px; border: 1px solid var(--line); border-radius: 20px; background: #fff; }
.content-tile h2 { font-family: var(--serif); font-weight: 500; font-size: 30px; }
.content-tile p, .page-card p { color: var(--muted); line-height: 1.65; }
.form-card { max-width: 760px; margin: 28px auto 0; padding: 24px; }

@media (min-width: 901px) {
  .nav-toggle { display: none; }
}
@media (max-width: 1180px) {
  .listing-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .app-shell { grid-template-columns: minmax(0, 1fr) 340px; }
}
@media (max-width: 900px) {
  .site-header { grid-template-columns: 1fr auto; }
  .nav-toggle {
    display: none;
    justify-self: end;
    position: fixed;
    top: 18px;
    right: 16px;
    z-index: 80;
  }
  .mobile-menu-fixed {
    display: inline-flex;
    position: fixed;
    top: 18px;
    right: 16px;
    z-index: 999;
    box-shadow: 0 8px 20px rgba(16, 36, 58, 0.18);
  }
  .brand { padding-right: 72px; }
  .site-nav {
    display: none;
    grid-column: 1 / -1;
    flex-direction: column;
    padding: 12px 0;
  }
  .site-nav.open { display: flex; }
  .ebook-btn { grid-column: 1 / -1; justify-self: start; }
  .hero { min-height: 360px; }
  .hero img { min-height: 360px; }
  .app-shell { grid-template-columns: 1fr; }
  .gpt-panel { position: fixed; inset: auto 12px 12px; z-index: 90; display: none; }
  .gpt-panel.open { display: block; }
  .panel-card { max-height: 76vh; overflow: auto; }
  .mobile-gpt { display: block; }
  .detail-body { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .brand { font-size: 19px; }
  .hero { margin: 12px; border-radius: 18px; min-height: 330px; }
  .hero img { min-height: 330px; }
  .hero-copy { left: 20px; right: 20px; }
  .hero p:last-child { font-size: 17px; }
  .category-strip, .app-shell { margin-left: 12px; margin-right: 12px; padding-left: 0; padding-right: 0; }
  .listing-grid { grid-template-columns: 1fr; }
  .filter-top { flex-direction: column; }
  .content-grid { grid-template-columns: 1fr; }
  .page-card { border-radius: 20px; }
}
