/* ================================================================
   PINNACLE ADVISORY — STYLESHEET
   Architecture:
     1. Custom Properties (design tokens)
     2. Reset & Base
     3. Skip Link
     4. Utility: Button
     5. Navigation
     6. Hero
     7. Services
     8. About
     9. Contact & Form
    10. Footer
    11. Responsive breakpoints (tablet → desktop)
    12. Reduced motion
   All styles use BEM naming (.block__element--modifier).
   Mobile-first: base styles target small screens, media queries
   progressively enhance for larger viewports.
================================================================ */


/* ================================================================
   1. CUSTOM PROPERTIES — DESIGN TOKENS
   Single source of truth for every colour, spacing value, and
   typographic scale used across the site. Changing a token here
   propagates everywhere automatically.
================================================================ */

:root {
  /* --- Colour palette --- */
  --color-primary:  #1a1a2e;   /* Deep navy — headings, nav, footer */
  --color-accent:   #4f8ef7;   /* Blue — CTAs, highlights, active states */
  --color-bg:       #ffffff;   /* Page background */
  --color-surface:  #f8f9fa;   /* Alternate section background */
  --color-text:     #333333;   /* Body copy */
  --color-subtle:   #6c757d;   /* Secondary text, labels */
  --color-border:   #e2e6ea;   /* Input borders, dividers */
  --color-error:    #c0392b;   /* Validation error text */
  --color-success:  #27ae60;   /* Success state */

  /* --- Spacing scale --- */
  --space-xs:  8px;
  --space-sm:  16px;
  --space-md:  32px;
  --space-lg:  64px;
  --space-xl:  96px;

  /* --- Typography --- */
  --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                Helvetica, Arial, sans-serif, "Apple Color Emoji";
  --font-size-base:  1rem;        /* 16px */
  --font-size-sm:    0.875rem;    /* 14px */
  --font-size-lg:    1.125rem;    /* 18px */
  --font-size-xl:    1.5rem;      /* 24px */
  --font-size-2xl:   2rem;        /* 32px */
  --font-size-3xl:   2.75rem;     /* 44px */
  --font-size-4xl:   3.5rem;      /* 56px */
  --line-height-body:     1.7;
  --line-height-heading:  1.15;

  /* --- Layout --- */
  --max-width:       1100px;
  --nav-height:      68px;

  /* --- Borders & Radius --- */
  --radius-sm:  4px;
  --radius-md:  8px;

  /* --- Shadows --- */
  --shadow-nav:  0 1px 0 rgba(0, 0, 0, 0.08);
  --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.06);

  /* --- Transitions --- */
  --transition-fast:   150ms ease;
  --transition-base:   250ms ease;
}


/* ================================================================
   2. RESET & BASE
   Modern CSS reset: removes inconsistent browser defaults without
   being overly aggressive. box-sizing: border-box on everything
   means padding and border are included in declared widths.
================================================================ */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  /* Smooth scrolling for same-page anchor links.
     JS provides a polyfill for browsers that don't support this.
     scroll-padding-top offsets the sticky nav height so sections
     don't hide behind the nav when scrolled to via anchor. */
  scroll-behavior: smooth;
  scroll-padding-top: var(--nav-height);
}

body {
  font-family: var(--font-stack);
  font-size: var(--font-size-base);
  line-height: var(--line-height-body);
  color: var(--color-text);
  background-color: var(--color-bg);
  /* Prevent horizontal overflow on mobile */
  overflow-x: hidden;
  /* Improve text rendering on macOS/iOS */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Remove list styling when used as layout (role="list" preserves semantics) */
ul[role="list"],
ol[role="list"] {
  list-style: none;
}

/* Images and media are responsive by default */
img,
svg {
  display: block;
  max-width: 100%;
}

/* Inherit font in form controls — browsers often override this */
input,
textarea,
button,
select {
  font: inherit;
}

/* Visible focus outline for keyboard users.
   Uses outline-offset so it sits just outside the element.
   accent color keeps it on-brand while remaining clearly visible. */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}

/* Remove default focus ring (we use :focus-visible above) */
:focus:not(:focus-visible) {
  outline: none;
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
  color: var(--color-primary);
  line-height: var(--line-height-heading);
  font-weight: 700;
}

/* Links */
a {
  color: var(--color-accent);
  text-decoration: underline;
  text-decoration-skip-ink: auto;
}

a:hover {
  text-decoration: none;
}

/* Paragraph spacing */
p + p {
  margin-top: var(--space-sm);
}


/* ================================================================
   3. SKIP LINK
   Visually hidden at rest — appears on focus so keyboard users
   can jump past the nav to main content. Uses clip/clip-path
   technique which works across all modern screen readers.
================================================================ */

