/* ==========================================================================
   Khalifa Solutions — styles
   Tokens follow brand/brand-guide.md. Spacing uses an 8px grid.
   ========================================================================== */

:root {
  --green: #1F4D3A;
  --green-dark: #163828;
  --gold: #C9A24A;
  --sand: #F7F4EC;
  --ink: #1B1F1D;
  --muted: #4E6B5E;
  --line: #E4DFD2;
  --white: #FFFFFF;

  --radius: 12px;
  --radius-sm: 8px;
  --container: 1120px;

  /* Header shrinks slightly once the page is scrolled. */
  --header-h: 76px;
  --header-h-condensed: 60px;

  /* Fluid vertical rhythm, still landing on the 8px grid at each end. */
  --section-y: clamp(72px, 9vw, 128px);
  --gap-lg: clamp(48px, 6vw, 88px);

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);

  --font: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* --------------------------------------------------------------- Base ----- */

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

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

body {
  margin: 0;
  background: var(--white);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.65;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

@media (min-width: 768px) {
  body { font-size: 18px; }
}

img, svg { max-width: 100%; }
img { height: auto; }

h1, h2, h3 {
  margin: 0;
  color: var(--green);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.12;
  text-wrap: balance;
}

h1 {
  font-size: clamp(38px, 5.6vw, 60px);
  letter-spacing: -0.03em;
}

h2 { font-size: clamp(30px, 3.4vw, 40px); }

h3 {
  font-size: 20px;
  line-height: 1.3;
  letter-spacing: -0.015em;
}

@media (min-width: 1024px) {
  h3 { font-size: 22px; }
}

p { margin: 0; text-wrap: pretty; }

a { color: var(--green); }

ul, ol, dl, dd { margin: 0; padding: 0; }
li { list-style: none; }

:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px;
  border-radius: 2px;
}

/* Sections get focus programmatically after an in-page jump; they are not
   controls, so they do not need a focus ring of their own. */
section[tabindex="-1"]:focus,
section[tabindex="-1"]:focus-visible { outline: none; }

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: 20px;
}

@media (min-width: 768px) {
  .container { padding-inline: 40px; }
}

.eyebrow {
  margin-bottom: 20px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.12em;
  line-height: 1.4;
  text-transform: uppercase;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -200%;
  z-index: 100;
  padding: 10px 16px;
  background: var(--green);
  border-radius: var(--radius-sm);
  color: var(--white);
  font-weight: 500;
  text-decoration: none;
}

.skip-link:focus { top: 12px; }

/* ------------------------------------------------------------- Buttons ---- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 26px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.005em;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s var(--ease), transform 0.2s var(--ease);
}

.btn-primary {
  background: var(--green);
  color: var(--white);
}

.btn-primary:hover {
  background: var(--green-dark);
  transform: translateY(-1px);
}

.btn-primary:active { transform: none; }

.btn-sm {
  min-height: 42px;
  padding: 9px 18px;
  font-size: 15px;
}

/* Text link with an arrow and an underline that grows in from the left. */
.link-arrow {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  font-weight: 500;
  text-decoration: none;
}

.link-arrow::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 12px;
  height: 1px;
  background: currentColor;
  transform-origin: left;
  opacity: 0.28;
  transition: opacity 0.25s var(--ease);
}

.link-arrow:hover::after,
.link-arrow:focus-visible::after { opacity: 1; }

.link-arrow span { transition: transform 0.3s var(--ease); }
.link-arrow:hover span { transform: translateX(4px); }

/* -------------------------------------------------------------- Header ---- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s var(--ease), background-color 0.25s var(--ease);
}

/* Browsers without backdrop-filter get a solid bar instead of a washed-out one. */
@supports not ((backdrop-filter: blur(10px)) or (-webkit-backdrop-filter: blur(10px))) {
  .site-header { background: var(--white); }
}

.site-header.is-scrolled {
  background: rgba(255, 255, 255, 0.94);
  border-bottom-color: var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: var(--header-h);
  transition: min-height 0.25s var(--ease);
}

.site-header.is-scrolled .header-inner { min-height: var(--header-h-condensed); }

.brand {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
}

.brand img {
  width: auto;
  height: 28px;
  display: block;
  transition: height 0.25s var(--ease);
}

@media (min-width: 768px) {
  .brand img { height: 32px; }
  .site-header.is-scrolled .brand img { height: 28px; }
}

.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--green);
  cursor: pointer;
  transition: border-color 0.2s var(--ease);
}

.nav-toggle:hover { border-color: var(--muted); }

.nav-toggle-bars {
  display: block;
  width: 18px;
}

.nav-toggle-bars span {
  display: block;
  height: 1.75px;
  background: currentColor;
  border-radius: 2px;
  transition: transform 0.25s var(--ease), opacity 0.2s var(--ease);
}

.nav-toggle-bars span + span { margin-top: 4px; }

