:root {
  --navy-950: #041629;
  --navy-900: #071d34;
  --navy-850: #0a2644;
  --navy-800: #0d3159;
  --ink: #091b32;
  --ink-soft: #263a50;
  --muted: #607086;
  --muted-light: #8995a4;
  --page: #ffffff;
  --surface: #ffffff;
  --surface-soft: #f6f8fa;
  --surface-blue: #eef4f9;
  --border: #dfe5eb;
  --border-strong: #cfd7df;
  --cream: #fbf6ec;
  --amber: #c88900;
  --blue: #1d5597;
  --teal: #187c7c;
  --purple: #7658a6;
  --green: #6a7c28;
  --orange: #c4660b;
  --shadow-sm: 0 1px 2px rgba(7, 29, 52, 0.05);
  --shadow-md: 0 12px 30px rgba(7, 29, 52, 0.10);
  --shadow-lg: 0 24px 70px rgba(7, 29, 52, 0.20);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --sidebar-width: 292px;
  --header-height: 82px;
  --ui-font: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif-font: Georgia, "Times New Roman", serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 24px);
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--page);
  color: var(--ink);
  font-family: var(--ui-font);
  font-size: 15px;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

button,
a,
input,
select,
summary {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

button:not(:disabled),
a,
summary,
select {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.56;
}

img {
  display: block;
  max-width: 100%;
}

svg {
  display: block;
}

h1,
h2,
h3,
p,
blockquote {
  margin-top: 0;
}

h1,
h2,
h3,
.brand-title {
  font-family: var(--serif-font);
  color: var(--ink);
}

h1,
h2,
h3 {
  text-wrap: balance;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 10px;
  left: 10px;
  transform: translateY(-140%);
  padding: 10px 14px;
  border-radius: 7px;
  background: white;
  color: var(--navy-900);
  box-shadow: var(--shadow-md);
  transition: transform 160ms ease;
}

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

:focus-visible {
  outline: 3px solid rgba(43, 113, 177, 0.35);
  outline-offset: 3px;
}

.site-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  grid-template-rows: var(--header-height) minmax(calc(100vh - var(--header-height)), auto);
  min-height: 100vh;
}

.topbar {
  position: sticky;
  z-index: 70;
  top: 0;
  grid-column: 1 / -1;
  grid-row: 1;
  display: grid;
  grid-template-columns: minmax(380px, 0.9fr) auto minmax(280px, 332px);
  align-items: center;
  gap: 28px;
  min-width: 0;
  height: var(--header-height);
  padding: 11px 27px 10px 22px;
  background: linear-gradient(100deg, var(--navy-900) 0%, var(--navy-950) 100%);
  color: white;
  box-shadow: 0 1px 0 rgba(255,255,255,0.04);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  width: fit-content;
  color: white;
}

.brand-mark {
  display: grid;
  flex: 0 0 56px;
  width: 56px;
  height: 56px;
  place-items: center;
}

.brand-mark svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.08;
}

.brand-title {
  color: white;
  font-size: 27px;
  font-weight: 700;
  letter-spacing: -0.45px;
  white-space: nowrap;
}

.brand-subtitle {
  margin-top: 6px;
  color: rgba(255,255,255,0.78);
  font-family: var(--serif-font);
  font-size: 15px;
  white-space: nowrap;
}

.top-nav {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 44px;
  height: 100%;
}

.top-nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1px 0 0;
  border: 0;
  background: transparent;
  color: rgba(255,255,255,0.94);
  font-family: var(--ui-font);
  font-size: 15.5px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
}

.top-nav-link::after {
  position: absolute;
  right: 0;
  bottom: 6px;
  left: 0;
  height: 2px;
  border-radius: 999px;
  background: #9ec9ef;
  content: "";
  opacity: 0;
  transform: scaleX(0.35);
  transition: opacity 160ms ease, transform 160ms ease;
}

.top-nav-link:hover,
.top-nav-link.is-active {
  color: white;
}

.top-nav-link:hover::after,
.top-nav-link.is-active::after {
  opacity: 1;
  transform: scaleX(1);
}

.top-nav-button {
  appearance: none;
}

.header-search {
  position: relative;
  display: flex;
  align-items: center;
  height: 44px;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 8px;
  background: rgba(4, 22, 41, 0.44);
  color: rgba(255,255,255,0.92);
}

