/* styles.css */

/* Inter (SIL OFL), self-hosted: one variable file covers weights 400–800; Latin subset, as Google Fonts served it */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('assets/fonts/inter-v20-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* EB Garamond (SIL OFL): display serif for headings, matching the "A" monogram.
   Subset to Basic Latin plus typographic punctuation, with only kerning and ligatures (fonttools pyftsubset) */
@font-face {
  font-family: 'EB Garamond';
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url('assets/fonts/ebgaramond-v33-basic-latin.woff2') format('woff2');
  unicode-range: U+0020-007E, U+00A0, U+00A9, U+00B7, U+2013-2014, U+2018-2019, U+201C-201D, U+2026;
}

/* -------------------------------------------------------------------------- */
/*                                 THEME VARIABLES                            */
/* -------------------------------------------------------------------------- */

:root {
  /* Header height for layout calculations */
  --header-height: 60px;
  --measured-header-height: 0px; /* Set by JavaScript based on actual measurements */

  /* Brand accents for gradients */
  --brand-a: 253 94% 61%; /* violet */
  --brand-b: 199 89% 48%; /* cyan */
  --brand-c: 281 89% 64%; /* purple */
  --brand-d: 152 76% 46%; /* teal */

  /* Let the UA know both color schemes are supported */
  color-scheme: dark light;

  /* --- DEFAULT THEME (DARK) - Monochrome --- */
  --background-hsl: 240 10% 3.9%;    /* Almost Black */
  --foreground-hsl: 0 0% 98%;        /* Almost White */

  --card-hsl: 240 6% 10%;          /* Slightly lighter dark gray for cards */
  --card-foreground-hsl: 0 0% 98%;

  --popover-hsl: 240 10% 3.9%;
  --popover-foreground-hsl: 0 0% 98%;

  /* Primary becomes near-white in dark mode */
  --primary-hsl: 0 0% 98%;
  --primary-foreground-hsl: 240 10% 3.9%; /* Text on primary button (dark) */

  --secondary-hsl: 240 5% 18%;      /* Dark Gray for secondary elements */
  --secondary-foreground-hsl: 0 0% 98%; /* Light text on secondary */

  --muted-hsl: 240 5% 18%;          /* Muted backgrounds */
  --muted-foreground-hsl: 240 4% 65%; /* Softer Gray for muted text */

  --accent-hsl: 240 5% 18%;
  --accent-foreground-hsl: 0 0% 98%;

  /* Destructive can remain a muted red for semantics */
  --destructive-hsl: 0 72% 51%; /* More desaturated red */
  --destructive-foreground-hsl: 0 0% 98%;

  --border-hsl: 240 4% 20%;         /* Border for cards, inputs etc. */
  --input-hsl: 240 4% 20%;          /* Input background */
  --ring-hsl: 0 0% 98%;              /* Focus ring (using primary) */

  /* Shadows for Dark Theme - subtle dark shadows */
  --shadow-color-hsl: 0 0% 0%; /* Pure black for shadow base */
  --shadow-opacity: 0.2;
  --shadow-sm: 0 1px 2px 0 hsl(var(--shadow-color-hsl) / var(--shadow-opacity));
  --shadow: 0 2px 4px 0 hsl(var(--shadow-color-hsl) / var(--shadow-opacity));
  --shadow-md: 0 3px 6px 0 hsl(var(--shadow-color-hsl) / var(--shadow-opacity));
  --shadow-lg: 0 8px 16px 0 hsl(var(--shadow-color-hsl) / var(--shadow-opacity));

  /* Motion */
  --reveal-distance: 24px;
  --reveal-duration: 700ms;
  --reveal-ease: cubic-bezier(.21,.62,.31,1);
}

@media (prefers-color-scheme: light) {
  :root {
    /* --- LIGHT THEME (auto, via OS preference) - Monochrome --- */
    --background-hsl: 0 0% 100%;         /* White */
    --foreground-hsl: 240 10% 3.9%;     /* Almost Black text */

    --card-hsl: 0 0% 100%;
    --card-foreground-hsl: 240 10% 3.9%;

    --popover-hsl: 0 0% 100%;
    --popover-foreground-hsl: 240 10% 3.9%;

    /* Primary becomes near-black in light mode */
    --primary-hsl: 240 10% 3.9%;
    --primary-foreground-hsl: 0 0% 98%; /* Text on primary button (light) */

    --secondary-hsl: 240 5% 96%;       /* Light gray */
    --secondary-foreground-hsl: 240 10% 3.9%; /* Dark text on secondary */

    --muted-hsl: 240 5% 96%;
    --muted-foreground-hsl: 240 4% 46%;

    --accent-hsl: 240 5% 96%;
    --accent-foreground-hsl: 240 10% 3.9%;

    --destructive-hsl: 0 84% 60%;
    --destructive-foreground-hsl: 0 0% 98%;

    --border-hsl: 240 6% 90%;           /* Light gray border */
    --input-hsl: 240 6% 90%;
    --ring-hsl: 240 10% 3.9%;           /* Focus ring (using primary) */

    /* Darken brand accents so gradient text/borders keep >=3:1 contrast on white */
    --brand-a: 253 80% 52%;
    --brand-b: 199 89% 38%;
    --brand-c: 281 68% 50%;
    --brand-d: 152 76% 36%;

    /* Shadows for Light Theme */
    --shadow-color-hsl: 220 3% 15%;
    --shadow-opacity: 0.1;
    --shadow-sm: 0 1px 2px hsl(var(--shadow-color-hsl) / calc(var(--shadow-opacity) - 0.04));
    --shadow: 0 3px 6px hsl(var(--shadow-color-hsl) / var(--shadow-opacity));
    --shadow-md: 0 4px 8px hsl(var(--shadow-color-hsl) / var(--shadow-opacity));
    --shadow-lg: 0 10px 20px hsl(var(--shadow-color-hsl) / var(--shadow-opacity));
  }
}

/* --- COMMON DERIVED VARIABLES (Applied Globally) --- */
:root {
  --radius: 0.5rem;

  --font-display: 'EB Garamond', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
  --font-mono: ui-monospace, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;

  --background: hsl(var(--background-hsl));
  --foreground: hsl(var(--foreground-hsl));
  --card: hsl(var(--card-hsl));
  --card-foreground: hsl(var(--card-foreground-hsl));
  --popover: hsl(var(--popover-hsl));
  --popover-foreground: hsl(var(--popover-foreground-hsl));
  --primary: hsl(var(--primary-hsl));
  --primary-foreground: hsl(var(--primary-foreground-hsl));
  /* Hover for primary: make it slightly transparent/dimmed */
  --primary-hover: hsl(var(--primary-hsl) / 0.9);
  --secondary: hsl(var(--secondary-hsl));
  --secondary-foreground: hsl(var(--secondary-foreground-hsl));
  --secondary-hover: hsl(var(--secondary-hsl) / 0.85); /* Adjust if needed for better effect on grays */
  --muted: hsl(var(--muted-hsl));
  --muted-foreground: hsl(var(--muted-foreground-hsl));
  --accent: hsl(var(--accent-hsl));
  --accent-foreground: hsl(var(--accent-foreground-hsl));
  --destructive: hsl(var(--destructive-hsl));
  --destructive-foreground: hsl(var(--destructive-foreground-hsl));
  --border: hsl(var(--border-hsl));
  --input: hsl(var(--input-hsl));
  --ring: hsl(var(--ring-hsl));

}


/* Global reset & smooth scroll */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(max(var(--header-height, 60px), var(--measured-header-height, 0px)) + 10px);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
  color: var(--foreground);
  line-height: 1.65;
  background-color: var(--background);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'kern' 1;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}


