/* style.css — Apalala static site.
   Consumes css/tokens.css custom properties ONLY (data-model §E6):
   zero raw color literals in this file; translucent paints are
   color-mix() over tokens. Component shapes follow getphishingundercontrol.com
   per design-tokens.md binding rule 2. No JS-dependent layout. */

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

* {
  margin: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--c-ink);
  background: var(--c-white);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-wrap: break-word;
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

ul[class],
ol[class] {
  list-style: none;
  padding: 0;
}

::selection {
  background: var(--c-teal-200);
  color: var(--c-teal-950);
}

/* Headings and anchor targets clear the sticky header (--header-h). */
h1, h2, h3, h4, h5, h6,
[id] {
  scroll-margin-top: calc(var(--header-h) + var(--s-3));
}

/* ----- Typography ----- */
h1, h2, h3, h4 {
  font-family: var(--font-head);
  line-height: var(--lh-head);
  color: var(--c-teal-800);
  font-weight: 600;
  text-wrap: balance;
}

h1 {
  font-size: var(--fs-hero);
  color: var(--c-teal-950);
}

h2 {
  font-size: var(--fs-h2);
}

h3 {
  font-size: var(--fs-h3);
}

p {
  text-wrap: pretty;
}

a {
  color: var(--c-teal-800);
  text-decoration: underline;
  text-underline-offset: var(--s-1);
  transition: color 180ms ease-out;
}

a:hover {
  color: var(--c-teal-950);
}

/* ----- Focus ring (dual-layer, ≥3:1 on light and teal-950 surfaces) -----
   Light surfaces: orange-400 ring over a teal-950 separator halo —
   teal-950 vs white = 13.9:1, orange-400 vs teal-950 = 6.2:1.
   Dark surfaces: teal-200 ring over an orange-400 halo —
   teal-200 vs teal-950 = 7.8:1, orange-400 vs teal-950 = 6.2:1. */
:where(a, button, summary, input, textarea, select, [tabindex]):focus-visible {
  outline: 2px solid var(--c-orange-400);
  outline-offset: 2px;
  border-radius: var(--r-sm);
  box-shadow: 0 0 0 2px var(--c-teal-950);
}

.site-header :focus-visible,
.cta-band :focus-visible,
.site-footer :focus-visible {
  outline-color: var(--c-teal-200);
  box-shadow: 0 0 0 2px var(--c-orange-400);
}

/* ----- Skip link ----- */
.skip-link {
  position: fixed;
  top: var(--s-2);
  left: var(--s-2);
  z-index: 100;
  padding: var(--s-2) var(--s-3);
  background: var(--c-orange-400);
  color: var(--c-teal-950);
  font-family: var(--font-head);
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--r-sm);
  transform: translateY(calc(-100% - var(--s-4)));
  transition: transform 150ms ease-out;
}

.skip-link:focus-visible {
  transform: none;
}

/* ----- Layout helpers ----- */
.container {
  width: min(var(--container), 100% - (var(--s-4) * 2));
  margin-inline: auto;
}

section {
  padding-block: var(--s-7);
}

/* Alternating rhythm: white → mist → paper → teal-950 (contract rule 4). */
.section--alt {
  background: var(--c-mist);
}

.section--warm {
  background: var(--c-paper);
}

.section--dark {
  background: var(--c-teal-950);
  color: var(--c-white);
}

.section--dark h2,
.section--dark h3 {
  color: var(--c-white);
}

.section-head {
  max-width: min(760px, 100%);
  margin-bottom: var(--s-5);
}

.section-head p {
  color: var(--c-gray-600);
}

/* ----- Buttons ----- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-5);
  border: 0;
  border-radius: var(--r-pill);
  font-family: var(--font-head);
  font-weight: 600;
  font-size: var(--fs-body);
  min-height: var(--tap);
  text-decoration: none;
  cursor: pointer;
  transition: transform 180ms ease-out,
              background-color 180ms ease-out,
              color 180ms ease-out;
}

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

.btn:active {
  transform: translateY(0) scale(0.98);
}

/* Orange pill. Ink is teal-950 (6.2:1 on orange-400) — white text on
   orange fails AA, so the pill uses the dark brand ink for contrast. */
.btn-primary {
  background: var(--c-orange-400);
  color: var(--c-teal-950);
}

.btn-primary:hover,
.btn-primary:focus-visible {
  background: var(--c-orange-600);
  color: var(--c-teal-950);
}

/* ----- Sticky header ----- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--c-ming-dark); /* solid official Ming green — translucency washed it over white pages (owner feedback 2026-10-05) */
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid color-mix(in srgb, var(--c-white) 14%, transparent);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-5);
  min-height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.brand img {
  height: var(--s-5);
  width: auto;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--s-4);
}

.nav-links a:not(.btn) {
  font-family: var(--font-head);
  font-weight: 500;
  color: color-mix(in srgb, var(--c-white) 92%, transparent);
  text-decoration: none;
}

