/* =========================================================
   Ansari Notes Hub — stylesheet
   Plain CSS3, no framework. Organized top-to-bottom as:
   variables, reset, layout, header, buttons, hero, sections,
   cards, forms, footer, note page, utilities, responsive.
   ========================================================= */

:root {
  --color-primary: #1d4ed8;
  --color-primary-dark: #1e3a8a;
  --color-primary-light: #e8f0fe;
  --color-navy: #0f172a;
  --color-bg: #ffffff;
  --color-bg-alt: #f5f7fb;
  --color-text: #1f2937;
  --color-text-light: #64748b;
  --color-border: #e2e8f0;
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow: 0 2px 10px rgba(15, 23, 42, 0.07);
  --shadow-hover: 0 10px 26px rgba(15, 23, 42, 0.12);
  --container: 1180px;
  --header-height: 72px;
  --font-base: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans Devanagari', 'Noto Sans', Arial, sans-serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-base);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

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

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

h1, h2, h3, h4, p {
  margin: 0;
}

button {
  font-family: inherit;
}

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 20px;
}

section {
  padding: 56px 0;
}

.section-alt {
  background: var(--color-bg-alt);
}

.section-head {
  text-align: center;
  max-width: 640px;
  margin: 0 auto 36px;
}

.section-head h2 {
  font-size: 1.9rem;
  color: var(--color-navy);
  margin-bottom: 10px;
}

.section-head p {
  color: var(--color-text-light);
}

.eyebrow {
  display: inline-block;
  color: var(--color-primary);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

/* ---------- skip link ---------- */

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--color-primary);
  color: #fff;
  padding: 10px 16px;
  border-radius: 0 0 8px 0;
  z-index: 200;
}

.skip-link:focus {
  left: 0;
}

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

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: saturate(180%) blur(6px);
  border-bottom: 1px solid var(--color-border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.brand-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  color: #fff;
  font-weight: 800;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.02em;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-name {
  font-weight: 700;
  color: var(--color-navy);
  font-size: 1.05rem;
}

.brand-tagline {
  font-size: 0.72rem;
  color: var(--color-text-light);
}

.primary-nav ul {
  display: flex;
  align-items: center;
  gap: 4px;
}

.primary-nav a {
  display: block;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--color-text);
  transition: background 0.15s ease, color 0.15s ease;
}

.primary-nav a:hover,
.primary-nav a[aria-current='page'] {
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: #fff;
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  height: 2px;
  width: 20px;
  margin: 0 auto;
  background: var(--color-navy);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-toggle.is-open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle.is-open span:nth-child(2) {
  opacity: 0;
}

.nav-toggle.is-open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 24px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--color-primary-dark);
  box-shadow: var(--shadow-hover);
}

.btn-outline {
  background: #fff;
  color: var(--color-primary-dark);
  border-color: var(--color-border);
}

.btn-outline:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.btn-ghost {
  background: transparent;
  color: var(--color-navy);
}

.btn-small {
  padding: 9px 16px;
  font-size: 0.85rem;
}

.btn-block {
  width: 100%;
}

/* ---------- hero ---------- */

.hero {
  background: linear-gradient(180deg, var(--color-primary-light) 0%, #ffffff 65%);
  padding: 64px 0 56px;
}

.hero-inner {
  max-width: 760px;
  margin: 0 auto;
  text-align: center;
}

.hero h1 {
  font-size: clamp(1.9rem, 4vw, 2.8rem);
  color: var(--color-navy);
  line-height: 1.25;
  margin-bottom: 16px;
}

.hero p {
  color: var(--color-text-light);
  font-size: 1.05rem;
  max-width: 560px;
  margin: 0 auto 28px;
}

.search-bar {
  display: flex;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 6px;
  box-shadow: var(--shadow);
  max-width: 560px;
  margin: 0 auto 24px;
}

.search-bar input {
  flex: 1;
  border: none;
  outline: none;
  padding: 12px 14px;
  font-size: 0.98rem;
  font-family: inherit;
  background: transparent;
  color: var(--color-text);
}

.hero-ctas {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}

.search-results {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 20px 40px;
}

.search-results h2 {
  font-size: 1.3rem;
  color: var(--color-navy);
  margin-bottom: 18px;
}

/* ---------- class chooser ---------- */

.class-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.class-card {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.class-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}

.class-card .class-badge {
  display: inline-block;
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  margin-bottom: 16px;
}

.class-card h3 {
  font-size: 1.4rem;
  color: var(--color-navy);
  margin-bottom: 10px;
}

.class-card p {
  color: var(--color-text-light);
  margin-bottom: 22px;
}

/* ---------- grids ---------- */

.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 22px;
}