a {
  text-decoration: none;
  color: var(--foreground); /* Links are standard foreground color */
  transition: color 0.2s ease-in-out;
}
a:not(.btn):hover {
  color: var(--primary); /* Hover to primary (white/black) */
}

ul {
  list-style: none;
}

/* Utility classes */
.container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.section {
  padding: 6rem 0;
  scroll-margin-top: 90px; /* Offset for fixed header */
  position: relative;
  isolation: isolate; /* contain fades and glows */
  z-index: 0;
  background: var(--background);
}

.bg-glow {
  position: relative;
  background: var(--background);
  overflow: hidden;
}

.section-header {
  max-width: 720px;
  margin-bottom: 3rem;
}

.section-description {
  font-size: 1.125rem;
  color: var(--muted-foreground);
}

/* Small monospace label above a heading, e.g. "01 — Services" */
.eyebrow {
  margin-bottom: 1rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: hsl(var(--brand-b));
}

h1, h2, h3, h4, h5, h6 {
  color: var(--foreground);
  font-weight: 700;
  line-height: 1.3;
  text-rendering: optimizeLegibility;
}

h1,
h2 {
  font-family: var(--font-display);
  font-weight: 600;
  text-wrap: balance;
}

h1 {
  font-size: 3rem;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

h2 {
  font-size: clamp(2.1rem, 1.4rem + 2.2vw, 3.1rem);
  margin-bottom: 0.75rem;
  letter-spacing: -0.01em;
  line-height: 1.06;
}

h3 {
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

p {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--muted-foreground);
  text-wrap: pretty;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  font-weight: 500;
  text-align: center;
  transition: all 0.2s ease-in-out;
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
  text-decoration: none;
  font-size: 0.875rem;
}

.btn-lg {
  padding: 1rem 2rem;
  font-size: 1rem;
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
}

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

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

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

.btn-secondary {
  background-color: var(--secondary);
  color: var(--secondary-foreground);
  border-color: var(--border); /* Using standard border */
}

.btn-secondary:hover {
  background-color: var(--secondary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

/* Focus states for keyboard navigation */
:where(a, button, .btn):focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

/* Service card focus states */
.service-card:focus-visible {
  outline: 2px solid hsl(var(--brand-b));
  outline-offset: 3px;
}

.service-cta:focus-visible {
  outline: 2px solid hsl(var(--brand-c));
  outline-offset: 2px;
}

nav a:focus-visible {
  color: var(--foreground);
  text-decoration: underline;
}


/* Header */
header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  background-color: hsl(var(--background-hsl) / 0.85);
  border-bottom: 1px solid hsl(var(--border-hsl) / 0.6);
  will-change: background-color;
  contain: layout style;
  transition: background-color 0.2s ease;
}

.site-header.is-scrolled {
  background-color: hsl(var(--background-hsl) / 0.8);
  border-bottom-color: hsl(var(--border-hsl) / 0.9);
}

.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.5rem;
  min-height: 60px;
}

.logo-container {
  display: flex;
  align-items: center;
}

.logo-container a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 600;
  font-size: 1.125rem;
  color: var(--foreground);
  text-decoration: none;
}