.skip-link {
  position: absolute;
  top: 0;
  left: 0;
  padding: var(--space-xs) var(--space-sm);
  background: var(--color-accent);
  color: #ffffff;
  font-weight: 600;
  font-size: var(--font-size-sm);
  text-decoration: none;
  border-radius: 0 0 var(--radius-sm) 0;
  z-index: 9999;
  /* Hide visually until focused */
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

.skip-link:focus {
  clip: auto;
  clip-path: none;
  overflow: visible;
}


/* ================================================================
   4. UTILITY: BUTTON
   .btn is the base; .btn--primary is the filled variant.
   Buttons use display: inline-flex for icon alignment support.
   Explicit padding/sizing ensures a 44px minimum touch target.
================================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  padding: 14px var(--space-md);
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  font-size: var(--font-size-base);
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--transition-fast),
              color var(--transition-fast),
              border-color var(--transition-fast),
              box-shadow var(--transition-fast);
  /* Minimum 44×44px touch target per WCAG 2.5.5 */
  min-height: 44px;
  white-space: nowrap;
  user-select: none;
}

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

.btn--primary:hover {
  background-color: #3a7ae8;  /* Darkened accent — ~10% darker */
  border-color: #3a7ae8;
  color: #ffffff;
  text-decoration: none;
}

.btn--primary:active {
  background-color: #2c6dd4;
  border-color: #2c6dd4;
}


/* ================================================================
   5. NAVIGATION
   Fixed to the top of the viewport (sticky).
   White background with subtle border-bottom at rest.
   JS adds .nav--scrolled when user scrolls past 10px, which
   adds a box-shadow for a lifted appearance.
================================================================ */

.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  transition: box-shadow var(--transition-base);
}

/* JS-toggled class — adds elevation shadow on scroll */
.nav--scrolled {
  box-shadow: var(--shadow-nav);
}

/* Inner container: max-width centered, flex row */
.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-sm);
  height: var(--nav-height);
}

/* Logo */
.nav__logo {
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--color-primary);
  text-decoration: none;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

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

/* Mobile hamburger toggle — shown on small screens only */
.nav__toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: none;
  border: none;
  color: var(--color-primary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast), background-color var(--transition-fast);
  /* Pushes toggle + lang switcher to the right on mobile via flex auto-margin */
  margin-left: auto;
}

.nav__toggle:hover {
  color: var(--color-accent);
  background-color: var(--color-surface);
}

/* Nav links list — hidden on mobile, shown via JS toggle */
.nav__links {
  display: none;
  flex-direction: column;
  position: absolute;
  top: var(--nav-height);
  left: 0;
  right: 0;
  background-color: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-xs) 0;
  /* Animate open/close */
  animation: slideDown var(--transition-base) ease forwards;
}

/* JS adds this class when the menu is open */
.nav__links--open {
  display: flex;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.nav__link {
  display: block;
  padding: 12px var(--space-sm);
  color: var(--color-text);
  font-size: var(--font-size-base);
  font-weight: 500;
  text-decoration: none;
  transition: color var(--transition-fast), background-color var(--transition-fast);
}

.nav__link:hover {
  color: var(--color-accent);
  background-color: var(--color-surface);
}

/* Language switcher container — flex row holding EN | FR buttons.
   flex-shrink: 0 prevents it from being squashed by the nav__links list.
   padding-left gives breathing room from the adjacent toggle (mobile)
   or last nav link (desktop). */
.nav__lang {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  padding-left: var(--space-xs);
}

/* Vertical pipe separator between EN and FR — decorative only,
   aria-hidden in HTML so screen readers skip it. */
.nav__lang-divider {
  color: var(--color-border);
  font-size: var(--font-size-sm);
  line-height: 1;
  user-select: none;
}

/* Language button — inherits nav aesthetic, no background at rest.
   min 36x36px keeps the touch target accessible on mobile.
   font-weight 600 + letter-spacing matches the nav link style. */
.nav__lang-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  min-height: 36px;
  padding: 4px 8px;
  background: none;
  border: none;
  color: var(--color-subtle);
  font-size: var(--font-size-sm);
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast), background-color var(--transition-fast);
}

.nav__lang-btn:hover {
  color: var(--color-accent);
  background-color: var(--color-surface);
}

/* Active language — accent colour signals the current selection.
   JS keeps aria-pressed and this class in sync. */
.nav__lang-btn--active {
  color: var(--color-accent);
}


/* ================================================================
   6. HERO SECTION
   Full viewport height on large screens, tall but not full on mobile.
   Vertically and horizontally centered content.
   White background — clean, no decorative elements.
================================================================ */

