:root {
  --ink: #14223a;
  --ink-soft: #33445f;
  --muted: #63738c;
  --bg: #f3f6fb;
  --card: #ffffff;
  --line: #e1e8f3;
  --brand: #2f6fed;
  --brand-dark: #1e4fb8;
  --navy: #0f1f3a;
  --navy-2: #1c4372;
  --amber: #f7a325;
  --amber-dark: #e88a10;
  --sans: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", "Times New Roman", serif;
  --radius: 18px;
  --shadow-sm: 0 1px 2px rgba(16, 35, 58, 0.05), 0 10px 24px -18px rgba(16, 35, 58, 0.28);
  --shadow-md: 0 18px 40px -26px rgba(16, 35, 58, 0.5);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font: 16px/1.6 var(--sans);
  background:
    radial-gradient(1100px 460px at 8% -12%, #e6eefc 0, rgba(230, 238, 252, 0) 62%),
    radial-gradient(900px 420px at 102% -4%, #fdf0dd 0, rgba(253, 240, 221, 0) 58%),
    var(--bg);
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--brand-dark);
}

:focus-visible {
  outline: 3px solid rgba(47, 111, 237, 0.45);
  outline-offset: 2px;
  border-radius: 8px;
}

.wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.container {
  width: 100%;
  max-width: 1220px;
  margin: 0 auto;
  padding: 0 24px;
}

.header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
}

.header__inner {
  display: flex;
  align-items: center;
  gap: 26px;
  min-height: 78px;
}

.header__logo {
  flex: none;
}

.logo__link {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--ink);
}

.logo__ico {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
}

.logo__ico img {
  display: block;
  width: 44px;
  height: 44px;
  object-fit: contain;
}

.logo__tagline {
  display: flex;
  align-items: baseline;
  gap: 1px;
  line-height: 1;
}

.logo__lg {
  font-weight: 700;
  font-size: 21px;
  letter-spacing: -0.03em;
}

.logo__sm {
  font-weight: 700;
  font-size: 13px;
  color: var(--brand);
  letter-spacing: 0.01em;
}

.header__search {
  flex: 1 1 auto;
  max-width: 540px;
}

.search-form form {
  margin: 0;
}

.search-form__control {
  width: 100%;
  height: 46px;
  padding: 0 18px 0 46px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f7f9fd url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237888a1' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.6-3.6'/%3E%3C/svg%3E") no-repeat 17px center / 18px 18px;
  font: 15px/1.4 var(--sans);
  color: var(--ink);
  transition: border-color 0.18s, background-color 0.18s, box-shadow 0.18s;
}

.search-form__control::placeholder {
  color: #93a1b8;
}

.search-form__control:focus {
  outline: none;
  border-color: #b9cdf7;
  background-color: #fff;
  box-shadow: 0 0 0 4px rgba(47, 111, 237, 0.12);
}

.header__action {
  flex: none;
  margin-left: auto;
}

.header-user {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-user__login-btn {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-decoration: none;
  color: var(--ink-soft);
  white-space: nowrap;
}

.header-user__login-btn:hover {
  color: var(--brand-dark);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: 999px;
  font: 600 14px/1 var(--sans);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.16s, box-shadow 0.16s, background-color 0.16s, color 0.16s, border-color 0.16s;
}

.btn:active {
  transform: translateY(1px);
}

.header-user__question-btn.btn {
  height: 42px;
  font-size: 12px;
  letter-spacing: 0.06em;
  color: #241a05;
  background: linear-gradient(135deg, #ffc963, var(--amber) 55%, var(--amber-dark));
  box-shadow: 0 10px 22px -12px rgba(232, 138, 16, 0.95);
}

.header-user__question-btn.btn:hover {
  box-shadow: 0 14px 26px -12px rgba(232, 138, 16, 0.95);
}

.btn--primary {
  background: linear-gradient(135deg, #ffc963, var(--amber) 55%, var(--amber-dark));
  color: #241a05;
  box-shadow: 0 14px 26px -14px rgba(232, 138, 16, 0.95);
}

.btn--lg {
  height: 52px;
  padding: 0 28px;
  font-size: 15px;
}

.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  align-items: center;
  gap: 44px;
  margin: 34px 0 40px;
  padding: 48px 50px;
  border-radius: 30px;
  color: #fff;
  background:
    radial-gradient(760px 340px at 86% -22%, rgba(47, 111, 237, 0.62), rgba(47, 111, 237, 0) 62%),
    radial-gradient(520px 320px at 4% 118%, rgba(247, 163, 37, 0.24), rgba(247, 163, 37, 0) 60%),
    linear-gradient(135deg, #0d1a31 0%, #16305a 52%, #1c4372 100%);
  box-shadow: 0 36px 70px -38px rgba(13, 26, 49, 0.85);
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(70% 80% at 70% 20%, #000 20%, transparent 78%);
}

.hero__badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 15px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.88);
}

.hero__badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #5ee1a4;
  box-shadow: 0 0 0 4px rgba(94, 225, 164, 0.18);
}

.hero__title {
  margin: 18px 0 14px;
  font: 700 clamp(30px, 3.6vw, 47px) / 1.08 var(--serif);
  letter-spacing: -0.015em;
}

.hero__lead {
  margin: 0;
  max-width: 48ch;
  font-size: 16px;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.76);
}

