/* =========================================================
   BANIK Advisory — Design system
   ---------------------------------------------------------
   Tokens (CSS custom properties), base typography and shared
   components. Loaded on every page BEFORE style.css.
   Review everything at /styleguide.html.
   Rules: see CLAUDE.md (Brand + UX rules).
   ========================================================= */

/* ---------- 1. Tokens ---------- */
/* Self-hosted fonts (only the weights and alphabets we use). font-display: swap = text shows at once in a fallback font. */
@font-face { font-family: 'Hind Siliguri'; font-style: normal; font-weight: 400; font-display: optional; src: url(/assets/fonts/hind-siliguri-bengali-400.woff2) format('woff2'); unicode-range: U+0951-0952, U+0964-0965, U+0980-09FE, U+1CD0, U+1CD2, U+1CD5-1CD6, U+1CD8, U+1CE1, U+1CEA, U+1CED, U+1CF2, U+1CF5-1CF7, U+200C-200D, U+20B9, U+25CC, U+A8F1, U+11DF0-11DF1; }
@font-face { font-family: 'Hind Siliguri'; font-style: normal; font-weight: 400; font-display: optional; src: url(/assets/fonts/hind-siliguri-latin-400.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Hind Siliguri'; font-style: normal; font-weight: 600; font-display: optional; src: url(/assets/fonts/hind-siliguri-bengali-600.woff2) format('woff2'); unicode-range: U+0951-0952, U+0964-0965, U+0980-09FE, U+1CD0, U+1CD2, U+1CD5-1CD6, U+1CD8, U+1CE1, U+1CEA, U+1CED, U+1CF2, U+1CF5-1CF7, U+200C-200D, U+20B9, U+25CC, U+A8F1, U+11DF0-11DF1; }
@font-face { font-family: 'Hind Siliguri'; font-style: normal; font-weight: 600; font-display: optional; src: url(/assets/fonts/hind-siliguri-latin-600.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Hind Siliguri'; font-style: normal; font-weight: 700; font-display: optional; src: url(/assets/fonts/hind-siliguri-bengali-700.woff2) format('woff2'); unicode-range: U+0951-0952, U+0964-0965, U+0980-09FE, U+1CD0, U+1CD2, U+1CD5-1CD6, U+1CD8, U+1CE1, U+1CEA, U+1CED, U+1CF2, U+1CF5-1CF7, U+200C-200D, U+20B9, U+25CC, U+A8F1, U+11DF0-11DF1; }
@font-face { font-family: 'Hind Siliguri'; font-style: normal; font-weight: 700; font-display: optional; src: url(/assets/fonts/hind-siliguri-latin-700.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400 700; font-display: swap; src: url(/assets/fonts/inter-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Lora'; font-style: normal; font-weight: 600 700; font-display: swap; src: url(/assets/fonts/lora-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  /* Colour — brand palette (CLAUDE.md) */
  --color-brand: #ed1c24;          /* main accents, borders, icons — used sparingly */
  --color-brand-dark: #c8102e;     /* small red text, links, primary button (AA on white: 5.9:1) */
  --color-brand-darker: #a50d25;   /* hover / pressed */
  --color-ink: #1f2937;            /* headings + body text */
  --color-text-2: #4b5563;         /* secondary text (AA on white: 7.6:1) */
  --color-bg: #ffffff;
  --color-bg-alt: #f9fafb;
  --color-tint: #fdf2f2;           /* soft red tint */
  --color-whatsapp: #25d366;       /* WhatsApp buttons only */
  --color-whatsapp-ink: #0b3d24;   /* text/icon on WhatsApp green (AA: 7.9:1) */

  /* Colour — supporting (derived) */
  --color-surface: #ffffff;
  --color-surface-2: #f3f4f6;
  --color-border: #e5e7eb;
  --color-border-strong: #d1d5db;
  --color-on-brand: #ffffff;
  --color-on-brand-dark: #ffffff; /* text on --color-brand-dark backgrounds */
  --color-focus: #c8102e;
  --color-error: #b91c1c;          /* AA on white: 6.5:1 */
  --color-error-bg: #fef2f2;
  --color-success: #15803d;        /* AA on white: 5.0:1 */
  --color-success-bg: #f0fdf4;
  --color-info-bg: #f3f4f6;

  /* Typography */
  --font-heading: "Lora", Georgia, "Times New Roman", serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-bangla: "Hind Siliguri", "Noto Sans Bengali", system-ui, sans-serif;
  --fs-body: 1.0625rem;           /* 17px; 18px from 768px. rem so the visitor's text-size setting scales it */
  --fs-small: 0.9375rem;           /* 15px — meta text only */
  --fs-h1: clamp(2rem, 1.55rem + 2vw, 3rem);       /* 32 → 48px */
  --fs-h2: clamp(1.625rem, 1.4rem + 1vw, 2.25rem); /* 26 → 36px */
  --fs-h3: clamp(1.1875rem, 1.12rem + .3vw, 1.375rem); /* 19 → 22px */
  --lh-body: 1.7;
  --lh-heading: 1.25;

  /* Spacing scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --space-9: 96px;

  /* Layout */
  --content-max: 1200px;
  --gutter: var(--space-4);        /* 16px on phones, 24px from 768px */
  --section-y: var(--space-8);     /* 64px on phones, 96px from 1024px */

  /* Shape & depth */
  --radius-sm: 10px;
  --radius-md: 12px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(17, 24, 39, .06);
  --shadow-md: 0 6px 20px rgba(17, 24, 39, .08);
  --shadow-lg: 0 16px 40px rgba(17, 24, 39, .12);

  /* Controls */
  --control-h: 48px;               /* buttons, inputs, tap targets */
  --focus-ring: 0 0 0 3px var(--color-bg), 0 0 0 6px var(--color-focus);

  /* Motion (gentle; disabled under prefers-reduced-motion) */
  --ease: cubic-bezier(.22, .61, .36, 1);
  --dur-fast: .15s;
  --dur: .3s;
  --dur-slow: .6s;

  color-scheme: light;
}

@media (min-width: 768px) {
  :root { --fs-body: 1.125rem; --gutter: var(--space-5); }
}
@media (min-width: 1024px) {
  :root { --section-y: var(--space-9); }
}

/* Dark theme (optional toggle) — same roles, dark values */
:root[data-theme="dark"] {
  --color-brand: #ff3a41;
  --color-brand-dark: #ff7a7f;
  --color-brand-darker: #ff9a9e;
  --color-ink: #f3f4f6;
  --color-text-2: #c4c8cf;
  --color-bg: #0e0f12;
  --color-bg-alt: #14161a;
  --color-tint: rgba(255, 58, 65, .12);
  --color-surface: #191b20;
  --color-surface-2: #20232a;
  --color-border: #2a2d35;
  --color-border-strong: #3a3e48;
  --color-focus: #ff7a7f;
  --color-on-brand-dark: #14161a;
  --color-error: #fca5a5;
  --color-error-bg: rgba(248, 113, 113, .12);
  --color-success: #86efac;
  --color-success-bg: rgba(74, 222, 128, .12);
  --color-info-bg: #20232a;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 6px 20px rgba(0, 0, 0, .35);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--color-ink);
  background: var(--color-bg);
}
:lang(bn) { font-family: var(--font-bangla); }

h1, h2, h3 {
  font-family: var(--font-heading);
  line-height: var(--lh-heading);
  font-weight: 700;
  color: var(--color-ink);
  margin: 0 0 var(--space-3);
  letter-spacing: -.01em;
}
h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); font-weight: 600; }
:lang(bn) h1, :lang(bn) h2, :lang(bn) h3,
h1 :lang(bn), h2 :lang(bn), h3 :lang(bn) { font-family: var(--font-bangla); letter-spacing: 0; }

p { margin: 0 0 var(--space-4); }
small, .text-small { font-size: var(--fs-small); }
.text-muted { color: var(--color-text-2); }

:focus { outline: none; }
:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--radius-sm); }

.sr-only { 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; }

.container { width: 100%; max-width: calc(var(--content-max) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); }

/* ---------- 3. Components ---------- */

/* Buttons — min 48px tall, visible focus ring */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: var(--control-h); padding: var(--space-3) var(--space-5);
  border: 2px solid transparent; border-radius: var(--radius-sm);
  font-family: var(--font-body); font-size: 1rem; font-weight: 600; line-height: 1.2;
  text-align: center; text-decoration: none; cursor: pointer;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease),
              color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur-fast) var(--ease);
}
.btn:lang(bn), .btn :lang(bn) { font-family: var(--font-bangla); }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }

