/**
 * CA Assist - Proprietary Software
 * Copyright (c) 2026 Sana Shahzad. All rights reserved.
 * Base Styles & Typography (English + Urdu RTL)
 */

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

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

body {
  font-family: var(--font-en);
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
  color: var(--text-main);
  background-color: var(--bg-page);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Urdu Language Specific Typography & RTL Handling */
html[lang="ur"],
[data-lang="ur"] {
  font-family: var(--font-ur-body);
  line-height: var(--line-height-urdu);
}

html[lang="ur"] h1,
html[lang="ur"] h2,
html[lang="ur"] h3,
html[lang="ur"] .font-heading {
  font-family: var(--font-ur-heading);
  line-height: 2.1;
  letter-spacing: 0;
  padding-bottom: 0.15em;
}

/* Ensure numerals, NTN, STRN, currency, codes stay LTR in Urdu context */
.numeral,
.ntn-badge,
.strn-badge,
.code-inline,
.amount-cell,
[dir="ltr"] {
  direction: ltr;
  unicode-bidi: isolate;
  display: inline-block;
}

/* Table cells must stay real table cells (inline-block would make columns collapse) */
td.numeral,
td.amount-cell,
th.amount-cell {
  display: table-cell;
  white-space: nowrap;
}
td.amount-cell,
th.amount-cell {
  text-align: right;
}

/* Focus visibility for WCAG 2.2 AA accessibility */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-main);
  font-weight: 700;
  line-height: var(--line-height-tight);
}

h1 { font-size: var(--font-size-2xl); }
h2 { font-size: var(--font-size-xl); }
h3 { font-size: var(--font-size-lg); }
h4 { font-size: var(--font-size-md); }
h5 { font-size: var(--font-size-base); }
h6 { font-size: var(--font-size-sm); }

p {
  color: var(--text-main);
  margin-block-end: var(--space-3);
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  text-decoration: underline;
  color: var(--color-primary-hover);
}

/* Inputs & Form Base */
input, select, textarea, button {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: transparent;
}

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

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

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-page);
}

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-neutral-400);
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
