/* ==========================================================================
   HARSHYA.IN — OFFICIAL DESIGN SYSTEM TOKENS & TYPOGRAPHY
   Philosophy: Serif = Knowledge (Source Serif 4) • Sans = Technology (Inter)
   Production-ready • WCAG AAA/AA Compliant • Zero CLS Layout Shifts
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Source+Serif+4:ital,opsz,wght@0,8..60,400;0,8..60,600;0,8..60,700;0,8..60,800;1,8..60,400;1,8..60,600&display=swap');
@import url('harshya_layout.css');

:root {
  /* ========================================================================
     0. HARSHYA DESIGN SYSTEM v1.0 MASTER TOKENS (HIMALAYAN MINIMALISM)
     ======================================================================== */
  --color-crimson: #8B2E3F;           /* Kashmir Crimson */
  --color-velvet-light: #D8B5C8;      /* Red Velvet Light */
  --color-stone: #4A4A4A;             /* Himalayas Stone */
  --color-snow: #F9F8F6;              /* Alpine Snow */
  --color-saffron: #E8A62C;           /* Saffron Accent */
  --color-gold: #C17A3A;              /* Dogra Gold */
  --color-slate: #5B6F7E;             /* Wular Slate */
  --color-mist: #E8DDD5;              /* Pashmina Mist */
  --color-success: #6B9B6B;           /* Success Green */
  --color-alert: #C85A54;             /* Alert Red */

  /* 8px Vertical Rhythm Scale */
  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 32px;
  --space-5: 48px;
  --space-6: 64px;
  --space-7: 80px;
  --space-8: 96px;

  /* ========================================================================
     1. BRAND COLOR PALETTE (Extracted from Official Emblem)
     ======================================================================== */
  /* Primary: Kashmir Crimson & Chinar Heritage */
  --h-primary: #8B2E3F;
  --h-primary-rgb: 139, 46, 63;
  --h-primary-hover: #732332;
  --h-primary-active: #5E1C29;
  --h-primary-light: #F9EBEF;
  --h-primary-glow: rgba(139, 46, 63, 0.14);

  /* Secondary / Accent: Himalayan Terracotta & Copper (Saffron, Craftsmanship) */
  --h-secondary: #844118;
  --h-secondary-rgb: 132, 65, 24;
  --h-secondary-hover: #9E4E1C;
  --h-secondary-active: #6A3311;
  --h-secondary-light: #FAF1EA;
  --h-secondary-glow: rgba(132, 65, 24, 0.14);

  /* Surface & Canvas Colors (Archival Warm Ivory & Clean White) */
  --h-canvas: #FDFBF7;
  --h-surface: #FFFFFF;
  --h-subtle: #F5F2EB;
  --h-surface-elevated: #FFFFFF;

  /* Hairline Borders & Dividers */
  --h-border: #E7E2D8;
  --h-border-strong: #D5CEC1;
  --h-border-subtle: #EFECE5;

  /* High-Contrast Typographic Ink (Rich Charcoal Slate) */
  --h-text: #14221D;
  --h-text-muted: #4A5853;
  --h-text-subtle: #52605B;
  --h-text-inverse: #FFFFFF;

  /* Contextual Status Colors */
  --h-success: #1E6B47;
  --h-success-bg: #E8F5EE;
  --h-warning: #B45309;
  --h-warning-bg: #FEF3C7;
  --h-danger: #991B1B;
  --h-danger-bg: #FEE2E2;
  --h-info: #1D4ED8;
  --h-info-bg: #EFF6FF;

  /* ========================================================================
     2. TYPOGRAPHY PERSONALITY SYSTEM
     ======================================================================== */
  /* Display & Knowledge: Editorial authority, titles, historical & gazetteer dossiers */
  --font-display: 'Source Serif 4', Georgia, Cambria, 'Times New Roman', serif;
  
  /* Interface & Technology: Navigation, buttons, filters, dashboards, exams, forms */
  --font-ui: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* ========================================================================
     3. EXACT TYPOGRAPHIC SCALE & LINE HEIGHT RATIOS
     ======================================================================== */
  /* Display XL: 64 / 1.05 */
  --type-display-xl-size: 64px;
  --type-display-xl-line: 1.05;
  --type-display-xl-weight: 700;

  /* Display L: 48 / 1.08 */
  --type-display-l-size: 48px;
  --type-display-l-line: 1.08;
  --type-display-l-weight: 700;

  /* Display M: 40 / 1.12 */
  --type-display-m-size: 40px;
  --type-display-m-line: 1.12;
  --type-display-m-weight: 700;

  /* H1: 36 / 1.15 */
  --type-h1-size: 36px;
  --type-h1-line: 1.15;
  --type-h1-weight: 700;

  /* H2: 30 / 1.2 */
  --type-h2-size: 30px;
  --type-h2-line: 1.2;
  --type-h2-weight: 600;

  /* H3: 24 / 1.25 */
  --type-h3-size: 24px;
  --type-h3-line: 1.25;
  --type-h3-weight: 600;

  /* H4: 20 / 1.3 */
  --type-h4-size: 20px;
  --type-h4-line: 1.3;
  --type-h4-weight: 600;

  /* Body L: 18 / 1.65 */
  --type-body-l-size: 18px;
  --type-body-l-line: 1.65;
  --type-body-l-weight: 400;

  /* Body: 16 / 1.6 */
  --type-body-size: 16px;
  --type-body-line: 1.6;
  --type-body-weight: 400;

  /* Body Small: 14 / 1.5 */
  --type-body-sm-size: 14px;
  --type-body-sm-line: 1.5;
  --type-body-sm-weight: 400;

  /* Caption: 12 / 1.4 */
  --type-caption-size: 12px;
  --type-caption-line: 1.4;
  --type-caption-weight: 500;

  /* Label: 11 / 1.3 */
  --type-label-size: 11px;
  --type-label-line: 1.3;
  --type-label-weight: 600;

  /* Elevation Shadows */
  --h-shadow-sm: 0 1px 3px rgba(15, 44, 36, 0.05), 0 1px 2px rgba(15, 44, 36, 0.04);
  --h-shadow-md: 0 4px 8px -1px rgba(15, 44, 36, 0.07), 0 2px 4px -1px rgba(15, 44, 36, 0.04);
  --h-shadow-lg: 0 10px 20px -3px rgba(15, 44, 36, 0.08), 0 4px 6px -2px rgba(15, 44, 36, 0.04);
  --h-shadow-xl: 0 20px 30px -5px rgba(15, 44, 36, 0.1), 0 8px 10px -4px rgba(15, 44, 36, 0.04);

  /* Border Radii */
  --h-radius-sm: 6px;
  --h-radius-md: 10px;
  --h-radius-lg: 14px;
  --h-radius-xl: 20px;
  --h-radius-full: 9999px;

  /* Mobile Touch Targets & Ergonomics (WCAG 2.5.5 AAA / Apple HIG / Material 48dp) */
  --touch-target-min: 44px;
  --touch-target-comfortable: 48px;
  --safe-area-top: env(safe-area-inset-top, 0px);
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
  --safe-area-left: env(safe-area-inset-left, 0px);
  --safe-area-right: env(safe-area-inset-right, 0px);
}