.btn-primary { background: var(--color-brand-dark); color: var(--color-on-brand); box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--color-brand-darker); box-shadow: var(--shadow-md); }
:root[data-theme="dark"] .btn-primary { background: #c8102e; }
:root[data-theme="dark"] .btn-primary:hover { background: #e01f3a; }

.btn-secondary, .btn-outline { background: var(--color-surface); color: var(--color-ink); border-color: var(--color-border-strong); }
.btn-secondary:hover, .btn-outline:hover { border-color: var(--color-brand-dark); color: var(--color-brand-dark); }

.btn-whatsapp { background: var(--color-whatsapp); color: var(--color-whatsapp-ink); }
.btn-whatsapp:hover { background: #1ebe5b; }

.btn-ghost { background: none; color: var(--color-brand-dark); padding-left: 0; padding-right: 0; }
.btn-ghost:hover { gap: var(--space-3); }
.btn-white { background: #fff; color: var(--color-brand-darker); }
.btn-white:hover { background: var(--color-tint); }
.btn-sm { padding: var(--space-2) var(--space-4); font-size: .9375rem; } /* still 48px tall */
.btn-block { width: 100%; }

/* Text link */
.link {
  color: var(--color-brand-dark); font-weight: 600;
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px;
  transition: color var(--dur) var(--ease);
}
.link:hover { color: var(--color-brand-darker); text-decoration-thickness: 2px; }

/* Card */
.card {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-md); padding: var(--space-5); box-shadow: var(--shadow-sm);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
a.card, .card.is-interactive { display: block; color: inherit; text-decoration: none; }
a.card:hover, .card.is-interactive:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--color-border-strong); }
.card > :last-child { margin-bottom: 0; }

/* Badge / chip */
.badge, .tag {
  display: inline-flex; align-items: center; gap: var(--space-1);
  padding: 2px var(--space-3); border-radius: var(--radius-pill);
  background: var(--color-tint); color: var(--color-brand-dark);
  font-size: .8125rem; font-weight: 600; line-height: 1.6;
}
.badge-neutral { background: var(--color-surface-2); color: var(--color-text-2); }
.badge-success { background: var(--color-success-bg); color: var(--color-success); }

/* Callout box */
.callout {
  display: flex; gap: var(--space-3); align-items: flex-start;
  padding: var(--space-4) var(--space-5); border-radius: var(--radius-md);
  background: var(--color-info-bg); border-left: 4px solid var(--color-text-2); color: var(--color-ink);
}
.callout svg { width: 22px; height: 22px; flex: none; margin-top: 3px; }
.callout > div > :last-child { margin-bottom: 0; }
.callout-title { display: block; font-weight: 700; margin-bottom: var(--space-1); }
.callout-tip { background: var(--color-tint); border-left-color: var(--color-brand); }
.callout-success { background: var(--color-success-bg); border-left-color: var(--color-success); }
.callout-warning { background: #fffbeb; border-left-color: #b45309; }
:root[data-theme="dark"] .callout-warning { background: rgba(245, 158, 11, .12); }

/* Accordion — native <details>, works without JavaScript */
.accordion { border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface); overflow: hidden; }
.accordion details + details { border-top: 1px solid var(--color-border); }
.accordion summary {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
  min-height: var(--control-h); padding: var(--space-4) var(--space-5);
  font-weight: 600; cursor: pointer; list-style: none;
}
.accordion summary::-webkit-details-marker { display: none; }
.accordion summary::after {
  content: ""; flex: none; width: 10px; height: 10px; margin-right: 4px;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(45deg); transition: transform var(--dur) var(--ease);
}
.accordion details[open] summary::after { transform: rotate(-135deg); }
.accordion summary:hover { color: var(--color-brand-dark); }
.accordion .accordion-body { padding: 0 var(--space-5) var(--space-5); color: var(--color-text-2); }
.accordion details[open] .accordion-body { animation: ds-fade-in var(--dur) var(--ease); }

/* Form field: label + help text + error state */
.field { display: grid; gap: var(--space-2); margin-bottom: var(--space-5); }
.field-label { font-weight: 600; color: var(--color-ink); }
.field-label .req { color: var(--color-brand-dark); }
.field-help { font-size: var(--fs-small); color: var(--color-text-2); margin: 0; }
.field-input {
  width: 100%; min-height: var(--control-h); padding: var(--space-3) var(--space-4);
  border: 1.5px solid var(--color-border-strong); border-radius: var(--radius-sm);
  background: var(--color-surface); color: var(--color-ink);
  font: inherit; font-size: 1rem;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
textarea.field-input { min-height: 120px; resize: vertical; }
.field-input:focus-visible, .field-input:focus { outline: none; border-color: var(--color-focus); box-shadow: 0 0 0 3px var(--color-tint); }
.field-error { display: none; align-items: center; gap: var(--space-2); font-size: var(--fs-small); font-weight: 600; color: var(--color-error); margin: 0; }
.field.is-invalid .field-input { border-color: var(--color-error); background: var(--color-error-bg); }
.field.is-invalid .field-error { display: flex; }

/* ---------- 4. Motion (gentle) ---------- */
@keyframes ds-fade-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.js .reveal { opacity: 0; transform: translateY(16px); transition: opacity var(--dur-slow) var(--ease), transform var(--dur-slow) var(--ease); }
.js .reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .js .reveal { opacity: 1; transform: none; }
}