.subjects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 18px;
}

/* ---------- note card ---------- */

.note-card {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.note-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}

.note-card-top {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}

.badge-class {
  background: var(--color-navy);
  color: #fff;
}

.badge-subject {
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
}

.note-card-title {
  font-size: 1.08rem;
  color: var(--color-navy);
  line-height: 1.4;
}

.note-card-title a:hover {
  color: var(--color-primary);
}

.note-card-chapter {
  font-size: 0.85rem;
  color: var(--color-primary-dark);
  font-weight: 600;
}

.note-card-desc {
  color: var(--color-text-light);
  font-size: 0.92rem;
  flex-grow: 1;
}

.note-card-meta {
  font-size: 0.8rem;
  color: var(--color-text-light);
}

.note-card-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.no-results {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--color-text-light);
  padding: 32px 0;
  font-size: 1.02rem;
}

/* ---------- popular notes ---------- */

.popular-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 820px;
  margin: 0 auto;
}

.popular-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: #fff;
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-primary);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  box-shadow: var(--shadow);
}

.popular-item-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.popular-item-title {
  font-weight: 600;
  color: var(--color-navy);
}

.popular-item-subject {
  color: var(--color-text-light);
  font-size: 0.88rem;
}

/* ---------- subject card ---------- */

.subject-card {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 22px 18px;
  text-align: center;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.subject-card:hover {
  transform: translateY(-3px);
  border-color: var(--color-primary);
  box-shadow: var(--shadow-hover);
}

.subject-icon {
  font-size: 2rem;
  line-height: 1;
  margin-bottom: 4px;
}

.subject-name {
  font-weight: 700;
  color: var(--color-navy);
}

.subject-desc {
  font-size: 0.82rem;
  color: var(--color-text-light);
}

/* ---------- forms / filters ---------- */

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 28px;
  align-items: center;
}

.filter-bar input[type='search'],
.filter-bar input[type='text'],
.filter-bar select {
  padding: 11px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.92rem;
  background: #fff;
  color: var(--color-text);
}

.filter-bar input[type='search'] {
  flex: 1;
  min-width: 200px;
}

.filter-bar select {
  min-width: 150px;
}

/* ---------- subject section (class pages) ---------- */

.subject-section {
  margin-bottom: 44px;
}

.subject-section-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 18px;
  border-bottom: 2px solid var(--color-primary-light);
  padding-bottom: 10px;
}

.subject-section-head h2 {
  font-size: 1.3rem;
  color: var(--color-navy);
}

/* ---------- page hero (inner pages) ---------- */

.page-hero {
  background: var(--color-bg-alt);
  padding: 48px 0 36px;
  text-align: center;
}

.page-hero h1 {
  font-size: clamp(1.7rem, 3.5vw, 2.3rem);
  color: var(--color-navy);
  margin-bottom: 12px;
}

.page-hero p {
  color: var(--color-text-light);
  max-width: 620px;
  margin: 0 auto;
}

/* ---------- breadcrumb ---------- */

.breadcrumb {
  font-size: 0.85rem;
  color: var(--color-text-light);
  margin-bottom: 18px;
}

.breadcrumb a {
  color: var(--color-primary-dark);
}

.breadcrumb a:hover {
  text-decoration: underline;
}

/* ---------- note detail page ---------- */

.note-detail-head {
  margin-bottom: 28px;
}

.note-detail-head h1 {
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  color: var(--color-navy);
  margin: 10px 0 14px;
}

.note-detail-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.note-detail-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 32px;
  align-items: start;
}