/* Universal Box Model */
*, *::before, *::after {
  box-sizing: border-box;
}

/* ==========================================================================
   4. GLOBAL RESET & BASE RULES (Zero Layout Shift & Mobile Viewport Constraints)
   ========================================================================== */
html {
  background-color: var(--h-canvas);
  color: var(--h-text);
  font-family: var(--font-ui);
  /* Modern Web Guidance: Normalize font size based on primary font x-height to eliminate CLS */
  font-size-adjust: from-font;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--topbar-height, 60px) + 16px);
  overflow-x: hidden;
  max-width: 100vw;
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--h-canvas);
  color: var(--h-text);
  font-family: var(--font-ui);
  font-size: var(--type-body-size);
  line-height: var(--type-body-line);
  overflow-x: hidden;
  max-width: 100vw;
  width: 100%;
  box-sizing: border-box;
}

/* ==========================================================================
   5. TYPOGRAPHY CLASSES & ELEMENT RULES
   ========================================================================== */
/* Display Personalities (Source Serif 4) */
h1, h2, h3, h4,
.type-display-xl,
.type-display-l,
.type-display-m,
.editorial-title,
.archive-heading {
  font-family: var(--font-display);
  color: var(--h-primary);
  font-size-adjust: from-font;
  letter-spacing: -0.015em;
  margin-top: 0;
}

.type-display-xl {
  font-size: var(--type-display-xl-size);
  line-height: var(--type-display-xl-line);
  font-weight: var(--type-display-xl-weight);
}

.type-display-l {
  font-size: var(--type-display-l-size);
  line-height: var(--type-display-l-line);
  font-weight: var(--type-display-l-weight);
}

.type-display-m {
  font-size: var(--type-display-m-size);
  line-height: var(--type-display-m-line);
  font-weight: var(--type-display-m-weight);
}

h1, .type-h1 {
  font-size: var(--type-h1-size);
  line-height: var(--type-h1-line);
  font-weight: var(--type-h1-weight);
}

