/*
 * William — Freelance Web Developer, stylesheet.
 *
 * Palette: near-black background with an electric-purple + teal accent
 * pair (a common "dev portfolio at night" look). All custom properties
 * live in :root below — re-theme the site by editing values there, not by
 * hunting for hardcoded hex codes through the rest of the file. A few
 * variables intentionally share the same hex value (e.g. --dark-blue,
 * --electric-purple and --purple are all #8B5CF6) but are named for the
 * *role* they play (buttons/links vs. hero glow vs. card borders/tags) —
 * if you want just one of those roles to diverge in color, change that
 * specific variable, not the others, even though they match today.
 *
 * WCAG notes (read before changing colors):
 *   - Every text/background pairing below was checked against WCAG 2.1 AA
 *     contrast (4.5:1 normal text, 3:1 large text/UI components). The one
 *     pairing that originally failed — white text on the raw --green
 *     button background (~1.9:1) — is called out at .contact-submit-btn
 *     below with the fix and the reasoning; don't revert that one without
 *     re-checking contrast.
 *   - The reduced-motion media query near the bottom disables every
 *     continuously-looping animation (background gradient drift, neon
 *     name glow, envelope-send flourish) for users who've set their OS to
 *     reduce motion (WCAG 2.2.2 Pause, Stop, Hide) — if you add a new
 *     infinite/long-running animation, add its "off switch" there too.
 *   - The :focus-visible rule below is what gives keyboard users a visible
 *     ring on nav links, buttons, etc. (WCAG 2.4.7 Focus Visible). Form
 *     inputs define their own focus style further down instead of using
 *     this rule, since a box-shadow reads better than an outline on a
 *     bordered input.
 */
:root {
  --bg: #0D0D0D;
  --electric-purple: #8B5CF6; /* hero name glow + section-adjacent purple accents */
  --teal-accent: #2DD4BF; /* links, focus rings, form accents, "in-progress" states */
  --white: #ffffff;
  --dark-blue: #8B5CF6; /* nav-link hover + testimonial-avatar bg (same hex as electric-purple, named for its role as a "button/link" color) */
  --dark-blue-hover: #7C3AED; /* unused today — reserved hover shade for --dark-blue if it's ever applied to a solid button */
  --blue: #A78BFA; /* project/service card top border + .tag text color */
  --purple: #8B5CF6; /* project/service/testimonial card top border (purple variant) */
  --green: #2DD4BF; /* base "positive action" color — see the contrast note on .btn-cta below before using this as a background under white text */
  --green-hover: #14B8A6;
  --teal: #2DD4BF; /* project/service card top border (teal variant) — same hex as --green/--teal-accent, kept as a separate name for the border-color use case */
  --teal-hover: #14B8A6;
  --heading: #F5F5F7; /* h1-h3 and other high-emphasis text */
  --body-text: #A1A1AA; /* paragraph/nav text — ~7.6:1 against --bg, comfortably passes AA */
  --card-bg: #151515;
  --border-light: rgba(255, 255, 255, 0.08);
}

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

html {
  scroll-behavior: smooth;
}

body {
  position: relative;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg);
  color: var(--body-text);
  line-height: 1.6;
  overflow-x: hidden; /* clips the oversized, blurred body::before gradient below so it can't cause horizontal scroll */
}

/* ---------- Animated background gradient ----------
   Purely decorative: three soft, blurred color blobs that slowly drift
   (see @keyframes gradient-drift). inset:-20% + blur(70px) intentionally
   oversizes it past the viewport edges so the blur never shows a hard
   border. Disabled entirely under prefers-reduced-motion — see that media
   query near the bottom of this file. Adjustable: the three
   radial-gradient() stops control blob position/color/spread (% values
   are position on screen, the rgba alpha controls intensity); the 22s
   duration and translate/scale % in @keyframes control how far and how
   fast it drifts. */
body::before {
  content: '';
  position: fixed;
  inset: -20%;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle at 20% 25%, rgba(139, 92, 246, 0.35), transparent 45%),
    radial-gradient(circle at 80% 70%, rgba(45, 212, 191, 0.30), transparent 45%),
    radial-gradient(circle at 50% 100%, rgba(139, 92, 246, 0.18), transparent 55%);
  filter: blur(70px);
  animation: gradient-drift 22s ease-in-out infinite alternate;
}