.logo-container a:hover {
  color: var(--muted-foreground);
}

/* Vector monogram (same artwork as the favicon), crisp at any size */
.logo-mark {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Light theme (auto, via OS preference): outline the cream tile against the white header */
@media (prefers-color-scheme: light) {
  .logo-mark {
    box-shadow: 0 0 0 1px var(--border);
  }
}

/* Hover effects */
.logo-container a:hover .logo-mark {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Company name styling */
.company-name {
  white-space: nowrap;
}

nav {
  display: flex;
  align-items: center;
  gap: 2rem;
  position: relative;
}

nav ul {
  display: flex;
  gap: 2rem;
}

nav a {
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--muted-foreground);
  position: relative;
  padding: 0.5rem 0; /* Improved tap target */
}

nav a:not(.btn):hover {
  color: var(--foreground);
}
nav a.active { color: var(--foreground); }

.nav-link {
  position: relative;
}

/* Header CTA button */
.header-cta {
  margin-left: 1rem;
}

/* Mobile menu button: hidden unless JS is available (html.js, set inline in <head>) on a narrow screen */
.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--foreground);
  cursor: pointer;
}

.menu-toggle[aria-expanded="true"] .menu-icon-open,
.menu-toggle[aria-expanded="false"] .menu-icon-close {
  display: none;
}


/* Hero section */

/* Anchored to the top (not centred) so a web font arriving late can't move the whole block */
.hero {
  min-height: 88vh;
  display: flex;
  align-items: flex-start;
  padding-bottom: 4rem;
  position: relative;
  padding-top: calc(max(var(--header-height, 60px), var(--measured-header-height, 0px)) + 40px);
  background: var(--background);
  scroll-margin-top: var(--header-height);
  overflow: hidden;
  isolation: isolate;
}


/* Fallback for browsers without max() support */
@supports not (height: max(1px, 2px)) {
  .hero {
    /* Use measured value if available, otherwise CSS value */
    padding-top: calc(var(--measured-header-height, var(--header-height, 60px)) + 40px);
  }
}

.hero .container {
  width: 100%;
}

.hero-copy {
  max-width: 760px;
  padding-top: clamp(1.5rem, 9vh, 6.5rem);
}