.hero__search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 28px 0 30px;
  padding: 7px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 22px 40px -26px rgba(0, 0, 0, 0.75);
}

.hero__search input {
  flex: 1 1 auto;
  min-width: 0;
  height: 48px;
  padding: 0 20px;
  border: 0;
  background: transparent;
  font: 15.5px/1.4 var(--sans);
  color: var(--ink);
}

.hero__search input::placeholder {
  color: #8d9bb2;
}

.hero__search input:focus {
  outline: none;
}

.hero__search .btn {
  height: 48px;
  padding: 0 26px;
  font-size: 14.5px;
}

.hero__stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 38px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.hero__stats li {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-left: 14px;
  border-left: 2px solid rgba(247, 163, 37, 0.7);
}

.hero__stats b {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.hero__stats span {
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.62);
}

.hero__art {
  position: relative;
}

.hero__art img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3.2;
  object-fit: cover;
  border-radius: 22px;
  border: 1px dashed rgba(255, 255, 255, 0.42);
  background:
    radial-gradient(circle at 50% 38%, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.03));
  box-shadow: 0 26px 50px -30px rgba(0, 0, 0, 0.8);
}

.section-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 18px;
  font: 700 22px/1.25 var(--sans);
  letter-spacing: -0.015em;
}

.section-title::before {
  content: "";
  flex: none;
  width: 6px;
  height: 24px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--amber), var(--brand));
}

.subjects__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(178px, 1fr));
  gap: 14px;
  margin-bottom: 38px;
}

.subject {
  --tile: #eef3ff;
  --tile-ink: #2f6fed;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  color: inherit;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
}

.subject:hover {
  transform: translateY(-3px);
  border-color: #c6d6f5;
  box-shadow: var(--shadow-md);
}

.subject__ico {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 13px;
  background: var(--tile);
  color: var(--tile-ink);
}

.subject__ico svg {
  width: 24px;
  height: 24px;
}

.subject__name {
  font-size: 15.5px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.subject__meta {
  margin-top: -8px;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--muted);
}

.subject--ro {
  --tile: #fdeef2;
  --tile-ink: #c03a6b;
}

.subject--math {
  --tile: #eaf1ff;
  --tile-ink: #1e4fb8;
}

.subject--history {
  --tile: #fdf3e2;
  --tile-ink: #b57a12;
}

.subject--chem {
  --tile: #f0edff;
  --tile-ink: #5b45c0;
}

.subject--bio {
  --tile: #e9f8ef;
  --tile-ink: #1c8a52;
}

.main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 306px;
  align-items: start;
  gap: 32px;
  padding-bottom: 56px;
}

.content {
  min-width: 0;
}

.box {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

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

.post-item {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
}

.post-item:hover {
  transform: translateY(-2px);
  border-color: #c6d6f5;
  box-shadow: var(--shadow-md);
}

.post-item__head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 12px;
  font-size: 12.5px;
  color: var(--muted);
}

.post-item__category {
  margin-right: auto;
}

.post-item__category-link {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 12px;
  border-radius: 999px;
  background: #eef3ff;
  color: var(--brand-dark);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  text-decoration: none;
  transition: background-color 0.15s, color 0.15s;
}

.post-item__category-link:hover {
  background: var(--brand);
  color: #fff;
}

.post-item__author,
.post-item__date {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.post-item__author svg,
.post-item__date svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
  opacity: 0.6;
}

.post-item__body {
  flex: 1 1 auto;
}

.post-item__desc-link {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 15.5px;
  font-weight: 500;
  line-height: 1.55;
  color: var(--ink);
  text-decoration: none;
  overflow-wrap: anywhere;
  transition: color 0.15s;
}

.post-item__desc-link:hover {
  color: var(--brand-dark);
}

.post-item__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}

.post-item__more-btn.btn {
  height: 36px;
  padding: 0 18px;
  border-color: #d4dff2;
  background: #fff;
  color: var(--brand-dark);
  font-size: 12.5px;
  letter-spacing: 0.02em;
}

.post-item__more-btn.btn:hover {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.aside {
  position: sticky;
  top: 96px;
  display: grid;
  gap: 16px;
}

.widget {
  padding: 18px;
}

.widget-title {
  margin: 0 0 12px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #8b98ad;
}

.aside-menu {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 2px;
}

.aside-menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--ink);
  font-size: 14.5px;
  text-decoration: none;
  transition: background-color 0.15s, color 0.15s;
}

