/* ==========================================================================
   fivenines Consulting: site styles
   Mobile-first, no build step.

   Palette taken from the supplied logo (assets/fivenines-logo.jpg).
   WCAG contrast ratios are measured against the stated background:
     --navy        #001a2e  logo navy; primary. On white about 17.7:1
     --green       #7fae4c  lighter tint of the logo green, used ONLY on navy/dark
                            backgrounds (about 6.8:1 on navy)
     --green-dark  #4a6e2a  logo green; accent text and button fill on light
                            backgrounds (about 5.9:1 with white)
     --green-darker #3a5a20 hover state (about 7.9:1 with white)
     --text        #1c2433  body text on white (about 15:1)
     --muted       #4a5568  secondary text on white / #f4f7fb (about 7:1)
     --on-dark     #d5dde8  body text on navy (about 13:1)
   ========================================================================== */

:root {
  --navy: #001a2e;
  --navy-2: #0b2a45;
  --navy-3: #1d3a57;
  --green: #7fae4c;
  --green-dark: #4a6e2a;
  --green-darker: #3a5a20;
  --text: #1c2433;
  --muted: #4a5568;
  --on-dark: #d5dde8;
  --bg: #ffffff;
  --bg-alt: #f4f7fb;
  --border: #dbe2ec;
  --focus: #ffbf47;

  --font: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0, 26, 46, .06), 0 8px 24px rgba(0, 26, 46, .08);
  --header-h: 68px;
  --logo-h: 52px;
  --container: 1140px;
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 12px);
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
}

h1, h2, h3 { line-height: 1.2; color: var(--navy); margin: 0 0 .6em; font-weight: 700; }
h1 { font-size: clamp(2rem, 6vw, 3.4rem); letter-spacing: -.02em; }
h2 { font-size: clamp(1.6rem, 4vw, 2.3rem); letter-spacing: -.01em; }
h3 { font-size: 1.15rem; font-weight: 600; }
p { margin: 0 0 1em; }
ul { margin: 0; padding: 0; }
img, svg { max-width: 100%; }

a { color: var(--green-dark); text-underline-offset: .2em; }
a:hover { color: var(--green-darker); }

/* Visible, high-contrast focus for keyboard users */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 4px;
}
main:focus { outline: none; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute;
  left: 1rem; top: -100px;
  z-index: 1000;
  padding: .75rem 1rem;
  background: var(--navy);
  color: #fff;
  font-weight: 600;
  border-radius: 0 0 8px 8px;
  text-decoration: none;
}
.skip-link:focus { top: 0; color: #fff; }

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* Visible placeholder marker; remove each one once the fact is confirmed */
.todo {
  display: inline-block;
  padding: 0 .4em;
  font-size: .8em;
  font-weight: 600;
  color: #5c4300;
  background: #fff1c2;
  border: 1px dashed #b08300;
  border-radius: 4px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: .75rem 1.4rem;
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  border: 2px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease, transform .15s ease;
}
.btn--primary { background: var(--green-dark); color: #fff; }
.btn--primary:hover { background: var(--green-darker); color: #fff; }
.btn--ghost { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .7); }
.btn--ghost:hover { background: rgba(255, 255, 255, .1); color: #fff; border-color: #fff; }
.btn--sm { min-height: 42px; padding: .55rem 1.1rem; font-size: .92rem; }

@media (prefers-reduced-motion: no-preference) {
  .btn:hover { transform: translateY(-1px); }
}

/* ---------- Brand / logo ---------- */
/* The logo is a square JPEG on an opaque white background with navy artwork,
   so on dark backgrounds it sits on a white rounded card (.brand--card). */
.brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  line-height: 0;
}
.brand__logo {
  display: block;
  width: var(--logo-h);
  height: var(--logo-h);
  object-fit: contain;
}
.brand--card {
  padding: .4rem;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .25);
}
.brand--card .brand__logo { width: 104px; height: 104px; }
@media (min-width: 900px) {
  :root { --header-h: 80px; --logo-h: 64px; }
  .brand--card .brand__logo { width: 120px; height: 120px; }
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, .97);
  border-bottom: 1px solid var(--border);
  backdrop-filter: saturate(1.2) blur(6px);
}
.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-h);
  gap: .5rem 1rem;
}