.note-content-card,
.note-side-card {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

.note-content-card h2 {
  font-size: 1.2rem;
  color: var(--color-navy);
  margin-bottom: 12px;
}

.note-content-card p {
  color: var(--color-text);
  margin-bottom: 12px;
}

.topic-list li {
  padding: 8px 0 8px 26px;
  position: relative;
  border-bottom: 1px dashed var(--color-border);
  color: var(--color-text);
}

.topic-list li:last-child {
  border-bottom: none;
}

.topic-list li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--color-primary);
  font-weight: 700;
}

.pdf-placeholder {
  background: var(--color-bg-alt);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-sm);
  padding: 34px 18px;
  text-align: center;
  color: var(--color-text-light);
  font-size: 0.9rem;
  margin-bottom: 16px;
}

.note-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.note-side-card h3 {
  font-size: 1rem;
  color: var(--color-navy);
  margin-bottom: 14px;
}

.related-notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
  margin-top: 16px;
}

/* ---------- about / contact ---------- */

.prose {
  max-width: 760px;
  margin: 0 auto;
}

.prose h2 {
  font-size: 1.3rem;
  color: var(--color-navy);
  margin: 28px 0 12px;
}

.prose p {
  color: var(--color-text);
  margin-bottom: 14px;
}

.prose ul {
  margin-bottom: 14px;
}

.prose ul li {
  padding-left: 22px;
  position: relative;
  margin-bottom: 8px;
  color: var(--color-text);
}

.prose ul li::before {
  content: '•';
  color: var(--color-primary);
  position: absolute;
  left: 4px;
  font-weight: 700;
}

.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  max-width: 900px;
  margin: 0 auto;
}

.contact-card {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 26px;
  text-align: center;
  box-shadow: var(--shadow);
}

.contact-card .contact-icon {
  font-size: 2rem;
  margin-bottom: 10px;
}

.contact-card h3 {
  color: var(--color-navy);
  margin-bottom: 8px;
}

.contact-card p {
  color: var(--color-text-light);
  font-size: 0.9rem;
  margin-bottom: 16px;
}

/* ---------- footer ---------- */

.site-footer {
  background: var(--color-navy);
  color: #cbd5e1;
  padding: 52px 0 0;
  margin-top: 60px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 32px;
  padding-bottom: 36px;
}

.footer-brand .brand-name {
  color: #fff;
}

.footer-brand p {
  color: #94a3b8;
  font-size: 0.9rem;
  margin: 14px 0 16px;
  max-width: 320px;
}

.footer-social {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.footer-social a {
  border: 1px solid #334155;
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 0.82rem;
  color: #e2e8f0;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.footer-social a:hover {
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.footer-col h3 {
  color: #fff;
  font-size: 0.95rem;
  margin-bottom: 14px;
}

.footer-col ul li {
  margin-bottom: 10px;
}

.footer-col a {
  color: #94a3b8;
  font-size: 0.9rem;
  transition: color 0.15s ease;
}

.footer-col a:hover {
  color: #fff;
}

.footer-bottom {
  border-top: 1px solid #1e293b;
  padding: 18px 20px;
  text-align: center;
  font-size: 0.82rem;
  color: #64748b;
}

/* ---------- toast ---------- */

.anh-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 20px);
  background: var(--color-navy);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  box-shadow: var(--shadow-hover);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 300;
  max-width: 90vw;
  text-align: center;
}

.anh-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- utilities ---------- */

.text-center {
  text-align: center;
}

.mt-24 {
  margin-top: 24px;
}

/* =========================================================
   Responsive
   ========================================================= */

@media (max-width: 900px) {
  .note-detail-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 760px) {
  .nav-toggle {
    display: flex;
  }

  .primary-nav {
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: #fff;
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
  }

  .primary-nav.is-open {
    max-height: 420px;
  }

  .primary-nav ul {
    flex-direction: column;
    align-items: stretch;
    padding: 10px 20px 18px;
    gap: 2px;
  }

  .primary-nav a {
    padding: 12px 10px;
  }

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

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

  section {
    padding: 40px 0;
  }
}

@media (max-width: 520px) {
  .search-bar {
    flex-direction: column;
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    gap: 10px;
  }

  .search-bar input {
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
  }

  .search-bar .btn {
    width: 100%;
  }

  .hero-ctas {
    flex-direction: column;
  }

  .hero-ctas .btn {
    width: 100%;
  }

  .popular-item {
    flex-direction: column;
    align-items: flex-start;
  }
}
