/* ==========================================================================
   SAR Group LLC — main.css
   Single stylesheet for the company website (Django 6).
   Design tokens are defined on :root; every rule below consumes them.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design tokens
   -------------------------------------------------------------------------- */
:root {
  --accent: #9A3412;       /* terracotta primary — 7.31:1 with white text */
  --accent-dark: #7C2D12;
  --green: #4D7C0F;        /* muted sage — secondary organic accent */
  --ink: #3D2B1F;          /* warm brown-black */
  --slate: #6A5140;        /* 7.33:1 on #fff, 6.76:1 on --bg-alt */
  --bg: #ffffff;
  --bg-alt: #FAF5EF;
  --bg-wash: #FBF7F1;      /* soft warm page wash — body top */
  --bg-alt-deep: #F3EAE0;  /* deepened alt-section tint */
  --border: #E8DACB;
  --accent-soft: #F8E8DD;  /* chip / badge / icon-tint backgrounds */
  --radius: 12px;
  --shadow: 0 1px 3px rgb(61 43 31 / .08), 0 8px 24px rgb(61 43 31 / .06);
  --shadow-card: 0 1px 3px rgb(61 43 31 / .08), 0 12px 32px rgb(61 43 31 / .10);
  /* Dot-grid pattern: --accent dots on a 24px grid (fill-opacity carried per use) */
  --dot-grid: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Ccircle cx='2' cy='2' r='1.5' fill='%239A3412' fill-opacity='0.07'/%3E%3C/svg%3E");
  --dot-grid-faint: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Ccircle cx='2' cy='2' r='1.5' fill='%239A3412' fill-opacity='0.04'/%3E%3C/svg%3E");
}

/* --------------------------------------------------------------------------
   2. Modern reset + base
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: "Noto Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: var(--ink);
  /* Soft warm wash instead of flat white — cards stay white and pop against it.
     background-color is the fallback where the gradient doesn't paint. */
  background-color: var(--bg-wash);
  background-image: linear-gradient(180deg, var(--bg-wash) 0%, var(--bg) 40%);
  background-attachment: fixed;
  line-height: 1.6;
}

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

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

h1,
h2,
h3,
h4,
h5,
h6 {
  line-height: 1.2;
  overflow-wrap: break-word;
}

/* Display face for headings and title-scale elements */
h1,
h2,
h3,
h4,
.hero-title,
.section-title,
.page-title,
.cta-title,
.logo {
  font-family: "Figtree", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
}

p {
  overflow-wrap: break-word;
}

/* Focus visibility for every interactive element */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* --------------------------------------------------------------------------
   3. Layout container
   -------------------------------------------------------------------------- */
.container {
  max-width: 1100px;
  margin-inline: auto;
  padding-inline: 24px;
}

/* --------------------------------------------------------------------------
   4. Site header + navigation
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgb(251 247 241 / .85); /* --bg-wash at 85% to match body wash */
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--ink);
  text-decoration: none;
}

.logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  background-color: var(--accent);
  color: #ffffff;
  border-radius: 10px;
  font-weight: 800;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
}

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 8px;
  color: var(--slate);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.nav-link:hover {
  color: var(--ink);
  background-color: var(--bg-alt);
}

/* Nav dropdown ---------------------------------------------------------- */
.nav-item {
  position: relative;
  display: inline-flex;
}

/* .dropdown-toggle is a <button> that also carries .nav-link — reset the
   button chrome so it renders identically to the anchor nav links. */
.dropdown-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 0;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

/* 6px chevron via the border trick; flips 180° when the item is open */
.caret {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  margin-top: -3px;
  transition: transform 0.15s ease;
}

.nav-item.has-dropdown.open .caret {
  transform: rotate(225deg);
  margin-top: 3px;
}

.nav-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 10;
  min-width: 200px;
  background-color: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 8px;
  /* Hidden by default via opacity + pointer-events so the 0.15s fade can run;
     the prefers-reduced-motion block below zeroes the transition, making
     open/close instant for those users. */
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.nav-item.has-dropdown.open .nav-dropdown {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.dropdown-link {
  display: block;
  padding: 10px 14px;
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.95rem;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.dropdown-link:hover,
.dropdown-link:focus-visible {
  background-color: var(--bg-alt);
  color: var(--accent);
}

/* Mobile nav toggle — hidden on desktop */
.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--ink);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background-color: var(--ink);
  border-radius: 1px;
  position: relative;
}