.nav-links a:not(.btn):hover {
  color: var(--c-white);
  border-bottom: 2px solid var(--c-orange-400);
}

.nav-links a[aria-current="page"] {
  color: var(--c-white);
  font-weight: 600;
  border-bottom: 2px solid var(--c-orange-400);
}

.nav-links .btn {
  padding: var(--s-2) var(--s-4);
}

/* Mobile disclosure — same items, works with JS disabled (research R5). */
.nav-menu {
  display: none;
  position: relative;
}

.nav-menu summary {
  display: flex;
  align-items: center;
  min-height: var(--tap);
  font-family: var(--font-head);
  font-weight: 600;
  color: var(--c-white);
  cursor: pointer;
  list-style: none;
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-sm);
  background: color-mix(in srgb, var(--c-white) 10%, transparent);
}

.nav-menu summary::-webkit-details-marker {
  display: none;
}

.nav-menu ul {
  position: fixed;
  top: var(--header-h);
  left: 0;
  right: 0;
  display: grid;
  gap: var(--s-1);
  padding: var(--s-3) var(--s-4) var(--s-4);
  background: var(--c-teal-950);
  border-top: 1px solid color-mix(in srgb, var(--c-white) 14%, transparent);
}

.nav-menu a:not(.btn) {
  display: flex;
  align-items: center;
  min-height: var(--tap);
  padding: var(--s-2) var(--s-3);
  font-family: var(--font-head);
  font-weight: 500;
  color: color-mix(in srgb, var(--c-white) 92%, transparent);
  text-decoration: none;
}

.nav-menu a:not(.btn):hover {
  color: var(--c-orange-400);
}

.nav-menu .btn {
  margin-top: var(--s-2);
}

/* ----- Stats (big number + caption) ----- */
.stat {
  display: grid;
  gap: var(--s-1);
}

.stat-num {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: var(--fs-stat);
  line-height: 1;
  color: var(--c-teal-800);
}

.stat-label {
  font-size: var(--fs-small);
  color: var(--c-gray-600);
  max-width: 16ch;
}

.cta-band .stat-num,
.section--dark .stat-num {
  color: var(--c-lime-400);
}

.cta-band .stat-label,
.section--dark .stat-label {
  color: var(--c-teal-200);
  max-width: none;
}

/* ----- Cards ----- */
.card {
  background: var(--c-white);
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  padding: var(--s-5);
  box-shadow: var(--shadow-card);
  transition: transform 200ms ease-out;
}

.card h3 {
  margin-bottom: var(--s-2);
}

.card p {
  color: var(--c-gray-600);
}

/* ----- Phases (numbered card grid) ----- */
.phase-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(var(--container) / 3, 100%), 1fr));
  gap: var(--s-3);
  counter-reset: phase;
}

.phase {
  counter-increment: phase;
  position: relative;
  background: var(--c-white);
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  padding: var(--s-5) var(--s-5) var(--s-5) calc(var(--s-6) + var(--s-5));
  box-shadow: var(--shadow-card);
}

.phase::before {
  content: counter(phase);
  position: absolute;
  top: var(--s-5);
  left: var(--s-4);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--s-6);
  height: var(--s-6);
  border-radius: var(--r-pill);
  background: var(--c-teal-800);
  color: var(--c-white);
  font-family: var(--font-head);
  font-weight: 700;
}

.phase:nth-child(even)::before {
  background: var(--c-orange-400);
  color: var(--c-teal-950);
}

.phase h3 {
  margin-bottom: var(--s-1);
}

.phase p {
  color: var(--c-gray-600);
}

/* ----- CTA band (full-width teal-950) ----- */
.cta-band {
  background: var(--c-teal-950);
  color: var(--c-white);
  text-align: center;
  padding-block: var(--s-7);
}

.cta-band h2 {
  color: var(--c-white);
  margin-bottom: var(--s-3);
}

.cta-band p {
  color: var(--c-teal-200);
  max-width: min(620px, 100%);
  margin-inline: auto;
}

.cta-band .btn {
  margin-top: var(--s-4);
}

/* ----- Footer ----- */
.site-footer {
  background: var(--c-teal-950);
  color: var(--c-teal-200);
  padding-block: var(--s-6);
  font-size: var(--fs-small);
}

.footer-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--s-5);
}

.footer-grid > * {
  min-width: 0;
}

.site-footer strong {
  color: var(--c-white);
  font-family: var(--font-head);
}

.site-footer address {
  font-style: normal;
}

.site-footer a {
  color: var(--c-teal-200);
  overflow-wrap: anywhere;
}

.site-footer a:hover {
  color: var(--c-orange-400);
}

.footer-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3);
  margin-bottom: var(--s-3);
}

@media (min-width: 768px) {
  .footer-nav ul {
    flex-wrap: nowrap;
    align-items: baseline;
  }
}

/* ----- Contact page: details + map, mailto form ----- */

.contact-grid {
  display: grid;
  gap: var(--s-5);
  align-items: start;
}

