/* =============================================================================
   maattaam v2 — base: reset, typography, utilities. Mobile-first.
   ============================================================================= */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  scroll-padding-top: calc(var(--header-h-mobile) + var(--safe-top) + var(--space-4));
}
@media (min-width: 768px) { html { scroll-padding-top: calc(var(--header-h) + var(--space-4)); } }
body {
  min-height: 100dvh;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  line-height: var(--leading-normal);
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-wrap: break-word;
}
:lang(ml), .lang-ml { line-height: var(--leading-malayalam); }

img, picture, svg, video, canvas { display: block; max-width: 100%; }
img { height: auto; }
input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled, [aria-disabled="true"] { cursor: not-allowed; }
ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }
table { border-collapse: collapse; }
[hidden] { display: none !important; }

/* ---- Headings & text ---------------------------------------------------- */
h1, h2, h3, h4 { font-weight: var(--weight-semibold); line-height: var(--leading-tight); color: var(--color-text); letter-spacing: -0.01em; }
h1, .h1 { font-size: var(--text-2xl); }
h2, .h2 { font-size: var(--text-xl); }
h3, .h3 { font-size: var(--text-lg); }
h4, .h4 { font-size: var(--text-base); }
p { max-width: 70ch; }
small, .text-sm { font-size: var(--text-sm); }
.text-xs { font-size: var(--text-xs); }
.text-muted { color: var(--color-text-muted); }
.text-secondary { color: var(--color-text-secondary); }
.text-orange { color: var(--orange-800); }
.text-purple { color: var(--purple-500); }
.fw-semibold, strong, b { font-weight: var(--weight-semibold); }
.tabular { font-variant-numeric: tabular-nums; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

a { color: var(--color-link); text-decoration: none; }
a:hover { color: var(--color-link-hover); text-decoration: underline; text-underline-offset: 3px; }
a:not([class]) { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }

/* ---- Focus: always visible for keyboard users -------------------------- */
:focus { outline: none; }
:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 2px; border-radius: 4px; }

/* ---- Icons (sprite <svg class="icon"><use href="…#name"></svg>) -------- */
.icon { width: 1.25em; height: 1.25em; flex: none; display: inline-block; vertical-align: -0.2em; }
.icon--sm { width: 1em; height: 1em; }
.icon--lg { width: 1.5em; height: 1.5em; }
.icon--xl { width: 2rem; height: 2rem; }

/* ---- Layout helpers ----------------------------------------------------- */
.container { width: 100%; max-width: var(--container-max); margin-inline: auto; padding-inline: max(var(--gutter), var(--safe-left)) max(var(--gutter), var(--safe-right)); }
.stack > * + * { margin-top: var(--stack-gap, var(--space-4)); }
.stack-sm { --stack-gap: var(--space-2); }
.stack-lg { --stack-gap: var(--space-8); }
.cluster { display: flex; flex-wrap: wrap; gap: var(--cluster-gap, var(--space-3)); align-items: center; }
.cluster--center { justify-content: center; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.grid { display: grid; gap: var(--space-4); }
.section { padding-block: var(--space-8); }
@media (min-width: 768px) { .section { padding-block: var(--space-12); } }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-4); }
.card-surface { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); }
.divider { border: 0; border-top: 1px solid var(--color-border); margin-block: var(--space-6); }

/* ---- Accessibility ------------------------------------------------------ */
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; top: calc(var(--safe-top) + var(--space-2)); left: var(--space-2); z-index: var(--z-skiplink);
  padding: var(--space-3) var(--space-4); background: var(--purple-700); color: var(--white);
  border-radius: var(--radius-md); font-weight: var(--weight-semibold);
  transform: translateY(-200%); transition: transform var(--dur-fast) var(--ease-out);
}
.skip-link:focus, .skip-link:focus-visible { transform: translateY(0); color: var(--white); text-decoration: none; }

/* No-JS: anything enhanced by JS can opt out via .js-only */
html:not(.js) .js-only { display: none !important; }
