/* Foyware: tokens and styles. Decisions (palette, type, motion) live in DECISIONS.md. */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@9..40,400;9..40,500;9..40,700&family=Poppins:wght@500;600;700&display=swap');

:root {
  /* Color: original Foyware palette (foyware.com _tokens.scss, FW badge, social card) */
  --blue: #196ab1;          /* primary: actions and links */
  --teal: #00788d;          /* #008ba3 darkened so white text on it and it on white both pass 4.5:1 */
  --teal-bright: #008ba3;   /* original teal, decorative only (bars, rules) */
  --mint: #79d1c8;          /* accents on navy */
  --navy: #1e3454;          /* badge navy: dark panels, footer */
  --soft-blue: #e6f7ff;     /* hero, tints */
  --ink: #14141c;

  /* Color: surfaces and text */
  --surface: #f8f9fa;
  --surface-raised: #ffffff;
  --surface-tint: var(--soft-blue);
  --surface-dark: var(--navy);
  --text: var(--ink);
  --text-muted: #4f5d66;    /* the original #7f8c8d is too light for body text (3.5:1) */
  --heading: var(--navy);
  --text-on-dark: #ffffff;
  --text-on-dark-muted: #c4d3de;
  --border: hsl(213 47% 22% / 0.12);
  --border-on-dark: hsl(0 0% 100% / 0.18);
  --grid-line: hsl(208 75% 40% / 0.09);

  /* Type */
  --font-display: 'Poppins', system-ui, sans-serif;
  --font-sans: 'DM Sans', system-ui, sans-serif;
  --text-sm: 0.875rem;
  --text-base: 1.0625rem;
  --text-lg: 1.25rem;
  --text-xl: clamp(1.375rem, 1.15rem + 0.8vw, 1.625rem);
  --text-2xl: clamp(1.875rem, 1.45rem + 1.8vw, 2.625rem);
  --text-3xl: clamp(2.375rem, 1.55rem + 3.6vw, 4.25rem);

  /* Space */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-24: 6rem;
  --section-y: clamp(4rem, 3rem + 4vw, 7rem);
  --gutter: 16px;
  --content-max: 1120px;
  --measure: 62ch;

  /* Shape and elevation (one light source: shadows fall straight down, navy-tinted) */
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-panel: 35px;     /* the original site's offset-panel radius */
  --radius-pill: 999px;
  --shadow-low: 0 1px 2px hsl(213 47% 22% / 0.06), 0 1px 1px hsl(213 47% 22% / 0.04);
  --shadow-medium: 0 2px 4px hsl(213 47% 22% / 0.06), 0 10px 20px hsl(213 47% 22% / 0.10);

  /* Motion (00d): animate transform and opacity only */
  --duration-fast: 140ms;
  --duration-base: 220ms;
  --duration-reveal: 520ms; /* the one hero moment only */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
}

@media (min-width: 640px) { :root { --gutter: 24px; } }
@media (min-width: 1024px) { :root { --gutter: 32px; } }

/* Page changes cross-fade where supported, and only when motion is welcome. */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  ::view-transition-old(root), ::view-transition-new(root) { animation-duration: var(--duration-base); }
}

/* Base */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-width: 320px;
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.65;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--heading);
  margin: 0;
  text-wrap: balance;
}
p { margin: 0; text-wrap: pretty; }
::selection { background: var(--mint); color: var(--navy); }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; border-radius: 2px; }
a, button { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }

.container { width: min(var(--content-max), 100% - var(--gutter) * 2); margin-inline: auto; }
.skip-link {
  position: absolute; inset-inline-start: var(--space-3); top: -100px; z-index: 100;
  padding: var(--space-3) var(--space-4); background: var(--navy); color: var(--text-on-dark);
  border-radius: var(--radius-sm);
}
.skip-link:focus { top: var(--space-3); }

