* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--canvas);
}

body {
  margin: 0;
  min-width: 0;
  overflow-wrap: break-word;
  font-family: Inter, "Noto Sans Devanagari", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
}

main {
  min-width: 0;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

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

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

[hidden] {
  display: none !important;
}

:where(a, button, input):focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}

.shell {
  width: min(var(--content), calc(100% - 36px));
  margin: auto;
}

.narrow {
  width: min(900px, calc(100% - 36px));
  margin: auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--line);
  background: var(--header-bg);
  backdrop-filter: blur(14px);
}

.nav {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 72px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 205px;
}

.brand img {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
}

.brand-text,
.footer-brand > div {
  min-width: 0;
}

.brand-text strong,
.footer-brand strong {
  display: block;
  color: var(--navy);
  font-size: 16px;
}

.brand-text span,
.footer-brand span {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-left: auto;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 800;
}

.nav-links a {
  border-bottom: 2px solid transparent;
  padding: 10px 1px;
}

.nav-links a:hover,
.nav-links a.active {
  border-bottom-color: var(--blue);
  color: var(--blue);
}

.header-search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  width: 220px;
  min-height: 44px;
  border: 1px solid var(--input-border);
  border-radius: 11px;
  padding: 0 11px;
  color: var(--text-subtle);
  background: var(--surface);
}

.header-search:focus-within {
  border-color: var(--focus-ring);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus-ring) 18%, transparent);
}

.header-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  padding: 11px 0;
  color: var(--ink);
  background: transparent;
  font-size: 13px;
}

.header-search input::placeholder {
  color: var(--text-subtle);
  opacity: 1;
}

.search-results {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 100;
  width: min(440px, calc(100vw - 24px));
  max-height: min(54vh, 420px);
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 8px;
  background: var(--surface-elevated);
  box-shadow: var(--shadow);
}

.search-result {
  display: flex;
  min-height: 44px;
  flex-direction: column;
  justify-content: center;
  border-radius: 9px;
  padding: 10px 11px;
}

.search-result:hover {
  background: var(--surface-hover);
}

.search-result strong {
  display: block;
  color: var(--navy);
  font-size: 13px;
  line-height: 1.35;
}

.search-result span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.theme-toggle,
.menu-button {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 0;
  background: var(--surface);
  cursor: pointer;
}

.theme-toggle {
  display: inline-grid;
  color: var(--blue);
}

.theme-toggle:hover,
.menu-button:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
}

.theme-icon,
.theme-icon svg {
  display: block;
  width: 21px;
  height: 21px;
}

.theme-icon svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-icon-sun {
  display: none;
}

:root[data-theme="dark"] .theme-icon-sun {
  display: block;
}

:root[data-theme="dark"] .theme-icon-moon {
  display: none;
}

.menu-button {
  display: none;
  color: var(--navy);
  font-size: 25px;
  line-height: 1;
}

.section {
  padding: 46px 0;
}

.muted {
  background: var(--bg);
}

.kicker {
  color: var(--blue);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-head h2 {
  margin: 0;
  color: var(--navy);
  font-size: 27px;
  line-height: 1.2;
  letter-spacing: -0.025em;
  overflow-wrap: anywhere;
}

.section-head a {
  flex: 0 0 auto;
  color: var(--blue);
  font-size: 13px;
  font-weight: 850;
}

.breadcrumbs {
  margin-bottom: 14px;
  color: var(--text-subtle);
  font-size: 12px;
  line-height: 1.5;
}

.breadcrumbs a {
  color: var(--blue);
}

.breadcrumbs span {
  padding: 0 5px;
}

.footer {
  margin-top: 20px;
  border-top: 1px solid var(--line);
  background: var(--footer-bg);
}

.footer .shell {
  padding-top: 24px;
  padding-bottom: 22px;
}

.footer-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
}

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

.footer-brand img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.footer-social > span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  text-align: right;
  font-size: 12px;
}

