/* ============================================
   CUSTOM PROPERTIES
   ============================================ */
:root {
  /* ============ PRIMITIVES ============ */

  /* Paper — cool near-white surfaces */
  --paper-cool:        #fcfcfd;
  --paper-cool-alt:    #edecf0;

  /* Ink — deep aubergine text hierarchy */
  --ink-aubergine:     #2e2838;
  --ink-plum:          #54506a;

  /* Lavender — muted mid-tones */
  --lavender-dusk:     #625d75;
  --lavender-mist:     #948fa3;
  --lavender-edge:     #8c879b;

  /* Wash — botanical accent palette */
  --wash-emerald:      #4a7a3a;
  --wash-emerald-deep: #407030;
  --wash-forest:       #2d5222;
  --wash-sage:         #7a9058;
  --wash-sienna:       #b06a3a;
  --wash-ochre:        #c49430;
  --wash-rose:         #c68070;
  --wash-slate:        #6a85a8;
  --wash-berry:        #8a3a3a;  /* deep warm berry — error text */
  --wash-berry-pale:   #fceeed;  /* pale pink — error surface */
  --wash-berry-edge:   #b86a66;  /* muted rose — error border */

  /* Neutral */
  --white:             #ffffff;

  /* ============ SEMANTIC ============ */

  --color-surface:          var(--paper-cool);
  --color-surface-alt:      var(--paper-cool-alt);
  --color-text:             var(--ink-aubergine);
  --color-text-muted:       var(--ink-plum);
  --color-text-subtle:      var(--lavender-dusk);
  --color-text-placeholder: var(--lavender-mist);
  --color-text-inverse:     var(--white);
  --color-border:           var(--lavender-edge);
  --color-primary:          var(--wash-emerald-deep);
  --color-primary-hover:    var(--wash-forest);
  --color-primary-bg:       var(--wash-emerald-deep); /* button bg; same as --color-primary in light mode, deeper in dark */
  --color-primary-bg-hover: var(--wash-forest);       /* button bg hover */
  --color-secondary:        var(--wash-slate);
  --color-accent:           var(--wash-rose);
  --color-error-text:       var(--wash-berry);
  --color-error-surface:    var(--wash-berry-pale);
  --color-error-border:     var(--wash-berry-edge);

  /* Derived — compose from semantic so palette swaps propagate */
  --color-border-subtle:       color-mix(in srgb, var(--color-text) 10%, transparent);
  --color-surface-translucent: color-mix(in srgb, var(--color-surface) 85%, transparent);
  --color-overlay:             color-mix(in srgb, var(--color-text) 50%, transparent);
  --color-shadow-soft:         color-mix(in srgb, var(--color-text) 8%, transparent);
  --color-shadow-medium:       color-mix(in srgb, var(--color-text) 15%, transparent);
  --color-focus-ring:          color-mix(in srgb, var(--color-primary) 35%, transparent);
  --color-selection:           color-mix(in srgb, var(--color-primary) 25%, transparent);

  /* Typography */
  --font-heading: 'Newsreader', Georgia, 'Times New Roman', serif;
  --font-body:    'Source Sans 3', Optima, Candara, sans-serif;

  /* Spacing scale */
  --space-xs:   0.5rem;
  --space-sm:   1rem;
  --space-md:   1.5rem;
  --space-lg:   2.5rem;
  --space-xl:   4rem;
  --space-2xl:  6rem;
  --space-3xl:  8rem;         /* reserved — not currently used */

  /* Layout */
  --max-width:  68rem;
  --max-width-narrow: 44rem;  /* reserved — not currently used */

  /* Transitions */
  --ease-out: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --duration: 0.3s;
}

/* ============================================
   RESET & BASE
   ============================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

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

body {
  font-family: var(--font-body);
  font-size: 1.125rem;
  font-weight: 400;
  line-height: 1.7;
  color: var(--color-text);
  background-color: var(--color-surface);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   SKIP LINK
   ============================================ */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-sm);
  z-index: 1000;
  padding: var(--space-xs) var(--space-sm);
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-inverse);
  background-color: var(--color-text);
  border-radius: 0 0 0.25rem 0.25rem;
  text-decoration: none;
  transition: top var(--duration) var(--ease-out);
}

.skip-link:focus {
  top: 0;
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}

/* ============================================
   VISUALLY HIDDEN (screen reader only)
   ============================================ */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ============================================
   FOCUS STYLES
   ============================================ */
:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 3px;
}

:focus:not(:focus-visible) {
  outline: none;
}

/* Sections receiving programmatic focus (from nav clicks) */
section[tabindex="-1"]:focus {
  outline: none;
}

/* ============================================
   TEXT SELECTION
   ============================================ */
::selection {
  background-color: var(--color-selection);
  color: var(--color-text);
}

