/* ============================================================
   SAMVIDHAN SARAL — Base Styles
   Reset, typography foundation, utility classes
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,600;0,700;0,800;1,600;1,700&family=Lora:ital,wght@0,400;0,500;0,600;1,400;1,500&family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=Noto+Serif+Devanagari:wght@400;500;600&display=swap');

/* ── Reset ─────────────────────────────────────────────────── */

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

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

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--text);
  background-color: var(--bg);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

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

button {
  cursor: pointer;
  font-family: var(--font-ui);
  border: none;
  background: none;
}

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

input, textarea, select {
  font-family: var(--font-ui);
  font-size: var(--text-base);
}

ul, ol { list-style: none; }

/* ── Typography ─────────────────────────────────────────────── */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
  color: var(--ink);
  letter-spacing: -0.01em;
}

h1 { font-size: clamp(var(--text-3xl), 5vw, var(--text-5xl)); }
h2 { font-size: clamp(var(--text-2xl), 3.5vw, var(--text-4xl)); }
h3 { font-size: clamp(var(--text-xl), 2.5vw, var(--text-2xl)); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-md); font-family: var(--font-ui); font-weight: 600; }

p {
  line-height: 1.8;
  color: var(--text);
}

/* Reading-optimized body text */
.reading-text {
  font-family: var(--font-body);
  font-size: var(--text-md);
  line-height: 1.85;
  color: var(--text);
  max-width: 68ch;
}

.reading-text p + p {
  margin-top: var(--sp-4);
}

/* Devanagari / Hindi text */
.hindi-text {
  font-family: var(--font-devanagari);
  font-size: 1.0625rem;
  line-height: 1.9;
  letter-spacing: 0.01em;
  color: var(--text);
}

/* ── Layout ─────────────────────────────────────────────────── */

.container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--sp-6);
}

.container-reading {
  width: 100%;
  max-width: var(--max-w-reading);
  margin: 0 auto;
  padding: 0 var(--sp-6);
}

.container-narrow {
  width: 100%;
  max-width: var(--max-w-narrow);
  margin: 0 auto;
  padding: 0 var(--sp-6);
}

@media (max-width: 640px) {
  .container,
  .container-reading,
  .container-narrow {
    padding: 0 var(--sp-4);
  }
}

/* Page section spacing */
.section {
  padding: var(--sp-16) 0;
}

.section-lg {
  padding: var(--sp-20) 0;
}

@media (max-width: 768px) {
  .section { padding: var(--sp-12) 0; }
  .section-lg { padding: var(--sp-16) 0; }
}

/* ── Grid utilities ──────────────────────────────────────────── */

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-5);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-5);
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-5);
}

@media (max-width: 1024px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: 1fr; }
}

/* ── Flex utilities ──────────────────────────────────────────── */

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }
.gap-6 { gap: var(--sp-6); }
.gap-8 { gap: var(--sp-8); }
.flex-wrap { flex-wrap: wrap; }

/* ── Text utilities ──────────────────────────────────────────── */

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-muted { color: var(--text-muted); }
.text-subtle { color: var(--text-subtle); }
.text-ink { color: var(--ink); }
.text-gold { color: var(--gold); }
.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-lg { font-size: var(--text-lg); }
.font-ui { font-family: var(--font-ui); }
.font-display { font-family: var(--font-display); }
.font-600 { font-weight: 600; }
.font-700 { font-weight: 700; }
.uppercase { text-transform: uppercase; }
.tracking-wide { letter-spacing: 0.06em; }

/* ── Visibility ──────────────────────────────────────────────── */

.hide-mobile { display: flex; }
.hide-desktop { display: none; }

@media (max-width: 768px) {
  .hide-mobile { display: none !important; }
  .hide-desktop { display: flex !important; }
}

/* ── Divider ─────────────────────────────────────────────────── */

.divider {
  height: 1px;
  background: var(--border);
  margin: var(--sp-8) 0;
}

/* ── Texture ─────────────────────────────────────────────────── */

.texture {
  position: relative;
}

.texture::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='0.08'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
  border-radius: inherit;
}

.texture > * { position: relative; z-index: 1; }

/* ── Section header pattern ──────────────────────────────────── */

.section-label {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: var(--sp-3);
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(var(--text-2xl), 3vw, var(--text-3xl));
  font-weight: 700;
  color: var(--ink);
  margin-bottom: var(--sp-4);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.section-subtitle {
  font-family: var(--font-body);
  font-size: var(--text-lg);
  color: var(--text-muted);
  line-height: 1.75;
  max-width: 60ch;
}

/* ── Scrollbar (webkit) ─────────────────────────────────────── */

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--r-full); }
::-webkit-scrollbar-thumb:hover { background: var(--text-subtle); }

/* ── Focus styles ────────────────────────────────────────────── */

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}