.gradient-text {
  background: linear-gradient(120deg,
    hsl(var(--brand-b)) 10%,
    hsl(var(--brand-c)) 50%,
    hsl(var(--brand-a)) 90%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

/* ASCII Background */
.backdrop-grid {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}

#ascii-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 1.5s ease-in-out;
  contain: strict;
  /* Promote to own compositor layer for scroll performance */
  transform: translateZ(0);
  backface-visibility: hidden;
  /* Fade in from the left edge so the field never sits behind the hero copy */
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 35%);
  mask-image: linear-gradient(90deg, transparent 0%, #000 35%);
}

/* The ASCII field owns the right side of the hero */
.hero .backdrop-grid {
  left: 40%;
}

#ascii-canvas.active {
  opacity: 1;
}

.backdrop-grid.no-canvas #ascii-canvas {
  display: none;
}

.hero-title {
  /* Fluid 48px → 88px so the headline only ever shrinks as the screen narrows */
  font-size: clamp(3rem, 1.6rem + 5vw, 5.5rem);
  letter-spacing: -0.02em;
  line-height: 0.98;
  margin-bottom: 1.75rem;
}

/* The gradient phrase gets its own line, sized to the words so the gradient spans just them */
.hero-title .gradient-text {
  display: block;
  width: fit-content;
  padding-bottom: 0.08em; /* keep descenders inside the clipped gradient */
}

.hero-title .sub {
  display: block;
  margin-top: 0.35em;
  font-size: 0.42em;
  font-weight: 500;
  letter-spacing: 0;
  color: hsl(var(--foreground-hsl) / 0.72);
}

.hero-description {
  max-width: 34rem;
  margin-bottom: 2.25rem;
  font-size: 1.2rem;
  line-height: 1.6;
  color: var(--muted-foreground);
}

.hero-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem 2rem;
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding-bottom: 2px;
  font-weight: 500;
  color: var(--foreground);
  border-bottom: 1px solid hsl(var(--foreground-hsl) / 0.3);
  transition: border-color 0.2s ease;
}

.text-link:hover {
  border-bottom-color: currentColor;
}

.text-link .arrow {
  transition: transform 0.2s ease;
}

.text-link:hover .arrow {
  transform: translateY(2px);
}

/* Proof line: "Experience from" + monochrome logos */
.proof {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem 1.75rem;
  margin-top: 3.5rem;
}

.proof-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}

.proof-logos {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem 2rem;
}

/* Optical alignment, measured from the artwork: each logo is sized to a similar visual weight and nudged so
   its centre of mass sits on the row's centre line (Amazon's smile drags its box down; "cruise" has only an
   i-dot above its x-height; Life Time's dense capitals would dominate at equal height) */
.proof-logos img {
  width: auto;
  height: var(--logo-height, 22px);
  transform: translateY(var(--logo-shift, 0));
  filter: brightness(0) invert(1);
  opacity: 0.55;
}

.proof-logo-amazon { --logo-height: 25px; --logo-shift: 3px; }
.proof-logo-cruise { --logo-height: 25px; --logo-shift: -3px; }
.proof-logo-lifetime { --logo-height: 19px; --logo-shift: 0.5px; }

@media (prefers-color-scheme: light) {
  .proof-logos img {
    filter: brightness(0);
    opacity: 0.5;
  }
}

/* Reveal on scroll */
/* Reveal defaults visible; JS adds .motion to enable animations */
.reveal { opacity: 1; transform: none; }
.motion .reveal { opacity: 0; transform: translateY(var(--reveal-distance)); will-change: transform, opacity; }
.motion .reveal.in-view { opacity: 1; transform: translateY(0); transition: opacity var(--reveal-duration) var(--reveal-ease) calc(var(--reveal-delay, 0ms)), transform var(--reveal-duration) var(--reveal-ease) calc(var(--reveal-delay, 0ms)); }

/* Services section */
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 2rem;
  margin-top: 3rem;
}

.service-card {
  background: hsl(var(--card-hsl) / 0.98);
  border: 1px solid hsl(var(--border-hsl) / 0.6);
  border-radius: calc(var(--radius) * 1.5);
  padding: 2.5rem;
  box-shadow: 0 1px 3px hsl(var(--shadow-color-hsl) / 0.08);
  transition: background-color 200ms cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  text-align: left;
  position: relative;
  overflow: hidden;
}

.service-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, hsl(var(--brand-b)), hsl(var(--brand-c)));
  transform-origin: left;
  transform: scaleX(0);
  opacity: 0;
  transition: transform 200ms cubic-bezier(0.16, 1, 0.3, 1),
              opacity 150ms ease;
}

.service-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: 0 8px 20px hsl(var(--shadow-color-hsl) / 0.15);
  opacity: 0;
  transition: opacity 200ms ease;
  pointer-events: none;
  z-index: -1;
}

