/* ============================================================
   GROUNDWORK AI — Design System & Styles
   Warm, earthy, grounded. Anti-generic AI aesthetic.
   ============================================================ */

/* --- Type Scale (Fluid) --- */
:root {
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-lg: clamp(1.125rem, 1rem + 0.75vw, 1.5rem);
  --text-xl: clamp(1.5rem, 1.2rem + 1.25vw, 2.25rem);
  --text-2xl: clamp(2rem, 1.2rem + 2.5vw, 3.5rem);
  --text-3xl: clamp(2.5rem, 1rem + 4vw, 5rem);

  /* --- Spacing (4px base) --- */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  --space-32: 8rem;

  /* --- Radius --- */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;

  /* --- Transitions --- */
  --transition-interactive: 180ms cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  /* --- Content widths --- */
  --content-narrow: 640px;
  --content-default: 960px;
  --content-wide: 1200px;

  /* --- Fonts --- */
  --font-display: 'Instrument Serif', Georgia, serif;
  --font-body: 'Satoshi', 'Helvetica Neue', sans-serif;
}

/* ============================================================
   COLOR SYSTEM — Warm earth palette
   ============================================================ */
:root,
[data-theme='light'] {
  /* Surfaces */
  --color-bg: #F5F0E8;
  --color-surface: #FAF7F2;
  --color-surface-2: #FDFCF9;
  --color-surface-offset: #EDE8DF;
  --color-border: #D4CCBF;
  --color-divider: #E0D9CF;

  /* Text */
  --color-text: #2C2418;
  --color-text-muted: #6B6050;
  --color-text-faint: #A39B8D;
  --color-text-inverse: #FAF7F2;

  /* Primary — Terracotta */
  --color-primary: #B85C38;
  --color-primary-hover: #9A4928;
  --color-primary-active: #7D3A1E;
  --color-primary-highlight: #F0DDD4;

  /* Accent — Deep sage */
  --color-accent: #5B7553;
  --color-accent-hover: #4A6043;

  /* Warm amber */
  --color-amber: #C4873B;

  /* Shadows */
  --shadow-sm: 0 1px 2px oklch(0.25 0.02 60 / 0.08);
  --shadow-md: 0 4px 12px oklch(0.25 0.02 60 / 0.1);
  --shadow-lg: 0 12px 32px oklch(0.25 0.02 60 / 0.14);
}

/* DARK MODE */
[data-theme='dark'] {
  --color-bg: #1A1612;
  --color-surface: #211C17;
  --color-surface-2: #28221B;
  --color-surface-offset: #1E1914;
  --color-border: #3D352B;
  --color-divider: #2F2821;

  --color-text: #D9D0C4;
  --color-text-muted: #8A8075;
  --color-text-faint: #5C5549;
  --color-text-inverse: #1A1612;

  --color-primary: #D4805C;
  --color-primary-hover: #E09570;
  --color-primary-active: #C06A45;
  --color-primary-highlight: #352820;

  --color-accent: #7FA074;
  --color-accent-hover: #95B48C;

  --color-amber: #DBA04F;

  --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.25);
  --shadow-md: 0 4px 12px oklch(0 0 0 / 0.35);
  --shadow-lg: 0 12px 32px oklch(0 0 0 / 0.45);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --color-bg: #1A1612;
    --color-surface: #211C17;
    --color-surface-2: #28221B;
    --color-surface-offset: #1E1914;
    --color-border: #3D352B;
    --color-divider: #2F2821;
    --color-text: #D9D0C4;
    --color-text-muted: #8A8075;
    --color-text-faint: #5C5549;
    --color-text-inverse: #1A1612;
    --color-primary: #D4805C;
    --color-primary-hover: #E09570;
    --color-primary-active: #C06A45;
    --color-primary-highlight: #352820;
    --color-accent: #7FA074;
    --color-accent-hover: #95B48C;
    --color-amber: #DBA04F;
    --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.25);
    --shadow-md: 0 4px 12px oklch(0 0 0 / 0.35);
    --shadow-lg: 0 12px 32px oklch(0 0 0 / 0.45);
  }
}