h2, .type-h2 {
  font-size: var(--type-h2-size);
  line-height: var(--type-h2-line);
  font-weight: var(--type-h2-weight);
}

h3, .type-h3 {
  font-size: var(--type-h3-size);
  line-height: var(--type-h3-line);
  font-weight: var(--type-h3-weight);
}

h4, .type-h4 {
  font-size: var(--type-h4-size);
  line-height: var(--type-h4-line);
  font-weight: var(--type-h4-weight);
}

/* Body & Interface Text (Inter) */
p, li, dd {
  font-family: var(--font-ui);
  font-size: var(--type-body-size);
  line-height: var(--type-body-line);
  color: var(--h-text);
}

.type-body-l {
  font-size: var(--type-body-l-size);
  line-height: var(--type-body-l-line);
}

.type-body {
  font-size: var(--type-body-size);
  line-height: var(--type-body-line);
}

.type-body-sm {
  font-size: var(--type-body-sm-size);
  line-height: var(--type-body-sm-line);
}

.type-caption, caption {
  font-size: var(--type-caption-size);
  line-height: var(--type-caption-line);
  font-weight: var(--type-caption-weight);
  color: var(--h-text-muted);
}

.type-label {
  font-size: var(--type-label-size);
  line-height: var(--type-label-line);
  font-weight: var(--type-label-weight);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--h-secondary);
}

/* Interface Elements */
nav, button, input, select, textarea, .badge, .btn, .chip, .tab, table th {
  font-family: var(--font-ui);
}

/* Consistent SVG Iconography Tokens */
.icon-harshya {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25em;
  height: 1.25em;
  vertical-align: -0.15em;
  stroke-width: 1.75;
  stroke: currentColor;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ========================================================================
   WCAG 2.2 AA / AAA ACCESSIBILITY FOUNDATIONS
   ======================================================================== */

/* 1. Universal Skip to Main Content Link */
.skip-link {
  position: fixed !important;
  top: -120px !important;
  left: 16px !important;
  background: #0F2C24 !important;
  color: #FFFFFF !important;
  padding: 12px 22px !important;
  font-family: var(--font-ui, system-ui, sans-serif) !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  line-height: 1 !important;
  text-decoration: none !important;
  border: 2px solid #F59E0B !important;
  border-radius: 0 0 8px 8px !important;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.45) !important;
  z-index: 9999999 !important;
  transition: top 0.18s cubic-bezier(0.16, 1, 0.3, 1) !important;
}
.skip-link:focus,
.skip-link:focus-visible {
  top: 0 !important;
  outline: 3px solid #38BDF8 !important;
  outline-offset: 3px !important;
}

/* 2. Universal High-Contrast Adaptive Focus Indicators */
:focus-visible {
  outline: 2.5px solid #0284C7 !important;
  outline-offset: 2px !important;
}

/* Dark surface focus contrast guarantee (contrast > 6:1) */
header :focus-visible,
.bp-topbar :focus-visible,
.bp-sidebar :focus-visible,
.mobile-drawer :focus-visible,
footer :focus-visible,
.bp-footer :focus-visible,
.dark-surface :focus-visible,
[data-theme="dark"] :focus-visible,
.hero-culture-master :focus-visible,
.card-dark :focus-visible {
  outline: 2.5px solid #38BDF8 !important;
  outline-offset: 2px !important;
}

/* 3. WCAG 2.2 Focus Not Obscured (SC 2.4.11 / 2.4.12) */
:target,
main[id],
section[id],
h1[id], h2[id], h3[id], h4[id], h5[id], h6[id],
[tabindex="-1"]:focus {
  scroll-margin-top: calc(var(--topbar-height, 64px) + 24px) !important;
  outline: none;
}

/* 4. Universal Reduced Motion Support (WCAG 2.2 SC 2.3.3) */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  html {
    scroll-behavior: auto !important;
  }
  .bp-reveal, .bp-reveal-stagger > *, .animate-pulse, .pulse-dot {
    animation: none !important;
    transition: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}

/* 5. Non-text Contrast & Color Independence (WCAG 2.2 SC 1.4.1 & 1.4.11) */
.chip-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2);
}

/* 6. Accessible Screen-Reader-Only Heading & Utility */
.page-main-heading, .sr-only, .visually-hidden:where(:not(:focus-within, :active)) {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* 7. Accessible Forms & Touch Targets (WCAG 2.2 SC 2.5.8) */
input, select, textarea, button, a.btn, .bp-nav-chip {
  touch-action: manipulation;
}