/* ============================================
   TYPOGRAPHY
   ============================================ */
h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 500;
  line-height: 1.2;
  color: var(--color-text);
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.5rem, 5vw + 1rem, 4.5rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  font-variation-settings: 'opsz' 144;
}

h2 {
  font-size: clamp(1.75rem, 3vw + 0.5rem, 2.75rem);
  letter-spacing: -0.015em;
  font-variation-settings: 'opsz' 72;
}

h3 {
  font-size: clamp(1.25rem, 2vw + 0.25rem, 1.5rem);
  font-weight: 500;
  font-variation-settings: 'opsz' 36;
}

p {
  max-width: 65ch;
  text-wrap: pretty;
}

p + p {
  margin-top: var(--space-sm);
}

/* ============================================
   LINKS
   ============================================ */
a {
  color: var(--color-primary);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
  transition: color var(--duration) var(--ease-out),
              text-decoration-color var(--duration) var(--ease-out);
}

a:hover {
  color: var(--color-primary-hover);
}

/* ============================================
   LAYOUT UTILITIES
   ============================================ */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: var(--space-md);
}

@media (min-width: 48em) {
  .container { padding-inline: var(--space-lg); }
}

.section {
  padding-block: var(--space-lg);
}

@media (min-width: 48em) {
  .section { padding-block: var(--space-xl); }
}

/* ============================================
   SECTION LABEL (Eyebrow)
   ============================================ */
.section-label {
  display: block;
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-subtle);
  margin-bottom: var(--space-sm);
}

/* ============================================
   HEADER
   ============================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  padding-block: var(--space-md);
  border-bottom: 1px solid var(--color-border-subtle);
  background-color: var(--color-surface);
  transition: padding var(--duration) var(--ease-out),
              background-color var(--duration) var(--ease-out),
              box-shadow var(--duration) var(--ease-out);
}

.site-header.is-scrolled {
  padding-block: var(--space-sm);
  background-color: var(--color-surface-translucent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 1px 3px var(--color-shadow-soft);
}

.site-header.nav-open,
.site-header.is-scrolled.nav-open {
  background-color: var(--color-surface);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  transition: none;
}

.site-header .container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
}

.site-name {
  font-family: var(--font-heading);
  font-size: 1.125rem;
  font-weight: 500;
  font-variation-settings: 'opsz' 36;
  color: var(--color-text);
  text-decoration: none;
}

.site-name:hover {
  color: var(--color-primary);
}

/* Mobile menu button */
.nav-toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0.625rem;
  background: none;
  border: none;
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  width: 100%;
  height: 2px;
  background-color: var(--color-text);
  border-radius: 1px;
  transition: transform var(--duration) var(--ease-out),
              opacity var(--duration) var(--ease-out);
}

/* 7px = span height (2px) + gap (5px) — aligns rotation to center */
.nav-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

@media (min-width: 48em) {
  .nav-toggle {
    display: none;
  }
}

/* Navigation overlay */
.nav-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--color-overlay);
  z-index: 90;
  pointer-events: none;
}

.nav-overlay.is-visible {
  display: block;
  pointer-events: auto;
}

@media (min-width: 48em) {
  .nav-overlay {
    display: none;
  }
}

/* Navigation */
.site-nav {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background-color: var(--color-surface);
  border-top: 3px solid var(--color-primary);
  box-shadow: 0 8px 24px var(--color-shadow-medium);
  padding: var(--space-md);
  z-index: 95;
  opacity: 0;
  transform: translateY(-0.5rem);
  pointer-events: none;
  transition: opacity var(--duration) var(--ease-out),
              transform var(--duration) var(--ease-out);
}

.site-nav.is-open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

@media (min-width: 48em) {
  .site-nav {
    position: static;
    background: none;
    border-top: none;
    box-shadow: none;
    padding: 0;
    width: auto;
    opacity: 1;
    transform: none;
    pointer-events: auto;
    transition: none;
  }
}

.site-nav ul {
  display: flex;
  flex-direction: column;
  gap: 0;
  list-style: none;
}

@media (min-width: 48em) {
  .site-nav ul {
    flex-direction: row;
    gap: var(--space-xs) var(--space-md);
  }
}

.site-nav a {
  display: block;
  padding: 0.875rem 0;
  min-height: 2.75rem;
  font-size: 1rem;
  font-weight: 400;
  color: var(--color-text-muted);
  text-decoration: none;
  border-bottom: 1px solid var(--color-border);
  transition: color var(--duration) var(--ease-out);
}

.site-nav li:last-child a {
  border-bottom: none;
}

@media (min-width: 48em) {
  .site-nav a {
    display: inline;
    padding: 0;
    font-size: 0.9375rem;
    border-bottom: none;
  }
}

.site-nav a:hover,
.site-nav a:focus-visible {
  color: var(--color-primary);
}