/* ============================================================
   LAYOUT
   ============================================================ */
.container {
  max-width: var(--content-wide);
  margin-inline: auto;
  padding-inline: var(--space-4);
}

.container--narrow {
  max-width: var(--content-default);
}

section {
  padding-block: clamp(var(--space-12), 8vw, var(--space-32));
}

/* ============================================================
   HEADER
   ============================================================ */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: oklch(from var(--color-bg) l c h / 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid oklch(from var(--color-text) l c h / 0.06);
  transition: box-shadow 0.3s var(--ease-out);
}

.header--scrolled {
  box-shadow: var(--shadow-sm);
}

.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}

.header__logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  color: var(--color-text);
}

.header__logo-mark {
  width: 36px;
  height: 36px;
  color: var(--color-primary);
}

.header__logo-text {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 400;
  letter-spacing: -0.01em;
}

.header__nav {
  display: flex;
  align-items: center;
  gap: var(--space-8);
}

.header__links {
  display: flex;
  gap: var(--space-6);
  list-style: none;
}

.header__links a {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  text-decoration: none;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.header__links a:hover {
  color: var(--color-text);
}

.header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
}

.theme-toggle:hover {
  background: oklch(from var(--color-text) l c h / 0.06);
  color: var(--color-text);
}

/* Mobile menu */
.mobile-menu-btn {
  display: none;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  color: var(--color-text);
}

.mobile-menu {
  display: none;
  position: fixed;
  top: 72px;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--color-bg);
  z-index: 49;
  padding: var(--space-8) var(--space-4);
}

.mobile-menu.active {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.mobile-menu a {
  font-size: var(--text-lg);
  color: var(--color-text);
  text-decoration: none;
  font-weight: 500;
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-divider);
}

@media (max-width: 768px) {
  .header__links,
  .header__actions .btn {
    display: none;
  }
  .mobile-menu-btn {
    display: flex;
  }
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition:
    background var(--transition-interactive),
    color var(--transition-interactive),
    transform var(--transition-interactive),
    box-shadow var(--transition-interactive);
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.btn--primary {
  background: var(--color-primary);
  color: var(--color-text-inverse);
}

.btn--primary:hover {
  background: var(--color-primary-hover);
}

.btn--secondary {
  background: transparent;
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.btn--secondary:hover {
  background: var(--color-surface);
  border-color: var(--color-text-faint);
}

.btn--large {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-base);
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
  position: relative;
  min-height: 85vh;
  display: flex;
  align-items: center;
  overflow: hidden;
  padding-block: var(--space-24);
}

.hero__bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.hero__bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.18;
}

.hero__content {
  position: relative;
  z-index: 1;
  max-width: 800px;
}

.hero__eyebrow {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-4);
}

.hero__title {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: 400;
  color: var(--color-text);
  margin-bottom: var(--space-6);
  letter-spacing: -0.02em;
}

.hero__title em {
  font-style: italic;
  color: var(--color-primary);
}

.hero__description {
  font-size: var(--text-lg);
  color: var(--color-text-muted);
  max-width: 600px;
  margin-bottom: var(--space-8);
  line-height: 1.7;
}

.hero__actions {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.hero__stats {
  display: flex;
  gap: var(--space-12);
  margin-top: var(--space-16);
  padding-top: var(--space-8);
  border-top: 1px solid rgba(255,255,255,0.2);
}

.hero__stat-value {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  color: #fff;
  display: block;
}

.hero__stat-label {
  font-size: var(--text-xs);
  color: rgba(255,255,255,0.75);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: var(--space-1);
}

@media (max-width: 768px) {
  .hero {
    min-height: auto;
    padding-block: var(--space-16);
  }
  .hero__stats {
    flex-wrap: wrap;
    gap: var(--space-8);
  }
}

/* ============================================================
   SECTION HEADERS
   ============================================================ */
.section-header {
  margin-bottom: clamp(var(--space-8), 4vw, var(--space-16));
}

.section-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--space-3);
}

