:root {
  color-scheme: light;
  --blue: #0617f4;
  --blue-deep: #0011c7;
  --brand: #1b5da2;
  --ink: #111827;
  --muted: #5f6675;
  --paper: #ffffff;
  --soft: #f2f4f8;
  --line: #d8ddeb;
  --shadow: 0 18px 50px rgba(10, 19, 70, 0.14);
  --radius: 14px;
  font-family: 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(--paper);
  color: var(--ink);
}

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

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--blue);
  color: #fff;
  box-shadow: 0 2px 18px rgba(0, 0, 0, 0.16);
}

.nav {
  width: 100%;
  min-height: 64px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand-link {
  min-height: 64px;
  display: inline-flex;
  align-items: center;
  padding: 0;
  color: #fff;
  font-weight: 800;
  font-size: 1rem;
  white-space: nowrap;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
  overflow-x: auto;
}

.nav-links a {
  min-height: 56px;
  display: grid;
  place-items: center;
  padding: 0 13px;
  border-bottom: 5px solid transparent;
  font-weight: 700;
  font-size: 0.92rem;
  white-space: nowrap;
}

.nav-links a[aria-current="page"],
.nav-links a:hover {
  border-bottom-color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 82% 20%, rgba(6, 23, 244, 0.10), transparent 28rem),
    linear-gradient(180deg, #fff 0%, #f7f9ff 100%);
}

.hero-inner {
  width: min(1160px, calc(100% - 32px));
  min-height: 230px;
  margin: 0 auto;
  display: grid;
  align-content: center;
  gap: 22px;
  padding: 54px 0 48px;
}

.intro {
  max-width: 850px;
}

.intro summary {
  cursor: pointer;
  color: var(--blue-deep);
  font-size: clamp(1.8rem, 4vw, 2.55rem);
  font-weight: 800;
}

.intro p {
  max-width: 780px;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1.75;
}

.section-band {
  background: var(--soft);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 44px 0 60px;
}

.topic-search {
  width: min(720px, calc(100% - 32px));
  margin: 0 auto 26px;
  display: grid;
  gap: 9px;
}

.topic-search label {
  color: var(--blue-deep);
  font-weight: 800;
  font-size: 0.92rem;
}

.search-box {
  min-height: 56px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border: 1px solid rgba(6, 23, 244, 0.18);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 16px 38px rgba(10, 19, 70, 0.10);
}

.search-icon {
  flex: 0 0 23px;
  width: 23px;
  height: 23px;
  display: grid;
  place-items: center;
  color: var(--blue);
}

.search-icon svg {
  width: 22px;
  height: 22px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font: inherit;
}

.search-box input::placeholder {
  color: #8a91a1;
}

.search-box:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(6, 23, 244, 0.12), 0 18px 42px rgba(10, 19, 70, 0.13);
}

.topics-grid {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 276px));
  justify-content: center;
  gap: 16px;
}

.topic-card {
  position: relative;
  min-height: 280px;
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: grid;
  grid-template-rows: 145px 1fr;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.topic-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 24px 65px rgba(10, 19, 70, 0.22);
}

.topic-card[hidden],
.topic-card.is-filtered {
  display: none;
}

.favorite-toggle {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(6, 23, 244, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: #8a91a1;
  -webkit-text-fill-color: #8a91a1;
  box-shadow: 0 12px 28px rgba(10, 19, 70, 0.18);
  cursor: pointer;
  font: inherit;
  font-size: 1.35rem;
  line-height: 1;
  transition: transform 160ms ease, background 160ms ease, color 160ms ease;
}

.favorite-toggle:hover {
  transform: translateY(-2px);
}

.favorite-toggle.is-active {
  border-color: rgba(225, 29, 72, 0.24);
  background: rgba(255, 255, 255, 0.98);
  color: #e11d48;
  -webkit-text-fill-color: #e11d48;
}

.topic-media {
  background: #f7f9ff;
  background-size: cover;
  background-position: center;
}

.topic-body {
  display: grid;
  align-content: space-between;
  gap: 14px;
  padding: 16px;
}

.topic-body h2 {
  margin: 0;
  color: var(--blue-deep);
  font-size: clamp(1.02rem, 1.5vw, 1.18rem);
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.topic-body p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.empty-search {
  width: min(720px, calc(100% - 32px));
  margin: 24px auto 0;
  padding: 18px 20px;
  border: 1px solid rgba(6, 23, 244, 0.18);
  border-radius: var(--radius);
  background: #fff;
  color: var(--muted);
  text-align: center;
  box-shadow: 0 14px 34px rgba(10, 19, 70, 0.08);
}

.favorites-panel {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
}

.favorites-heading {
  margin-bottom: 14px;
}

.favorites-heading h2 {
  margin: 0;
  color: var(--blue-deep);
  font-size: clamp(1.45rem, 3vw, 2rem);
}

.favorites-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 276px));
  gap: 16px;
}