@keyframes gradient-drift {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-4%, 4%) scale(1.1); }
  100% { transform: translate(4%, -4%) scale(1); }
}

a {
  text-decoration: none;
  color: inherit;
}

ul {
  list-style: none;
}

section {
  padding: 100px 24px;
  max-width: 1100px;
  margin: 0 auto;
}

h1, h2, h3 {
  color: var(--heading);
  font-weight: 700;
}

/* ---------- Focus indicators ----------
   Gives every link and button a clearly visible ring when reached via
   keyboard or assistive tech (WCAG 2.4.7 Focus Visible) — without this,
   most of these elements would fall back to whatever faint default the
   browser supplies, which can be hard to see against the near-black
   background. :focus-visible (rather than plain :focus) means a mouse
   click won't show the ring, only keyboard/AT focus, so it doesn't add
   visual noise for mouse users. Form <input>/<textarea> elements define
   their own focus style further down (a border-color + box-shadow reads
   better on a bordered field) and are unaffected by this rule since it
   only targets a/button. */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--teal-accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- Skip links ---------- */
.skip-link {
  position: fixed;
  top: -60px; /* parked off-screen above the viewport until focused */
  left: 16px;
  z-index: 2000;
  background-color: var(--electric-purple);
  color: var(--white);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 12px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(139, 92, 246, 0.4);
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 16px; /* slides into view the moment it receives keyboard focus (first Tab press on the page) */
  outline: 2px solid var(--teal-accent);
  outline-offset: 2px;
}

#main-content:focus {
  outline: none; /* suppresses the default focus ring when the skip link programmatically focuses <main> — it's not a real interactive element, just a scroll target */
}

/* ============================================================
   Header / Navigation
   Sticky header with a desktop inline nav that collapses into a
   hamburger-triggered dropdown below the 640px breakpoint (see the
   @media block further down). The open/close behavior itself lives in
   scripts/main.js — this file only controls what each state looks like.
   ============================================================ */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(13, 13, 13, 0.75);
  backdrop-filter: blur(8px); /* frosted-glass effect so page content is still faintly visible scrolling underneath */
  border-bottom: 1px solid var(--border-light);
}

.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-logo {
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--heading);
}

.nav-links {
  display: flex;
  gap: 32px;
}

.nav-links a {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--body-text);
  transition: color 0.2s ease;
  position: relative; /* positioning context for the ::after underline below */
}

.nav-links a:hover {
  color: var(--dark-blue);
}

/* Animated underline: starts at 0 width and grows to 100% on hover, rather
   than a static border, so it doesn't affect layout/spacing at rest. */
.nav-links a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 0%;
  height: 2px;
  background-color: var(--dark-blue);
  transition: width 0.25s ease;
}

.nav-links a:hover::after {
  width: 100%;
}

/* Hamburger button. display:none by default; the 640px media query below
   flips this to display:flex. Always present in the DOM (not JS-injected)
   so it's reachable without JS, and scripts/main.js keeps its
   aria-expanded attribute in sync with #navLinks' open/closed state for
   screen-reader users even though it's visually hidden on desktop. */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  background: none;
  border: none;
}

.nav-toggle span {
  width: 24px;
  height: 2px;
  background-color: var(--heading);
  transition: all 0.3s ease;
}

/* ============================================================
   Hero
   ============================================================ */
.hero {
  min-height: 90vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  text-align: left;
}

/* clamp(min, preferred, max): scales fluidly between viewport widths
   instead of jumping at breakpoints. Raise/lower the middle (vw-based)
   value to change how aggressively the heading scales with viewport width;
   the outer two values cap it on very small/large screens. */
.hero h1 {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  line-height: 1.1;
  margin-bottom: 20px;
}

.hero .subtitle {
  font-size: clamp(1.1rem, 2.5vw, 1.4rem);
  color: var(--body-text);
  margin-bottom: 40px;
  max-width: 500px;
}

/* Gradient-filled text ("neon" look): background-clip:text + transparent
   text color lets the gradient show through the glyph shapes instead of
   filling a box. The drop-shadow glow then pulses via @keyframes
   neon-pulse. Disabled under prefers-reduced-motion — see that media
   query near the bottom of this file. */