.section-title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 400;
  color: var(--color-text);
  letter-spacing: -0.02em;
}

.section-subtitle {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  max-width: 600px;
  margin-top: var(--space-4);
  line-height: 1.7;
}

/* ============================================================
   SERVICES
   ============================================================ */
.services {
  background: var(--color-surface);
}

.services__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr));
  gap: var(--space-6);
}

.service-card {
  background: var(--color-bg);
  border: 1px solid oklch(from var(--color-text) l c h / 0.08);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  transition:
    box-shadow var(--transition-interactive),
    transform var(--transition-interactive);
}

.service-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.service-card__icon {
  width: 48px;
  height: 48px;
  color: var(--color-primary);
  margin-bottom: var(--space-5);
}

.service-card__title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  color: var(--color-text);
  margin-bottom: var(--space-3);
}

.service-card__desc {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  line-height: 1.7;
  margin-bottom: var(--space-5);
}

.service-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.tag {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  background: var(--color-surface-offset);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  white-space: nowrap;
}

/* ============================================================
   PROCESS / HOW IT WORKS
   ============================================================ */
.process {
  position: relative;
}

.process__layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-16);
  align-items: center;
}

.process__image {
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.process__image img {
  width: 100%;
  height: auto;
}

.process__steps {
  display: flex;
  flex-direction: column;
  gap: var(--space-10);
}

.step {
  display: flex;
  gap: var(--space-5);
}

.step__number {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  color: var(--color-text-inverse);
  font-family: var(--font-display);
  font-size: var(--text-base);
  display: flex;
  align-items: center;
  justify-content: center;
}

.step__content h3 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

.step__content p {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  line-height: 1.7;
}

@media (max-width: 768px) {
  .process__layout {
    grid-template-columns: 1fr;
    gap: var(--space-8);
  }
  .process__image {
    order: -1;
  }
}

/* ============================================================
   WHY SECTION (differentiators)
   ============================================================ */
.why {
  background: var(--color-surface);
}

.why__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-6);
}

.why-card {
  background: var(--color-bg);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  border: 1px solid oklch(from var(--color-text) l c h / 0.06);
}

.why-card--featured {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-8);
  align-items: center;
  background: var(--color-text);
  color: var(--color-text-inverse);
  border-color: transparent;
}

.why-card--featured .why-card__title {
  color: var(--color-text-inverse);
}

.why-card--featured .why-card__desc {
  color: oklch(from var(--color-text-inverse) l c h / 0.75);
}

.why-card--featured img {
  border-radius: var(--radius-md);
  width: 100%;
}

.why-card__number {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  color: var(--color-primary);
  display: block;
  margin-bottom: var(--space-3);
}

.why-card--featured .why-card__number {
  color: var(--color-amber);
}

.why-card__title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  color: var(--color-text);
  margin-bottom: var(--space-3);
}

.why-card__desc {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  line-height: 1.7;
}

@media (max-width: 768px) {
  .why__grid {
    grid-template-columns: 1fr;
  }
  .why-card--featured {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   INDUSTRIES
   ============================================================ */
.industries__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
}

.industry-card {
  padding: var(--space-6);
  border: 1px solid oklch(from var(--color-text) l c h / 0.08);
  border-radius: var(--radius-lg);
  text-align: left;
  transition: border-color var(--transition-interactive);
}

.industry-card:hover {
  border-color: var(--color-primary);
}

.industry-card__icon {
  width: 32px;
  height: 32px;
  color: var(--color-accent);
  margin-bottom: var(--space-4);
}

.industry-card__name {
  font-family: var(--font-display);
  font-size: var(--text-base);
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

.industry-card__detail {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  line-height: 1.5;
}

@media (max-width: 768px) {
  .industries__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .industries__grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   TESTIMONIALS
   ============================================================ */
.testimonials {
  background: var(--color-surface);
}

.testimonials__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(360px, 100%), 1fr));
  gap: var(--space-6);
}