.nav-toggle span::before,
.nav-toggle span::after {
  content: "";
  position: absolute;
  left: 0;
  width: 18px;
  height: 2px;
  background-color: var(--ink);
  border-radius: 1px;
}

.nav-toggle span::before {
  top: -6px;
}

.nav-toggle span::after {
  top: 6px;
}

/* --------------------------------------------------------------------------
   5. Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 999px; /* pill — the capsule signature motif */
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.2;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease,
    border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.btn-primary {
  background-color: var(--accent);
  color: #ffffff;
}

.btn-primary:hover {
  background-color: var(--accent-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.btn-ghost {
  background-color: transparent;
  border-color: var(--border);
  color: var(--ink);
}

.btn-ghost:hover {
  background-color: var(--bg-alt);
}

/* --------------------------------------------------------------------------
   6. Badge
   -------------------------------------------------------------------------- */
.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px; /* pill — the capsule signature motif */
  background-color: var(--accent-soft);
  border: 1px solid var(--border);
  color: var(--accent); /* 6.12:1 on --accent-soft */
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
}

/* --------------------------------------------------------------------------
   7. Hero + page hero
   -------------------------------------------------------------------------- */
.hero {
  position: relative;
  overflow: hidden;
  padding: 96px 0 72px;
  background:
    var(--dot-grid) repeat,
    radial-gradient(ellipse 80% 60% at 50% -10%, #F8E8DD 0%, rgb(248 232 221 / 0) 70%),
    linear-gradient(180deg, #F8E8DD 0%, var(--bg) 60%);
}

.page-hero {
  position: relative;
  overflow: hidden;
  padding: 64px 0 40px;
  background:
    var(--dot-grid) repeat,
    radial-gradient(ellipse 80% 70% at 50% -10%, #F8E8DD 0%, rgb(248 232 221 / 0) 70%),
    linear-gradient(180deg, #F8E8DD 0%, var(--bg) 70%);
}

/* Decorative blobs — soft radial circles, clipped by the hero's overflow:hidden.
   Static (no animation), purely decorative, never intercept input. */
.hero::before,
.page-hero::before {
  content: "";
  position: absolute;
  top: -180px;
  right: -160px;
  width: 560px;
  height: 560px;
  background: radial-gradient(circle, rgb(154 52 18 / .12) 0%, rgb(154 52 18 / 0) 70%);
  pointer-events: none;
}

.hero::after,
.page-hero::after {
  content: "";
  position: absolute;
  bottom: -200px;
  left: -180px;
  width: 520px;
  height: 520px;
  /* Ambient terracotta blob on standard page heroes */
  background: radial-gradient(circle, rgb(154 52 18 / .08) 0%, rgb(154 52 18 / 0) 70%);
  pointer-events: none;
}

/* Health-sage ambient variant — reserved for health-context heroes (home's
   product hero only), per GL-003's sparing-green rule */
.hero::after {
  background: radial-gradient(circle, rgb(77 124 15 / .10) 0%, rgb(77 124 15 / 0) 70%);
}

/* Real content sits above the decorative layers */
.hero > *,
.page-hero > * {
  position: relative;
  z-index: 1;
}

.hero-title {
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.hero-sub {
  font-size: 1.15rem;
  color: var(--slate);
  max-width: 640px;
  margin-top: 16px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
}

/* Decorative page-art utilities — templates drop an inline SVG illustration
   with .hero-art inside a (position-relative) .hero-inner wrapper. */
.hero-inner {
  position: relative;
}

/* Text column sits above the art and never runs under it */
.hero-copy {
  position: relative;
  z-index: 1;
}

@media (min-width: 901px) {
  .hero-copy {
    max-width: min(60ch, 62%);
  }
}

.hero-art {
  position: absolute;
  right: 4%;
  top: 50%;
  transform: translateY(-50%);
  width: min(360px, 32vw);
  pointer-events: none;
  opacity: 0.9;
}

@media (max-width: 900px) {
  .hero-art {
    display: none;
  }
}

.page-title {
  font-size: clamp(2rem, 4vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.page-sub {
  font-size: 1.1rem;
  color: var(--slate);
  max-width: 640px;
  margin-top: 12px;
}

/* --------------------------------------------------------------------------
   8. Sections
   -------------------------------------------------------------------------- */
.section {
  padding: 72px 0;
}

.section-alt {
  background-color: var(--bg-alt-deep);
  background-image: var(--dot-grid-faint);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.section-title {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
}

.section-sub {
  color: var(--slate);
  max-width: 640px;
  margin-bottom: 24px;
}

/* --------------------------------------------------------------------------
   9. Cards
   -------------------------------------------------------------------------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-top: 32px;
}

.card {
  background-color: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow-card); /* stronger than --shadow so cards float on the tinted bg */
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 2px 6px rgb(61 43 31 / .1), 0 16px 40px rgb(61 43 31 / .12);
}

/* Rounded soft-terracotta chip holding a 24x24 stroke SVG (stroke="currentColor") */
.card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background-color: var(--accent-soft);
  color: var(--accent);
  line-height: 1;
  margin-bottom: 12px;
}

.card-icon svg {
  width: 22px;
  height: 22px;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.card-text {
  color: var(--slate);
  font-size: 0.95rem;
}

/* --------------------------------------------------------------------------
   10. CTA band
   -------------------------------------------------------------------------- */
.cta {
  padding: 72px 0;
  background-color: #332014; /* deep warm brown band, darker than --ink */
  /* Subtle corner glow (--accent at 15%) so the dark band isn't flat */
  background-image: radial-gradient(
    ellipse 640px 420px at 88% -10%,
    rgb(154 52 18 / .15) 0%,
    rgb(154 52 18 / 0) 70%
  );
  color: #ffffff;
  text-align: center;
}

.cta-title {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 20px;
}

.cta .btn-primary:focus-visible {
  outline-color: #ffffff;
}

/* --------------------------------------------------------------------------
   11. Prose (long-form content)
   -------------------------------------------------------------------------- */
.prose {
  max-width: 720px;
}

.prose p {
  margin-bottom: 1em;
}

.prose h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 2em 0 0.5em;
}

.prose ul,
.prose ol {
  padding-left: 1.4em;
  margin-bottom: 1em;
}

.prose li {
  margin-bottom: 0.35em;
}

.prose a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.prose a:hover {
  color: var(--accent-dark);
}

/* --------------------------------------------------------------------------
   12. Feature + contact lists
   -------------------------------------------------------------------------- */
.feature-list,
.contact-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.feature-list li {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.feature-list li:last-child {
  border-bottom: none;
}

.contact-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.contact-item strong {
  color: var(--ink);
  font-weight: 600;
}

.contact-item a {
  color: var(--accent);
  text-decoration: none;
}

.contact-item a:hover {
  color: var(--accent-dark);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* --------------------------------------------------------------------------
   13. Footer
   -------------------------------------------------------------------------- */
.footer {
  background-color: var(--bg-alt);
  border-top: 1px solid var(--border);
  padding: 56px 0 24px;
  color: var(--slate);
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}

.footer-title {
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 12px;
}

.footer-link {
  display: block;
  padding: 4px 0;
  color: var(--slate);
  text-decoration: none;
  transition: color 0.15s ease;
}

.footer-link:hover {
  color: var(--accent);
}

.footer-bottom {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--slate);
}

/* Skip link — visually hidden until keyboard focus (WCAG 2.4.1) */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 12px 20px;
  background: var(--accent);
  color: #fff;
  border-radius: 0 0 10px 0;
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus-visible {
  left: 0;
}

/* --------------------------------------------------------------------------
   14. Responsive — single breakpoint at 760px
   -------------------------------------------------------------------------- */
@media (max-width: 760px) {
  /* Nav collapse */
  .nav-toggle {
    display: inline-flex;
  }

  .nav {
    display: none;
  }

  .site-header.nav-open .nav {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background-color: var(--bg);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: 8px 24px 16px;
  }

  .site-header.nav-open .nav-link {
    padding: 12px 14px;
  }

  /* Dropdown flattens into the mobile flyout — always visible so no
     double-tap is needed; toggle stays as a plain group label. */
  .nav-item {
    display: block;
  }

  .dropdown-toggle {
    width: 100%;
  }

  .caret {
    display: none;
  }

  .nav-dropdown {
    display: block;
    position: static;
    min-width: 0;
    border: none;
    box-shadow: none;
    padding: 0 0 4px 16px;
    opacity: 1;
    pointer-events: auto;
    transform: none;
    transition: none;
  }

  /* Hero paddings shrink */
  .hero {
    padding: 64px 0 48px;
  }

  .page-hero {
    padding: 48px 0 32px;
  }

  .section {
    padding: 56px 0;
  }

  /* Grid collapse */
  .footer-grid {
    grid-template-columns: 1fr;
  }
}

/* --------------------------------------------------------------------------
   15. Reduced motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }

  .btn-primary:hover,
  .card:hover {
    transform: none;
  }
}
