:root {
  color-scheme: light;
  --bg: #f7f8f3;
  --ink: #18211c;
  --muted: #5f6f67;
  --line: #dce2d7;
  --surface: #ffffff;
  --surface-2: #eef3f4;
  --accent: #0d6b70;
  --accent-2: #b14e2f;
  --accent-soft: #dff0ee;
  --shadow: 0 18px 45px rgba(18, 32, 28, 0.08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
}

a {
  color: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px clamp(18px, 4vw, 56px);
  border-bottom: 1px solid var(--line);
  background: rgba(247, 248, 243, 0.94);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
}

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

.brand strong {
  font-size: 15px;
  line-height: 1.05;
}

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

.topbar nav {
  display: flex;
  gap: 18px;
  color: var(--muted);
  font-size: 14px;
}

.topbar nav a {
  text-decoration: none;
}

.topbar nav a:hover {
  color: var(--ink);
}

.layout {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 30px clamp(18px, 4vw, 56px) 56px;
}

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 520px);
  gap: 28px;
  align-items: end;
  padding: 12px 0 24px;
}

.intro h1 {
  max-width: 820px;
  margin: 0;
  font-size: clamp(34px, 5vw, 68px);
  line-height: 0.96;
  letter-spacing: 0;
}

.intro p {
  max-width: 720px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 18px;
}

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

.stat-grid div {
  min-height: 88px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 8px 22px rgba(18, 32, 28, 0.05);
}

.stat-grid strong {
  display: block;
  font-size: 27px;
  line-height: 1;
}

.stat-grid span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.search-panel {
  margin: 10px 0 24px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.search-form {
  display: grid;
  gap: 14px;
}

.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 126px;
  gap: 12px;
  align-items: end;
}

label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

input,
select,
button {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  font-size: 15px;
}

input,
select {
  padding: 0 12px;
  background: #fbfcf9;
  color: var(--ink);
}

.search-input {
  min-height: 54px;
  font-size: 20px;
}

button {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

button:hover {
  background: #095a5f;
}

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

.content-grid {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.rail {
  position: sticky;
  top: 84px;
  display: grid;
  gap: 14px;
}

.rail h2,
.profile-body h2,
.profile-side h2 {
  margin: 18px 0 0;
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.term-list {
  display: grid;
  gap: 8px;
}

.term-list a {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.68);
  color: var(--ink);
  font-size: 14px;
  text-decoration: none;
}

.term-list a:hover {
  border-color: #b8ccc7;
  background: var(--accent-soft);
}

.term-list strong {
  color: var(--accent);
}

.results {
  min-width: 0;
}

.result-meta,
.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 14px;
}

.pager {
  padding: 8px 0;
}

.pager a {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  text-decoration: none;
}

.result-card {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  gap: 16px;
  margin-bottom: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.thumb {
  display: block;
  width: 108px;
  height: 108px;
  overflow: hidden;
  border-radius: 6px;
  background: var(--surface-2);
  text-decoration: none;
}

.thumb img,
.profile-images img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-fallback {
  display: grid;
  place-items: center;
  height: 100%;
  color: var(--accent);
  font-size: 42px;
  font-weight: 900;
}

.result-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.result-title a:first-child {
  color: var(--ink);
  font-size: 22px;
  font-weight: 800;
  text-decoration: none;
}

.result-title a:first-child:hover {
  color: var(--accent);
}

.source-link {
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.facts,
.profile-facts {
  display: grid;
  gap: 7px;
  margin: 12px 0;
}

.facts div,
.profile-facts div {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 10px;
}

dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

dd {
  margin: 0;
}

.snippet {
  margin: 10px 0 12px;
  color: #35443d;
}

mark {
  border-radius: 3px;
  background: #ffe28a;
  color: inherit;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.chips span,
.chips a {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: #38514a;
  font-size: 12px;
  text-decoration: none;
}

.chips a:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.empty {
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.68);
  color: var(--muted);
}

.back-link {
  display: inline-block;
  margin-bottom: 18px;
  color: var(--accent);
  font-weight: 800;
  text-decoration: none;
}

.profile-layout {
  max-width: 1280px;
}

.profile-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 28px;
  align-items: start;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.profile-head h1 {
  margin: 0;
  font-size: clamp(36px, 6vw, 72px);
  line-height: 0.98;
}

.profile-images {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.profile-images img,
.image-empty {
  aspect-ratio: 1;
  border-radius: 6px;
  background: var(--surface-2);
}

.image-empty {
  display: grid;
  grid-column: 1 / -1;
  place-items: center;
  min-height: 160px;
  color: var(--muted);
}

.profile-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 24px;
  margin-top: 24px;
}

.profile-body,
.profile-side {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.profile-body p {
  margin: 0 0 16px;
  font-size: 16px;
}

.profile-side {
  align-self: start;
  position: sticky;
  top: 84px;
}

.link-list {
  display: grid;
  gap: 10px;
  padding: 0;
  list-style: none;
}

.link-list li {
  display: grid;
  gap: 4px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.link-list span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.link-list a {
  color: var(--accent);
  overflow-wrap: anywhere;
}

@media (max-width: 980px) {
  .intro,
  .content-grid,
  .profile-head,
  .profile-columns {
    grid-template-columns: 1fr;
  }

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

  .rail,
  .profile-side {
    position: static;
  }
}

@media (max-width: 640px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .search-row,
  .filters,
  .stat-grid {
    grid-template-columns: 1fr;
  }

  .result-card {
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 12px;
  }

  .thumb {
    width: 76px;
    height: 76px;
  }

  .result-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .result-title a:first-child {
    font-size: 19px;
  }

  .facts div,
  .profile-facts div {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}
