:root {
  --header-height: 64px;
  --color-bg: #ffffff;
  --color-primary: #0f3b4c;   /* logo dark teal */
  --color-accent: #2fa7a0;    /* logo highlight square */
  --color-text: #0f3b4c;
  --color-muted: #6b7c85;
  --color-border: #e2e8ec;
  --max-width: 1100px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
}

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

/* Floating Back to Top link */
#back-to-top {
  display: block;
  position: fixed;
  right: 1.5rem;
  bottom: calc(2.5rem + env(safe-area-inset-bottom));
  z-index: 1000;
  background: var(--color-primary);
  color: #fff;
  padding: 0.75em 1.25em;
  border-radius: 2em;
  box-shadow: 0 4px 16px rgba(15,59,76,0.12);
  font-size: 1.1rem;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, background 0.2s;
}
#back-to-top:hover, #back-to-top:focus {
  background: var(--color-accent);
  opacity: 1;
}
.is-visible#back-to-top {
  opacity: 0.95;
  pointer-events: auto;
}

/* Utility-like helpers used by index.htm (no inline styles) */
.muted { opacity: 0.85; }
.section-kicker {
  opacity: 0.8;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.85rem;
}

/* Skip link visible on keyboard focus */
.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 0.75rem;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  box-shadow: 0 6px 18px rgba(5,50,58,0.06);
  z-index: 9999;
}

header {
  border-bottom: 1px solid var(--color-border);
  background: #ffffffcc;
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  height: var(--header-height);
  z-index: 10;
}