.service-card:is(:hover, :focus-visible, :has(:focus-visible)) {
  background: hsl(var(--card-hsl));
}

.service-card:is(:hover, :focus-visible, :has(:focus-visible))::before {
  transform: scaleX(1);
  opacity: 1;
}

.service-card:is(:hover, :focus-visible, :has(:focus-visible))::after {
  opacity: 1;
}

.service-card:active {
  transform: translateY(-1px);
}

.service-icon {
  color: var(--primary);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.service-icon svg {
  width: 2.5rem;
  height: 2.5rem;
}

.service-content h3 {
  font-size: 1.375rem;
  margin-bottom: 1rem;
  color: var(--card-foreground);
  font-weight: 600;
}

.service-content p {
  color: var(--muted-foreground);
  font-size: 0.95rem;
  line-height: 1.6;
  flex-grow: 1;
}

.service-cta {
  margin-top: 1.25rem;
  font-weight: 600;
  color: var(--foreground);
  opacity: 0.9;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  text-decoration: none;
  position: relative;
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0% 1px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size 200ms cubic-bezier(0.16, 1, 0.3, 1),
              opacity 150ms ease;
}

.service-cta .arrow {
  transition: transform 200ms cubic-bezier(0.16, 1, 0.3, 1);
}

.service-card:is(:hover, :focus-visible, :has(:focus-visible)) .service-cta {
  opacity: 1;
  background-size: 100% 1px;
}

.service-card:is(:hover, :focus-visible, :has(:focus-visible)) .service-cta .arrow {
  transform: translateX(2px);
}

/* Tilt targets */
.tilt {
  --tilt-x: 0deg;
  --tilt-y: 0deg;
  will-change: transform;
  transform-style: preserve-3d;
  transform: rotateX(var(--tilt-x)) rotateY(var(--tilt-y)) translateY(0);
  transition: transform 200ms cubic-bezier(0.16, 1, 0.3, 1);
}

.tilt:is(:hover, :focus-visible, :has(:focus-visible)) {
  transform: rotateX(var(--tilt-x)) rotateY(var(--tilt-y)) translateY(-3px);
}


/* How we work: timeline */

.section-band {
  background: hsl(var(--card-hsl) / 0.55);
  border-block: 1px solid hsl(var(--border-hsl) / 0.6);
}

.timeline {
  --dot: 0.625rem;
  --gap: 3rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gap);
  list-style: none;
  view-timeline: --timeline block;
}

.timeline-step {
  position: relative;
}

.timeline-marker {
  display: block;
  width: var(--dot);
  height: var(--dot);
  margin-bottom: 1.5rem;
  border-radius: 50%;
  background: var(--step-color);
}

.timeline-step:nth-child(1) { --step-color: hsl(var(--brand-b)); }
.timeline-step:nth-child(2) { --step-color: hsl(var(--brand-c)); }
.timeline-step:nth-child(3) { --step-color: hsl(var(--brand-a)); }

/* Each step draws the segment to the next dot, so the line starts and ends exactly at the dots */
.timeline-step:not(:last-child)::before,
.timeline-step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: calc(var(--dot) / 2);
  left: calc(var(--dot) + 0.5rem);
  right: calc(0.5rem - var(--gap));
  height: 1px;
}

.timeline-step:not(:last-child)::before {
  background: hsl(var(--border-hsl));
}

.timeline-step:not(:last-child)::after {
  background: linear-gradient(90deg, var(--step-color), var(--next-color));
  transform-origin: left;
}

.timeline-step:nth-child(1) { --next-color: hsl(var(--brand-c)); }
.timeline-step:nth-child(2) { --next-color: hsl(var(--brand-a)); }

.timeline-index {
  margin-bottom: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  color: var(--muted-foreground);
}

.timeline-step h3 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.timeline-step p:last-child {
  font-size: 0.975rem;
  max-width: 22rem;
}

/* Scroll-driven progress: segments fill and dots light up in turn as the timeline scrolls in.
   Without support, or with reduced motion, it shows in its finished state. */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .timeline-marker,
    .timeline-step:not(:last-child)::after {
      animation-timeline: --timeline;
      animation-fill-mode: both;
      animation-timing-function: linear;
    }

    .timeline-marker { animation-name: dot-on; }
    .timeline-step:not(:last-child)::after { animation-name: segment-fill; }

    .timeline-step:nth-child(1) .timeline-marker { animation-range: entry 70% entry 90%; }
    .timeline-step:nth-child(1)::after { animation-range: entry 90% cover 40%; }
    .timeline-step:nth-child(2) .timeline-marker { animation-range: cover 38% cover 42%; }
    .timeline-step:nth-child(2)::after { animation-range: cover 42% cover 52%; }
    .timeline-step:nth-child(3) .timeline-marker { animation-range: cover 50% cover 54%; }
  }
}