.site-nav a.is-active {
  color: var(--color-primary);
  text-shadow: 0.4px 0 0 currentColor;
}

/* ============================================
   HERO
   ============================================ */
.hero {
  padding-top: var(--space-xl);
  padding-bottom: var(--space-xl);
}

@media (min-width: 48em) {
  .hero {
    padding-top: var(--space-2xl);
    padding-bottom: var(--space-2xl);
  }
}

.hero__intro {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 400;
  color: var(--color-text-subtle);
  margin-bottom: var(--space-xs);
  letter-spacing: 0.02em;
}

.hero h1 {
  font-weight: 350;
  margin-bottom: var(--space-md);
}

.hero h1 em {
  font-style: italic;
  color: var(--color-primary);
  font-variation-settings: 'opsz' 144;
}

.hero__summary {
  font-size: clamp(1.125rem, 1.5vw + 0.5rem, 1.375rem);
  line-height: 1.65;
  color: var(--color-text-muted);
  max-width: 52ch;
  margin-bottom: var(--space-lg);
}

.hero__cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 500;
  color: var(--color-text-inverse);
  background-color: var(--color-primary-bg);
  padding: 0.875rem 1.75rem;
  border-radius: 0.25rem;
  text-decoration: none;
  transition: background-color var(--duration) var(--ease-out),
              transform var(--duration) var(--ease-out);
}

.hero__cta:hover {
  background-color: var(--color-primary-bg-hover);
  color: var(--color-text-inverse);
  transform: translateY(-1px);
}

.hero__cta:active {
  transform: translateY(0);
}

.hero__cta svg {
  width: 1.125em;
  height: 1.125em;
  flex-shrink: 0;
  transition: transform var(--duration) var(--ease-out);
}

.hero__cta:hover svg {
  transform: translateX(2px);
}

/* ============================================
   WAVE DIVIDERS
   ============================================ */
.wave-divider {
  display: block;
  width: 100%;
  height: 60px;
  position: relative;
  z-index: 1;
  margin-top: -1px;
  margin-bottom: -1px;
}

.wave-divider--surface     { background-color: var(--color-surface); }
.wave-divider--surface-alt { background-color: var(--color-surface-alt); }

@media (min-width: 48em) {
  .wave-divider {
    height: 80px;
  }
}

@media (min-width: 64em) {
  .wave-divider {
    height: 100px;
  }
}

/* ============================================
   PROBLEMS SECTION
   ============================================ */
.problems__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg);
  margin-top: var(--space-lg);
}

@media (min-width: 48em) {
  .problems__grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-lg) var(--space-xl);
  }
}

@media (min-width: 48em) {
  .problem-card {
    padding-top: var(--space-md);
  }
}

.problem-card h3 {
  margin-bottom: var(--space-xs);
  color: var(--color-text);
}

.problem-card p {
  color: var(--color-text-muted);
  font-size: 1rem;
  line-height: 1.7;
}

/* ============================================
   SECTION BACKGROUNDS
   ============================================ */
.bg-dark {
  background-color: var(--color-surface-alt);
}

/* ============================================
   HOW I WORK
   ============================================ */

.how__intro {
  font-size: clamp(1.125rem, 1.5vw + 0.5rem, 1.3125rem);
  color: var(--color-text-muted);
  line-height: 1.65;
  max-width: 55ch;
  margin-top: var(--space-sm);
  margin-bottom: var(--space-lg);
}

@media (min-width: 48em) {
  .how__intro {
    margin-bottom: var(--space-xl);
  }
}

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

@media (min-width: 48em) {
  .how__grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-lg) var(--space-xl);
  }
}

@media (min-width: 48em) {
  .how-item {
    padding-top: var(--space-md);
  }
}

.how-item h3 {
  margin-bottom: var(--space-xs);
}

.how-item p {
  color: var(--color-text-muted);
  font-size: 1rem;
}

/* ============================================
   SERVICES
   ============================================ */
.services__intro {
  font-size: clamp(1.125rem, 1.5vw + 0.5rem, 1.3125rem);
  color: var(--color-text-muted);
  line-height: 1.65;
  max-width: 55ch;
  margin-top: var(--space-sm);
  margin-bottom: var(--space-lg);
}

@media (min-width: 48em) {
  .services__intro {
    margin-bottom: var(--space-xl);
  }
}

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

@media (min-width: 48em) {
  .services__list {
    gap: var(--space-xl);
  }

  .service-item {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: var(--space-lg);
    align-items: start;
  }
}

.service-item h3 {
  margin-bottom: var(--space-xs);
  font-size: clamp(1.25rem, 2vw, 1.5rem);
}

.service-item__body p {
  color: var(--color-text-muted);
  font-size: 1rem;
}

.service-item__body p + p {
  margin-top: var(--space-sm);
}

