:root {
  --hub-paper: #f4f6f3;
  --hub-surface: #ffffff;
  --hub-surface-soft: rgba(255, 255, 255, 0.72);
  --hub-ink: #18211d;
  --hub-muted: #56635c;
  --hub-line: #ccd5cf;
  --hub-line-strong: #aebbb2;
  --hub-accent: #1f6650;
  --hub-accent-strong: #154536;
  --hub-warm: #b66b32;
  --hub-shadow: 0 14px 34px rgba(25, 36, 31, 0.11);
  --hub-content: 1120px;
}

html[data-theme="dark"],
html.dark {
  --hub-paper: #141917;
  --hub-surface: #1c2320;
  --hub-surface-soft: rgba(28, 35, 32, 0.82);
  --hub-ink: #edf3ef;
  --hub-muted: #b7c2bc;
  --hub-line: #39453f;
  --hub-line-strong: #536159;
  --hub-shadow: 0 16px 36px rgba(0, 0, 0, 0.28);
}

body.subject-hub--modern {
  --hub-accent: #934737;
  --hub-accent-strong: #673126;
  --hub-warm: #c49338;
}

body.subject-hub--uttarakhand {
  --hub-accent: #1f6b4f;
  --hub-accent-strong: #154837;
  --hub-warm: #b5523d;
}

body.subject-hub--hindi {
  --hub-accent: #a64f2c;
  --hub-accent-strong: #74371f;
  --hub-warm: #24756e;
}

body.subject-hub--world {
  --hub-accent: #6e4b72;
  --hub-accent-strong: #4d3451;
  --hub-warm: #b28735;
}

body.subject-hub--geography {
  --hub-accent: #176b78;
  --hub-accent-strong: #104b55;
  --hub-warm: #a76731;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  letter-spacing: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--shared-topbar-height, 64px) + 22px);
}

body.subject-hub-page {
  min-width: 320px;
  min-height: 100vh;
  color: var(--hub-ink);
  background: var(--hub-paper);
  font-family: "Noto Sans Devanagari", system-ui, sans-serif;
  line-height: 1.65;
}

body.subject-hub-page::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  content: "";
  background:
    linear-gradient(rgba(244, 246, 243, 0.9), rgba(244, 246, 243, 0.9)),
    url("brand/pahadi-pathshala-background.png") center / cover no-repeat;
  opacity: 1;
  pointer-events: none;
}

html[data-theme="dark"] body.subject-hub-page::before,
html.dark body.subject-hub-page::before {
  background:
    linear-gradient(rgba(20, 25, 23, 0.9), rgba(20, 25, 23, 0.9)),
    url("brand/pahadi-pathshala-background.png") center / cover no-repeat;
  opacity: 1;
}

button,
input {
  font: inherit;
}

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

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

:focus-visible {
  outline: 3px solid var(--hub-accent);
  outline-offset: 3px;
}

.hub-skip-link {
  position: fixed;
  z-index: 1500;
  top: 8px;
  left: 8px;
  padding: 8px 13px;
  color: #fff;
  background: var(--hub-accent-strong);
  border-radius: 4px;
  transform: translateY(-150%);
}

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

.subject-hub-layout {
  min-height: calc(100vh - var(--shared-topbar-height, 64px));
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
}

.subject-hub-sidebar {
  position: sticky;
  z-index: 700;
  top: var(--shared-topbar-height, 64px);
  height: calc(100vh - var(--shared-topbar-height, 64px));
  padding: 25px 20px 30px;
  overflow-y: auto;
  border-right: 1px solid var(--hub-line);
  background: rgba(246, 248, 245, 0.96);
  scrollbar-width: thin;
}

html[data-theme="dark"] .subject-hub-sidebar,
html.dark .subject-hub-sidebar {
  background: rgba(20, 25, 23, 0.97);
}

.hub-sidebar-heading {
  margin-bottom: 10px;
  color: var(--hub-muted);
  font-size: 11px;
  font-weight: 800;
}