@keyframes dot-on {
  from { background: hsl(var(--border-hsl)); }
  to { background: var(--step-color); }
}

@keyframes segment-fill {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

/* Narrow screens: steps stack, with the line running down the left edge */
@media (max-width: 768px) {
  .timeline {
    --gap: 2.25rem;
    grid-template-columns: 1fr;
  }

  .timeline-step {
    padding-left: 1.75rem;
  }

  .timeline-marker {
    position: absolute;
    left: 0;
    top: 0.3rem;
    margin: 0;
  }

  .timeline-step:not(:last-child)::before,
  .timeline-step:not(:last-child)::after {
    top: calc(0.3rem + var(--dot) + 0.4rem);
    bottom: calc(0.4rem - var(--gap) - 0.3rem);
    left: calc(var(--dot) / 2);
    right: auto;
    width: 1px;
    height: auto;
  }

  .timeline-step:not(:last-child)::after {
    background: linear-gradient(180deg, var(--step-color), var(--next-color));
    transform-origin: top;
  }

  @supports (animation-timeline: view()) {
    @media (prefers-reduced-motion: no-preference) {
      .timeline-step:not(:last-child)::after { animation-name: segment-fill-down; }
    }
  }
}

@keyframes segment-fill-down {
  from { transform: scaleY(0); }
  to { transform: scaleY(1); }
}

/* About section */

.about-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 4rem;
  align-items: start;
  margin-top: 3rem;
}

.about-panel {
  position: relative;
  padding: 2rem;
  border-radius: calc(var(--radius) * 1.5);
  border: 1px solid hsl(var(--border-hsl) / 0.5);
  background: hsl(var(--card-hsl) / 0.9);
  box-shadow: 0 10px 30px hsl(var(--shadow-color-hsl) / 0.15);
  overflow: hidden;
  transition: outline 200ms ease, outline-offset 200ms ease;
}

.about-panel:focus-within {
  outline: 2px solid hsl(var(--brand-b) / 0.5);
  outline-offset: 4px;
}

.about-decor {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  overflow: hidden;
}

.about-panel .about-grid { position: relative; z-index: 1; }

.about-text {
  text-align: left;
}

.about-text .lead {
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--foreground);
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.about-text p {
  margin-bottom: 1.25rem;
  color: var(--muted-foreground);
  line-height: 1.7;
  font-size: 1rem;
}

.about-text p:last-of-type {
  margin-bottom: 0;
}

.about-stats {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.stat-item {
  text-align: center;
  padding: 1.5rem;
  background: linear-gradient(var(--card), var(--card)) padding-box,
              linear-gradient(135deg, hsl(var(--brand-c)), hsl(var(--brand-b))) border-box;
  border: 1px solid transparent;
  border-radius: calc(var(--radius) * 1.25);
  transition: transform 200ms cubic-bezier(0.16, 1, 0.3, 1),
              background-color 200ms cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 1px 3px hsl(var(--shadow-color-hsl) / 0.08);
  position: relative;
  cursor: default;
}

.stat-number {
  font-size: 2.75rem;
  font-weight: 800;
  background: linear-gradient(120deg, hsl(var(--brand-b)) 20%, hsl(var(--brand-c)) 80%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  line-height: 1;
  margin-bottom: 0.5rem;
}

.stat-label {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-item::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: 0 8px 20px hsl(var(--shadow-color-hsl) / 0.15);
  opacity: 0;
  transition: opacity 200ms ease;
  pointer-events: none;
  z-index: -1;
}

.stat-item:is(:hover, :focus-visible) {
  transform: translateY(-3px);
}

.stat-item:is(:hover, :focus-visible)::after {
  opacity: 1;
}

.stat-item:active {
  transform: translateY(-1px);
}

.stat-item:focus-visible {
  outline: 2px solid hsl(var(--brand-b));
  outline-offset: 3px;
}

.about-tags {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem .5rem;
  margin-top: 1rem;
}
.about-tags li {
  padding: .35rem .65rem;
  border-radius: 999px;
  font-size: .8rem;
  border: 1px solid hsl(var(--border-hsl));
  background: hsl(var(--muted-hsl));
  color: var(--muted-foreground);
  transition: transform 160ms cubic-bezier(0.16, 1, 0.3, 1),
              background-color 160ms ease,
              border-color 160ms ease;
  cursor: default;
  display: inline-block;
}

.about-tags li:hover {
  transform: scale(1.02);
  background: hsl(var(--muted-hsl) / 0.8);
  border-color: hsl(var(--border-hsl) / 0.8);
}

.about-tags li:focus-visible {
  outline: 2px solid hsl(var(--brand-c));
  outline-offset: 2px;
}


/* Contact section */
.contact-content {
  text-align: center;
  max-width: 700px;
  margin: 0 auto;
}

/* Closing call-to-action band: brand glows instead of a card */
.section-cta {
  background:
    radial-gradient(ellipse 55% 70% at 15% 0%, hsl(var(--brand-b) / 0.16), transparent 70%),
    radial-gradient(ellipse 55% 70% at 85% 100%, hsl(var(--brand-a) / 0.2), transparent 70%),
    var(--background);
  border-top: 1px solid hsl(var(--border-hsl) / 0.6);
}

.cta-panel {
  position: relative;
  padding: 1rem 0;
}

.btn-primary.shine { position: relative; overflow: hidden; }
.btn-primary.shine::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 40%, hsl(var(--brand-b) / .15) 50%, transparent 60%);
  transform: translateX(-100%);
  transition: transform 700ms ease;
}
.btn-primary.shine:hover::after { transform: translateX(100%); }