.empty-favorites {
  margin: 0;
  padding: 16px 18px;
  border: 1px solid rgba(6, 23, 244, 0.14);
  border-radius: var(--radius);
  background: #fff;
  color: var(--muted);
}

.page-hero {
  background:
    linear-gradient(90deg, rgba(6, 23, 244, 0.92), rgba(6, 23, 244, 0.58)),
    var(--image) center / cover;
  color: #fff;
}

.favorites-hero {
  background:
    linear-gradient(90deg, rgba(6, 23, 244, 0.94), rgba(6, 23, 244, 0.68)),
    radial-gradient(circle at 80% 24%, rgba(255, 255, 255, 0.26), transparent 18rem),
    var(--blue);
}

.favorites-page {
  min-height: 430px;
}

.page-hero-inner {
  width: min(1040px, calc(100% - 32px));
  min-height: 300px;
  margin: 0 auto;
  display: grid;
  align-content: end;
  padding: 58px 0 44px;
}

.page-hero h1 {
  margin: 0;
  max-width: 100%;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3rem, 8vw, 6rem);
  line-height: 0.95;
  overflow-wrap: anywhere;
}

.page-favorite {
  position: static;
  width: 52px;
  height: 52px;
  margin-top: 18px;
}

.content {
  width: min(900px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0 70px;
}

.content-section {
  padding: 28px 0;
  border-bottom: 1px solid var(--line);
}

.content-section h2 {
  margin: 0 0 18px;
  color: var(--blue-deep);
  font-size: clamp(1.75rem, 4vw, 2.55rem);
}

.content-section h3 {
  margin: 22px 0 10px;
  color: var(--blue-deep);
  font-size: clamp(1.18rem, 2.5vw, 1.45rem);
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.content-section p,
.content-section li {
  color: #222a38;
  font-size: 1.08rem;
  line-height: 1.82;
  overflow-wrap: anywhere;
}

.content-section p {
  margin: 0 0 16px;
}

.content-section ul {
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 9px;
}

.content-section li {
  position: relative;
  padding-left: 28px;
}

.content-section li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.82em;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 0 5px rgba(6, 23, 244, 0.10);
}

.content-section strong {
  color: var(--blue-deep);
  font-weight: 800;
}

.curiosity {
  margin-top: 30px;
  padding: clamp(20px, 4vw, 34px);
  border: 1px solid rgba(6, 23, 244, 0.16);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at top right, rgba(6, 23, 244, 0.08), transparent 18rem),
    #fff;
  box-shadow: 0 16px 42px rgba(10, 19, 70, 0.08);
}

.note-card {
  margin-top: 20px;
  padding: 20px;
  border-radius: 8px;
  border: 1px solid rgba(6, 23, 244, 0.18);
  background: rgba(6, 23, 244, 0.055);
}

.site-footer {
  padding: 18px 16px;
  border-top: 1px solid var(--line);
  background: #fff;
  display: grid;
  place-items: center;
}

.footer-logo {
  width: 54px;
  max-width: 54px;
  height: auto;
  max-height: 66px;
  display: block;
  object-fit: contain;
}

@media (max-width: 980px) {
  .topics-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 276px));
  }
}

@media (max-width: 640px) {
  .nav {
    width: 100%;
    min-height: 58px;
    padding: 0 10px;
    gap: 8px;
  }

  .nav-links {
    flex: 0 1 auto;
    justify-content: flex-end;
  }

  .nav-links a {
    min-height: 58px;
    padding: 0 7px;
    font-size: 0.84rem;
  }

  .brand-link {
    min-height: 58px;
    padding: 0;
    font-size: 0.9rem;
  }

  .hero-inner {
    min-height: 220px;
    padding: 42px 0 38px;
  }

  .search-icon {
    flex-basis: 25px;
    width: 25px;
    height: 25px;
    position: relative;
  }

  .search-icon svg {
    display: none;
  }

  .search-icon::before {
    content: "";
    position: absolute;
    left: 3px;
    top: 3px;
    width: 13px;
    height: 13px;
    border: 2.2px solid currentColor;
    border-radius: 50%;
  }

  .search-icon::after {
    content: "";
    position: absolute;
    left: 16px;
    top: 17px;
    width: 8px;
    height: 2.2px;
    border-radius: 999px;
    background: currentColor;
    transform: rotate(45deg);
    transform-origin: left center;
  }

  .topics-grid {
    grid-template-columns: 1fr;
    justify-content: stretch;
  }

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

  .topic-card {
    grid-template-rows: 150px 1fr;
  }

  .page-hero h1 {
    font-size: clamp(2.1rem, 9.6vw, 3.1rem);
  }
}