.neon-name {
  background: linear-gradient(90deg, var(--electric-purple), var(--teal-accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: neon-pulse 2.8s ease-in-out infinite alternate;
}

@keyframes neon-pulse {
  0% {
    filter: drop-shadow(0 0 6px rgba(139, 92, 246, 0.7)) drop-shadow(0 0 16px rgba(45, 212, 191, 0.5));
  }
  100% {
    filter: drop-shadow(0 0 12px rgba(139, 92, 246, 1)) drop-shadow(0 0 28px rgba(45, 212, 191, 0.85));
  }
}

.btn {
  display: inline-block;
  padding: 14px 32px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  border: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.btn:hover {
  transform: translateY(-3px);
}

/* Base "call to action" button style. IMPORTANT — WCAG contrast: white
   text directly on --green (#2DD4BF) measures only ~1.9:1, far under the
   4.5:1 AA minimum, because --green is a bright/light color rather than a
   dark one. Where this class is combined with .btn-hero-cta or
   .contact-submit-btn below, those rules override background-color with a
   darker teal (#0F766E, ~5.5:1 with white) specifically to stay
   compliant. If you ever use bare .btn-cta with no darkening override,
   either swap in a dark background or switch the text to a dark color —
   don't leave white text on the raw --green. */
.btn-cta {
  background-color: var(--green);
  color: var(--white);
  box-shadow: 0 4px 14px rgba(45, 212, 191, 0.35);
}

.btn-cta:hover {
  background-color: var(--green-hover);
  box-shadow: 0 8px 20px rgba(45, 212, 191, 0.45);
}

/* Darker teal override for the hero CTA — see the contrast note on
   .btn-cta above for why this can't just use --green. */
.btn-hero-cta {
  background-color: #0F766E;
  box-shadow: 0 4px 14px rgba(15, 118, 110, 0.35);
}

.btn-hero-cta:hover {
  background-color: #0B5B54;
  box-shadow: 0 8px 20px rgba(15, 118, 110, 0.45);
}

.btn-contact {
  background-color: #330099;
  color: var(--white);
  box-shadow: 0 4px 14px rgba(51, 0, 153, 0.3);
}

.btn-contact:hover {
  background-color: #26007A;
  box-shadow: 0 8px 20px rgba(51, 0, 153, 0.4);
}

/* ---------- Fade-in on scroll ----------
   Starts every .fade-section invisible and offset; scripts/main.js uses an
   IntersectionObserver to add .is-visible the first time each section
   scrolls into view, which is what actually triggers this transition.
   Because visibility depends on that JS running, this technique assumes
   JS is available — there's no <noscript> fallback, so if JS fails to
   load these sections would stay invisible. The transition itself is
   skipped under prefers-reduced-motion (see that media query near the
   bottom) so reduced-motion users still see the content, just without the
   slide/fade. */
.fade-section {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.fade-section.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- Section headings ---------- */
.section-heading {
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  margin-bottom: 48px;
  text-align: center;
}

/* ============================================================
   Projects
   Each project is one .project-card inside .projects-grid. To add a new
   project, duplicate a <div class="project-card"> in index.html — this
   CSS needs no changes, the grid reflows automatically (adjustable via
   the repeat(3, 1fr) column count below and its responsive overrides
   further down).
   ============================================================ */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr); /* fixed 3-column grid on desktop; drops to 2 then 1 column at the breakpoints in the @media blocks below */
  gap: 28px;
}

.project-card {
  background-color: var(--card-bg);
  border: 1px solid var(--border-light);
  border-top: 4px solid var(--blue); /* default top-accent color; overridden per-card below by border-green/blue/purple/teal — purely decorative categorization, not meaning conveyed by color alone (WCAG 1.4.1), since every card also has full text content */
  border-radius: 10px;
  padding: 28px;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.project-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 28px rgba(139, 92, 246, 0.18);
}

.project-card.border-green { border-top-color: var(--green); }
.project-card.border-blue { border-top-color: var(--blue); }
.project-card.border-purple { border-top-color: var(--purple); }
.project-card.border-teal { border-top-color: var(--teal); }

.project-card-featured {
  position: relative; /* positioning context for .featured-badge */
  grid-column: 1 / -1; /* spans the full grid width regardless of column count */
}

/* Centers the 5th card (an odd count) under a 2-column responsive layout;
   reset to grid-column:auto on narrower screens (see @media below) where
   the grid drops to a single column and centering no longer applies. */
.project-card-center {
  grid-column: 2;
}

.featured-badge {
  position: absolute;
  top: 16px;
  right: 16px;
  background-color: #0F766E; /* same darkened teal as .btn-hero-cta, chosen so the white label text clears WCAG contrast */
  color: var(--white);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 999px;
  letter-spacing: 0.02em;
  z-index: 2;
}

.project-card-featured .project-title h3 .project-link {
  display: inline-flex;
  vertical-align: middle;
}

.project-card h3 {
  font-size: 1.2rem;
  margin-bottom: 12px;
}

.project-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.project-title h3 {
  margin-bottom: 0;
}

.project-link {
  display: flex;
  color: var(--body-text);
  transition: color 0.2s ease;
  flex-shrink: 0;
}

.project-link:hover {
  color: var(--dark-blue);
}

.project-card p {
  font-size: 0.95rem;
  margin-bottom: 20px;
}

.project-image-wrap {
  position: relative;
  overflow: hidden;
  border-radius: 6px;
  margin-bottom: 20px;
}

.project-image {
  display: block;
  width: 100%;
  height: 160px;
  object-fit: cover; /* crops every screenshot to the same aspect ratio regardless of its original dimensions, so mismatched source images still line up evenly across cards */
}

/* Dark scrim + description text that fades in over the screenshot on
   hover — mouse-only interaction (see project-image-wrap:hover below);
   the same description is not otherwise exposed to keyboard/touch users,
   which is an acceptable "nice to have" here since it's supplementary
   detail, not the only way to reach the project (the title + external
   link are always visible/reachable). */
.project-image-overlay {
  position: absolute;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.8);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 16px;
  font-size: 0.85rem;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.project-image-wrap:hover .project-image-overlay {
  opacity: 1;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 999px;
  background-color: rgba(139, 92, 246, 0.15);
  color: var(--blue); /* ~5.7:1 against the translucent-purple-over-card-bg effective background, passes AA for this text size */
}

/* ============================================================
   Services
   Same card/grid pattern as Projects above.
   ============================================================ */
.services-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}

.service-card {
  background-color: var(--card-bg);
  border: 1px solid var(--border-light);
  border-top: 4px solid var(--blue);
  border-radius: 10px;
  padding: 28px;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.service-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 28px rgba(139, 92, 246, 0.18);
}

.service-card.border-green { border-top-color: var(--green); }
.service-card.border-blue { border-top-color: var(--blue); }
.service-card.border-purple { border-top-color: var(--purple); }
.service-card.border-teal { border-top-color: var(--teal); }

.service-card h3 {
  font-size: 1.2rem;
  margin-bottom: 12px;
}

.service-card p {
  font-size: 0.95rem;
  margin-bottom: 20px;
}

/* Unused today (no service card currently omits an image) — kept as the
   fallback look for a service card added without artwork yet; matches
   .service-image's box but with placeholder text instead of an <img>. */
.service-placeholder-image {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 160px;
  border-radius: 6px;
  margin-bottom: 20px;
  background-color: rgba(255, 255, 255, 0.04);
  color: var(--body-text);
  font-size: 0.85rem;
  border: 1px dashed var(--border-light);
}

.service-image {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 160px;
  border-radius: 6px;
  margin-bottom: 20px;
  background-color: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-light);
  padding: 16px;
}