/* ---------- Links: a resting underline, plus a teal bar that slides in from the left ---------- */
.text-link {
  position: relative; display: inline-block;
  font-weight: 700; color: var(--blue); text-decoration: none;
  padding-bottom: 3px;
  transition: color var(--duration-fast) ease;
}
.text-link::before, .text-link::after {
  content: ''; position: absolute; inset-inline: 0; bottom: 0; height: 2px; border-radius: 2px;
}
.text-link::before { background: currentColor; opacity: 0.3; }
.text-link::after {
  background: var(--teal); transform: scaleX(0); transform-origin: left;
  transition: transform var(--duration-base) var(--ease-out);
}
.text-link:hover { color: var(--teal); }
.text-link:hover::after, .text-link:focus-visible::after { transform: scaleX(1); }
.text-link:active { opacity: 0.75; }

/* ---------- Buttons: color shift on hover, press to 0.97 ---------- */
.button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 48px;
  padding: var(--space-3) var(--space-6); border-radius: var(--radius-pill);
  background: var(--blue); color: var(--text-on-dark);
  font-family: var(--font-display); font-weight: 600; font-size: var(--text-sm); letter-spacing: 0.01em;
  text-decoration: none; cursor: pointer; border: 0;
  transition: background-color var(--duration-fast) ease, transform var(--duration-fast) var(--ease-out);
}
.button:hover { background: var(--teal); }
.button:active { transform: scale(0.97); }
.button-on-dark { background: var(--surface-raised); color: var(--navy); }
.button-on-dark:hover { background: var(--soft-blue); }

/* ---------- Header and navigation ---------- */
.site-header { position: relative; z-index: 30; background: var(--surface-raised); border-bottom: 1px solid var(--border); }
.nav-wrap { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: var(--space-6); }
.brand {
  display: inline-flex; align-items: center; gap: var(--space-3); text-decoration: none;
  font-family: var(--font-display); font-weight: 700; font-size: 1.25rem; letter-spacing: -0.02em; color: var(--ink);
}
.brand img { border-radius: var(--radius-sm); transition: transform var(--duration-fast) var(--ease-out); }
.brand:active img { transform: scale(0.94); }
.site-nav { display: flex; align-items: center; gap: var(--space-8); font-size: var(--text-sm); font-weight: 500; }
.site-nav a:not(.button) {
  position: relative; text-decoration: none; padding-block: var(--space-3);
  transition: color var(--duration-fast) ease;
}
.site-nav a:not(.button)::after {
  content: ''; position: absolute; inset-inline: 0; bottom: 6px; height: 2px; border-radius: 2px;
  background: var(--teal); transform: scaleX(0); transform-origin: left;
  transition: transform var(--duration-base) var(--ease-out);
}
.site-nav a:not(.button):hover, .site-nav a[aria-current="page"] { color: var(--teal); }
.site-nav a[aria-current="page"]::after { transform: scaleX(1); }
.site-nav .button { padding: var(--space-3) var(--space-4); }
.menu-toggle { display: none; }

/* ---------- Sections ---------- */
.section { padding-block: var(--section-y); }
.section-raised { background: var(--surface-raised); border-block: 1px solid var(--border); }
.section-head { max-width: var(--measure); margin-bottom: var(--space-12); }
.section-head h2 { font-size: var(--text-2xl); }
.section-head p { margin-top: var(--space-4); color: var(--text-muted); }
.section-more { margin-top: var(--space-12); }

/* ---------- Hero: soft blue with the blueprint grid (the site's one surface detail) ---------- */
.hero {
  position: relative; overflow: hidden;
  background-color: var(--soft-blue);
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 32px 32px;
  background-position: center top;
}
.hero::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to bottom, transparent 60%, var(--surface));
}
.hero-inner { position: relative; z-index: 1; padding-block: clamp(4rem, 2.5rem + 6vw, 8.5rem); }
.hero h1 { font-size: var(--text-3xl); font-weight: 700; color: var(--ink); max-width: 17ch; letter-spacing: -0.03em; }
.hero-accent { color: var(--blue); }
.hero-lede { margin-top: var(--space-6); font-size: var(--text-lg); color: var(--text-muted); max-width: 42rem; }
.hero-actions { margin-top: var(--space-8); display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-4) var(--space-8); }

/* The two-tone bar from the Foyware social card */
.brand-bar { display: flex; gap: 6px; margin-top: var(--space-8); }
.brand-bar span { display: block; width: 60px; height: 4px; border-radius: 2px; background: var(--blue); transform-origin: left; }
.brand-bar span + span { background: var(--teal-bright); }