.testimonial-card {
  background: var(--color-bg);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  border: 1px solid oklch(from var(--color-text) l c h / 0.06);
}

.testimonial-card__quote {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  color: var(--color-text);
  font-style: italic;
  margin-bottom: var(--space-6);
  line-height: 1.6;
}

.testimonial-card__quote::before {
  content: '\201C';
  color: var(--color-primary);
  font-size: var(--text-2xl);
  line-height: 0;
  vertical-align: -0.35em;
  margin-right: var(--space-1);
}

.testimonial-card__author {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
}

.testimonial-card__role {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}

/* ============================================================
   FAQ
   ============================================================ */
.faq__list {
  max-width: var(--content-default);
  margin-inline: auto;
}

.faq-item {
  border-bottom: 1px solid var(--color-divider);
}

.faq-item__question {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-5) 0;
  font-family: var(--font-display);
  font-size: var(--text-lg);
  color: var(--color-text);
  text-align: left;
  cursor: pointer;
  gap: var(--space-4);
}

.faq-item__question svg {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  color: var(--color-text-faint);
  transition: transform 0.3s var(--ease-out);
}

.faq-item.active .faq-item__question svg {
  transform: rotate(45deg);
}

.faq-item__answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s var(--ease-out), padding 0.3s var(--ease-out);
}

.faq-item.active .faq-item__answer {
  max-height: 400px;
  padding-bottom: var(--space-6);
}

.faq-item__answer p {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  line-height: 1.7;
}

/* ============================================================
   CTA BANNER
   ============================================================ */
.cta-banner {
  background: var(--color-text);
  color: var(--color-text-inverse);
  text-align: center;
}

.cta-banner .section-title {
  color: var(--color-text-inverse);
}

.cta-banner .section-subtitle {
  color: oklch(from var(--color-text-inverse) l c h / 0.7);
  margin-inline: auto;
}

.cta-banner .btn--primary {
  background: var(--color-primary);
  margin-top: var(--space-8);
}

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  padding-block: var(--space-12);
  border-top: 1px solid var(--color-divider);
}

.footer__inner {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--space-8);
}

.footer__brand p {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-top: var(--space-3);
  max-width: 280px;
  line-height: 1.6;
}

.footer__col-title {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-4);
}

.footer__links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.footer__links a {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  text-decoration: none;
}

.footer__links a:hover {
  color: var(--color-text);
}

.footer__bottom {
  margin-top: var(--space-10);
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-divider);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}

@media (max-width: 768px) {
  .footer__inner {
    grid-template-columns: 1fr 1fr;
  }
  .footer__brand {
    grid-column: 1 / -1;
  }
  .footer__bottom {
    flex-direction: column;
    gap: var(--space-3);
    text-align: center;
  }
}

/* ============================================================
   SCROLL ANIMATIONS
   ============================================================ */
.fade-in {
  opacity: 1;
}

@supports (animation-timeline: scroll()) {
  .fade-in {
    opacity: 0;
    animation: reveal-fade linear both;
    animation-timeline: view();
    animation-range: entry 0% entry 80%;
  }
}

@keyframes reveal-fade {
  to { opacity: 1; }
}

.reveal-up {
  opacity: 1;
}

@supports (animation-timeline: scroll()) {
  .reveal-up {
    clip-path: inset(100% 0 0 0);
    animation: reveal-clip linear both;
    animation-timeline: view();
    animation-range: entry 0% entry 80%;
  }
}

@keyframes reveal-clip {
  to { clip-path: inset(0 0 0 0); }
}

/* ============================================================
   CONTACT FORM
   ============================================================ */
.contact-form {
  max-width: var(--content-narrow);
  margin-inline: auto;
  display: grid;
  gap: var(--space-5);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.form-group label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text);
}

.form-group input,
.form-group textarea,
.form-group select {
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  font-size: var(--text-base);
  color: var(--color-text);
  transition: border-color var(--transition-interactive), box-shadow var(--transition-interactive);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px oklch(from var(--color-primary) l c h / 0.15);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-5);
}

@media (max-width: 480px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}