.nav-toggle {
  display: none;
  width: 48px; height: 48px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
}
.nav-toggle__bars,
.nav-toggle__bars::before,
.nav-toggle__bars::after {
  display: block;
  width: 22px; height: 2px;
  margin: 0 auto;
  background: var(--navy);
  border-radius: 2px;
  position: relative;
  transition: transform .2s ease, background-color .2s ease;
}
.nav-toggle__bars::before,
.nav-toggle__bars::after { content: ""; position: absolute; left: 0; }
.nav-toggle__bars::before { top: -7px; }
.nav-toggle__bars::after { top: 7px; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars::before { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars::after { transform: translateY(-7px) rotate(-45deg); }

.primary-nav { width: 100%; }
.primary-nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: .25rem 1rem;
  padding-bottom: .75rem;
}
.primary-nav a:not(.btn) {
  display: inline-block;
  padding: .6rem .25rem;
  color: var(--navy);
  font-weight: 500;
  text-decoration: none;
}
.primary-nav a:not(.btn):hover { color: var(--green-dark); text-decoration: underline; }

/* With JS: collapse nav behind the toggle on small screens */
.js .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
.js .primary-nav { display: none; }
.js .primary-nav.is-open { display: block; }
.js .primary-nav ul { flex-direction: column; gap: 0; padding: .25rem 0 1rem; }
.js .primary-nav li { border-top: 1px solid var(--border); }
.js .primary-nav a:not(.btn) { display: block; padding: .85rem 0; }
.js .primary-nav__cta { padding-top: .9rem; }
.js .primary-nav__cta .btn { width: 100%; }

@media (min-width: 900px) {
  .header-inner { flex-wrap: nowrap; }
  .js .nav-toggle { display: none; }
  .primary-nav,
  .js .primary-nav { display: block; width: auto; }
  .primary-nav ul,
  .js .primary-nav ul { flex-direction: row; align-items: center; gap: 1.5rem; padding: 0; }
  .js .primary-nav li { border: 0; }
  .js .primary-nav a:not(.btn) { display: inline-block; padding: .6rem .25rem; }
  .js .primary-nav__cta { padding-top: 0; }
  .js .primary-nav__cta .btn { width: auto; }
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  color: var(--on-dark);
  background:
    radial-gradient(1200px 500px at 85% -10%, rgba(127, 174, 76, .18), transparent 60%),
    linear-gradient(160deg, var(--navy) 0%, var(--navy-2) 100%);
  padding: 4.5rem 0 5rem;
}
.hero__bg {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  opacity: .5;
  pointer-events: none;
}
.hero__links line { stroke: #3a5684; stroke-width: 1.2; }
.hero__nodes circle { fill: #3a5684; }
.hero__nodes--accent circle { fill: var(--green); }
.hero__inner { position: relative; max-width: 860px; margin-left: 0; }
@media (min-width: 1180px) { .hero__inner { margin-left: calc((100% - var(--container)) / 2); } }
.hero h1 { color: #fff; }
.hero__lead { font-size: clamp(1.05rem, 2.2vw, 1.25rem); max-width: 42em; }
.hero__lead strong { color: #fff; }
.hero__actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.75rem; }

@media (min-width: 900px) { .hero { padding: 7rem 0 7.5rem; } }

.eyebrow {
  display: inline-block;
  margin-bottom: .9rem;
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--green);
}
.eyebrow--dark { color: var(--green-dark); }

/* ---------- Trust strip ---------- */
.trust { background: var(--bg-alt); border-bottom: 1px solid var(--border); }
.trust__list {
  list-style: none;
  display: grid;
  gap: 1rem;
  padding-top: 1.5rem;
  padding-bottom: 1.5rem;
}
.trust__item { display: flex; align-items: flex-start; gap: .75rem; color: var(--muted); font-size: .95rem; }
.trust__item strong { display: block; color: var(--navy); }
.trust__icon { flex: 0 0 28px; width: 28px; height: 28px; fill: var(--green-dark); margin-top: .1rem; }
@media (min-width: 768px) { .trust__list { grid-template-columns: repeat(3, 1fr); gap: 2rem; } }

/* ---------- Sections ---------- */
.section { padding: 4rem 0; }
.section--alt { background: var(--bg-alt); }
.section__head { max-width: 720px; margin-bottom: 2.5rem; }
.section__intro { color: var(--muted); font-size: 1.05rem; }
@media (min-width: 900px) { .section { padding: 6rem 0; } }

/* ---------- Service cards ---------- */
.cards { display: grid; gap: 1.25rem; }
.card {
  display: flex;
  flex-direction: column;
  padding: 1.75rem;
  background: #fff;
  border: 1px solid var(--border);
  border-top: 4px solid var(--green-dark);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card p { color: var(--muted); }
.card p:last-child { margin-bottom: 0; }

.card--flagship {
  position: relative;
  color: var(--on-dark);
  background:
    radial-gradient(600px 300px at 100% 0%, rgba(127, 174, 76, .2), transparent 60%),
    var(--navy);
  border: 0;
  border-top: 4px solid var(--green);
}
.card--flagship h3 { color: #fff; font-size: 1.5rem; }
.card--flagship p { color: var(--on-dark); }
.card__badge {
  align-self: flex-start;
  padding: .25rem .7rem;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--navy);
  background: var(--green);
  border-radius: 999px;
}
.card__list {
  list-style: none;
  display: grid;
  gap: .5rem;
  margin: .5rem 0 1.5rem;
}
.card__list li { position: relative; padding-left: 1.6rem; color: #fff; }
.card__list li::before {
  content: "";
  position: absolute;
  left: 0; top: .5em;
  width: .7rem; height: .7rem;
  border-radius: 50%;
  border: 2px solid var(--green);
}
.card__link { margin-top: auto; color: var(--green); font-weight: 600; }
.card__link:hover { color: #fff; }

@media (min-width: 640px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
  .card--flagship { grid-column: 1 / -1; }
  .card__list { grid-template-columns: repeat(2, 1fr); column-gap: 1.5rem; }
}
@media (min-width: 1000px) {
  .cards { grid-template-columns: repeat(3, 1fr); }
  .card--flagship { grid-column: 1 / span 2; grid-row: span 2; padding: 2.5rem; }
  /* 3-col grid: flagship (2x2) + 5 cards fill 3 rows; the 7th card spans the last row */
  .card--wide { grid-column: 1 / -1; }
}

/* ---------- Expertise chips ---------- */
.skills { display: grid; gap: 1.5rem; }
.skills__group {
  padding: 1.5rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.skills__group h3 { font-size: 1rem; margin-bottom: 1rem; }
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem; }
.chips li {
  padding: .35rem .85rem;
  font-size: .9rem;
  font-weight: 500;
  color: var(--navy);
  background: #eef4e7;
  border: 1px solid #cfe0bc;
  border-radius: 999px;
}
@media (min-width: 768px) {
  .skills { grid-template-columns: repeat(2, 1fr); }
  .skills__group--wide { grid-column: 1 / -1; }
}

/* ---------- Why fivenines ---------- */
.why { list-style: none; display: grid; gap: 1.5rem; }
.why__item { position: relative; padding-top: 3.5rem; }
.why__num {
  position: absolute;
  top: 0; left: 0;
  display: grid;
  place-items: center;
  width: 2.75rem; height: 2.75rem;
  font-weight: 700;
  font-size: 1.3rem;
  color: #fff;
  background: var(--navy);
  border-radius: 10px;
}
.why__item:nth-child(even) .why__num { background: var(--green-dark); }
.why__item p { color: var(--muted); }
/* Five points: 2 per row (last one centred), then 3 + 2 (second row centred),
   then a single row of 5. Half-width "slots" (span 2) make the centring exact. */
@media (min-width: 640px) {
  .why { grid-template-columns: repeat(4, 1fr); gap: 2rem; }
  .why__item { grid-column: span 2; }
  .why__item:last-child:nth-child(odd) { grid-column: 2 / span 2; }
}
@media (min-width: 1000px) {
  .why { grid-template-columns: repeat(6, 1fr); }
  .why__item:last-child:nth-child(odd) { grid-column: auto / span 2; }
  .why__item:nth-child(3n+1):nth-last-child(2) { grid-column: 2 / span 2; }
}
@media (min-width: 1200px) {
  .why { grid-template-columns: repeat(5, 1fr); }
  .why__item,
  .why__item:last-child:nth-child(odd),
  .why__item:nth-child(3n+1):nth-last-child(2) { grid-column: auto; }
}

/* ---------- About ---------- */
.about { display: grid; gap: 2rem; align-items: start; }
.about__avatar {
  display: block;
  width: 140px; height: 140px;
  object-fit: cover;
  background: var(--navy);   /* shown while the lazy-loaded photo arrives */
  border-radius: 50%;
  box-shadow: 0 0 0 6px #fff, 0 0 0 8px var(--green-dark);
}
.about__body { max-width: 720px; }
.about__body h2 { margin-bottom: .2rem; }
.about__role { font-weight: 600; color: var(--green-dark); margin-bottom: 1.25rem; }
.about__note { font-size: .875rem; color: var(--muted); }
.text-link { font-weight: 600; }
@media (min-width: 768px) {
  .about { grid-template-columns: 200px 1fr; gap: 3rem; }
  .about__avatar { width: 180px; height: 180px; }
}

/* ---------- Contact ---------- */
.contact {
  color: var(--on-dark);
  background: linear-gradient(160deg, var(--navy) 0%, var(--navy-2) 100%);
}
.contact h2 { color: #fff; }
.contact a { color: #a9cf7f; }           /* about 10:1 on navy */
.contact a:hover { color: #fff; }
.contact .todo { color: #5c4300; }
.contact__inner { display: grid; gap: 2.5rem; }
.contact__list { list-style: none; display: grid; gap: 1rem; margin-top: 1.5rem; }
.contact__list li { display: grid; gap: .1rem; }
.contact__label {
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--green);
}
.contact__list a, .contact__list span:not(.contact__label):not(.todo) { font-size: 1.1rem; color: #fff; }
.contact__list a { text-decoration: underline; text-decoration-color: var(--green); }

.contact-form[hidden] { display: none; } /* author display:grid would beat the UA [hidden] rule */
.contact-form {
  display: grid;
  gap: 1rem;
  padding: 1.75rem;
  background: #fff;
  color: var(--text);
  border-radius: var(--radius);
  box-shadow: 0 20px 40px rgba(0, 0, 0, .25);
}
.field { display: grid; gap: .35rem; }
.field label { font-weight: 600; color: var(--navy); font-size: .95rem; }
.req { color: #b3261e; }
.field input,
.field textarea {
  width: 100%;
  padding: .75rem .9rem;
  font: inherit;
  font-size: 1rem;              /* 16px+ prevents iOS zoom-on-focus */
  color: var(--text);
  background: #fff;
  border: 1px solid #6b778a;    /* about 4.6:1 against white (non-text needs 3:1) */
  border-radius: 8px;
}
.field textarea { resize: vertical; min-height: 140px; }
.field input:focus-visible,
.field textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; border-color: var(--navy); }
.form-note { margin: 0; font-size: .85rem; color: var(--muted); }
.contact-form .btn { justify-self: start; }
.contact-form .btn:disabled { opacity: .6; cursor: wait; }

/* Turnstile widget: reserve its height (65px) so the layout doesn't jump when it loads */
.cf-turnstile { min-height: 65px; }

/* Submission status (role="status"); hidden until there is something to say */
.form-status {
  margin: 0;
  padding: .75rem 1rem;
  font-size: .95rem;
  border-left: 4px solid var(--border);
  border-radius: 8px;
  background: var(--bg-alt);
  color: var(--text);
}
.form-status[hidden] { display: none; }
.form-status--ok { border-left-color: var(--green-dark); color: var(--green-darker); }
.form-status--error { border-left-color: #b3261e; color: #8c1d18; background: #fdf1f0; }

/* Success panel: replaces the form after a successful send (main.js), or is
   revealed by :target without JS (the Worker 303s to /?sent=1#form-success). */
.form-success {
  padding: 1.75rem;
  background: #fff;
  color: var(--text);
  border-left: 6px solid var(--green-dark);
  border-radius: var(--radius);
  box-shadow: 0 20px 40px rgba(0, 0, 0, .25);
}
.form-success__title { margin: 0 0 .5rem; color: var(--green-darker); }
.form-success a { color: var(--green-darker); }
.form-success:focus { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ----- No-JS fallbacks (html without the .js class set by the head script) -----
   The Worker's plain-form 303 carries a fragment (#form-success or
   #form-error-<reason>); :target reveals the matching element and the browser
   scrolls to it, so feedback works with JavaScript disabled or stale. */
.nojs-error { display: none; }
html:not(.js) #form-success:target { display: block; }
html:not(.js) #form-success:target ~ .contact-form { display: none; }
html:not(.js) .nojs-error:target { display: block; }

/* Honeypot: off-screen rather than display:none so naive bots still see it */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

@media (min-width: 900px) {
  .contact__inner { grid-template-columns: 1fr 1.1fr; gap: 4rem; align-items: start; }
}

/* ---------- Footer ---------- */
.site-footer {
  padding: 2.5rem 0;
  color: var(--on-dark);
  background: #00121f;
  border-top: 1px solid var(--navy-3);
}
.footer-inner { display: grid; gap: 1.5rem; }
.footer-tagline { margin: .9rem 0 0; color: var(--green); font-weight: 500; }
.footer-links { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; }
.footer-links a { color: #fff; }
.footer-links a:hover { color: var(--green); }
.footer-copy { margin: 0; font-size: .875rem; color: #aab6c8; }  /* about 9:1 on #00121f */
@media (min-width: 900px) {
  .footer-inner { grid-template-columns: 1fr auto; align-items: center; }
  .footer-copy { grid-column: 1 / -1; padding-top: 1.25rem; border-top: 1px solid var(--navy-3); }
}

/* ---------- Motion preference ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