.nav {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.nav-left { display:flex; align-items:center; gap:0.75rem; }

.logo-mark { width:34px; height:34px; display:grid; grid-template-columns:repeat(3,1fr); grid-template-rows:repeat(3,1fr); gap:2px; }
.logo-square { background:var(--color-primary); border-radius:2px; }
.logo-square.highlight { background:var(--color-accent); }
.brand-text { font-weight:700; letter-spacing:0.08em; font-size:0.9rem; text-transform:uppercase; }

.nav-links { display:flex; gap:1rem; font-size:0.95rem; }
.nav-links a { color:var(--color-muted); padding:0.25rem; border-radius:4px; }
.nav-links a:hover, .nav-links a:focus { color:var(--color-accent); outline:none; }
.nav-links a.active { color:var(--color-primary); font-weight:700; }

main { max-width:var(--max-width); margin:0 auto; padding:2.5rem 1.5rem 3.5rem; }

/* HERO */
.hero { margin-bottom:3rem; }
.hero-content { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:2.5rem; align-items:center; }
.hero-text { display:flex; flex-direction:column; justify-content:center; }
.hero-image { display:flex; justify-content:left; align-items:left; }
.hero-image img { width:100%; height:auto; max-width:500px; object-fit:contain; }

.hero-kicker {
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  color: var(--color-accent);
  font-weight: 600;
  margin-bottom: 0.75rem;
}
.hero h1 { font-size:clamp(2rem,3vw + 1rem,3rem); line-height:1.2; margin-bottom:0.75rem; }
.hero p { color:var(--color-muted); margin-bottom:1.2rem; max-width:none; }

.hero-subtitle { margin-bottom: 1.2rem; }
.hero-actions { display:flex; gap:0.75rem; margin-bottom: 1rem; }

/* Hero flow (Clarity → Insight → Confidence → Action) */
.hero-flow{
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: 0.25rem;
  margin-bottom: 0.85rem;
}

.hero-flow .flow-sep{
  opacity: .55;
  font-size: 1rem;
  transform: translateY(-1px);
}

.pill{
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(15,59,76,0.14);
  background: rgba(255,255,255,0.8);
  color: var(--color-primary);
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 8px 18px rgba(5,50,58,0.06);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.pill:hover{
  transform: translateY(-2px);
  border-color: rgba(47,167,160,0.45);
  box-shadow: 0 14px 26px rgba(5,50,58,0.10);
}

.hero-note {
  margin-top: 0.25rem;
  margin-bottom: 0;
  max-width: none;
}

/* Buttons */
.btn-primary, .btn-ghost {
  border-radius:999px;
  padding:0.55rem 1.25rem;
  font-size:0.9rem;
  border:1px solid transparent;
  font-weight:600;
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  transition:all 0.15s ease;
}
.btn-primary { background:#05323a; color:#ffffff; box-shadow:0 6px 18px rgba(5,50,58,0.12); }
.btn-primary:hover { background:#032926; transform:translateY(-1px) scale(1.01); }
.btn-ghost { border-color:var(--color-border); color:var(--color-primary); background:#ffffff; }
.btn-ghost:hover { border-color:var(--color-accent); color:var(--color-accent); }

/* Sections */
section { margin-bottom:3rem; }
section h2 { font-size:1.35rem; margin-bottom:0.6rem; }
section p.lead { color:var(--color-muted); max-width:none; }

.subsection { margin-top: 2rem; }
.subsection h3 { margin-top: 0.25rem; margin-bottom: 0.75rem; }

/* FP&A CTA */
.fpna-cta { margin: 1rem 0; }
.fpna-cta .btn-primary { margin-right: 0.5rem; }

/* Gallery - Masonry layout */
.gallery { margin-top: 0.75rem; }
.gallery-grid { column-count: 4; column-gap: 0.75rem; }
.gallery-item {
  display: inline-block;
  width: 100%;
  margin: 0 0 0.75rem;
  position: relative;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  overflow: hidden;
  background: #ffffff;
  box-shadow: 0 1px 8px rgba(0,0,0,0.04);
  cursor: zoom-in;
  break-inside: avoid;
}
.gallery-item img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
  background: #fff;
  transition: transform 0.18s ease;
}
.gallery-item:hover img,
.gallery-item:focus img { transform: scale(1.01); }
.gallery-item::after {
  content: "View";
  position: absolute;
  inset: auto 0 0 0;
  height: 28px;
  background: linear-gradient(to top, rgba(15,59,76,0.55), rgba(15,59,76,0));
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 0.35rem 0.6rem;
  opacity: 0;
  transition: opacity 0.18s ease;
}
.gallery-item:hover::after,
.gallery-item:focus::after { opacity: 1; }

/* Gallery - Carousel override */
.gallery.carousel .gallery-grid {
  display: flex;
  overflow-x: auto;
  gap: 0.75rem;
  column-count: initial;
  column-gap: initial;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.25rem;
}
.gallery.carousel .gallery-item {
  flex: 0 0 auto;
  width: clamp(320px, 70vw, 880px);
  margin: 0;
  aspect-ratio: 16 / 9;
  scroll-snap-align: center;
}
.gallery.carousel .gallery-item img {
  height: 100%;
  object-fit: contain;
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.82);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  z-index: 9999;
}
.lightbox.open { display: flex; }
.lightbox img {
  max-width: 92vw;
  max-height: 86vh;
  border-radius: 12px;
  box-shadow: 0 18px 48px rgba(0,0,0,0.45);
}
.lightbox .nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  border: 1px solid rgba(255,255,255,0.55);
  background: rgba(255,255,255,0.9);
  color: #0f3b4c;
  border-radius: 999px;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  font-size: 1.2rem;
  font-weight: 900;
  cursor: pointer;
  user-select: none;
}
.lightbox .nav.prev { left: 1rem; }
.lightbox .nav.next { right: 1rem; }
.lightbox button.close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  border: 1px solid rgba(255,255,255,0.65);
  background: rgba(255,255,255,0.92);
  color: #0f3b4c;
  border-radius: 999px;
  padding: 0.35rem 0.65rem;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
}
.lightbox .counter {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}

@media (max-width: 1100px) { .gallery-grid { column-count: 3; } }
@media (max-width: 700px) { .gallery-grid { column-count: 2; } }
@media (max-width: 480px) { .gallery-grid { column-count: 1; } }

/* Cards */
.grid-3 { display:grid; grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); gap:1.25rem; margin-top:1.25rem; }
.card { border-radius:12px; border:1px solid var(--color-border); padding:1.1rem; background:#ffffff; }
.card h3 { font-size:1rem; margin-bottom:0.35rem; }
.card p { font-size:0.88rem; color:var(--color-muted); }

.card-cta { margin-top: 0.75rem; }
.card-footnote { margin-top: 0.75rem; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(15,59,76,0.14);
  background: rgba(255,255,255,0.75);
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}

/* Tables */
.table-wrap { overflow-x: auto; border-radius: 16px; margin-top: 1rem; }
.feature-table { width: 100%; border-collapse: collapse; min-width: 720px; background: #fff; border: 1px solid var(--color-border); border-radius: 12px; overflow: hidden; }
.feature-table th, .feature-table td { padding: 14px 16px; vertical-align: top; border-bottom: 1px solid rgba(0,0,0,0.06); word-break: break-word; }
.feature-table th { text-align: left; font-weight: 700; color: var(--color-primary); background: rgba(15,59,76,0.03); }
.feature-table tr:last-child td { border-bottom: none; }
.feature-table td { color: var(--color-muted); }

/* Ensure description column wraps and is responsive */
.feature-table .desc-col, .feature-table td.desc-col {
  word-break: break-word;
  white-space: normal;
  max-width: 1px;
}

@media (max-width: 800px) {
  .feature-table .desc-col, .feature-table td.desc-col {
    width: 60vw !important;
    min-width: 120px;
    max-width: 100vw;
  }
  .feature-table {
    min-width: 320px;
  }
}
.feature-table td strong { color: var(--color-primary); }

/* Bullets */
.bullets { margin: 0; padding-left: 1.1rem; }
.bullets li { margin: 0.35rem 0; color: var(--color-muted); }
.bullets li strong { color: var(--color-primary); }

/* Steps container and cards */
.steps-container { display:flex; align-items:stretch; gap:1.5rem; margin-top:2rem; position:relative; }

.step-card {
  flex:1;
  border:1px solid var(--color-border);
  border-radius:12px;
  padding:1.5rem;
  background:#ffffff;
  display:flex;
  flex-direction:column;
  align-items:center;
  text-align:center;
  box-shadow:0 2px 8px rgba(0,0,0,0.04);
  transition:all 0.2s ease;
}
.step-card:hover { border-color:var(--color-accent); box-shadow:0 6px 16px rgba(0,0,0,0.08); }

.step-number {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:60px;
  height:60px;
  background:var(--color-primary);
  color:#ffffff;
  border-radius:50%;
  font-weight:700;
  font-size:1.25rem;
  margin-bottom:1rem;
  flex-shrink:0;
}

.step-card h3 { font-size:1rem; margin-bottom:0.5rem; color:var(--color-primary); }
.step-card p { font-size:0.9rem; color:var(--color-muted); line-height:1.5; }

.step-connector {
  position:absolute;
  top:50%;
  left:0;
  right:0;
  height:2px;
  background:linear-gradient(to right, transparent, var(--color-border), transparent);
  pointer-events:none;
  z-index:-1;
}

/* Contact */
#contact .contact-logo { display:block; margin:1rem 0; max-width:260px; width:40%; height:auto; }

.contact-email {
  margin-top: 0.75rem;
  text-align: left;
}

/* Footer */
footer {
  border-top: 1px solid var(--color-border);
  padding: 1.25rem 1.5rem 2rem;
  font-size: 0.78rem;
  color: var(--color-muted);
  text-align: center;
}

.footer-note { margin-top: 0.4rem; }

/* Mobile menu open state */
.nav-links.open { display:flex !important; }

.logo-img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  display: block;
}

/* Responsive */
@media (max-width:1200px) {
  .hero-image img { max-width:400px; }
}

@media (max-width:900px) {
  .steps-container { flex-wrap:wrap; }
  .step-card { flex:0 1 calc(50% - 0.75rem); }
  .step-connector { display:none; }
  .hero-content { grid-template-columns:1fr; }
  .hero-image { order:2; }
  .hero-text { order:1; }
}

@media (max-width:800px) {
  .nav-links { flex-wrap:wrap; gap:0.5rem; font-size:0.85rem; }
}

@media (max-width:640px) {
  .steps-container { flex-direction:column; gap:1rem; }
  .step-card { flex:1 0 100%; }
}

@media (max-width:480px) {
  .hero-image img { max-width:350px; }
}

@media (max-width:380px) {
  :root { --header-height:56px; }
  .brand-text { font-size:0.85rem; }
  .nav { padding:0.4rem 0.75rem; }
  .hero h1 { font-size:clamp(1.5rem,6vw,2rem); }
  #contact .contact-logo { width:40%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
  .step-card { box-shadow:none; }
}