/* The one earned decorative moment: the motto rises in word by word, then the bar draws in. Plays once. */
@media (prefers-reduced-motion: no-preference) {
  .hero-reveal > span {
    display: inline-block;
    animation: word-in var(--duration-reveal) var(--ease-out) both;
    animation-delay: calc(80ms + var(--i) * 70ms);
  }
  .brand-bar span { animation: bar-in 420ms var(--ease-out) both; animation-delay: 640ms; }
  .brand-bar span + span { animation-delay: 740ms; }
}
@keyframes word-in { from { opacity: 0; transform: translateY(0.35em); } to { opacity: 1; transform: none; } }
@keyframes bar-in { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* ---------- Services ---------- */
.service-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-8); grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.service-list li { border-top: 3px solid var(--blue); padding-top: var(--space-6); }
.service-list li:nth-child(2) { border-top-color: var(--teal-bright); }
.service-list li:nth-child(3) { border-top-color: var(--navy); }
.service-list h3 { font-size: var(--text-xl); }
.service-list p { margin-top: var(--space-3); color: var(--text-muted); }

/* ---------- Offset panel (the original foyware.com pattern): flush to one edge, rounded on the inside ---------- */
.section-panel { padding-block: var(--space-8); }
.panel { padding-block: var(--section-y); }
.panel-dark { background: var(--surface-dark); color: var(--text-on-dark); }
.panel-dark h2, .panel-dark h3 { color: var(--text-on-dark); }
.panel-dark .section-head p, .panel-dark p { color: var(--text-on-dark-muted); }
.panel-dark :focus-visible { outline-color: var(--mint); }
@media (min-width: 1024px) {
  .panel-left { margin-inline-end: 20px; border-start-end-radius: var(--radius-panel); border-end-end-radius: var(--radius-panel); }
  .panel-right { margin-inline-start: 20px; border-start-start-radius: var(--radius-panel); border-end-start-radius: var(--radius-panel); }
}
.values { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-8); grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.values li { border-top: 2px solid var(--mint); padding-top: var(--space-6); }
.values h3 { font-size: var(--text-xl); }
.values p { margin-top: var(--space-3); }

/* ---------- How a project runs ---------- */
.process { display: grid; gap: var(--space-12); }
.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; display: grid; gap: var(--space-6); }
.steps li { counter-increment: step; display: grid; grid-template-columns: 3rem 1fr; gap: var(--space-4); padding-bottom: var(--space-6); border-bottom: 1px solid var(--border); }
.steps li:last-child { border-bottom: 0; padding-bottom: 0; }
.steps li::before {
  content: counter(step); display: grid; place-items: center; width: 2.25rem; height: 2.25rem;
  border-radius: 50%; background: var(--soft-blue); color: var(--blue);
  font-family: var(--font-display); font-weight: 600; font-variant-numeric: tabular-nums;
}
.steps h3 { font-size: var(--text-base); line-height: 1.4; letter-spacing: 0; padding-top: 0.35rem; }
.steps p { margin-top: var(--space-1); color: var(--text-muted); }
@media (min-width: 1024px) {
  .process { grid-template-columns: 1fr 1.15fr; gap: var(--space-24); align-items: start; }
  .process .section-head { margin-bottom: 0; }
}

/* ---------- People ---------- */
.person { display: grid; gap: var(--space-8); align-items: center; }
.person-photo {
  width: 100%; max-width: 380px; aspect-ratio: 4 / 5; object-fit: cover; object-position: center 30%;
  border-radius: var(--radius-md); box-shadow: var(--shadow-medium);
}
.person-body h2 { font-size: var(--text-2xl); }
.person-role { margin-top: var(--space-2); font-weight: 700; color: var(--teal); }
.person-body p:not(.person-role) { color: var(--text-muted); max-width: var(--measure); margin-top: var(--space-4); }
.person-body .person-role + p { margin-top: var(--space-6); }
.person-body .text-link { margin-top: var(--space-6); }
.person-body .skills { font-size: var(--text-sm); margin-top: var(--space-6); }
.skills strong { color: var(--text); }
@media (min-width: 768px) {
  .person { grid-template-columns: minmax(0, 380px) 1fr; gap: var(--space-16); }
}

