/* ==========================================================================
   Mahalaxmi Autotech — shared design system
   Single source of truth for tokens, typography, header, footer, buttons,
   cards, forms and utilities. Linked by every public page BEFORE the
   page-specific stylesheet. Page stylesheets add layout only; they must not
   redefine heading or body typography.
   Documented in docs/PROJECT-BRIEF.md ("Design system record").
   ========================================================================== */

/* ---- 1. Tokens ---------------------------------------------------------- */
:root {
  /* brand — sampled from the client company profile (navy + amber) */
  --navy-900: #0a1627;
  --navy-800: #0e1d32;          /* primary */
  --navy-700: #16294a;
  --navy-600: #243b63;
  --amber-500: #e09020;         /* accent: fills, rules, graphics, text on navy */
  --amber-600: #c97d12;
  --amber-700: #8f5400;         /* accent text on light backgrounds (6.1:1) */

  /* neutrals */
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-alt: #f4f6f9;
  --surface-tint: #fbf3e6;
  --border: #dde3ec;
  --border-strong: #c3ccd9;
  --text: #1c2736;
  --text-muted: #566174;        /* 6.0:1 on white */
  --text-on-dark: #ffffff;
  --text-on-dark-muted: #c9d3e0;

  /* semantic */
  --success: #1c7a3f;
  --error: #b42318;
  --error-bg: #fdecea;
  --focus: #1b64d6;
  --whatsapp: #1fa855;

  /* typography — system stack: no web-font dependency */
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-heading: var(--font-body);
  --heading-color: var(--navy-800);

  /* spacing scale */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4.5rem;
  --space-section: clamp(3.5rem, 2.5rem + 4vw, 6rem);

  /* layout */
  --container-max: 1200px;
  --gutter: clamp(1rem, 4vw, 2rem);
  --header-h: 72px;

  /* shape + depth */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(14, 29, 50, 0.06), 0 1px 3px rgba(14, 29, 50, 0.08);
  --shadow-md: 0 8px 24px rgba(14, 29, 50, 0.10);

  /* motion */
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --t-fast: 150ms;
  --t-med: 200ms;
}

/* ---- 2. Base ------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 12px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1rem/1.65 var(--font-body);
  overflow-x: hidden;
}
img, svg { max-width: 100%; height: auto; }
a { color: var(--navy-700); text-underline-offset: 2px; }
a:hover { color: var(--amber-700); }
ul { margin: 0; padding: 0; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
.skip-link {
  position: absolute; left: var(--space-4); top: -100px; z-index: 1000;
  background: var(--navy-800); color: #fff; padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm); text-decoration: none; font-weight: 600;
}
.skip-link:focus { top: var(--space-3); color: #fff; }
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---- 3. Typography (single definition for every page) ------------------- */
h1, h2, h3, h4, h5, h6 { font-family: var(--font-heading); color: var(--heading-color); }
h1 { font-size: clamp(2rem, 1.4rem + 2.6vw, 3.25rem); font-weight: 800; line-height: 1.12; letter-spacing: -0.02em; margin: 0 0 0.6em; }
h2 { font-size: clamp(1.625rem, 1.3rem + 1.4vw, 2.25rem); font-weight: 800; line-height: 1.2; letter-spacing: -0.01em; margin: 2em 0 0.6em; }
h3 { font-size: 1.1875rem; font-weight: 700; line-height: 1.3; letter-spacing: -0.005em; margin: 1.5em 0 0.5em; }
h4 { font-size: 1.0625rem; font-weight: 700; line-height: 1.4; margin: 1.5em 0 0.5em; }
h5 { font-size: 1rem; font-weight: 700; line-height: 1.4; margin: 1.25em 0 0.4em; }
h6 { font-size: 0.875rem; font-weight: 700; line-height: 1.4; letter-spacing: 0.04em; text-transform: uppercase; margin: 1em 0 0.4em; }
/* One treatment for the title of every card, whatever its heading level */
.card-title { font-size: 1.1875rem; font-weight: 700; line-height: 1.3; letter-spacing: -0.005em; margin: 0 0 0.5em; color: var(--heading-color); }
p { margin: 0 0 1em; }
small, .caption { font-size: 0.875rem; line-height: 1.5; }
.lead { font-size: 1.125rem; line-height: 1.7; color: var(--text-muted); max-width: 62ch; }
.eyebrow {
  display: inline-block; margin: 0 0 var(--space-3);
  font-size: 0.8125rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--amber-700);
}
.eyebrow::before { content: ""; display: inline-block; width: 22px; height: 2px; background: var(--amber-500); vertical-align: middle; margin-right: 10px; }
.on-dark .eyebrow, .eyebrow.on-dark { color: var(--amber-500); }