.contact-header {
  margin-bottom: 3rem;
}

.contact-header h2 {
  font-size: clamp(2.4rem, 1.6rem + 3vw, 3.75rem);
  margin-bottom: 1rem;
  text-align: center;
}

.contact-description {
  font-size: 1.125rem;
  color: var(--muted-foreground);
  line-height: 1.6;
}

.contact-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
}

.contact-info {
  text-align: center;
}

.contact-email {
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--foreground);
  margin-bottom: 0.5rem;
}

.contact-note {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  margin: 0;
}


/* Footer */
footer {
  position: relative;
  text-align: center;
  padding: 2.5rem 0;
  background: var(--background);
  border-top: 1px solid var(--border);
  color: var(--muted-foreground);
  font-size: 0.875rem;
}
footer p {
    color: var(--muted-foreground);
}

/* Skip link for accessibility */
.skip-link {
  position: absolute;
  left: -999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.skip-link:focus {
  position: fixed;
  left: 1rem;
  top: 1rem;
  width: auto;
  height: auto;
  padding: 0.5rem 1rem;
  background: var(--primary);
  color: var(--primary-foreground);
  border-radius: var(--radius);
  z-index: 1001;
  outline: 2px solid var(--ring);
  text-decoration: none;
}


/* Responsive CSS */
@media (max-width: 968px) {
  /* Shift the field so the burst sits beside the headline, fading out toward the copy */
  .hero .backdrop-grid {
    right: -40%;
    bottom: 35%;
  }
  #ascii-canvas {
    -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 45%);
    mask-image: linear-gradient(90deg, transparent 0%, #000 45%);
  }
  .about-grid {
    grid-template-columns: 1fr;
    gap: 3rem;
  }
  
  .about-stats {
    flex-direction: row;
    justify-content: center;
  }
}

@media (max-width: 768px) {
  .section {
    padding: 3rem 0;
  }

  /* Compact one-row header: the full name and three links don't fit beside the CTA below ~660px */
  .header-container {
    flex-wrap: wrap; /* without JS the section links drop to a second row */
    gap: 0.5rem 0.75rem;
    padding: 0.625rem 1.5rem;
    min-height: 0;
  }
  .logo-container a {
    gap: 0.625rem;
  }
  /* Stacked lockup echoing the logo: "Ashworth" over a small-caps "Consulting LLC" */
  .company-name {
    display: flex;
    flex-direction: column;
    font-size: 1rem;
    line-height: 1.15;
  }
  .company-name-sub {
    font-size: 0.625rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted-foreground);
  }
  nav {
    position: static; /* the open menu anchors to the full-width header */
    gap: 0.5rem;
    margin-left: auto;
  }
  nav ul {
    gap: 1.25rem;
    font-size: 0.85rem;
  }
  .site-header .header-cta {
    width: auto;
    max-width: none;
    margin: 0;
  }

  /* With JS: section links collapse behind the menu button */
  .js nav ul {
    display: none;
  }
  .js .menu-toggle {
    display: inline-flex;
  }
  .js .nav-open nav ul {
    display: flex;
    flex-direction: column;
    gap: 0;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    padding: 0.25rem 1.5rem 0.75rem;
    background: var(--background);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
  }
  .js .nav-open nav .nav-link {
    display: block;
    padding: 0.75rem 0;
    font-size: 1rem;
    color: var(--foreground);
  }

  .service-card {
    padding: 2rem;
  }
  .services-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  .about-stats {
    flex-direction: column;
  }
  .contact-actions {
    gap: 1.5rem;
  }
}