.social-links {
  display: flex;
  gap: 8px;
}

.social-links a {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  background: var(--surface);
  font-size: 12px;
  font-weight: 800;
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-top: 20px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
  color: var(--text-subtle);
  font-size: 12px;
  line-height: 1.5;
}

.footer-bottom nav {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.footer-bottom a:hover {
  color: var(--blue);
}

.empty-state {
  border: 1px dashed var(--border-strong);
  border-radius: 14px;
  padding: 24px;
  color: var(--muted);
  text-align: center;
  font-size: 14px;
}

.prose {
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1.75;
}

.prose h1,
.prose h2,
.prose h3 {
  color: var(--navy);
}

.ad-slot {
  display: none;
}

.ads-enabled .ad-slot {
  display: flex;
  width: min(var(--content), calc(100% - 36px));
  min-height: 120px;
  align-items: center;
  justify-content: center;
  margin: 26px auto;
  border: 1px dashed var(--ad-border);
  border-radius: 14px;
  color: var(--ad-text);
  background: var(--ad-bg);
  font-size: 12px;
}

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

@media (max-width: 1100px) {
  .nav {
    gap: 10px;
  }

  .nav-links {
    gap: 10px;
  }

  .header-search {
    width: 180px;
  }
}

@media (max-width: 820px) {
  .nav {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px 44px;
    column-gap: 8px;
    row-gap: 8px;
    min-height: 0;
    padding: 8px 0;
  }

  .brand {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
    overflow: hidden;
  }

  .brand-text {
    overflow: hidden;
  }

  .brand-text strong,
  .brand-text span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .theme-toggle {
    grid-column: 2;
    grid-row: 1;
  }

  .menu-button {
    display: inline-grid;
    grid-column: 3;
    grid-row: 1;
  }

  .header-search {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    margin: 0;
  }

  .header-search input {
    min-height: 42px;
    padding: 10px 0;
    font-size: 16px;
  }

  .search-results {
    right: 0;
    left: 0;
    width: 100%;
    max-height: min(50dvh, 360px);
  }

  .search-result strong {
    font-size: 14px;
  }

  .search-result span {
    font-size: 13px;
  }

  .nav-links {
    display: none;
    grid-column: 1 / -1;
    grid-row: 3;
    width: 100%;
    max-height: min(46dvh, 350px);
    margin: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    white-space: normal;
  }

  .menu-open .nav-links {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
  }

  .nav-links a {
    display: flex;
    min-height: 44px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 12px;
  }

  .footer-main,
  .footer-bottom {
    align-items: flex-start;
    flex-direction: column;
  }

  .footer-social > span {
    text-align: left;
  }
}

@media (max-width: 620px) {
  .menu-open .nav-links {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 540px) {
  .shell,
  .narrow {
    width: min(calc(100% - 24px), var(--content));
  }

  .section {
    padding: 32px 0;
  }

  .section-head h2 {
    font-size: clamp(22px, 7vw, 28px);
  }

  .section-head a {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    font-size: 13px;
  }

  .breadcrumbs {
    font-size: 13px;
    line-height: 1.55;
  }

  .social-links {
    flex-wrap: wrap;
  }

  .social-links a {
    min-height: 44px;
    padding: 10px 14px;
    font-size: 13px;
  }

  .footer-social,
  .social-links {
    width: 100%;
  }

  .footer-bottom {
    font-size: 13px;
    line-height: 1.55;
  }

  .footer-bottom a {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
  }

  .prose {
    font-size: 16px;
  }

  .ads-enabled .ad-slot {
    width: min(var(--content), calc(100% - 24px));
  }
}

@media (max-width: 420px) {
  .brand-text span {
    display: none;
  }

  .section-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }
}

@media (hover: hover) and (pointer: fine) {
  .social-links a:hover,
  .theme-toggle:hover,
  .menu-button:hover {
    border-color: var(--border-strong);
  }
}

@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;
  }
}
