/* =========================================================
   BASE — design tokens, themes, reset, typography, layout
   Har section file inhi variables par chalti hai.
   Section kahin aur le jana ho to yeh file saath le jayein.
   ========================================================= */

:root {
  /* Neutrals — Cognitive logo ka black */
  --c-dark-900: #09090b;
  --c-dark-800: #111114;
  --c-dark-700: #1a1a1f;
  --c-dark-600: #26262d;

  --c-ink: #0c0c0f;
  --c-text: #3f3f46;
  --c-muted: #71717a;
  --c-line: #e4e4e7;
  --c-bg: #ffffff;
  --c-bg-soft: #f6f6f7;
  --c-surface: #ffffff;   /* cards, inputs, chips */

  /* Company colours (logos se sample kiye) */
  --brand-cognitive: #e0312a;
  --brand-csolar: #ea580c;
  --brand-cnc: #e60012;
  --brand-fico: #0072c6;
  --brand-cpower: #ee2224;

  /* Active theme — default: Cognitive group (red + black) */
  --accent: var(--brand-cognitive);
  --accent-hover: #f0483f;
  --accent-2: #ff7a45;          /* gradient partner */
  --accent-soft: color-mix(in srgb, var(--accent) 10%, #fff);
  --accent-glow: color-mix(in srgb, var(--accent) 45%, transparent);

  /* Type */
  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;

  /* Shape & depth */
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .05), 0 1px 3px rgba(0, 0, 0, .07);
  --shadow: 0 12px 32px -14px rgba(0, 0, 0, .22);
  --shadow-lg: 0 34px 70px -26px rgba(0, 0, 0, .38);

  /* Layout */
  --container: 1240px;
  --header-h: 78px;
  --ease: cubic-bezier(.2, .7, .2, 1);

  /* Subtle film-grain texture for dark sections */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E");
}

/* ---------- Dark mode (html[data-theme="dark"], toggle: js/ux.js) ---------- */
html[data-theme="dark"] {
  color-scheme: dark;
  --c-ink: #f4f4f5;
  --c-text: #c9c9d1;
  --c-muted: #8e8e99;
  --c-line: #2a2a31;
  --c-bg: #0d0d10;
  --c-bg-soft: #131317;
  --c-surface: #19191e;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 12px 32px -14px rgba(0, 0, 0, .7);
  --shadow-lg: 0 34px 70px -26px rgba(0, 0, 0, .85);
}
html[data-theme="dark"] body { --accent-soft: color-mix(in srgb, var(--accent) 16%, #19191e); }
html[data-theme="dark"] .section--dark { background: #050507; }
/* Logos have dark lettering: give them a white plate on dark cards */
html[data-theme="dark"] :is(.sister-card__logo, .dir-card__logo, .explorer__tab-logo, .feature__by span:first-child, .company-card__logo) { background: #fff; border-radius: 12px; padding: .35rem .7rem; width: fit-content; }
html[data-theme="dark"] .structure__node:not(.structure__node--root) img { background: #fff; border-radius: 10px; padding: .4rem .7rem; }
html[data-theme="dark"] .subnav { background: rgba(13, 13, 16, .92); }
html[data-theme="dark"] .btn--white { color: #0c0c0f; }
html[data-theme="dark"] .clients__grid { background: var(--c-line); }
html[data-theme="dark"] .clients__grid figure { background: #ececef; }
html[data-theme="dark"] .contact__note { color: #4ade80; }
/* Smooth colour change when switching theme */
html.theme-anim *, html.theme-anim *::before, html.theme-anim *::after { transition: background-color .4s, color .4s, border-color .4s !important; }

/* ---------- Page themes (body class) ---------- */
.theme-csolar { --accent: var(--brand-csolar); --accent-hover: #f97316; --accent-2: #fbbf24; }
.theme-cnc    { --accent: var(--brand-cnc);    --accent-hover: #ff2233; --accent-2: #ff6a5c; }
.theme-fico   { --accent: var(--brand-fico);   --accent-hover: #0a84e0; --accent-2: #22b8f0; }
.theme-cpower { --accent: var(--brand-cpower); --accent-hover: #ff3b3d; --accent-2: #ff8a3d; }

/* accent-soft / glow must be recalculated where the page theme sets --accent */
body { --accent-soft: color-mix(in srgb, var(--accent) 10%, #fff); --accent-glow: color-mix(in srgb, var(--accent) 45%, transparent); }

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: var(--header-h); }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--c-text);
  background: var(--c-bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
::selection { background: var(--accent); color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

/* Inline SVG icons: <svg class="i" viewBox="0 0 24 24">…</svg> */
svg.i { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Typography ---------- */
h1, h2, h3, h4 { font-family: var(--font-display); color: var(--c-ink); line-height: 1.1; margin: 0 0 .5em; letter-spacing: -.025em; }
p { margin: 0 0 1em; }
.grad {
  background: linear-gradient(95deg, var(--accent) 10%, var(--accent-2) 90%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ---------- Layout helpers ---------- */
.container { width: min(100% - 2.5rem, var(--container)); margin-inline: auto; }
.section { padding: clamp(3.5rem, 6.5vw, 6rem) 0; }
/* No double gap between two sections with the same background */
.section:not(.section--soft):not(.section--dark) + .section:not(.section--soft):not(.section--dark),
.section--soft + .section--soft,
.section--dark + .section--dark { padding-top: 0; }
.section--soft { background: var(--c-bg-soft); }
.section--dark { background: var(--c-dark-900); color: rgba(255, 255, 255, .7); position: relative; isolation: isolate; }
.section--dark::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--grain); opacity: .06; pointer-events: none; }
.section--dark h2, .section--dark h3 { color: #fff; }
.section--dark .section-lead { color: rgba(255, 255, 255, .6); }

.section-head { max-width: 720px; margin: 0 auto 2.75rem; text-align: center; }
.section-head--left { margin-inline: 0; text-align: left; }
.eyebrow {
  display: inline-flex; align-items: center; gap: .6rem;
  font-size: .78rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 1.1rem;
}
.eyebrow::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: currentColor; transform: rotate(45deg); }
.section-title { font-size: clamp(2.1rem, 4.4vw, 3.3rem); }
.section-lead { font-size: 1.12rem; color: var(--c-muted); }

/* ---------- Accessibility ---------- */
.skip-link { position: absolute; left: -999px; top: 0; background: #fff; color: var(--c-ink); padding: .6rem 1rem; border-radius: var(--radius-sm); z-index: 999; }
.skip-link:focus { left: 1rem; top: 1rem; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Reveal on scroll (js/reveal.js) ---------- */
.js .reveal { opacity: 0; transform: translateY(28px); transition: opacity .8s var(--ease), transform .8s var(--ease); }
.js .reveal.is-visible { opacity: 1; transform: none; }

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

/* Split section head: heading left, action right */
.head-split { display: flex; align-items: flex-end; justify-content: space-between; gap: 1.5rem 2rem; flex-wrap: wrap; margin-bottom: 2.5rem; }
.head-split .section-head { margin-bottom: 0; }