.aside-menu a::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #c9d5e8;
  transition: background-color 0.15s, box-shadow 0.15s;
}

.aside-menu a:hover {
  background: #f2f6ff;
  color: var(--brand-dark);
}

.aside-menu a:hover::before {
  background: var(--brand);
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.15);
}

.aside-menu a[aria-current="page"] {
  background: #eef3ff;
  color: var(--brand-dark);
  font-weight: 600;
}

.aside-menu a[aria-current="page"]::before {
  background: var(--brand);
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.15);
}

.category-hero {
  display: flex;
  align-items: center;
  gap: 20px;
  margin: 30px 0 24px;
  padding: 26px 30px;
  border-radius: 26px;
  color: #fff;
  background:
    radial-gradient(560px 240px at 92% -40%, rgba(47, 111, 237, 0.65), rgba(47, 111, 237, 0) 65%),
    linear-gradient(135deg, #0d1a31, #16305a 55%, #1c4372);
  box-shadow: 0 28px 56px -34px rgba(13, 26, 49, 0.85);
}

.category-hero__ico {
  flex: none;
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.12);
}

.category-hero__ico svg {
  width: 36px;
  height: 36px;
}

.category-hero h1 {
  margin: 0;
  font: 700 clamp(24px, 2.6vw, 34px) / 1.15 var(--serif);
  letter-spacing: -0.01em;
}

.category-hero p {
  margin: 7px 0 0;
  font-size: 14.5px;
  color: rgba(255, 255, 255, 0.75);
}

.cta {
  padding-bottom: 52px;
}

.cta__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 22px;
  padding: 32px 38px;
  border: 1px solid #f4d8a8;
  border-radius: 26px;
  background:
    radial-gradient(420px 200px at 92% 0%, #ffe6bd, rgba(255, 230, 189, 0) 70%),
    linear-gradient(120deg, #fff8ec, #ffefd4);
}

.cta h2 {
  margin: 0 0 5px;
  font: 700 24px/1.2 var(--sans);
  letter-spacing: -0.015em;
}

.cta p {
  margin: 0;
  color: #86652a;
}

.footer {
  margin-top: auto;
  padding: 42px 0 30px;
  color: rgba(255, 255, 255, 0.68);
  background:
    radial-gradient(700px 280px at 15% 0%, rgba(47, 111, 237, 0.22), rgba(47, 111, 237, 0) 65%),
    linear-gradient(180deg, #0f1f3a, #0a1424);
}

.footer__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 18px;
  padding-top: 22px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.footer__logo img {
  display: block;
  width: 44px;
  height: 44px;
  object-fit: contain;
}

.footer__copywrite {
  font-size: 13px;
  letter-spacing: 0.01em;
}

@media (max-width: 1080px) {
  .main {
    grid-template-columns: minmax(0, 1fr);
  }

  .aside {
    position: static;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  }
}

@media (max-width: 900px) {
  .hero {
    grid-template-columns: minmax(0, 1fr);
    gap: 30px;
    padding: 36px;
  }

  .hero__art {
    order: -1;
    max-width: 440px;
  }

  .hero__art img {
    aspect-ratio: 16 / 9;
  }
}

@media (max-width: 820px) {
  .post-list {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  .header__inner {
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 0;
  }

  .header-user__question-btn.btn {
    height: 38px;
    padding: 0 14px;
    font-size: 11px;
  }

  .header__search {
    order: 3;
    flex: 1 1 100%;
    max-width: none;
  }

  .header__action {
    margin-left: auto;
  }

  .hero {
    margin-top: 22px;
    padding: 28px;
    border-radius: 24px;
  }

  .hero__search {
    flex-wrap: wrap;
    padding: 10px;
    border-radius: 20px;
  }

  .hero__search input {
    flex: 1 1 100%;
    height: 42px;
  }

  .hero__search .btn {
    width: 100%;
  }

  .hero__stats {
    gap: 14px 26px;
  }

  .cta__inner {
    padding: 24px;
  }

  .category-hero {
    padding: 22px;
    gap: 16px;
  }
}

@media (max-width: 560px) {
  .container {
    padding: 0 16px;
  }

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

  .logo__lg {
    font-size: 19px;
  }

  .hero__stats b {
    font-size: 14.5px;
  }

  .hero__stats span {
    font-size: 11.5px;
    line-height: 1.35;
  }

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

  .subject {
    padding: 14px;
    gap: 9px;
  }

  .subject__meta {
    font-size: 12px;
  }

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

  .hero__art {
    display: none;
  }

  .header-user__login {
    display: none;
  }

  .post-item {
    padding: 16px;
  }

  .category-hero__ico {
    display: none;
  }
}

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

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