.service-image-img {
  max-height: 100%;
  max-width: 100%;
  object-fit: contain; /* unlike .project-image's object-fit:cover, this never crops — service logos/graphics shrink to fit instead */
}

.service-image-svg {
  width: 100%;
  height: 100%;
}

.text-link {
  color: var(--teal-accent);
  font-weight: 600;
  text-decoration: underline; /* kept (not just relying on the color) so the link is distinguishable without relying on color alone, WCAG 1.4.1 */
  transition: color 0.2s ease;
}

.text-link:hover {
  color: var(--electric-purple);
}

/* ============================================================
   Testimonials
   Section is commented out in index.html until real testimonials exist —
   see the WCAG note there about .testimonial-avatar's contrast before
   re-enabling it.
   ============================================================ */
.testimonials-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}

.testimonial-card {
  background-color: var(--card-bg);
  border: 1px solid var(--border-light);
  border-top: 4px solid var(--purple);
  border-radius: 10px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.testimonial-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 28px rgba(139, 92, 246, 0.18);
}

.testimonial-card.border-green { border-top-color: var(--green); }
.testimonial-card.border-blue { border-top-color: var(--blue); }
.testimonial-card.border-purple { border-top-color: var(--purple); }

.testimonial-quote {
  font-size: 0.95rem;
  font-style: italic;
  margin-bottom: 24px;
  flex-grow: 1; /* pushes .testimonial-author to the bottom of every card, even when quote lengths differ */
}