@media (min-width: 900px) {
  .contact-grid {
    grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  }
}

.map-card address p {
  color: var(--c-teal-600);
}

.contact-form {
  display: grid;
  gap: var(--s-4);
  max-width: 42rem;
}

.field {
  display: grid;
  gap: var(--s-1);
}

.field label {
  font-weight: 600;
  color: var(--c-ink);
}

.field input,
.field textarea {
  font: inherit;
  color: var(--c-ink);
  background: var(--c-white);
  border: 1px solid var(--c-teal-800);
  border-radius: var(--r-md);
  padding: var(--s-2) var(--s-3);
}

.field textarea {
  resize: vertical;
}

.contact-form .btn {
  justify-self: start;
}

/* ----- Tables (privacy.html per-app overview) -----
   .table-wrap is the horizontal-scroll pattern: wrap any <table> in
   <div class="table-wrap" tabindex="0" role="region"
   aria-label="…"> so narrow viewports scroll instead of overflowing. */
table {
  border-collapse: collapse;
  width: 100%;
  font-size: var(--fs-small);
}

caption {
  caption-side: top;
  text-align: left;
  padding: var(--s-3);
  color: var(--c-gray-600);
  font-size: var(--fs-small);
}

th,
td {
  padding: var(--s-3);
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--c-line);
}

thead th {
  font-family: var(--font-head);
  font-weight: 600;
  color: var(--c-teal-800);
  background: var(--c-haze);
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
}

.table-wrap > table {
  min-width: 640px;
  border: 0;
}

/* ----- Responsive ----- */
@media (max-width: 640px) {
  .container {
    width: min(var(--container), 100% - (var(--s-3) * 2));
  }

  .nav-links {
    display: none;
  }

  .nav-menu {
    display: block;
  }

  section {
    padding-block: var(--s-6);
  }

  .phase {
    padding: var(--s-4);
  }

  .phase::before {
    position: static;
    margin-bottom: var(--s-3);
  }
}

@media (hover: hover) {
  .card:hover,
  .phase:hover {
    transform: translateY(-4px);
  }
}

/* ----- Reduced motion (site-map invariants) ----- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }

  .btn:hover,
  .btn:active,
  .card:hover,
  .phase:hover {
    transform: none;
  }
}

/* =====================================================================
   Page-layout additions for index.html (T009) and services.html (T010).
   Token-only: var(--) and color-mix() paints, var(--s-*) spacing,
   font tokens for typography. Mobile-first: single column until 768px.
   ===================================================================== */

/* ----- Hero: text left / photo right ----- */
.hero-grid {
  display: grid;
  gap: var(--s-5);
  align-items: center;
}

.hero-kicker,
.section-tag {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: var(--fs-small);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--c-teal-600);
}

.section-tag {
  display: block;
  margin-bottom: var(--s-2);
}

.card .section-tag {
  color: var(--c-teal-500);
}

.hero-sub {
  color: var(--c-gray-600);
  max-width: 60ch;
}

.hero-ctas {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3);
  margin-top: var(--s-4);
}

.btn-ghost {
  background: transparent;
  color: var(--c-teal-800);
  box-shadow: inset 0 0 0 2px var(--c-teal-200);
}

.btn-ghost:hover,
.btn-ghost:focus-visible {
  color: var(--c-teal-950);
  box-shadow: inset 0 0 0 2px var(--c-teal-400);
}

.hero-media img,
.split-media img {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--r-md);
  box-shadow: var(--shadow-card);
}

/* ----- Big-number stat row (hero) ----- */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr));
  gap: var(--s-3);
  margin-top: var(--s-5);
  padding-top: var(--s-4);
  border-top: 1px solid var(--c-line);
}

/* ----- Two-column image + copy splits ----- */
.split {
  display: grid;
  gap: var(--s-5);
  align-items: center;
}

.split-copy p {
  color: var(--c-gray-600);
}

.split-copy p + p {
  margin-top: var(--s-3);
}

/* ----- Card grids (pillar value statements, service catalog) ----- */
.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s-3);
  margin-top: var(--s-5);
}

.card-grid p {
  font-weight: 500;
}

/* ----- CTA band inner rhythm ----- */
.cta-band .container {
  display: grid;
  justify-items: center;
  gap: var(--s-2);
}

/* ----- Desktop: two-column hero, splits and grids ----- */
@media (min-width: 768px) {
  .hero-grid {
    grid-template-columns: 1.05fr 0.95fr;
    gap: var(--s-6);
  }

  .split {
    grid-template-columns: 1fr 1fr;
    gap: var(--s-6);
  }

  .split--rev .split-media {
    order: -1;
  }

  .split .card-grid {
    margin-top: 0;
  }

  .card-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(var(--container) / 3, 100%), 1fr));
    gap: var(--s-4);
  }

  .stat-row {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--s-5);
  }
}

@media (hover: hover) {
  .split-media img {
    transition: transform 200ms ease-out;
  }

  .split-media img:hover {
    transform: translateY(-4px);
  }
}