@media (max-width: 600px) {
  :root {
    --header-height: 64px; /* One-row header */
  }

  body {
    line-height: 1.55;
  }
  .header-container {
    padding: 0.625rem 1rem;
  }
  nav ul {
    gap: 0.75rem;
  }
  .js .nav-open nav ul {
    padding-inline: 1rem;
  }

  .hero {
    padding-top: calc(var(--header-height) + 10px);
  }
  /* Always stacked, so the web font arriving can't re-wrap the button and link and shift the page */
  .hero-actions {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.25rem;
  }
  .hero-actions .btn {
    width: auto;
    margin: 0;
  }
  .btn {
    width: 100%;
    max-width: 300px;
    margin-left: auto;
    margin-right: auto;
  }

  .section-header {
    margin-bottom: 2rem;
  }

  .service-card {
    padding: 1.5rem;
  }
  
  .about-text .lead {
    font-size: 1.125rem;
  }
  
  .contact-description {
    font-size: 1rem;
  }

  .stat-number {
    font-size: 2rem;
  }
}

/* Smallest phones: keep the header on one row by dropping the "Consulting LLC" line */
@media (max-width: 340px) {
  .company-name-sub {
    display: none;
  }
}

/* Safe area inset support for notched devices */
@supports (padding: max(0px)) {
  .hero {
    /* Always respect the larger of the static guess and the measured height */
    padding-top: calc(
      max(var(--header-height, 60px), var(--measured-header-height, 0px))
      + 40px
      + env(safe-area-inset-top, 0px)
    );
  }

  @media (max-width: 600px) {
    .hero {
      /* Same idea for mobile */
      padding-top: calc(
        max(var(--header-height, 170px), var(--measured-header-height, 0px))
        + 10px
        + env(safe-area-inset-top, 0px)
      );
    }
  }

  .site-header {
    padding-top: env(safe-area-inset-top, 0px);
  }
}

/* Touch device support - replace hover with active states */
@media (hover: none) {
  .service-card:hover {
    transform: none;
  }

  .service-card:active {
    transform: translateY(-2px);
  }

  .service-card::before {
    opacity: 0.7;
    transform: scaleX(1);
  }

  .service-cta {
    background-size: 0% 1px;
  }

  .service-card:active .service-cta {
    background-size: 100% 1px;
  }

  .service-card:active .service-cta .arrow {
    transform: translateX(2px);
  }

  /* About section touch support */
  .stat-item:hover {
    transform: none;
  }

  .stat-item:active {
    transform: translateY(-2px);
  }

  .about-tags li:hover {
    transform: none;
    background: hsl(var(--muted-hsl));
    border-color: hsl(var(--border-hsl));
  }

  .about-tags li:active {
    transform: scale(0.98);
  }
}

/* Reduced motion preferences for accessibility */
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }

  html {
    scroll-behavior: auto;
  }

  /* Service cards - maintain visual feedback without motion */
  .service-card {
    transform: none !important;
  }

  .service-card::before {
    transform: scaleX(1) !important;
    opacity: 0 !important;
  }

  .service-card:is(:hover, :focus-visible, :has(:focus-visible))::before {
    opacity: 1 !important;
  }

  .service-cta {
    background-size: 100% 1px !important;
  }

  .service-cta .arrow {
    transform: none !important;
  }

  /* About section - maintain visual feedback without motion */
  .stat-item {
    transform: none !important;
  }

  .stat-item:is(:hover, :focus-visible)::after {
    opacity: 1 !important;
  }

  .about-tags li {
    transform: none !important;
  }

  .about-tags li:hover {
    background: hsl(var(--muted-hsl) / 0.8) !important;
    border-color: hsl(var(--border-hsl) / 0.8) !important;
  }
}

/* High contrast preference: remove decorative backgrounds */
@media (prefers-contrast: more) {
  .bg-glow::before {
    background: none !important;
    mask: none !important;
    -webkit-mask: none !important;
  }
}