.hero {
  display: flex;
  align-items: center;
  min-height: calc(90vh - var(--nav-height));
  padding: var(--space-lg) var(--space-sm);
  background-color: var(--color-bg);
}

.hero__inner {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
}

.hero__heading {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  color: var(--color-primary);
  letter-spacing: -0.03em;
  margin-bottom: var(--space-sm);
}

.hero__subheading {
  font-size: var(--font-size-lg);
  color: var(--color-subtle);
  max-width: 520px;
  line-height: var(--line-height-body);
  margin-bottom: var(--space-md);
}


/* ================================================================
   7. SERVICES SECTION
   Alternate background colour to create visual rhythm between sections.
   Cards use CSS Grid — auto-fit with minmax creates a responsive
   layout without media queries: 1 column on mobile, up to 3 on desktop.
================================================================ */

.services {
  padding: var(--space-lg) var(--space-sm);
  background-color: var(--color-surface);
}

.services__inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

/* Section header */
.services__header {
  margin-bottom: var(--space-md);
}

.services__heading {
  font-size: var(--font-size-2xl);
  margin-bottom: var(--space-xs);
}

.services__subheading {
  color: var(--color-subtle);
  font-size: var(--font-size-lg);
}

/* Responsive card grid:
   minmax(280px, 1fr) — minimum 280px, grows to fill available space.
   On mobile (<280*3 px): stacks to 1 column automatically. */
.services__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-md);
}

/* Individual service card */
.card {
  background-color: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  transition: box-shadow var(--transition-base), border-color var(--transition-base);
}

.card:hover {
  box-shadow: var(--shadow-card);
  border-color: #c8d6e5;
}

/* Icon container — accent colour, sized to contain the 32px SVG */
.card__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  background-color: #eaf1fe;  /* Tint of --color-accent */
  border-radius: var(--radius-md);
  color: var(--color-accent);
  margin-bottom: var(--space-sm);
  flex-shrink: 0;
}

.card__heading {
  font-size: var(--font-size-xl);
  margin-bottom: var(--space-xs);
}

.card__body {
  color: var(--color-subtle);
  font-size: var(--font-size-base);
  line-height: var(--line-height-body);
}


/* ================================================================
   8. ABOUT SECTION
   White background — alternates from the surface-coloured services.
   Single-column on mobile; two columns (bio + stats) on wide screens.
================================================================ */

.about {
  padding: var(--space-lg) var(--space-sm);
  background-color: var(--color-bg);
}

.about__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  /* Stack vertically on mobile; CSS Grid handles 2-col on desktop */
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg);
}

.about__heading {
  font-size: var(--font-size-2xl);
  margin-bottom: var(--space-sm);
}

/* Lead paragraph — slightly larger, darker */
.about__lead {
  font-size: var(--font-size-lg);
  color: var(--color-primary);
  font-weight: 500;
  margin-bottom: var(--space-sm);
  line-height: var(--line-height-body);
}

.about__body {
  color: var(--color-text);
  line-height: var(--line-height-body);
}

/* Stats widget — vertically stacked key/value pairs */
.about__stats {
  display: flex;
  align-items: flex-start;
}

.stats {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  width: 100%;
}

.stats__item {
  padding-left: var(--space-sm);
  border-left: 3px solid var(--color-accent);
}

.stats__value {
  font-size: var(--font-size-3xl);
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1;
  margin-bottom: 4px;
  /* <dd> has display: block by default — no reset needed */
}

.stats__label {
  font-size: var(--font-size-sm);
  color: var(--color-subtle);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}


/* ================================================================
   9. CONTACT SECTION & FORM
   Surface background to visually separate from About.
   Form max-width is narrower than page width — keeps lines short
   and comfortable to read/fill, especially on wide screens.
================================================================ */

.contact {
  padding: var(--space-lg) var(--space-sm);
  background-color: var(--color-surface);
}

.contact__inner {
  max-width: 640px;
  margin: 0 auto;
}

.contact__header {
  margin-bottom: var(--space-md);
}

.contact__heading {
  font-size: var(--font-size-2xl);
  margin-bottom: var(--space-xs);
}

.contact__subheading {
  color: var(--color-subtle);
  font-size: var(--font-size-lg);
}

/* Form-level feedback banner (success / error summary) */
.form-feedback {
  margin-bottom: var(--space-sm);
  padding: 0;
  font-size: var(--font-size-sm);
  font-weight: 500;
  border-radius: var(--radius-sm);
  /* Empty by default — JS populates and shows it */
}

.form-feedback--success {
  padding: var(--space-sm);
  background-color: #eafaf1;
  color: var(--color-success);
  border: 1px solid #a9dfbf;
}