/* ---- 4. Layout primitives ---------------------------------------------- */
.container { width: 100%; max-width: var(--container-max); margin-inline: auto; padding-inline: var(--gutter); }
.section { padding-block: var(--space-section); }
.section--alt { background: var(--surface-alt); }
.section--dark { background: var(--navy-800); color: var(--text-on-dark-muted); }
.section--dark h2, .section--dark h3, .section--dark .card-title { color: var(--text-on-dark); }
.section-head { margin-bottom: var(--space-6); }
.section-head > :first-child { margin-top: 0; }
.section-head h2 { margin-top: 0; }
.section-head .lead { margin-bottom: 0; }
.section-head--center { text-align: center; }
.section-head--center .lead { margin-inline: auto; }
.lead--on-dark { color: var(--text-on-dark-muted); }
.list-reset { list-style: none; padding: 0; margin: 0; }

/* Card grids — flex-wrap, centred. Column counts are set per breakpoint so the
   last row never holds a single orphan card (4 → 4/2/1, 5 → 5|3/1, 6 → 3/2/1). */
.grid { --c: 3; --g: var(--space-5); display: flex; flex-wrap: wrap; justify-content: center; gap: var(--g); }
.grid > * { flex: 0 0 calc((100% - (var(--c) - 1) * var(--g)) / var(--c)); min-width: 0; }
.grid--2 { --c: 2; }
.grid--3 { --c: 3; }
.grid--4 { --c: 4; }
.grid--5 { --c: 5; }
.grid--6 { --c: 3; }
@media (max-width: 1099px) { .grid--5 { --c: 3; } }
@media (max-width: 999px)  { .grid--4 { --c: 2; } }
@media (max-width: 899px)  { .grid--6 { --c: 2; } }
@media (max-width: 699px)  { .grid--2, .grid--3, .grid--5 { --c: 1; } }
@media (max-width: 559px)  { .grid--4, .grid--6 { --c: 1; } }

/* ---- 5. Header + navigation -------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 200;
  background: rgba(255, 255, 255, 0.97);
  border-bottom: 1px solid var(--border);
  transition: box-shadow var(--t-med) var(--ease);
}
.site-header.is-scrolled { box-shadow: var(--shadow-md); }
.site-header__inner { display: flex; align-items: center; justify-content: space-between; gap: var(--space-5); min-height: var(--header-h); }
.brand { display: inline-flex; align-items: center; gap: var(--space-3); text-decoration: none; color: var(--navy-800); }
.brand:hover { color: var(--navy-800); }
.brand img { width: auto; height: 44px; display: block; }
.brand__words { display: flex; flex-direction: column; line-height: 1.15; }
.brand__name { font-weight: 800; font-size: 1.0625rem; letter-spacing: 0.01em; text-transform: uppercase; }
.brand__sub { font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-muted); }

.nav-toggle {
  display: none; align-items: center; justify-content: center;
  width: 44px; height: 44px; padding: 0; cursor: pointer;
  background: transparent; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); color: var(--navy-800);
}
.nav-toggle__bars, .nav-toggle__bars::before, .nav-toggle__bars::after {
  display: block; width: 20px; height: 2px; background: currentColor; border-radius: 2px; content: "";
  transition: transform var(--t-med) var(--ease), opacity var(--t-fast);
}
.nav-toggle__bars { position: relative; }
.nav-toggle__bars::before { position: absolute; top: -6px; }
.nav-toggle__bars::after { position: absolute; top: 6px; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars::before { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars::after { transform: translateY(-6px) rotate(-45deg); }

.site-nav ul { list-style: none; display: flex; align-items: center; gap: var(--space-1); }
.site-nav a {
  display: block; padding: 10px 14px; border-radius: var(--radius-sm);
  color: var(--text); text-decoration: none; font-size: 0.9375rem; font-weight: 600; white-space: nowrap;
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.site-nav a:hover { background: var(--surface-alt); color: var(--navy-800); }
.site-nav a[aria-current="page"] { color: var(--navy-800); box-shadow: inset 0 -3px 0 var(--amber-500); border-radius: 0; }
.site-nav .btn { margin-left: var(--space-2); color: var(--navy-900); }

@media (max-width: 960px) {
  /* Without JavaScript the navigation simply wraps below the brand and stays usable. */
  .site-header__inner { flex-wrap: wrap; padding-block: var(--space-2); }
  .site-nav ul { flex-wrap: wrap; }
  .js .site-header__inner { flex-wrap: nowrap; padding-block: 0; }
  .js .nav-toggle { display: inline-flex; }
  .js .site-nav {
    position: absolute; left: 0; right: 0; top: 100%;
    background: #fff; border-bottom: 1px solid var(--border); box-shadow: var(--shadow-md);
    padding: var(--space-3) var(--gutter) var(--space-5);
    display: none;
  }
  .js .site-nav.is-open { display: block; }
  .js .site-nav ul { flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 0; }
  .js .site-nav a { padding: 14px 4px; border-bottom: 1px solid var(--border); border-radius: 0; }
  .js .site-nav a[aria-current="page"] { box-shadow: inset 3px 0 0 var(--amber-500); padding-left: 12px; }
  .js .site-nav .btn { margin: var(--space-4) 0 0; text-align: center; border-bottom: 0; }
}