/* Home page team cards (generated from content/team) */
.people-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-8); grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.person-card { display: grid; gap: var(--space-4); align-content: start; }
.person-card-photo {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover; object-position: center 30%;
  border-radius: var(--radius-md); box-shadow: var(--shadow-low);
}
.person-card h3 { font-size: var(--text-xl); }
.person-card .person-role { margin-top: var(--space-1); }
.person-card-body > p:last-child { margin-top: var(--space-3); color: var(--text-muted); max-width: var(--measure); }
.person-card:not(:has(img)) .person-card-body { border-top: 3px solid var(--blue); padding-top: var(--space-6); }

.team-list { display: grid; gap: var(--space-16); }
.person-text { padding-top: var(--space-16); border-top: 1px solid var(--border); }
@media (min-width: 768px) {
  .person-text .person-body { margin-inline-start: calc(380px + var(--space-16)); }
}

/* ---------- Page header (inner pages) ---------- */
.page-head { background: var(--soft-blue); padding-block: clamp(3.5rem, 2.5rem + 4vw, 6rem) var(--space-12); border-bottom: 1px solid var(--border); }
.page-head h1 { font-size: var(--text-3xl); font-weight: 700; color: var(--ink); letter-spacing: -0.03em; }
.page-head p { margin-top: var(--space-4); font-size: var(--text-lg); color: var(--text-muted); max-width: 40rem; }

/* ---------- Utilities ---------- */
.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;
}
/* Marks unfinished stub content so it can't be mistaken for real information. */
.placeholder {
  display: inline-block; padding: 0 var(--space-2); border: 1px dashed var(--text-muted);
  border-radius: var(--radius-sm); color: var(--text-muted); font-style: italic; font-size: var(--text-sm);
  white-space: nowrap;
}

/* ---------- Services: goal-routing tiles (lift 2px on hover, shadow fades in) ---------- */
.route-tiles { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.tile {
  position: relative; display: flex; flex-direction: column; gap: var(--space-2); height: 100%;
  padding: var(--space-6); text-decoration: none;
  background: var(--surface-raised); border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-low);
  transition: transform var(--duration-fast) var(--ease-out), border-color var(--duration-fast) ease;
}
.tile::after {
  content: ''; position: absolute; inset: -1px; border-radius: inherit; pointer-events: none;
  box-shadow: var(--shadow-medium); opacity: 0;
  transition: opacity var(--duration-fast) ease;
}
.tile:hover { border-color: var(--blue); }
.tile:active { transform: scale(0.99); }
.tile-goal { font-family: var(--font-display); font-size: var(--text-xl); font-weight: 600; line-height: 1.25; color: var(--heading); text-wrap: balance; }
.tile-option { font-size: var(--text-sm); font-weight: 700; color: var(--teal); }
.tile-detail { color: var(--text-muted); }
.route-shortcuts { margin-top: var(--space-8); display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-3) var(--space-8); color: var(--text-muted); }

/* ---------- Services: route sections ---------- */
.route { scroll-margin-top: var(--space-4); }
.route-inner { display: grid; gap: var(--space-8); }
.route-head h2 { font-size: var(--text-2xl); }
.route-head p { margin-top: var(--space-4); color: var(--text-muted); max-width: var(--measure); }
.facts { margin: 0; display: grid; gap: 0; border-top: 1px solid var(--border); }
.facts > div { display: grid; gap: var(--space-1); padding-block: var(--space-4); border-bottom: 1px solid var(--border); }
.facts dt { font-weight: 700; }
.facts dd { margin: 0; color: var(--text-muted); }
.route-inner > .button { justify-self: start; }
@media (min-width: 768px) {
  .facts > div { grid-template-columns: 12rem 1fr; gap: var(--space-6); }
}
@media (min-width: 1024px) {
  .route-inner { grid-template-columns: 1fr 1.2fr; column-gap: var(--space-24); align-items: start; }
  .route-head { grid-row: span 2; }
}

