/* Base styles — reset, typography, accessibility, layout shell (Phase 1). Components expand in Phase 2. */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

/* The `hidden` attribute must actually hide things.
   The browser's own rule is only `[hidden] { display: none }`, which loses to any class that
   sets display — `.btn { display: inline-flex }`, `.calculator__form { display: grid }`. The
   result is a "hidden" element that is plainly visible, and every script in the codebase that
   sets `el.hidden = true` silently stops working. One !important settles it everywhere. */
[hidden] { display: none !important; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-body);
  line-height: var(--leading-body);
  color: var(--color-text);
  background: var(--color-background);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
:lang(bn), .text-bn { line-height: var(--leading-bengali); }
img, svg, video { display: block; max-width: 100%; height: auto; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: var(--leading-tight); margin: 0 0 var(--space-md); font-weight: 700; letter-spacing: -0.01em; }
p { margin: 0 0 var(--space-md); max-width: var(--measure); }
a { color: var(--color-accent); text-underline-offset: 0.18em; }
a:hover { color: var(--color-accent-hover); }
code { font-size: 0.95em; }

/* Accessibility (P01 §22, P07 §86) */
:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 2px; border-radius: var(--radius-sm); }
.skip-link {
  position: absolute; left: var(--space-md); top: -100px; z-index: var(--z-toast);
  background: var(--color-primary); color: #fff; padding: var(--space-sm) var(--space-md); border-radius: var(--radius-sm);
}
.skip-link:focus { top: var(--space-md); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

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

/* Buttons (minimal set; full system in Phase 2 — P07 §21) */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-sm);
  min-height: 48px; padding: 0.7rem 1.25rem; border-radius: var(--radius-md); border: 2px solid transparent;
  font: 600 var(--text-button)/1.2 var(--font-sans); text-decoration: none; cursor: pointer;
  transition: background-color var(--dur-base) var(--ease-out), color var(--dur-base) var(--ease-out), border-color var(--dur-base) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--color-accent); color: #fff; }
.btn--primary:hover { background: var(--color-accent-hover); color: #fff; }
/* An outline button takes the colour of the text around it.
   This is why: the same button sits on white sections, on the navy hero, in the footer and
   inside an article's dark call-to-action band. Hard-coding navy meant every new dark block
   had to remember to join a list of exceptions — and twice it did not, which is how a navy
   button ended up on navy at 1.15:1 and then 1.39:1. Inheriting removes the list entirely:
   any surface that sets a text colour gets a legible outline button for free. */
.btn--outline { border-color: currentColor; color: inherit; background: transparent; opacity: 0.92; }
.btn--outline:hover { opacity: 1; background: color-mix(in srgb, currentColor 8%, transparent); }

/* Shell header/footer (replaced by full header & footer in Phase 7) */
.shell-header { background: var(--color-surface); border-bottom: 1px solid var(--color-border); }
.shell-header__inner { display: flex; align-items: center; min-height: 80px; }
.shell-header__brand img { width: 92px; height: 64px; object-fit: contain; }
.shell-footer { border-top: 1px solid var(--color-border); color: var(--color-text-muted); font-size: var(--text-body-sm); padding-block: var(--space-xl); }
.shell-footer p { margin: 0; }
main:focus { outline: none; }

/* Error pages (P02 §42–44) */
.error-page { padding-block: var(--section-y); min-height: 60vh; display: flex; align-items: center; }
.error-page__inner { max-width: 52rem; }
.error-page__code {
  font: 800 clamp(5rem, 3rem + 9vw, 9rem)/0.9 var(--font-display); margin: 0 0 var(--space-md);
  color: transparent; -webkit-text-stroke: 2px var(--color-border-strong); letter-spacing: -0.04em;
}
.error-page__title { font-size: var(--text-h1); max-width: 22ch; }
.error-page__text { color: var(--color-text-muted); font-size: var(--text-body-lg); }
.error-page__ref { color: var(--color-text-muted); font-size: var(--text-body-sm); }
.error-page__actions { display: flex; flex-wrap: wrap; gap: var(--space-sm); margin-top: var(--space-lg); }
.error-page--dark { background: var(--color-surface-dark); color: var(--color-text-inverse); }
.error-page--dark .error-page__text, .error-page--dark .error-page__ref { color: var(--color-text-inverse-muted); }
.error-page__debug { margin-top: var(--space-xl); padding: var(--space-md); background: #0d1030; color: #ffd7d2; border-radius: var(--radius-md); overflow-x: auto; font-size: var(--text-caption); }

/* Development preview (temporary — Phase 7 replaces) */
.dev-preview { background: var(--color-surface-dark); color: var(--color-text-inverse); padding-block: var(--section-y); }
.dev-preview__badge { display: inline-block; border: 1px solid var(--color-accent-bright); color: var(--color-accent-bright); padding: 0.2rem 0.7rem; border-radius: var(--radius-pill); font-size: var(--text-caption); }
.dev-preview__title { font-size: var(--text-display); max-width: 18ch; margin-top: var(--space-lg); }
.dev-preview__text { color: var(--color-text-inverse-muted); font-size: var(--text-body-lg); }
.dev-preview__checks { margin: var(--space-lg) 0 0; padding-left: 1.1rem; color: var(--color-text-inverse-muted); }
.dev-preview a { color: var(--color-accent-bright); }

/* Reduced motion (P01 §19, P07 §40) */
@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; }
}