/* Bars fold into an X while the menu is open. */
.nav-toggle[aria-expanded="true"] .nav-toggle-bars span:nth-child(1) { transform: translateY(5.75px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars span:nth-child(3) { transform: translateY(-5.75px) rotate(-45deg); }

.primary-nav { display: none; }

.primary-nav.is-open {
  display: block;
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  padding: 8px 20px 28px;
  background: var(--white);
  border-bottom: 1px solid var(--line);
  animation: menu-in 0.22s var(--ease) both;
}

@keyframes menu-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-list a {
  position: relative;
  display: block;
  padding: 10px 0;
  color: var(--ink);
  font-weight: 500;
  text-decoration: none;
  transition: color 0.2s var(--ease);
}

.nav-list a:hover { color: var(--green); }
.nav-list a.is-active { color: var(--green); }

.nav-cta { margin-top: 20px; }

@media (min-width: 900px) {
  .nav-toggle { display: none; }

  .primary-nav {
    display: flex;
    align-items: center;
    gap: 36px;
  }

  .nav-list {
    flex-direction: row;
    gap: 32px;
  }

  .nav-list a {
    padding: 4px 0;
    font-size: 16px;
  }

  /* Gold underline slides in under the current section's link. */
  .nav-list a::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -2px;
    height: 2px;
    background: var(--gold);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.28s var(--ease);
  }

  .nav-list a:hover::after { transform: scaleX(1); opacity: 0.45; }
  .nav-list a.is-active::after { transform: scaleX(1); opacity: 1; }

  .nav-cta { margin-top: 0; }
}

/* ---------------------------------------------------------------- Hero ---- */

.hero {
  position: relative;
  overflow: hidden;
  padding: clamp(64px, 11vw, 160px) 0 clamp(72px, 12vw, 168px);
}

.hero-inner { position: relative; }

.hero-text {
  position: relative;
  z-index: 1;
  max-width: 620px;
}

.hero h1 { margin-bottom: 28px; }

.hero .lede { max-width: 48ch; }

.lede {
  color: var(--muted);
  font-size: clamp(18px, 1.6vw, 21px);
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 32px;
  margin-top: clamp(32px, 4vw, 48px);
}

.hero-mark { display: none; }

@media (min-width: 1024px) {
  .hero-text { max-width: 720px; }
  .hero .lede { max-width: 46ch; }

  /* The mark bleeds off the right edge on purpose, so it reads as a watermark
     rather than a logo sitting in the corner. */
  .hero-mark {
    display: block;
    position: absolute;
    right: -90px;
    top: 50%;
    width: 440px;
    height: auto;
    transform: translateY(-50%);
    opacity: 0.055;
    pointer-events: none;
  }
}

@media (min-width: 1280px) {
  .hero-mark { width: 520px; right: -110px; }
}

/* ------------------------------------------------------------ Sections ---- */

.section {
  padding: var(--section-y) 0;
  scroll-margin-top: var(--header-h-condensed);
}

.section-sand {
  background: var(--sand);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.section-head {
  max-width: 580px;
  margin-bottom: clamp(40px, 5vw, 72px);
}

/* ------------------------------------------------------------ Services ---- */
/* Hairline cells rather than boxes: the rule does the separating, white space
   does the rest. */

.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  column-gap: var(--gap-lg);
  row-gap: clamp(36px, 4vw, 56px);
}

@media (min-width: 768px) {
  .card-grid { grid-template-columns: repeat(2, 1fr); }
}

.card {
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

.card-icon {
  display: block;
  margin-bottom: 20px;
  color: var(--green);
}

.card-icon svg {
  display: block;
  width: 26px;
  height: 26px;
}

.card h3 { margin-bottom: 12px; }

.card p {
  max-width: 46ch;
  color: var(--muted);
  font-size: 16px;
}

/* ------------------------------------------------------------ Approach ---- */

.steps {
  display: grid;
  grid-template-columns: 1fr;
  column-gap: var(--gap-lg);
  row-gap: clamp(36px, 4vw, 56px);
}

@media (min-width: 768px) {
  .steps { grid-template-columns: repeat(3, 1fr); }
}

.step {
  padding-top: 24px;
  border-top: 1px solid var(--gold); /* thin gold rule: the accent in this section */
}

/* Large but quiet: --muted keeps it readable (5.3:1 on sand) rather than
   a decorative ghost number nobody can make out. */
.step-num {
  display: block;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: clamp(26px, 2.6vw, 32px);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1;
}

.step h3 { margin-bottom: 12px; }

.step p {
  max-width: 42ch;
  color: var(--muted);
  font-size: 16px;
}

/* --------------------------------------------------------------- About ---- */

/* Heading left, text right: an editorial split that reads deliberately
   rather than like a column with something missing. */
.about-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

@media (min-width: 900px) {
  .about-grid {
    grid-template-columns: 1fr 1fr;
    gap: clamp(56px, 7vw, 112px);
    align-items: start;
    padding-top: 28px;
    border-top: 1px solid var(--line);
  }
}

.about-head { max-width: 480px; }

.about-text p {
  max-width: 54ch;
  color: var(--muted);
  font-size: clamp(17px, 1.3vw, 19px);
}

/* ------------------------------------------------------------- Contact ---- */

.contact-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gap-lg);
}