/* ---------- Pricing table ---------- */
.table-wrap { overflow-x: auto; }
.price-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.price-table th, .price-table td { text-align: start; padding: var(--space-4); border-bottom: 1px solid var(--border); vertical-align: top; }
.price-table thead th { font-size: var(--text-sm); color: var(--text-muted); font-weight: 700; border-bottom-width: 2px; border-bottom-color: var(--blue); }
.price-table tbody th { font-weight: 700; }
.price-table th:first-child, .price-table td:first-child { padding-inline-start: 0; }
.table-note { margin-top: var(--space-8); color: var(--text-muted); }

/* ---------- Contact ---------- */
.contact { background: var(--surface-dark); color: var(--text-on-dark); }
.contact-inner { display: grid; gap: var(--space-8); align-items: end; }
.contact h2 { font-size: var(--text-2xl); color: var(--text-on-dark); }
.contact p { margin-top: var(--space-4); color: var(--text-on-dark-muted); max-width: var(--measure); }
.contact-email { color: var(--mint); font-weight: 700; text-underline-offset: 5px; transition: opacity var(--duration-fast) ease; }
.contact-email:hover { opacity: 0.8; }
.contact :focus-visible { outline-color: var(--mint); }
@media (min-width: 768px) { .contact-inner { grid-template-columns: 1fr auto; } }

/* ---------- Footer ---------- */
.site-footer { background: var(--surface-dark); color: var(--text-on-dark-muted); border-top: 1px solid var(--border-on-dark); padding-block: var(--space-8); font-size: var(--text-sm); }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-4) var(--space-8); }
.footer-inner .brand { color: var(--text-on-dark); font-size: 1.0625rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-6); }
.footer-links a { position: relative; text-decoration: none; padding-block: var(--space-2); transition: color var(--duration-fast) ease; }
.footer-links a::after {
  content: ''; position: absolute; inset-inline: 0; bottom: 2px; height: 2px; border-radius: 2px;
  background: var(--mint); transform: scaleX(0); transform-origin: left;
  transition: transform var(--duration-base) var(--ease-out);
}
.footer-links a:hover, .footer-links a[aria-current="page"] { color: var(--text-on-dark); }
.footer-links a:hover::after, .footer-links a:focus-visible::after, .footer-links a[aria-current="page"]::after { transform: scaleX(1); }
.site-footer :focus-visible { outline-color: var(--mint); }

/* ---------- Hover motion only on real pointers (00d: no "hover" animations on tap) ---------- */
@media (hover: hover) and (pointer: fine) {
  .tile:hover { transform: translateY(-2px); }
  .tile:hover::after { opacity: 1; }
  .site-nav a:not(.button):hover::after { transform: scaleX(1); }
}

/* ---------- Mobile navigation ---------- */
@media (max-width: 767px) {
  .menu-toggle {
    display: inline-flex; flex-direction: column; justify-content: center; align-items: center; gap: 5px;
    width: 44px; height: 44px; padding: 0; background: none; cursor: pointer;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    transition: transform var(--duration-fast) var(--ease-out);
  }
  .menu-toggle:active { transform: scale(0.94); }
  .menu-toggle span { width: 18px; height: 2px; background: var(--navy); transition: transform var(--duration-base) var(--ease-out), opacity var(--duration-fast) ease; }
  .menu-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .menu-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .menu-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
  .site-nav {
    display: none; position: absolute; inset-inline: 0; top: 100%;
    flex-direction: column; align-items: stretch; gap: 0;
    padding: var(--space-2) var(--gutter) var(--space-6);
    background: var(--surface-raised); border-bottom: 1px solid var(--border); box-shadow: var(--shadow-medium);
    font-size: var(--text-base);
  }
  .site-nav.is-open { display: flex; animation: menu-in var(--duration-base) var(--ease-out); }
  .site-nav a:not(.button) { padding: var(--space-3) 0; align-self: start; }
  .site-nav a:not(.button)::after { bottom: 8px; }
  .site-nav .button { margin-top: var(--space-3); }
}
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* ---------- Reduced motion: no movement, keep color changes and focus rings ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation: none !important;
    transition-property: color, background-color, border-color, opacity !important;
  }
  .text-link::after, .site-nav a:not(.button)::after, .footer-links a::after { transition: none !important; }
  .button:active, .tile:active, .tile:hover, .menu-toggle:active, .brand:active img { transform: none !important; }
}