.testimonial-author {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* See the WCAG contrast note in index.html's commented-out testimonials
   section — white initials on this background measure ~4.2:1, just under
   the 4.5:1 AA minimum. Fix before uncommenting that section. */
.testimonial-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: var(--dark-blue);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.testimonial-name {
  font-weight: 700;
  color: var(--heading);
  font-size: 0.95rem;
}

.testimonial-role {
  font-size: 0.8rem;
  color: var(--body-text);
}

/* ---------- About ---------- */
.about p {
  font-size: 1.05rem;
  margin-bottom: 20px;
  max-width: 720px;
}

.about-highlight {
  color: var(--blue);
}

.about-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* ============================================================
   Contact
   #contactFormWrap (form + status + sending graphic) is toggled via the
   `hidden` attribute by scripts/main.js, not a CSS class — see the long
   comment above the Contact section in index.html for the full
   accessibility wiring (aria-expanded, aria-live regions, etc).
   ============================================================ */
.contact {
  text-align: center;
}

.contact-buttons {
  display: flex;
  gap: 20px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 32px;
}

.contact-form-wrap {
  max-width: 560px;
  margin: 40px auto 0;
  text-align: left;
}

.form-note {
  font-size: 0.85rem;
  color: var(--body-text);
  margin-bottom: 20px;
}

.form-field {
  margin-bottom: 20px;
}

.form-field label {
  display: block;
  font-weight: 600;
  color: var(--heading);
  font-size: 0.9rem;
  margin-bottom: 6px;
}

.optional-label {
  font-weight: 400;
  color: var(--body-text);
  font-size: 0.8rem;
}

.form-field input,
.form-field textarea {
  width: 100%;
  padding: 12px 14px;
  background-color: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--heading);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-field textarea {
  resize: vertical; /* horizontal resize disabled since the field is already 100% width — vertical-only avoids the textarea overflowing its container */
  min-height: 120px;
}

/* Custom focus style (rather than the global :focus-visible rule near the
   top of this file) — a border-color change + soft glow reads more
   clearly on a bordered form field than an outline ring would. */
.form-field input:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--teal-accent);
  box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.2);
}

.field-error {
  display: none; /* toggled to display:block by JS via the parent .form-field.error class below, once a field fails validation */
  color: #f87171;
  font-size: 0.8rem;
  margin-top: 6px;
}

.form-field.error input,
.form-field.error textarea {
  border-color: #f87171; /* paired with the text-based .field-error message so invalid fields aren't marked by color alone (WCAG 1.4.1) */
}

.form-field.error .field-error {
  display: block;
}

/* Base style shared by the form-level error status (#contactFormStatus,
   inside the form) and the post-submit success message
   (#contactFormSuccess, outside it) — both start empty/hidden and are
   populated + revealed by scripts/main.js. */
.form-status {
  margin-top: 8px;
  font-size: 0.9rem;
  color: #f87171; /* default (error) color; overridden by .form-status-success below */
  display: none;
}

.form-status.show {
  display: block;
}

/* Applied alongside .form-status.show for the success message so it reads
   as a positive confirmation (teal) rather than the shared error red. */
.form-status-success {
  color: var(--teal-accent);
}

.contact-submit-btn {
  width: 100%;
  /* Overrides the .btn-cta base background — see the WCAG contrast note on
     .btn-cta above. This button doesn't also have .btn-hero-cta, so
     without this override it would inherit the raw --green background and
     fail contrast under its white text; #0F766E is the same darkened teal
     used by .btn-hero-cta/.featured-badge for the same reason. */
  background-color: #0F766E;
}

.contact-submit-btn:hover {
  background-color: #0B5B54;
}

/* Shown in place of the form while the Formspree request is in flight (see
   the .show toggle in scripts/main.js). */
.sending-graphic {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 48px 0;
}