@media (min-width: 900px) {
  .contact-grid {
    grid-template-columns: 1fr 1.05fr;
    gap: clamp(56px, 7vw, 112px);
    align-items: start;
  }
}

.contact-text h2 { margin-bottom: 20px; }

.contact-text > p {
  max-width: 44ch;
  color: var(--muted);
}

.contact-details { margin-top: clamp(32px, 4vw, 48px); }

.detail {
  padding: 18px 0;
  border-top: 1px solid var(--line);
}

.detail:last-child { border-bottom: 1px solid var(--line); }

.detail dt {
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.detail dd {
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.01em;
  overflow-wrap: break-word;
}

.detail a {
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  transition: border-color 0.2s var(--ease);
}

.detail a:hover { border-bottom-color: var(--green); }

.contact-form {
  padding: clamp(24px, 3vw, 36px);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.field { margin-bottom: 20px; }

.field label {
  display: block;
  margin-bottom: 8px;
  color: var(--green);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.optional {
  color: var(--muted);
  font-weight: 400;
}

.field input,
.field textarea {
  display: block;
  width: 100%;
  padding: 13px 14px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-family: inherit;
  font-size: 16px;
  line-height: 1.5;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.field textarea { resize: vertical; min-height: 132px; }

.field input:hover,
.field textarea:hover { border-color: var(--muted); }

.field input:focus,
.field textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(31, 77, 58, 0.12);
  outline: none;
}

.field input:focus-visible,
.field textarea:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 1px;
}

.field-error {
  margin-top: 8px;
  color: #9A2B20;
  font-size: 14px;
  font-weight: 500;
}

.field.has-error input,
.field.has-error textarea { border-color: #9A2B20; }

.field.has-error input:focus,
.field.has-error textarea:focus { box-shadow: 0 0 0 3px rgba(154, 43, 32, 0.12); }

.contact-form .btn { width: 100%; }

@media (min-width: 480px) {
  .contact-form .btn { width: auto; }
}

.form-status {
  margin-top: 20px;
  padding: 14px 16px;
  background: var(--sand);
  border-left: 2px solid var(--gold);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-size: 16px;
}

.form-status.is-error {
  border-left-color: #9A2B20;
  color: #9A2B20;
}

/* -------------------------------------------------------------- Footer ---- */

.site-footer {
  background: var(--green);
  color: var(--white);
  padding: clamp(56px, 7vw, 88px) 0 32px;
}

/* Flex, not grid: the social nav is removed entirely when no URLs are set,
   and the remaining columns should close up rather than leave a hole. */
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 32px 64px;
}

.footer-brand { flex: 1 1 260px; }

.footer-nav,
.footer-social { flex: 0 1 auto; }

.footer-brand img {
  width: auto;
  height: 30px;
  display: block;
  margin-bottom: 16px;
}

.footer-brand p {
  color: rgba(255, 255, 255, 0.78);
  font-size: 16px;
}

.footer-nav ul,
.footer-social ul {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.site-footer a {
  position: relative;
  display: inline-block;
  padding: 1px 0;
  color: var(--white);
  font-size: 16px;
  text-decoration: none;
}

.site-footer a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: currentColor;
  opacity: 0.3;
  transform: scaleX(1);
  transform-origin: left;
  transition: opacity 0.2s var(--ease), background-color 0.2s var(--ease);
}

.site-footer a:hover::after {
  background: var(--gold);
  opacity: 1;
}

.site-footer :focus-visible {
  outline: 2px solid var(--white);
  outline-offset: 3px;
}

.footer-bottom {
  margin-top: clamp(48px, 6vw, 72px);
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
}

.footer-bottom p {
  color: rgba(255, 255, 255, 0.78);
  font-size: 15px;
}

/* -------------------------------------------------------------- Motion ---- */

/* Sections only start hidden once JS has taken over (html.js-reveal),
   so the page is always readable if JS is blocked or fails. */
.js-reveal [data-reveal] {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}

.js-reveal [data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

/* Children of a revealed block arrive one after another. */
.js-reveal [data-reveal] .stagger > * {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.5s var(--ease), transform 0.5s var(--ease);
}

.js-reveal [data-reveal].is-visible .stagger > * {
  opacity: 1;
  transform: none;
}

.js-reveal [data-reveal].is-visible .stagger > *:nth-child(1) { transition-delay: 0.06s; }
.js-reveal [data-reveal].is-visible .stagger > *:nth-child(2) { transition-delay: 0.14s; }
.js-reveal [data-reveal].is-visible .stagger > *:nth-child(3) { transition-delay: 0.22s; }
.js-reveal [data-reveal].is-visible .stagger > *:nth-child(4) { transition-delay: 0.30s; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }

  .js-reveal [data-reveal],
  .js-reveal [data-reveal].is-visible,
  .js-reveal [data-reveal] .stagger > * {
    opacity: 1;
    transform: none;
  }
}