/* ---- 6. Buttons --------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 48px; padding: 0.7rem 1.5rem;
  font: 700 0.9375rem/1.2 var(--font-body); text-decoration: none; text-align: center;
  border: 2px solid transparent; border-radius: var(--radius-sm); cursor: pointer;
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.btn--primary { background: var(--amber-500); color: var(--navy-900); }
.btn--primary:hover { background: var(--amber-600); color: var(--navy-900); }
.btn--secondary { background: var(--navy-800); color: #fff; }
.btn--secondary:hover { background: var(--navy-600); color: #fff; }
.btn--outline { background: transparent; color: var(--navy-800); border-color: var(--navy-800); }
.btn--outline:hover { background: var(--navy-800); color: #fff; }
.btn--outline-light { background: transparent; color: #fff; border-color: rgba(255, 255, 255, 0.6); }
.btn--outline-light:hover { background: #fff; color: var(--navy-800); border-color: #fff; }
.btn[disabled] { opacity: 0.65; cursor: default; }
.btn-row { display: flex; flex-wrap: wrap; gap: var(--space-3); }

/* ---- 7. Cards ----------------------------------------------------------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: var(--space-5); box-shadow: var(--shadow-sm);
  transition: transform var(--t-med) var(--ease), box-shadow var(--t-med) var(--ease), border-color var(--t-med) var(--ease);
}
a.card, .card--interactive { text-decoration: none; color: inherit; }
a.card:hover, .card--interactive:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.card h3, .card h4 { margin-top: 0; }
.card p:last-child { margin-bottom: 0; }
.tag {
  display: inline-block; padding: 3px 10px; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--amber-700); background: var(--surface-tint);
  border: 1px solid #f0d9ae; border-radius: 999px;
}

/* ---- 8. Forms ----------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 0.875rem; font-weight: 700; color: var(--navy-800); }
.field input, .field textarea, .field select {
  width: 100%; min-height: 48px; padding: 0.7rem 0.9rem;
  font: 400 1rem/1.4 var(--font-body); color: var(--text);
  background: #fff; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.field textarea { min-height: 120px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px rgba(27, 100, 214, 0.25); }
.field input.invalid, .field textarea.invalid { border-color: var(--error); background: #fffafa; }
input::placeholder, textarea::placeholder { color: #7b8596; }

/* ---- 9. Footer ---------------------------------------------------------- */
.site-footer { background: var(--navy-900); color: var(--text-on-dark-muted); padding-top: var(--space-7); font-size: 0.9375rem; }
.site-footer a { color: var(--text-on-dark-muted); text-decoration: none; }
.site-footer a:hover { color: var(--amber-500); text-decoration: underline; }
.site-footer h2 { font-size: 0.8125rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: #fff; margin: 0 0 var(--space-4); }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1.2fr; gap: var(--space-6); padding-bottom: var(--space-6); border-bottom: 1px solid rgba(255, 255, 255, 0.12); }
.footer-grid ul { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.site-footer .brand { color: #fff; }
.site-footer .brand:hover { color: #fff; }
.site-footer .brand__sub { color: var(--text-on-dark-muted); }
.site-footer .brand img { background: #fff; box-sizing: content-box; padding: 5px 8px; border-radius: 8px; }
.footer-about { margin-top: var(--space-4); max-width: 38ch; }
.footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-3); padding-block: var(--space-5) var(--space-3); font-size: 0.8125rem; }
.footer-bottom p { margin: 0; }
.footer-areas { font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--amber-500); }
.footer-note { padding-bottom: var(--space-4); font-size: 0.75rem; opacity: 0.8; max-width: 90ch; }
@media (max-width: 960px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .footer-grid { grid-template-columns: 1fr; } }

/* Polymath360Studio branding signature */
.p360-signature { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 0 18px; font-size: 0.72rem; letter-spacing: 0.03em; opacity: 0.6; transition: opacity 0.3s ease; }
.p360-signature:hover { opacity: 0.95; }
.p360-dots { display: inline-flex; align-items: center; gap: 4px; }
.p360-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.p360-dot.saffron { background: #ff9933; }
.p360-dot.white { background: #e8e8e8; border: 1px solid rgba(255, 255, 255, 0.15); }
.p360-dot.green { background: #138808; }
.p360-link { color: inherit; text-decoration: none; border-bottom: 1px solid transparent; transition: border-color 0.25s ease; }
.p360-link:hover { border-bottom-color: currentColor; text-decoration: none; }

/* ---- 10. Floating WhatsApp --------------------------------------------- */
.wa-float {
  position: fixed; right: 20px; bottom: 20px; z-index: 150;
  width: 56px; height: 56px; border-radius: 50%; background: var(--whatsapp);
  display: flex; align-items: center; justify-content: center; text-decoration: none;
  box-shadow: 0 6px 18px rgba(14, 29, 50, 0.28);
  transition: transform var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease);
}
.wa-float:hover { transform: translateY(-3px); background: #178a46; }
.wa-float svg { width: 30px; height: 30px; fill: #fff; }

/* ---- 11. Reduced motion ------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
  a.card:hover, .card--interactive:hover, .wa-float:hover { transform: none; }
}