.sending-graphic.show {
  display: flex;
}

.sending-graphic .envelope-icon {
  color: var(--teal-accent);
  animation: envelope-fly 1.4s ease-in-out forwards; /* runs once (forwards, not infinite) and holds its final state — disabled under prefers-reduced-motion below, where it should just appear without the flight path */
}

.sending-graphic p {
  font-size: 0.95rem;
  color: var(--body-text);
}

@keyframes envelope-fly {
  0% { transform: translate(0, 0) rotate(0deg); opacity: 1; }
  60% { transform: translate(10px, -14px) rotate(-4deg); opacity: 1; }
  100% { transform: translate(220px, -90px) rotate(8deg); opacity: 0; }
}

/* ---------- Footer ---------- */
footer {
  text-align: center;
  padding: 32px 24px;
  font-size: 0.85rem;
  color: var(--body-text);
  border-top: 1px solid var(--border-light);
}

/* Amazon Associates disclosure, required wording — see the HTML comment
   above the affiliate link in the footer of index.html. Slightly smaller
   and dimmer than the copyright line since it's a compliance notice, not
   primary content, but still well above the ~3:1 minimum needed for this
   text size against the footer background. */
.affiliate-disclosure {
  margin-top: 8px;
  font-size: 0.78rem;
  font-style: italic;
}

/* ---------- Responsive ----------
   Two breakpoints: 860px first drops both grids from 3 to 2 columns,
   640px (the same breakpoint the nav hamburger switches on) then drops
   everything to a single column and reduces section padding for phones. */
@media (max-width: 860px) {
  .projects-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .services-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .testimonials-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  section {
    padding: 70px 20px;
  }

  /* Mobile nav dropdown. Hidden by default; scripts/main.js toggles the
     .open class (and the matching aria-expanded on #navToggle) on click.
     Positioned absolute under the sticky navbar (top:100%) rather than
     inline, so opening it doesn't push page content down. display:none
     also removes these links from the accessibility tree while closed, so
     screen readers don't announce a hidden menu's contents.

     right:24px lines its right edge up with the hamburger button above it
     (#navToggle sits at the far right of .nav-inner, which has its own
     24px horizontal padding — see .nav-inner above — so this matches that
     padding rather than .navbar's bare edge, which is what .nav-links'
     position:absolute is actually relative to) instead of the panel
     hanging out past the button. width:max-content sizes the panel to its
     widest nav item (plus the 24px left/right padding below) instead of
     stretching edge-to-edge across the screen; adjust that padding value
     to make the panel a bit tighter or roomier around the text without
     affecting anything else. max-width is just a safety net so a very
     long future nav item on a very narrow phone still can't push the
     panel past the left edge of the screen. */
  .nav-links {
    position: absolute;
    top: 100%;
    right: 24px;
    left: auto;
    width: max-content;
    max-width: calc(100vw - 48px);
    flex-direction: column;
    background-color: var(--bg);
    border-bottom: 1px solid var(--border-light);
    padding: 20px 24px;
    gap: 18px;
    display: none;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-toggle {
    display: flex;
  }

  .projects-grid {
    grid-template-columns: 1fr;
  }

  .project-card-center {
    grid-column: auto; /* undoes the desktop 2nd-column centering — a 1-column layout has nothing to center against */
  }

  .services-grid {
    grid-template-columns: 1fr;
  }

  .testimonials-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    text-align: left;
    align-items: flex-start;
  }

  .contact-buttons {
    flex-direction: column;
    align-items: center;
  }
}

/* ---------- Reduced motion ----------
   WCAG 2.2.2 Pause, Stop, Hide: content that moves/animates
   automatically for more than 5 seconds needs a way to be paused, stopped,
   or hidden. Rather than building pause controls for purely decorative
   effects, this site honors the OS-level "reduce motion" setting instead
   — anyone who's turned that on gets a static background, a static name
   heading, instant (non-animated) section reveals, and no envelope flight
   path on form submit. Smooth anchor-scrolling (html's scroll-behavior)
   is switched off the same way. If a new looping/long-running animation is
   ever added elsewhere in this file, add its "off switch" here too. */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  body::before {
    animation: none;
  }

  .neon-name {
    animation: none;
  }

  .fade-section {
    transition: none;
  }

  .sending-graphic .envelope-icon {
    animation: none;
  }
}