.hub-subject-nav {
  display: grid;
}

.hub-subject-nav a {
  min-height: 45px;
  padding: 9px 8px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  border-bottom: 1px solid var(--hub-line);
  color: var(--hub-muted);
  font-size: 13px;
  font-weight: 700;
}

.hub-subject-nav a:hover {
  color: var(--hub-accent);
  background: var(--hub-surface-soft);
}

.hub-subject-nav a[aria-current="page"] {
  color: var(--hub-accent-strong);
  background: var(--hub-surface-soft);
  box-shadow: inset 3px 0 0 var(--hub-accent);
}

html[data-theme="dark"] .hub-subject-nav a[aria-current="page"],
html.dark .hub-subject-nav a[aria-current="page"] {
  color: #fff;
}

.hub-subject-icon {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 1px solid var(--hub-line);
  border-radius: 5px;
  background: var(--hub-surface);
  font-family: "Space Grotesk", sans-serif;
  font-size: 11px;
  font-weight: 800;
}

.hub-nav-arrow {
  color: var(--hub-accent);
  font-family: "Space Grotesk", sans-serif;
  font-size: 17px;
}

.hub-sidebar-divider {
  height: 1px;
  margin: 25px 0;
  background: var(--hub-line-strong);
}

.hub-jump-nav {
  display: grid;
}

.hub-jump-nav a {
  padding: 9px 5px;
  display: grid;
  grid-template-columns: 23px minmax(0, 1fr);
  gap: 7px;
  border-bottom: 1px solid var(--hub-line);
  color: var(--hub-muted);
  font-size: 12px;
  font-weight: 650;
}

.hub-jump-nav a:hover {
  color: var(--hub-accent);
}

.hub-jump-number {
  color: var(--hub-accent);
  font-family: "Space Grotesk", sans-serif;
  font-size: 11px;
  font-weight: 800;
}

.hub-sidebar-home {
  margin-top: 24px;
  min-height: 42px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--hub-line-strong);
  border-radius: 6px;
  color: var(--hub-accent-strong);
  background: var(--hub-surface-soft);
  font-size: 13px;
  font-weight: 800;
}

html[data-theme="dark"] .hub-sidebar-home,
html.dark .hub-sidebar-home {
  color: #fff;
}

.subject-hub-main {
  min-width: 0;
}

.subject-hub-hero {
  position: relative;
  min-height: 500px;
  display: flex;
  align-items: center;
  isolation: isolate;
  overflow: hidden;
  color: #fff;
  background-image: var(--hub-hero);
  background-position: center;
  background-size: cover;
}

.subject-hub-hero::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  content: "";
  background: rgba(10, 20, 17, 0.66);
}

.hub-hero-inner {
  width: min(var(--hub-content), calc(100% - 64px));
  margin: 0 auto;
  padding: 68px 0;
}

.hub-breadcrumb {
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(255, 255, 255, 0.8);
  font-size: 13px;
  font-weight: 700;
}

.hub-breadcrumb a:hover {
  color: #fff;
}

.hub-kicker {
  color: #f2cf87;
  font-size: 13px;
  font-weight: 800;
}

.hub-title {
  max-width: 760px;
  margin-top: 10px;
  font-size: 52px;
  line-height: 1.13;
  font-weight: 800;
  text-wrap: balance;
  text-shadow: 0 3px 18px rgba(0, 0, 0, 0.4);
}

.hub-lead {
  max-width: 740px;
  margin-top: 19px;
  color: #f1f5f2;
  font-size: 18px;
  line-height: 1.75;
  text-shadow: 0 2px 11px rgba(0, 0, 0, 0.5);
}

.hub-byline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 7px;
  margin-top: 10px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
  font-weight: 600;
}