.form-feedback--error {
  padding: var(--space-sm);
  background-color: #fdedec;
  color: var(--color-error);
  border: 1px solid #f1948a;
}

/* Form layout — vertical stack of groups */
.form {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

/* Each field + label + error is a group */
.form__group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Submit button aligned left on mobile */
.form__group--submit {
  margin-top: var(--space-xs);
}

/* Labels */
.form__label {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-primary);
}

/* Required asterisk */
.form__required {
  color: var(--color-error);
  margin-left: 2px;
}

/* Optional tag */
.form__optional {
  color: var(--color-subtle);
  font-weight: 400;
}

/* Shared styles for input and textarea */
.form__input,
.form__textarea {
  width: 100%;
  padding: 12px var(--space-sm);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background-color: var(--color-bg);
  color: var(--color-text);
  /* font-size must be 16px to prevent iOS auto-zoom on focus */
  font-size: 16px;
  line-height: var(--line-height-body);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form__input::placeholder,
.form__textarea::placeholder {
  color: #adb5bd;
}

.form__input:hover,
.form__textarea:hover {
  border-color: #adb5bd;
}

.form__input:focus,
.form__textarea:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(79, 142, 247, 0.15);
}

/* Invalid state — applied by JS after first submission attempt.
   JS sets form__input--invalid on both <input> and <textarea> elements. */
.form__input--invalid {
  border-color: var(--color-error);
}

.form__input--invalid:focus {
  border-color: var(--color-error);
  box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.12);
}

/* Valid state */
.form__input--valid {
  border-color: var(--color-success);
}

/* Textarea — disable horizontal resize to keep layout stable */
.form__textarea {
  resize: vertical;
  min-height: 140px;
}

/* Field-level error message */
.form__error {
  font-size: var(--font-size-sm);
  color: var(--color-error);
  font-weight: 500;
  min-height: 18px;  /* Reserve space so layout doesn't jump */
}


/* ================================================================
  10. FOOTER
  Minimal — dark primary background, white text.
  Centered copy with auto-updated year.
================================================================ */

.footer {
  padding: var(--space-md) var(--space-sm);
  background-color: var(--color-primary);
  color: rgba(255, 255, 255, 0.7);
}

.footer__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.footer__copy {
  font-size: var(--font-size-sm);
  text-align: center;
  line-height: 1.5;
}


/* ================================================================
  11. RESPONSIVE BREAKPOINTS
  Mobile-first: the base styles above are for small screens.
  Media queries progressively enhance for larger viewports.
================================================================ */

/* --- Tablet: 640px and up --- */
@media (min-width: 640px) {

  /* Larger hero heading */
  .hero__heading {
    font-size: var(--font-size-3xl);
  }

  /* Nav toggle hidden — show inline link list */
  .nav__toggle {
    display: none;
  }

  .nav__links {
    display: flex;
    flex-direction: row;
    position: static;
    background: none;
    border: none;
    padding: 0;
    gap: var(--space-xs);
    animation: none;
    /* Groups nav__links + lang switcher flush to the right;
       overrides the mobile margin-left: auto on the toggle (now hidden) */
    margin-left: auto;
  }

  .nav__link {
    padding: 8px 12px;
    border-radius: var(--radius-sm);
  }

  /* About stats in a row on tablet */
  .stats {
    flex-direction: row;
    gap: var(--space-md);
  }
}

/* --- Desktop: 900px and up --- */
@media (min-width: 900px) {

  /* Full-size hero heading */
  .hero__heading {
    font-size: var(--font-size-4xl);
  }

  /* Generous hero padding */
  .hero {
    padding: var(--space-xl) var(--space-md);
  }

  /* Services and about sections */
  .services,
  .contact {
    padding: var(--space-xl) var(--space-md);
  }

  .about {
    padding: var(--space-xl) var(--space-md);
  }

  /* About: two-column layout — bio takes more space than stats */
  .about__inner {
    grid-template-columns: 3fr 2fr;
    align-items: start;
    gap: var(--space-xl);
  }

  /* Stats stacked vertically in the right column */
  .stats {
    flex-direction: column;
    gap: var(--space-md);
  }

  /* Nav inner padding */
  .nav__inner {
    padding: 0 var(--space-md);
  }
}

/* --- Wide desktop: 1100px and up --- */
@media (min-width: 1100px) {
  .services__grid {
    /* Lock to exactly 3 columns on wide screens */
    grid-template-columns: repeat(3, 1fr);
  }
}


/* ================================================================
  12. REDUCED MOTION
  Respects the user's OS-level "reduce motion" preference.
  Removes all transitions and animations for users who need it.
  CSS scroll-behavior: smooth is also removed — instant scroll.
================================================================ */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  html {
    scroll-behavior: auto;
  }
}