.search-icon {
  flex: 0 0 auto;
  width: 21px;
  height: 21px;
  margin-left: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.header-search input {
  min-width: 0;
  flex: 1;
  height: 100%;
  padding: 0 38px 0 12px;
  border: 0;
  outline: 0;
  background: transparent;
  color: white;
  font-size: 15px;
}

.header-search input::placeholder {
  color: rgba(255,255,255,0.68);
}

.search-clear {
  position: absolute;
  right: 7px;
  display: grid;
  width: 30px;
  height: 30px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: rgba(255,255,255,0.82);
}

.search-clear:hover {
  background: rgba(255,255,255,0.08);
}

.search-clear svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.search-results {
  position: absolute;
  z-index: 120;
  top: calc(100% + 9px);
  right: 0;
  left: 0;
  max-height: min(430px, calc(100vh - 110px));
  overflow: auto;
  padding: 7px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: white;
  color: var(--ink);
  box-shadow: var(--shadow-lg);
}

.search-result-item {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  text-align: left;
}

.search-result-item:hover,
.search-result-item:focus-visible {
  background: var(--surface-soft);
}

.search-result-avatar {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 8px;
  background: var(--surface-blue);
  color: var(--navy-800);
  font-family: var(--serif-font);
  font-size: 15px;
  font-weight: 700;
}

.search-result-copy {
  min-width: 0;
}

.search-result-copy strong,
.search-result-copy small {
  display: block;
}

.search-result-copy strong {
  overflow: hidden;
  font-family: var(--serif-font);
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-result-copy small {
  color: var(--muted);
  font-size: 12px;
}

.search-result-era {
  color: var(--muted);
  font-size: 11px;
}

.search-no-results {
  padding: 18px 12px;
  color: var(--muted);
  text-align: center;
}

.icon-button,
.mobile-menu-button {
  display: none;
}

.sidebar {
  position: sticky;
  z-index: 40;
  top: var(--header-height);
  grid-column: 1;
  grid-row: 2;
  width: var(--sidebar-width);
  height: calc(100vh - var(--header-height));
  overflow: hidden;
  border-right: 1px solid var(--border);
  background: white;
}

.sidebar-scroll {
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #d3dbe3 transparent;
}

.sidebar-section {
  padding: 26px 22px 20px;
  border-bottom: 1px solid #e8edf1;
}

.sidebar-section h2,
.quote-card h2 {
  margin-bottom: 11px;
  color: var(--navy-850);
  font-family: var(--ui-font);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.explore-section {
  padding-bottom: 15px;
}

.sidebar-link {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 22px;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  padding: 8px 2px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #27374b;
  font-size: 14px;
  text-align: left;
}

.sidebar-link:hover {
  background: var(--surface-soft);
  color: var(--navy-800);
}

.sidebar-link > svg:not(.chevron) {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: #66788d;
  stroke-width: 1.55;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar-link .chevron {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: #5d6c7e;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.selection-count {
  display: grid;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  place-items: center;
  border-radius: 999px;
  background: var(--surface-blue);
  color: var(--navy-800);
  font-size: 11px;
  font-weight: 700;
}

.themes-sidebar {
  padding-top: 17px;
  padding-bottom: 20px;
}

.theme-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 7px;
}

.theme-chip {
  min-height: 31px;
  padding: 5px 9px;
  border: 1px solid #e4e8ed;
  border-radius: 8px;
  background: #f4f6f8;
  color: var(--navy-850);
  font-size: 12px;
  line-height: 1.2;
}

.theme-chip:hover,
.theme-chip.is-active {
  border-color: #c9d9e8;
  background: #eaf2f9;
}

.quote-card {
  position: relative;
  margin: 8px 22px 20px;
  padding: 13px 18px 11px;
  overflow: hidden;
  border: 1px solid #f0eadf;
  border-radius: 10px;
  background: linear-gradient(145deg, #fffdf9 0%, var(--cream) 100%);
}

.quote-card h2 {
  margin-bottom: 12px;
}

.quote-mark {
  position: absolute;
  top: 41px;
  left: 16px;
  width: 23px;
  height: 23px;
  fill: var(--navy-800);
}

.quote-card blockquote {
  min-height: 49px;
  margin: 0 4px 4px 31px;
  color: #183b63;
  font-family: var(--serif-font);
  font-size: 18px;
  font-style: italic;
  line-height: 1.45;
}

.quote-author {
  margin: 0 0 3px 31px;
  color: var(--navy-800);
  font-family: var(--serif-font);
  font-size: 14px;
}

.quote-link {
  float: right;
  margin-top: 3px;
}

.beginner-card {
  margin: 0 22px 28px;
  padding: 20px 24px 21px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--navy-850), #06233f);
  color: white;
}

.beginner-card h2 {
  margin-bottom: 7px;
  color: white;
  font-size: 19px;
}

.beginner-card p {
  margin-bottom: 16px;
  color: rgba(255,255,255,0.88);
  font-size: 13.5px;
}

.light-button {
  min-height: 37px;
  padding: 8px 19px;
  border: 0;
  border-radius: 7px;
  background: white;
  color: var(--navy-850);
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.light-button:hover {
  background: #f3f7fb;
}

.main-content {
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
  padding: 32px 28px 0 30px;
  background: white;
}

.hero {
  position: relative;
  isolation: isolate;
  min-height: 292px;
  overflow: hidden;
  border-radius: 13px;
  background-image: url("assets/hero.jpg");
  background-color: #e9f2f8;
  background-position: right 47%;
  background-repeat: no-repeat;
  background-size: 85% auto;
  box-shadow: inset 0 0 0 1px rgba(7, 29, 52, 0.04);
}

.hero::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  background: linear-gradient(90deg, rgba(239,246,251,0.98) 0%, rgba(243,248,252,0.94) 30%, rgba(245,249,252,0.50) 55%, rgba(255,255,255,0.03) 76%);
  content: "";
  pointer-events: none;
}

.hero::after {
  position: absolute;
  z-index: -1;
  right: 0;
  bottom: 0;
  left: 0;
  height: 34%;
  background: linear-gradient(0deg, rgba(20, 31, 38, 0.18), transparent);
  content: "";
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 2;
  width: 60%;
  padding: 33px 30px 24px 53px;
}

.hero h1 {
  margin-bottom: 16px;
  font-size: clamp(40px, 3.25vw, 50px);
  font-weight: 500;
  letter-spacing: -1.75px;
  line-height: 1.05;
}

.hero-content > p {
  margin-bottom: 17px;
  color: #27445f;
  font-size: 17px;
  line-height: 1.55;
}

.primary-button,
.secondary-button,
.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  font-weight: 600;
  transition: transform 150ms ease, background 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.primary-button {
  min-height: 48px;
  padding: 11px 25px;
  border: 1px solid var(--navy-900);
  background: linear-gradient(135deg, #092847, #061a30);
  color: white;
  font-size: 14px;
  box-shadow: 0 7px 18px rgba(5, 28, 50, 0.16);
}

.primary-button:hover {
  background: linear-gradient(135deg, #0c355e, #082641);
  transform: translateY(-1px);
}

.primary-button.compact {
  min-height: 40px;
  padding: 8px 17px;
  font-size: 13px;
}

.secondary-button {
  min-height: 42px;
  padding: 9px 17px;
  border: 1px solid var(--border-strong);
  background: white;
  color: var(--navy-850);
  font-size: 13px;
}

.secondary-button:hover {
  border-color: #aebdca;
  background: #f8fafb;
}

.text-button {
  padding: 8px 10px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
}

.text-button:hover {
  color: var(--navy-800);
}

.hero-facts {
  position: absolute;
  z-index: 3;
  top: 51px;
  right: 58px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: 400px;
  min-height: 190px;
  padding: 29px 28px 26px;
  gap: 30px 28px;
  border: 1px solid rgba(255,255,255,0.66);
  border-radius: 17px;
  background: rgba(255,255,255,0.87);
  box-shadow: 0 16px 34px rgba(25, 45, 65, 0.16);
  backdrop-filter: blur(12px);
}

.hero-fact {
  display: grid;
  grid-template-columns: 37px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  color: var(--navy-850);
}

.hero-fact svg {
  width: 35px;
  height: 35px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hero-fact strong,
.hero-fact small {
  display: block;
}

.hero-fact strong {
  margin-top: 1px;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.32;
}

.hero-fact small {
  margin-top: 3px;
  font-size: 13px;
  line-height: 1.32;
}

.section-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.compact-heading-row h2 {
  margin: 0;
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.35px;
}

.featured-section {
  padding-top: 23px;
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
  border: 0;
  background: transparent;
  color: #184f86;
  font-family: var(--ui-font);
  font-size: 13px;
  font-weight: 500;
}

.text-link:hover {
  color: #0c6ab7;
}

.featured-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 20px;
  margin-top: 14px;
}

.featured-card {
  position: relative;
  display: grid;
  grid-template-columns: 42% minmax(0, 1fr);
  min-width: 0;
  min-height: 212px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: white;
  box-shadow: var(--shadow-sm);
  text-align: left;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.featured-card:hover {
  border-color: #c7d2dd;
  box-shadow: 0 12px 25px rgba(7,29,52,0.09);
  transform: translateY(-2px);
}

.featured-portrait {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
  background: #d9d3c6;
}

.featured-card[data-id="confucius"] .featured-portrait {
  object-position: center 24%;
}

.featured-card[data-id="kant"] .featured-portrait {
  object-position: 58% center;
}

.featured-card-copy {
  display: flex;
  min-width: 0;
  padding: 17px 9px 11px 12px;
  flex-direction: column;
}

.featured-card-name {
  display: block;
  margin: 0 0 3px;
  font-size: 15.5px;
  line-height: 1.25;
}

.featured-lifespan {
  display: block;
  margin-bottom: 12px;
  color: var(--muted);
  font-family: var(--serif-font);
  font-size: 12px;
}

.featured-thought {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: #253548;
  font-size: 11.4px;
  line-height: 1.52;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
}

.featured-era {
  align-self: flex-start;
  margin-top: auto;
  padding: 4px 8px;
  border-radius: 6px;
  background: #f8f1e4;
  color: #7b5517;
  font-size: 10px;
  line-height: 1.2;
}

.featured-card[data-era="Enlightenment"] .featured-era {
  background: #eaf1f8;
  color: #205689;
}

.featured-card[data-era="Modern"] .featured-era {
  background: #eef3f3;
  color: #256868;
}

.time-preview {
  padding-top: 29px;
}

.era-preview {
  position: relative;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin-top: 11px;
  padding-top: 1px;
}

.era-preview::before {
  position: absolute;
  top: 9px;
  right: 0;
  left: 0;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg,
    var(--green) 0% 16.66%,
    #d09b08 16.66% 33.33%,
    var(--orange) 33.33% 50%,
    var(--blue) 50% 66.66%,
    var(--purple) 66.66% 83.33%,
    var(--teal) 83.33% 100%);
  content: "";
}

.era-preview-item {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  padding: 0 9px;
  border: 0;
  background: transparent;
  flex-direction: column;
  text-align: center;
}

.era-preview-dot {
  width: 14px;
  height: 14px;
  margin-bottom: 8px;
  border-radius: 50%;
  background: var(--era-color);
  box-shadow: 0 0 0 4px white;
}

.era-preview-item strong {
  color: var(--era-color);
  font-family: var(--serif-font);
  font-size: 14px;
  font-weight: 500;
}

.era-preview-item small {
  margin-top: 2px;
  color: #35506d;
  font-size: 11px;
  line-height: 1.3;
}

.era-preview-item:hover strong {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.time-preview-link-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px;
  padding: 17px 0 38px;
}

.quick-action {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  min-height: 132px;
  padding: 20px 23px 18px 16px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: white;
  text-align: left;
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.quick-action:hover {
  border-color: #c9d5df;
  box-shadow: 0 10px 23px rgba(7, 29, 52, 0.07);
  transform: translateY(-2px);
}

.quick-action-icon {
  display: grid;
  width: 64px;
  height: 64px;
  place-items: center;
  border-radius: 50%;
}

.quick-action-icon svg {
  width: 32px;
  height: 32px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.quick-action-icon.amber {
  background: #fbf1df;
  color: #c08100;
}

.quick-action-icon.blue {
  background: #e9eef8;
  color: #245ca1;
}

.quick-action-icon.teal {
  background: #e8f2f2;
  color: #1b6c74;
}

.quick-action-copy {
  display: block;
  min-width: 0;
}

.quick-action-copy strong,
.quick-action-copy small,
.action-link {
  display: block;
}

.quick-action-copy strong {
  margin-bottom: 5px;
  font-family: var(--serif-font);
  font-size: 16.5px;
  font-weight: 600;
}

.quick-action-copy small {
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 12.3px;
  line-height: 1.55;
}

.action-link {
  color: #205c9b;
  font-size: 12.4px;
  font-weight: 500;
}

.content-section {
  margin: 48px -28px 0 -30px;
  padding: 76px 56px 80px 58px;
  border-top: 1px solid #edf0f3;
}

.philosophers-section {
  background: #f8fafb;
}

.section-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  max-width: 1320px;
  margin: 0 auto 30px;
}

.section-overline {
  margin-bottom: 7px;
  color: #38638e;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.section-intro h2,
.about-layout h2,
.connections-copy h2 {
  margin-bottom: 10px;
  font-size: clamp(31px, 3vw, 43px);
  font-weight: 500;
  letter-spacing: -1px;
  line-height: 1.1;
}

.section-intro > div > p:last-child,
.connections-copy > p:not(.section-overline) {
  max-width: 650px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 16px;
}

.result-summary {
  flex: 0 0 auto;
  padding: 9px 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
  color: var(--muted);
  font-size: 12px;
}

.filter-panel {
  display: grid;
  grid-template-columns: minmax(260px, 1.5fr) repeat(3, minmax(150px, 0.75fr)) auto;
  align-items: end;
  gap: 13px;
  max-width: 1320px;
  margin: 0 auto 18px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: white;
  box-shadow: var(--shadow-sm);
}

.filter-field {
  min-width: 0;
}

.filter-field label,
.connection-selector label {
  display: block;
  margin-bottom: 6px;
  color: #43546a;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.filter-field input,
.filter-field select,
.connection-selector select {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  outline: 0;
  background: white;
  color: var(--ink);
  font-size: 13px;
}

.filter-field input:focus,
.filter-field select:focus,
.connection-selector select:focus {
  border-color: #7ba8d0;
  box-shadow: 0 0 0 3px rgba(78, 136, 190, 0.14);
}

.field-input-wrap {
  position: relative;
}

.field-input-wrap svg {
  position: absolute;
  top: 50%;
  left: 12px;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.7;
  transform: translateY(-50%);
}

.field-input-wrap input {
  padding-left: 39px;
}

.clear-filters-button {
  white-space: nowrap;
}

.active-filter-row {
  display: flex;
  max-width: 1320px;
  margin: 0 auto 18px;
  flex-wrap: wrap;
  gap: 8px;
}

.active-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 9px 6px 11px;
  border: 1px solid #cad9e7;
  border-radius: 999px;
  background: #edf4fa;
  color: #285781;
  font-size: 12px;
}

.active-filter-pill button {
  display: grid;
  width: 20px;
  height: 20px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(37, 89, 129, 0.1);
  color: inherit;
}

.active-filter-pill svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.philosopher-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 17px;
  max-width: 1320px;
  margin: 0 auto;
}

.library-card {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 212px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: white;
  box-shadow: var(--shadow-sm);
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
  flex-direction: column;
}

.library-card:hover {
  border-color: #c5d1dc;
  box-shadow: 0 12px 28px rgba(7,29,52,0.08);
  transform: translateY(-2px);
}

.library-card-main {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 15px;
  width: 100%;
  padding: 17px 16px 12px;
  border: 0;
  background: transparent;
  text-align: left;
}

.library-avatar {
  position: relative;
  display: grid;
  width: 72px;
  height: 88px;
  overflow: hidden;
  place-items: center;
  border-radius: 9px;
  background: linear-gradient(145deg, var(--avatar-soft), white);
  color: var(--avatar-color);
  font-family: var(--serif-font);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: inset 0 0 0 1px rgba(7,29,52,0.06);
}

.library-avatar::after {
  position: absolute;
  inset: 8px;
  border: 1px solid currentColor;
  border-radius: 50% 50% 46% 46%;
  content: "";
  opacity: 0.12;
}

.library-avatar.has-image::after {
  display: none;
}

.library-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
}

.library-card-copy {
  min-width: 0;
}

.library-card-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 8px;
}

.library-card-name {
  display: block;
  margin: 0 38px 2px 0;
  color: var(--navy-900);
  font-family: var(--serif-font);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.25;
}

.library-card-lifespan {
  margin-bottom: 8px;
  color: var(--muted);
  font-family: var(--serif-font);
  font-size: 12px;
}

.library-card-summary {
  display: -webkit-box;
  margin: 0 0 9px;
  overflow: hidden;
  color: #445267;
  font-size: 12.3px;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.library-card-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.meta-pill {
  padding: 4px 7px;
  border-radius: 5px;
  background: var(--surface-soft);
  color: #4c5e73;
  font-size: 10.5px;
}

.favorite-button {
  position: absolute;
  z-index: 2;
  top: 13px;
  right: 13px;
  display: grid;
  flex: 0 0 31px;
  width: 31px;
  height: 31px;
  padding: 0;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: #8794a3;
}

.favorite-button:hover {
  border-color: var(--border);
  background: var(--surface-soft);
  color: #bf5d66;
}

.favorite-button.is-favorite {
  color: #b94e5a;
}

.favorite-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.favorite-button.is-favorite svg {
  fill: currentColor;
}

.library-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding: 10px 15px 12px;
  border-top: 1px solid #edf0f3;
}

.compare-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #526378;
  font-size: 11.5px;
}

.compare-toggle input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--navy-800);
}

.card-open-link {
  border: 0;
  background: transparent;
  color: #1d5b96;
  font-size: 11.5px;
  font-weight: 600;
}

.card-open-link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.empty-state {
  max-width: 540px;
  margin: 50px auto 20px;
  padding: 42px 30px;
  border: 1px dashed #cbd5df;
  border-radius: 12px;
  background: white;
  text-align: center;
}

.empty-state svg {
  width: 40px;
  height: 40px;
  margin: 0 auto 13px;
  fill: none;
  stroke: #6e8296;
  stroke-width: 1.5;
}

.empty-state h3 {
  margin-bottom: 6px;
  font-size: 22px;
}

.empty-state p {
  color: var(--muted);
}

.show-more-row {
  display: flex;
  justify-content: center;
  max-width: 1320px;
  margin: 26px auto 0;
}

.themes-section {
  background: white;
}

.theme-browser {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  max-width: 1320px;
  margin: 0 auto;
}

.theme-browser-card {
  position: relative;
  min-height: 170px;
  overflow: hidden;
  padding: 23px 22px 19px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: white;
  text-align: left;
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.theme-browser-card::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 4px;
  background: var(--theme-color);
  content: "";
}

.theme-browser-card:hover {
  border-color: #c3d0db;
  box-shadow: 0 12px 25px rgba(7,29,52,0.07);
  transform: translateY(-2px);
}

.theme-browser-icon {
  display: grid;
  width: 42px;
  height: 42px;
  margin-bottom: 16px;
  place-items: center;
  border-radius: 50%;
  background: var(--theme-soft);
  color: var(--theme-color);
  font-family: var(--serif-font);
  font-size: 19px;
  font-weight: 700;
}

.theme-browser-card h3 {
  margin-bottom: 5px;
  font-size: 18px;
}

.theme-browser-card p {
  margin-bottom: 13px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.theme-count {
  color: #41627f;
  font-size: 11px;
  font-weight: 600;
}

.timeline-section {
  background: #f8fafb;
}

.timeline-controls {
  display: flex;
  max-width: 1320px;
  margin: 0 auto 28px;
  flex-wrap: wrap;
  gap: 8px;
}

.timeline-control {
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: white;
  color: #4a5c71;
  font-size: 12px;
}

.timeline-control:hover,
.timeline-control.is-active {
  border-color: var(--control-color);
  background: var(--control-soft);
  color: var(--control-color);
}

.timeline-list {
  max-width: 1320px;
  margin: 0 auto;
}

.timeline-era-group {
  display: grid;
  grid-template-columns: 205px minmax(0, 1fr);
  gap: 28px;
  padding: 29px 0;
  border-top: 1px solid var(--border);
}

.timeline-era-group:first-child {
  border-top: 0;
  padding-top: 0;
}

.timeline-era-heading {
  position: sticky;
  top: calc(var(--header-height) + 20px);
  align-self: start;
  padding-top: 3px;
}

.timeline-era-heading h3 {
  margin-bottom: 4px;
  color: var(--era-color);
  font-size: 25px;
}

.timeline-era-heading p {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
}

.timeline-era-heading small {
  color: #788697;
  font-size: 11px;
}

.timeline-people {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.timeline-person {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 57px;
  padding: 10px 12px 10px 15px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--era-color);
  border-radius: 8px;
  background: white;
  text-align: left;
}

.timeline-person:hover {
  border-color: #c7d2dd;
  border-left-color: var(--era-color);
  box-shadow: var(--shadow-sm);
}

.timeline-person strong,
.timeline-person small {
  display: block;
}

.timeline-person strong {
  font-family: var(--serif-font);
  font-size: 14px;
}

.timeline-person small {
  color: var(--muted);
  font-size: 10.5px;
}

.timeline-person svg {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  fill: none;
  stroke: #65778a;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.connections-section {
  background: white;
}

.connections-layout {
  display: grid;
  grid-template-columns: minmax(270px, 0.7fr) minmax(0, 1.3fr);
  align-items: center;
  gap: 70px;
  max-width: 1320px;
  margin: 0 auto;
}

.connection-selector {
  max-width: 360px;
  margin-top: 24px;
}

.connection-path {
  display: grid;
  align-items: center;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px;
}

.connection-node {
  position: relative;
  min-height: 154px;
  padding: 22px 16px 17px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: white;
  box-shadow: var(--shadow-sm);
  text-align: center;
}

.connection-node:not(:last-child)::after {
  position: absolute;
  top: 50%;
  left: calc(100% + 5px);
  width: 15px;
  height: 1px;
  background: #9cb1c3;
  content: "";
}

.connection-node:not(:last-child)::before {
  position: absolute;
  z-index: 2;
  top: calc(50% - 3px);
  left: calc(100% + 16px);
  width: 7px;
  height: 7px;
  border-top: 1px solid #9cb1c3;
  border-right: 1px solid #9cb1c3;
  content: "";
  transform: rotate(45deg);
}

.connection-node-number {
  display: grid;
  width: 34px;
  height: 34px;
  margin: 0 auto 11px;
  place-items: center;
  border-radius: 50%;
  background: var(--node-soft);
  color: var(--node-color);
  font-family: var(--serif-font);
  font-weight: 700;
}

.connection-node h3 {
  margin-bottom: 3px;
  font-size: 17px;
}

.connection-node p {
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 11px;
}

.connection-node button {
  border: 0;
  background: transparent;
  color: #245f97;
  font-size: 11px;
  font-weight: 600;
}

.about-section {
  background: linear-gradient(135deg, var(--navy-900), #092a49);
  color: white;
}

.about-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 80px;
  max-width: 1320px;
  margin: 0 auto;
}

.about-layout .section-overline {
  color: #9ec5e7;
}

.about-layout h2 {
  color: white;
}

.about-copy p {
  color: rgba(255,255,255,0.8);
  font-size: 15px;
}

.credits-details {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid rgba(255,255,255,0.17);
}

.credits-details summary {
  color: white;
  font-weight: 600;
}

.credits-copy {
  padding-top: 9px;
}

.credits-copy p {
  margin-bottom: 0;
  font-size: 12px;
  line-height: 1.65;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin: 0 -28px 0 -30px;
  padding: 26px 58px;
  border-top: 1px solid var(--border);
  background: white;
  color: var(--muted);
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.footer-mark {
  display: grid;
  width: 39px;
  height: 39px;
  place-items: center;
  border-radius: 50%;
  background: var(--navy-900);
  color: white;
  font-family: var(--serif-font);
  font-size: 21px;
}

.footer-brand strong,
.footer-brand small {
  display: block;
}

.footer-brand strong {
  color: var(--ink);
  font-family: var(--serif-font);
}

.footer-brand small,
.site-footer p {
  margin: 0;
  font-size: 11.5px;
}

.compare-tray {
  position: fixed;
  z-index: 80;
  right: 30px;
  bottom: 24px;
  left: calc(var(--sidebar-width) + 30px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  min-height: 70px;
  padding: 12px 14px 12px 18px;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 12px;
  background: rgba(6,27,49,0.97);
  color: white;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(10px);
}

.compare-tray-copy {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 14px;
}

.compare-tray-label {
  color: #b7cce0;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.compare-selected {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  gap: 8px;
}

.compare-selected-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 9px;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  font-size: 12px;
}

.compare-selected-pill button {
  display: grid;
  width: 19px;
  height: 19px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  color: white;
}

.compare-selected-pill svg {
  width: 11px;
  height: 11px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.compare-tray-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

.compare-tray .text-button {
  color: rgba(255,255,255,0.76);
}

.modal-backdrop {
  position: fixed;
  z-index: 200;
  inset: 0;
  background: rgba(2, 13, 24, 0.58);
  backdrop-filter: blur(4px);
}

.modal {
  position: fixed;
  z-index: 210;
  top: 50%;
  left: 50%;
  width: min(920px, calc(100vw - 40px));
  max-height: min(820px, calc(100vh - 40px));
  overflow: auto;
  border: 1px solid rgba(255,255,255,0.75);
  border-radius: 17px;
  background: white;
  box-shadow: var(--shadow-lg);
  transform: translate(-50%, -50%);
}

.modal-close {
  position: absolute;
  z-index: 3;
  top: 17px;
  right: 17px;
  display: grid;
  width: 39px;
  height: 39px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: rgba(255,255,255,0.92);
  color: var(--ink-soft);
  box-shadow: var(--shadow-sm);
}

.modal-close:hover {
  background: var(--surface-soft);
}

.modal-close svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.detail-hero {
  position: relative;
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  min-height: 300px;
  overflow: hidden;
  border-radius: 16px 16px 0 0;
  background: linear-gradient(135deg, var(--detail-soft), #ffffff 72%);
}

.detail-portrait,
.detail-monogram {
  width: 100%;
  height: 100%;
  min-height: 300px;
}

.detail-portrait {
  object-fit: cover;
  object-position: center 18%;
}

.detail-monogram {
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, var(--detail-color), var(--navy-900));
  color: white;
  font-family: var(--serif-font);
  font-size: 70px;
  font-weight: 700;
}

.detail-heading {
  display: flex;
  padding: 51px 66px 37px 39px;
  flex-direction: column;
}

.detail-kicker {
  margin-bottom: 7px;
  color: var(--detail-color);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.detail-heading h2 {
  margin-bottom: 5px;
  font-size: 42px;
  font-weight: 500;
  letter-spacing: -1.2px;
  line-height: 1.05;
}

.detail-lifespan {
  margin-bottom: 13px;
  color: #496078;
  font-family: var(--serif-font);
  font-size: 15px;
}

.detail-summary {
  max-width: 540px;
  margin-bottom: 16px;
  color: #46576b;
  font-size: 14px;
}

.detail-tags {
  display: flex;
  margin-top: auto;
  flex-wrap: wrap;
  gap: 7px;
}

.detail-tags span {
  padding: 5px 8px;
  border: 1px solid rgba(7,29,52,0.08);
  border-radius: 6px;
  background: rgba(255,255,255,0.72);
  color: #42566d;
  font-size: 11px;
}

.detail-body {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 35px;
  padding: 34px 39px 40px;
}

.detail-section h3 {
  margin-bottom: 11px;
  font-size: 19px;
}

.detail-section + .detail-section {
  margin-top: 26px;
}

.idea-list,
.works-list,
.related-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.idea-list li {
  position: relative;
  margin-bottom: 9px;
  padding-left: 17px;
  color: #47586c;
  font-size: 13px;
}

.idea-list li::before {
  position: absolute;
  top: 0.66em;
  left: 0;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--detail-color);
  content: "";
}

.works-list li {
  display: flex;
  align-items: start;
  gap: 9px;
  margin-bottom: 9px;
  color: #47586c;
  font-size: 13px;
}

.works-list svg {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin-top: 2px;
  fill: none;
  stroke: var(--detail-color);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.start-card {
  padding: 17px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
}

.start-card span,
.start-card strong,
.start-card small {
  display: block;
}

.start-card span {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.start-card strong {
  margin-bottom: 3px;
  font-family: var(--serif-font);
  font-size: 17px;
}

.start-card small {
  color: var(--muted);
  font-size: 11px;
}

.difficulty-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 14px;
}

.difficulty-row > span {
  color: var(--muted);
  font-size: 11px;
}

.difficulty-dots {
  display: flex;
  gap: 4px;
}

.difficulty-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #d7dee5;
}

.difficulty-dot.is-filled {
  background: var(--detail-color);
}

.related-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.related-list button {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: white;
  color: #345779;
  font-size: 11px;
  text-align: left;
}

.related-list button:hover {
  background: var(--surface-soft);
}

.modal-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 22px;
  padding: 30px 30px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  margin: 0;
  font-size: 31px;
}

.inline-close {
  position: static;
  flex: 0 0 auto;
}

.compare-modal {
  width: min(1040px, calc(100vw - 40px));
}

.compare-modal-content {
  overflow-x: auto;
  padding: 23px 30px 31px;
}

.compare-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  table-layout: fixed;
}

.compare-table th,
.compare-table td {
  padding: 14px 15px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  text-align: left;
}

.compare-table th:first-child,
.compare-table td:first-child {
  width: 150px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.compare-name-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.compare-avatar {
  display: grid;
  width: 47px;
  height: 54px;
  overflow: hidden;
  place-items: center;
  border-radius: 7px;
  background: var(--compare-soft);
  color: var(--compare-color);
  font-family: var(--serif-font);
  font-weight: 700;
}

.compare-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.compare-name-cell strong,
.compare-name-cell small {
  display: block;
}

.compare-name-cell strong {
  font-family: var(--serif-font);
  font-size: 17px;
}

.compare-name-cell small {
  color: var(--muted);
  font-size: 11px;
}

.compare-cell-list {
  margin: 0;
  padding-left: 18px;
}

.compare-cell-list li {
  margin-bottom: 5px;
  color: #46576b;
  font-size: 12px;
}

.guide-modal {
  width: min(880px, calc(100vw - 40px));
  padding: 42px 42px 36px;
}

.guide-header {
  max-width: 670px;
  margin-bottom: 26px;
}

.guide-icon {
  display: grid;
  width: 49px;
  height: 49px;
  margin-bottom: 17px;
  place-items: center;
  border-radius: 50%;
  background: #edf4fa;
  color: #1f5e97;
}

.guide-icon svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.guide-header h2 {
  margin-bottom: 10px;
  font-size: 37px;
  font-weight: 500;
  letter-spacing: -0.8px;
}

.guide-header > p:last-child {
  margin-bottom: 0;
  color: var(--muted);
}

.guide-steps {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
}

.guide-step {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 13px;
  padding: 17px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
}

.guide-step-number {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 50%;
  background: white;
  color: var(--navy-800);
  font-family: var(--serif-font);
  font-size: 17px;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

.guide-step h3 {
  margin-bottom: 3px;
  font-size: 16px;
}

.guide-step p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 11.5px;
}

.guide-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 24px;
}

.toast {
  position: fixed;
  z-index: 300;
  right: 24px;
  bottom: 24px;
  max-width: 360px;
  padding: 12px 15px;
  border-radius: 9px;
  background: var(--navy-900);
  color: white;
  box-shadow: var(--shadow-lg);
  font-size: 13px;
}

.mobile-overlay {
  display: none;
}

body.modal-open {
  overflow: hidden;
}

[hidden] {
  display: none !important;
}

@media (max-width: 1320px) {
  :root {
    --sidebar-width: 264px;
  }

  .topbar {
    grid-template-columns: minmax(310px, 0.8fr) auto minmax(250px, 300px);
    gap: 20px;
  }

  .brand-title {
    font-size: 24px;
  }

  .top-nav {
    gap: 28px;
  }

  .hero-facts {
    right: 34px;
    width: 375px;
  }

  .featured-grid {
    gap: 13px;
  }

  .featured-card-copy {
    padding-right: 8px;
  }

  .quick-actions {
    gap: 16px;
  }

  .filter-panel {
    grid-template-columns: minmax(250px, 1.4fr) repeat(3, minmax(135px, 0.7fr));
  }

  .clear-filters-button {
    grid-column: 1 / -1;
    justify-self: end;
  }
}

@media (max-width: 1080px) {
  :root {
    --sidebar-width: 0px;
  }

  .site-shell {
    grid-template-columns: 1fr;
  }

  .topbar {
    grid-template-columns: auto minmax(250px, 1fr) minmax(230px, 300px);
    padding-left: 14px;
  }

  .mobile-menu-button {
    display: grid;
    width: 42px;
    height: 42px;
    padding: 0;
    place-items: center;
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 8px;
    background: transparent;
    color: white;
  }

  .mobile-menu-button svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
  }

  .brand {
    gap: 10px;
  }

  .brand-mark {
    flex-basis: 45px;
    width: 45px;
    height: 45px;
  }

  .brand-subtitle {
    display: none;
  }

  .top-nav {
    display: none;
  }

  .sidebar {
    position: fixed;
    z-index: 101;
    top: var(--header-height);
    bottom: 0;
    left: 0;
    display: block;
    width: min(320px, calc(100vw - 54px));
    height: auto;
    box-shadow: var(--shadow-lg);
    transform: translateX(-105%);
    transition: transform 180ms ease;
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .mobile-overlay {
    position: fixed;
    z-index: 100;
    top: var(--header-height);
    right: 0;
    bottom: 0;
    left: 0;
    display: block;
    background: rgba(3,18,32,0.4);
  }

  .main-content {
    grid-column: 1;
  }

  .featured-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .featured-card:nth-child(n+4) {
    display: none;
  }

  .hero-content {
    width: 55%;
    padding-left: 38px;
  }

  .hero-facts {
    right: 27px;
    width: 390px;
  }

  .philosopher-grid,
  .timeline-people {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .theme-browser {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .filter-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-search-field {
    grid-column: 1 / -1;
  }

  .clear-filters-button {
    grid-column: auto;
    justify-self: stretch;
  }

  .connection-path {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .connection-node:nth-child(2)::after,
  .connection-node:nth-child(2)::before {
    display: none;
  }

  .compare-tray {
    left: 24px;
  }
}

@media (max-width: 840px) {
  .topbar {
    grid-template-columns: auto minmax(0, 1fr) minmax(180px, 260px);
    gap: 12px;
  }

  .brand-title {
    font-size: 21px;
  }

  .brand-mark {
    display: none;
  }

  .main-content {
    padding: 18px 17px 0;
  }

  .hero {
    min-height: auto;
    padding-bottom: 22px;
  }

  .hero-content {
    width: 100%;
    padding: 34px 30px 16px;
  }

  .hero h1 {
    font-size: 44px;
  }

  .hero-facts {
    position: relative;
    top: auto;
    right: auto;
    width: auto;
    min-height: auto;
    margin: 8px 20px 0;
    padding: 21px;
  }

  .featured-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .featured-card:nth-child(3) {
    display: none;
  }

  .quick-actions {
    grid-template-columns: 1fr;
  }

  .content-section {
    margin-right: -17px;
    margin-left: -17px;
    padding: 62px 24px 68px;
  }

  .site-footer {
    margin-right: -17px;
    margin-left: -17px;
    padding-right: 24px;
    padding-left: 24px;
  }

  .philosopher-grid,
  .theme-browser {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .timeline-era-group {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .timeline-era-heading {
    position: static;
  }

  .connections-layout,
  .about-layout {
    grid-template-columns: 1fr;
    gap: 34px;
  }

  .detail-hero {
    grid-template-columns: 180px minmax(0, 1fr);
  }

  .detail-body {
    grid-template-columns: 1fr;
  }

  .guide-steps {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  :root {
    --header-height: 72px;
  }

  .topbar {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
    height: var(--header-height);
    padding: 10px 12px;
  }

  .brand-title {
    font-size: 19px;
  }

  .header-search {
    grid-column: 1 / -1;
    display: none;
  }

  .main-content {
    padding-top: 12px;
  }

  .hero-content {
    padding: 28px 23px 13px;
  }

  .hero h1 {
    margin-bottom: 13px;
    font-size: 38px;
  }

  .hero-content > p {
    font-size: 15px;
  }

  .desktop-only {
    display: none;
  }

  .hero-facts {
    grid-template-columns: 1fr;
    gap: 15px;
    margin: 8px 14px 0;
  }

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

  .featured-card:nth-child(2) {
    display: none;
  }

  .featured-card {
    grid-template-columns: 120px minmax(0, 1fr);
  }

  .era-preview {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    row-gap: 21px;
  }

  .era-preview::before {
    display: none;
  }

  .era-preview-dot {
    box-shadow: none;
  }

  .section-intro {
    align-items: flex-start;
    flex-direction: column;
  }

  .filter-panel,
  .philosopher-grid,
  .theme-browser,
  .timeline-people {
    grid-template-columns: 1fr;
  }

  .filter-search-field,
  .clear-filters-button {
    grid-column: auto;
  }

  .clear-filters-button {
    justify-self: stretch;
  }

  .timeline-person {
    min-height: 62px;
  }

  .connection-path {
    grid-template-columns: 1fr;
  }

  .connection-node:not(:last-child)::after,
  .connection-node:not(:last-child)::before {
    display: none;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .compare-tray {
    right: 12px;
    bottom: 12px;
    left: 12px;
    align-items: stretch;
    flex-direction: column;
  }

  .compare-tray-copy {
    align-items: flex-start;
    flex-direction: column;
  }

  .compare-tray-actions {
    justify-content: flex-end;
  }

  .modal {
    top: 0;
    left: 0;
    width: 100%;
    max-height: 100vh;
    min-height: 100vh;
    border-radius: 0;
    transform: none;
  }

  .detail-hero {
    grid-template-columns: 112px minmax(0, 1fr);
    min-height: 240px;
    border-radius: 0;
  }

  .detail-portrait,
  .detail-monogram {
    min-height: 240px;
  }

  .detail-monogram {
    font-size: 42px;
  }

  .detail-heading {
    padding: 55px 48px 28px 21px;
  }

  .detail-heading h2 {
    font-size: 30px;
  }

  .detail-summary {
    font-size: 12px;
  }

  .detail-body {
    padding: 27px 22px 35px;
  }

  .guide-modal {
    padding: 68px 22px 32px;
  }

  .guide-header h2 {
    font-size: 31px;
  }

  .modal-header {
    padding-top: 67px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
