/* ═══════════════════════════════════════════════════════════════
   base.css — Global resets, typography, and utilities
   ─────────────────────────────────────────────────────────────
   Requires: tokens.css (loaded before this file)
   ═══════════════════════════════════════════════════════════════ */


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

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

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

section[id],
main[id],
div[id] {
  scroll-margin-top: 85px;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  line-height: var(--leading-normal);
  color: var(--color-text-primary);
  background-color: var(--color-bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  min-height: 100vh;
  min-height: 100dvh;
}

/* Prevent scroll when mobile nav is open */
body.nav-open {
  overflow: hidden;
}


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

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  color: var(--color-text-primary);
  text-wrap: balance;
}

h1 {
  font-size: var(--text-4xl);
  font-weight: var(--weight-extrabold);
}

h2 {
  font-size: var(--text-3xl);
  margin-bottom: var(--space-6);
}

h3 {
  font-size: var(--text-2xl);
  margin-bottom: var(--space-4);
}

h4 {
  font-size: var(--text-xl);
  margin-bottom: var(--space-3);
}

p {
  margin-bottom: var(--space-4);
  line-height: var(--leading-normal);
}

p:last-child {
  margin-bottom: 0;
}

/* Tamil text line-height — applied globally via lang attribute */
:lang(ta) {
  line-height: var(--leading-normal);
}

/* Latin labels, phone numbers, English fragments */
.label-text {
  font-family: var(--font-label);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-wide);
}

.label-text--caps {
  font-family: var(--font-label);
  font-variant: small-caps;
  letter-spacing: var(--tracking-wider);
}

strong, b {
  font-weight: var(--weight-bold);
}

small {
  font-size: var(--text-sm);
}


/* ── Links ────────────────────────────────────────────────── */

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

a:hover {
  color: var(--color-brass-pale);
}

a:active {
  color: var(--color-brass-dark);
}


/* ── Images & Media ───────────────────────────────────────── */

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

img {
  font-style: italic; /* Fallback text style if image fails */
}


/* ── Lists ────────────────────────────────────────────────── */

ul, ol {
  list-style: none;
}


/* ── Form elements reset ──────────────────────────────────── */

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
  border: none;
  background: none;
  outline: none;
}

button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}


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

.container {
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: var(--content-padding);
}

.section {
  padding-block: var(--space-16);
  position: relative;
}

.section--dark {
  background-color: var(--color-bg-dark);
  color: var(--color-text-on-dark);
}

.section--dark h2,
.section--dark h3,
.section--dark h4 {
  color: var(--color-text-on-dark);
}

.section--deep {
  background-color: var(--color-bg-deep);
  color: var(--color-text-on-dark);
}

.section--deep h2,
.section--deep h3,
.section--deep h4 {
  color: var(--color-text-on-dark);
}


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

.text-center { text-align: center; }
.text-brass { color: var(--color-temple-brass); }
.text-ivory { color: var(--color-aged-ivory); }
.text-kumkumam { color: var(--color-kumkumam); }
.text-muted { color: var(--color-text-muted); }


/* ── Accessibility ────────────────────────────────────────── */

/* Focus ring — brass to match the brand */
:focus-visible {
  outline: 2px solid var(--color-temple-brass);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* Skip link (keyboard nav) */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  padding: var(--space-2) var(--space-4);
  background: var(--color-bg-dark);
  color: var(--color-text-on-dark);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  border-radius: var(--radius-md);
  z-index: var(--z-modal);
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: var(--space-2);
}

/* Screen reader only */
.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;
}


/* ── Reduced Motion ───────────────────────────────────────── */

@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;
  }
}


/* ── Selection ────────────────────────────────────────────── */

::selection {
  background-color: rgba(201, 152, 46, 0.25);
  color: var(--color-deep-charcoal);
}


/* ── Scrollbar (warm-toned, subtle) ───────────────────────── */

@supports (scrollbar-color: auto) {
  html {
    scrollbar-color: var(--color-temple-brass) var(--color-ivory-warm);
    scrollbar-width: thin;
  }
}

::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--color-ivory-warm);
}

::-webkit-scrollbar-thumb {
  background: var(--color-temple-brass);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-brass-dark);
}


/* ── Bottom bar spacer — prevents content from hiding behind
     the fixed mobile bottom bar ───────────────────────────── */

body::after {
  content: '';
  display: block;
  height: var(--bottom-bar-height);
}

@media (min-width: 768px) {
  body::after {
    display: none;
  }
}
