/* ═══════════════════════════════════════════════════════════
   MasjidBD v13 — Base Styles & Reset
   css/base.css
   ═══════════════════════════════════════════════════════════ */

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

html {
  scroll-behavior: smooth;
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
  font-size: 16px;
  /* Theme transition applied when toggling */
  transition: background-color var(--dur-slow) var(--ease),
              color var(--dur-slow) var(--ease);
}

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

/* Glass theme uses gradient background on body */
[data-theme="glass"] body {
  background: var(--color-bg);
  background-attachment: fixed;
}

/* ── Typography base ────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  font-weight: var(--weight-normal);
  line-height: var(--leading-tight);
  color: var(--color-text-brand);
  letter-spacing: -0.02em;
}

h1 { font-size: var(--text-hero); }
h2 { font-size: var(--text-4xl); }
h3 { font-size: var(--text-3xl); }
h4 { font-size: var(--text-2xl); }
h5 { font-size: var(--text-xl); }
h6 { font-size: var(--text-md); }

p {
  color: var(--color-text-3);
  line-height: var(--leading-relaxed);
  font-weight: var(--weight-light);
}

a {
  color: var(--color-text-link);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease);
}
a:hover { color: var(--color-brand); }

strong, b { font-weight: var(--weight-semi); }
em, i { font-style: italic; }

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

ul, ol { list-style: none; }

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

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

input, textarea, select {
  outline: none;
  border: none;
  background: none;
}

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

/* ── Layout utilities ───────────────────────────────────── */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.section {
  padding: var(--sp-20) 0;
}

/* ── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar               { width: 6px; height: 6px; }
::-webkit-scrollbar-track         { background: transparent; }
::-webkit-scrollbar-thumb         { background: var(--color-border); border-radius: var(--r-full); }
::-webkit-scrollbar-thumb:hover   { background: var(--color-text-4); }

/* ── Selection ──────────────────────────────────────────── */
::selection {
  background: var(--c-forest-200);
  color: var(--c-forest-900);
}

/* ── Focus ring ─────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--color-border-focus);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* ── Arabic / Bengali text ──────────────────────────────── */
.arabic {
  font-family: var(--font-arabic);
  direction: rtl;
  line-height: 1.8;
}
.bengali { font-family: var(--font-bengali); }

/* ── Section header pattern ─────────────────────────────── */
.sec-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-semi);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: var(--sp-3);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.sec-label::after {
  content: '';
  flex: 1;
  max-width: 40px;
  height: 1px;
  background: var(--color-border-2);
}

.sec-h {
  font-family: var(--font-serif);
  font-size: clamp(1.6rem, 4vw, 2.5rem);
  color: var(--color-brand);
  letter-spacing: -0.02em;
  line-height: var(--leading-tight);
  margin-bottom: var(--sp-3);
}

.sec-p {
  font-size: var(--text-md);
  color: var(--color-text-3);
  max-width: 520px;
  line-height: var(--leading-relaxed);
  font-weight: var(--weight-light);
}

/* ── Utility classes ────────────────────────────────────── */
.hidden       { display: none !important; }
.sr-only      { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.truncate     { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.serif        { font-family: var(--font-serif); }
.font-medium  { font-weight: var(--weight-medium); }
.font-semi    { font-weight: var(--weight-semi); }
.text-muted   { color: var(--color-text-3); }
.text-brand   { color: var(--color-brand); }
.text-accent  { color: var(--color-accent); }
.text-danger  { color: var(--color-danger); }
.text-success { color: var(--color-success); }

/* ── Animations ─────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

@keyframes blink {
  0%, 80%, 100% { opacity: 0.3; }
  40%           { opacity: 1; }
}

@keyframes blinkColon {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0; }
}

@keyframes spinSlow {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* Page enter animation for tab pages */
.tab-page {
  display: none;
}
.tab-page.active {
  display: block;
  animation: fadeIn var(--dur-slow) var(--ease);
}

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg,
    var(--color-surface-3) 25%,
    var(--color-surface-2) 50%,
    var(--color-surface-3) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--r);
}

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