.hub-byline a {
  color: inherit;
  font-weight: 800;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.hub-byline a:hover,
.hub-byline a:focus-visible {
  color: #fff;
}

.hub-stats {
  margin-top: 27px;
  display: flex;
  align-items: stretch;
  flex-wrap: wrap;
  border-top: 1px solid rgba(255, 255, 255, 0.42);
  border-bottom: 1px solid rgba(255, 255, 255, 0.42);
}

.hub-stat {
  min-width: 135px;
  padding: 11px 22px 10px 0;
  margin-right: 22px;
  display: grid;
  border-right: 1px solid rgba(255, 255, 255, 0.32);
}

.hub-stat:last-child {
  margin-right: 0;
  border-right: 0;
}

.hub-stat strong {
  color: #fff;
  font-family: "Space Grotesk", "Noto Sans Devanagari", sans-serif;
  font-size: 18px;
}

.hub-stat span {
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
}

.hub-hero-actions {
  margin-top: 27px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.hub-primary-action,
.hub-secondary-action {
  min-height: 45px;
  padding: 9px 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 6px;
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

.hub-primary-action {
  color: var(--hub-accent-strong);
  background: #fff;
}

.hub-secondary-action {
  background: rgba(12, 24, 20, 0.5);
}

.hub-content {
  width: min(var(--hub-content), calc(100% - 64px));
  margin: 0 auto;
  padding: 70px 0 96px;
}

.hub-section-intro {
  max-width: 760px;
  margin-bottom: 44px;
}

.hub-section-label {
  color: var(--hub-accent);
  font-size: 12px;
  font-weight: 850;
}

.hub-section-title {
  margin-top: 7px;
  color: var(--hub-accent-strong);
  font-size: 36px;
  line-height: 1.3;
}

html[data-theme="dark"] .hub-section-title,
html.dark .hub-section-title {
  color: #f2f7f4;
}

.hub-section-intro p {
  margin-top: 10px;
  color: var(--hub-muted);
  font-size: 16px;
}

.hub-study-route {
  margin-bottom: 64px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--hub-line-strong);
  border-bottom: 1px solid var(--hub-line-strong);
}

.hub-route-step {
  min-height: 128px;
  padding: 22px 26px 21px 0;
}

.hub-route-step + .hub-route-step {
  padding-left: 26px;
  border-left: 1px solid var(--hub-line);
}

.hub-route-step span {
  color: var(--hub-warm);
  font-family: "Space Grotesk", sans-serif;
  font-size: 12px;
  font-weight: 800;
}

.hub-route-step strong {
  display: block;
  margin-top: 4px;
  font-size: 17px;
}

.hub-route-step p {
  margin-top: 5px;
  color: var(--hub-muted);
  font-size: 13px;
  line-height: 1.55;
}

.hub-groups {
  display: grid;
  gap: 58px;
}

.hub-group {
  scroll-margin-top: calc(var(--shared-topbar-height, 64px) + 20px);
}

.hub-group-header {
  padding-bottom: 17px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 22px;
  border-bottom: 2px solid var(--hub-accent);
}

.hub-group-number {
  color: var(--hub-warm);
  font-family: "Space Grotesk", sans-serif;
  font-size: 12px;
  font-weight: 800;
}

.hub-group-title {
  margin-top: 4px;
  color: var(--hub-ink);
  font-size: 26px;
  line-height: 1.35;
}

.hub-group-desc {
  max-width: 720px;
  margin-top: 6px;
  color: var(--hub-muted);
  font-size: 14px;
}

.hub-group-count {
  color: var(--hub-muted);
  font-family: "Space Grotesk", "Noto Sans Devanagari", sans-serif;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.hub-chapter-list {
  border-bottom: 1px solid var(--hub-line-strong);
}

.hub-chapter {
  min-height: 94px;
  padding: 18px 5px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid var(--hub-line);
}

.hub-chapter:last-child {
  border-bottom: 0;
}

a.hub-chapter:hover {
  background: var(--hub-surface-soft);
}

.hub-chapter-index {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--hub-line-strong);
  border-radius: 6px;
  color: var(--hub-accent);
  background: var(--hub-surface);
  font-family: "Space Grotesk", sans-serif;
  font-size: 12px;
  font-weight: 800;
}

.hub-chapter-copy {
  min-width: 0;
}

.hub-chapter-title {
  display: block;
  color: var(--hub-ink);
  font-size: 17px;
  line-height: 1.45;
  font-weight: 750;
}

a.hub-chapter:hover .hub-chapter-title {
  color: var(--hub-accent);
}

.hub-chapter-desc {
  display: block;
  margin-top: 5px;
  color: var(--hub-muted);
  font-size: 13px;
  line-height: 1.55;
}

.hub-chapter-meta {
  display: grid;
  justify-items: end;
  gap: 4px;
  color: var(--hub-muted);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.hub-chapter-arrow {
  color: var(--hub-accent);
  font-family: "Space Grotesk", sans-serif;
  font-size: 20px;
}

.hub-chapter--coming {
  opacity: 0.66;
}

.hub-coming-label {
  color: var(--hub-warm);
  font-size: 11px;
  font-weight: 850;
}

.hub-note {
  margin-top: 64px;
  padding: 24px 0;
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 30px;
  border-top: 1px solid var(--hub-line-strong);
  border-bottom: 1px solid var(--hub-line-strong);
}

.hub-note strong {
  color: var(--hub-accent-strong);
  font-size: 17px;
}

html[data-theme="dark"] .hub-note strong,
html.dark .hub-note strong {
  color: #fff;
}

.hub-note p {
  color: var(--hub-muted);
  font-size: 14px;
}

.sidebar-scrim {
  position: fixed;
  z-index: 650;
  inset: var(--shared-topbar-height, 60px) 0 0;
  display: none;
  border: 0;
  background: rgba(8, 14, 11, 0.52);
}

.subject-hub-footer {
  border-top: 1px solid var(--hub-line-strong);
  background: rgba(238, 242, 238, 0.94);
}

html[data-theme="dark"] .subject-hub-footer,
html.dark .subject-hub-footer {
  background: rgba(15, 20, 18, 0.96);
}

.hub-footer-inner {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  padding: 45px 0 26px;
}

.hub-footer-top {
  display: grid;
  grid-template-columns: minmax(260px, 1.2fr) minmax(0, 1fr);
  gap: 60px;
}

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

.hub-footer-brand img {
  width: 54px;
  height: 54px;
  object-fit: contain;
}

.hub-footer-brand strong {
  display: block;
  color: var(--hub-accent-strong);
  font-family: "Space Grotesk", sans-serif;
  font-size: 19px;
}

html[data-theme="dark"] .hub-footer-brand strong,
html.dark .hub-footer-brand strong {
  color: #fff;
}

.hub-footer-brand span {
  display: block;
  margin-top: 2px;
  color: var(--hub-muted);
  font-size: 12px;
}

.hub-footer-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 24px;
}

.hub-footer-nav a {
  padding: 6px 0;
  border-bottom: 1px solid var(--hub-line);
  color: var(--hub-muted);
  font-size: 13px;
  font-weight: 650;
}

.hub-footer-nav a:hover {
  color: var(--hub-accent);
}

.hub-footer-bottom {
  margin-top: 32px;
  padding-top: 17px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid var(--hub-line);
  color: var(--hub-muted);
  font-size: 11px;
}

@media (max-width: 900px) {
  .subject-hub-layout {
    display: block;
  }

  .subject-hub-main {
    padding-top: var(--shared-topbar-height, 60px);
  }

  .subject-hub-sidebar {
    position: fixed;
    z-index: 800;
    top: var(--shared-topbar-height, 60px);
    left: 0;
    width: min(310px, 84vw);
    height: calc(100dvh - var(--shared-topbar-height, 60px));
    max-height: none !important;
    transform: translateX(-104%);
    transition: transform 0.22s ease;
    box-shadow: 14px 0 32px rgba(8, 16, 12, 0.18);
  }

  .subject-hub-sidebar.open,
  .subject-hub-sidebar.active {
    transform: translateX(0);
  }

  body.sidebar-open {
    overflow: hidden;
  }

  body.sidebar-open .sidebar-scrim {
    display: block;
  }

  .hub-hero-inner,
  .hub-content {
    width: min(100% - 40px, var(--hub-content));
  }

  .hub-title {
    font-size: 44px;
  }

  .hub-study-route {
    grid-template-columns: 1fr;
  }

  .hub-route-step,
  .hub-route-step + .hub-route-step {
    min-height: 0;
    padding: 18px 0;
    border-left: 0;
    border-bottom: 1px solid var(--hub-line);
  }

  .hub-route-step:last-child {
    border-bottom: 0;
  }
}

@media (max-width: 620px) {
  .subject-hub-hero {
    min-height: min(510px, calc(100dvh - var(--shared-topbar-height, 60px)));
    align-items: flex-end;
    background-position: center;
  }

  .subject-hub-hero::before {
    background: rgba(8, 17, 14, 0.74);
  }

  .hub-hero-inner {
    width: min(100% - 28px, var(--hub-content));
    padding: 30px 0 34px;
  }

  .hub-breadcrumb {
    margin-bottom: 16px;
  }

  .hub-title {
    font-size: 34px;
    line-height: 1.2;
  }

  .hub-lead {
    margin-top: 13px;
    font-size: 15px;
    line-height: 1.62;
  }

  .hub-stats {
    margin-top: 19px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .hub-stat,
  .hub-stat:last-child {
    min-width: 0;
    margin: 0;
    padding: 9px 8px;
    border-right: 1px solid rgba(255, 255, 255, 0.25);
    border-bottom: 0;
  }

  .hub-stat:last-child {
    border-right: 0;
  }

  .hub-stat strong {
    font-size: 16px;
  }

  .hub-stat span {
    font-size: 10px;
    line-height: 1.35;
  }

  .hub-hero-actions {
    margin-top: 18px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }

  .hub-primary-action,
  .hub-secondary-action {
    width: 100%;
    min-height: 43px;
    padding: 8px 10px;
    font-size: 13px;
  }

  .hub-content {
    width: min(100% - 28px, var(--hub-content));
    padding: 44px 0 66px;
  }

  .hub-section-title {
    font-size: 27px;
  }

  .hub-section-intro {
    margin-bottom: 32px;
  }

  .hub-section-intro p {
    font-size: 14px;
  }

  .hub-study-route {
    margin-bottom: 40px;
  }

  .hub-groups {
    gap: 42px;
  }

  .hub-group-header {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .hub-group-title {
    font-size: 23px;
  }

  .hub-group-count {
    white-space: normal;
  }

  .hub-chapter {
    min-height: 0;
    padding: 15px 1px;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    gap: 10px;
  }

  .hub-chapter-index {
    width: 36px;
    height: 36px;
  }

  .hub-chapter-title {
    font-size: 16px;
  }

  .hub-chapter-meta span:not(.hub-chapter-arrow) {
    display: none;
  }

  .hub-note {
    margin-top: 48px;
    padding: 19px 0;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .hub-footer-inner {
    width: min(100% - 28px, 1180px);
  }

  .hub-footer-top {
    grid-template-columns: 1fr;
    gap: 30px;
  }

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

}

@media (max-width: 400px) {
  .hub-title {
    font-size: 31px;
  }

  .hub-kicker {
    font-size: 11px;
  }

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

  .hub-chapter-desc {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .hub-footer-nav {
    grid-template-columns: 1fr;
  }
}

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

  .subject-hub-sidebar {
    transition: none;
  }
}

@media print {
  .subject-hub-sidebar,
  .sidebar-scrim,
  .hub-hero-actions,
  .subject-hub-footer {
    display: none !important;
  }

  .subject-hub-layout {
    display: block;
  }

  .subject-hub-hero {
    min-height: 0;
    color: #000;
    background: none;
  }

  .subject-hub-hero::before {
    display: none;
  }
}