/* ============================================
   ABOUT
   ============================================ */

.about__content {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg);
  margin-top: var(--space-lg);
}

@media (min-width: 48em) {
  .about__content {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-xl);
  }
}

.about__photo {
  aspect-ratio: 4 / 5;
  background-color: var(--color-border);
  border-radius: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.about__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.about__text p {
  color: var(--color-text-muted);
  font-size: 1rem;
}

.about__text p + p {
  margin-top: var(--space-sm);
}

/* ============================================
   CONTACT
   ============================================ */
.contact__layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg);
  align-items: start;
}

@media (min-width: 48em) {
  .contact__layout {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-xl);
  }
}

.contact__text .section-label {
  margin-bottom: 0.5rem;
}

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

.contact__text p {
  color: var(--color-text-muted);
  font-size: 1rem;
}

.contact__text p + p {
  margin-top: var(--space-sm);
}

/* ============================================
   FOOTER
   ============================================ */
.site-footer {
  padding-block: var(--space-lg);
}

.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-sm);
}

.site-footer p {
  font-size: 0.875rem;
  color: var(--color-text-subtle);
}

.footer-links {
  display: flex;
  gap: var(--space-md);
  list-style: none;
}

.footer-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem;
  margin: -0.5rem;
  font-size: 0.875rem;
  color: var(--color-text-subtle);
  text-decoration: none;
  transition: color var(--duration) var(--ease-out);
}

.footer-links a:hover,
.footer-links a:focus-visible {
  color: var(--color-primary);
}

.footer-links svg {
  width: 1em;
  height: 1em;
  flex-shrink: 0;
}

/* ============================================
   CONTACT FORM
   ============================================ */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

/* Off-screen bot trap — must stay reachable to bots but hidden from humans */
.form-honeypot {
  position: absolute;
  left: -9999px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

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

.form-optional {
  font-weight: 400;
  color: var(--color-text-subtle);
}

.form-group input,
.form-group textarea {
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--color-text);
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 0.25rem;
  padding: 0.75rem 1rem;
  transition: border-color var(--duration) var(--ease-out),
              box-shadow var(--duration) var(--ease-out);
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-focus-ring);
  outline: none;
}

.form-group textarea {
  min-height: 8rem;
  resize: vertical;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--color-text-placeholder);
}

.form-submit {
  align-self: flex-start;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 500;
  color: var(--color-text-inverse);
  background-color: var(--color-primary-bg);
  border: none;
  border-radius: 0.25rem;
  padding: 0.875rem 2rem;
  cursor: pointer;
  transition: background-color var(--duration) var(--ease-out),
              transform var(--duration) var(--ease-out);
}

.form-submit:hover {
  background-color: var(--color-primary-bg-hover);
  transform: translateY(-1px);
}

.form-submit:active {
  transform: translateY(0);
}

.form-submit:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 3px;
}

.form-submit:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.contact-form.is-submitting {
  opacity: 0.7;
  pointer-events: none;
}

.form-error {
  color: var(--color-error-text);
  font-size: 0.9375rem;
  padding: 0.75rem 1rem;
  background-color: var(--color-error-surface);
  border: 1px solid var(--color-error-border);
  border-radius: 0.25rem;
}

.form-success {
  text-align: center;
  padding: var(--space-xl) var(--space-lg);
}

.form-success svg {
  width: 4rem;
  height: 4rem;
  color: var(--color-primary);
  margin-bottom: var(--space-sm);
}

.form-success h3 {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 0.5rem;
}

.form-success p {
  color: var(--color-text-muted);
  font-size: 1rem;
}

/* ============================================
   ANIMATIONS
   ============================================ */
/* Progressive enhancement: animations only run when JS adds .js-animate class */
@media (prefers-reduced-motion: no-preference) {
  .js-animate .fade-in {
    opacity: 0;
    transform: translateY(1.5rem);
    animation: fadeIn 0.8s var(--ease-out) forwards;
  }

  .js-animate .fade-in:nth-child(2) { animation-delay: 0.1s; }
  .js-animate .fade-in:nth-child(3) { animation-delay: 0.2s; }
  .js-animate .fade-in:nth-child(4) { animation-delay: 0.3s; }

  @keyframes fadeIn {
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .js-animate .hero__intro   { animation-delay: 0s; }
  .js-animate .hero h1       { animation-delay: 0.15s; }
  .js-animate .hero__summary { animation-delay: 0.3s; }
  .js-animate .hero__cta-wrap { animation-delay: 0.45s; }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
  body {
    font-size: 12pt;
    color: #000;
    background: #fff;
  }
  .site-header,
  .site-footer,
  .hero__cta,
  .contact-form { display: none; }
  .section { padding-block: 1.5rem; }
  a { color: #000; }
  a[href]::after { content: " (" attr(href) ")"; font-size: 0.85em; }
}
