/* ==========================================================================
   CCFM — Core-Competence Facility Management Limited
   Single stylesheet. All theming lives in the :root token block below.
   Swap the brand by editing tokens only — no markup changes required.
   ========================================================================== */

/* ---------- Design tokens (LIGHT / default theme) ---------- */
:root {
  /* Brand palette — corporate blue + steel */
  --color-primary:        #0f2b5b;   /* deep navy */
  --color-primary-dark:   #091d3f;
  --color-primary-light:  #1c477f;
  --color-accent:         #f2a413;   /* amber */
  --color-accent-dark:    #d68a00;

  /* Surfaces & text */
  --color-bg:             #ffffff;
  --color-bg-alt:         #f4f6fa;   /* section banding */
  --color-surface:        #ffffff;   /* cards */
  --color-surface-2:      #eef2f8;
  --color-border:         #dbe2ec;
  --color-text:           #17233a;
  --color-heading:        #0f2b5b;
  --color-muted:          #56637a;
  --color-on-primary:     #ffffff;

  /* Hero overlay */
  --hero-overlay: linear-gradient(115deg, rgba(9,29,63,.94) 0%, rgba(15,43,91,.86) 45%, rgba(28,71,127,.72) 100%);

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, "Noto Sans", sans-serif;
  --fs-hero: clamp(2.1rem, 5vw, 3.5rem);
  --fs-h2:   clamp(1.6rem, 3.2vw, 2.4rem);
  --fs-h3:   1.25rem;
  --lh:      1.65;

  /* Layout */
  --maxw:      1160px;
  --gutter:    clamp(1.1rem, 4vw, 2.5rem);
  --radius:    14px;
  --radius-sm: 9px;
  --shadow:    0 10px 30px -12px rgba(15, 43, 91, .22);
  --shadow-lg: 0 24px 60px -20px rgba(15, 43, 91, .30);
  --ring:      0 0 0 3px rgba(242, 164, 19, .45);
  --transition: 200ms ease;
}

/* ---------- Dark theme overrides (same token names) ---------- */
:root[data-theme="dark"] {
  --color-primary:        #4f86d6;
  --color-primary-dark:   #3a6fbd;
  --color-primary-light:  #6f9fe0;
  --color-accent:         #ffb733;
  --color-accent-dark:    #e79f14;

  --color-bg:             #0c1626;
  --color-bg-alt:         #111f34;
  --color-surface:        #14243c;
  --color-surface-2:      #1b3050;
  --color-border:         #26385a;
  --color-text:           #dce6f5;
  --color-heading:        #eaf1fb;
  --color-muted:          #9aabc6;
  --color-on-primary:     #0c1626;

  --hero-overlay: linear-gradient(115deg, rgba(6,14,26,.96) 0%, rgba(12,26,46,.90) 45%, rgba(20,40,68,.80) 100%);
  --shadow:    0 10px 30px -12px rgba(0,0,0,.55);
  --shadow-lg: 0 24px 60px -20px rgba(0,0,0,.65);
}

/* ---------- Reset-ish base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

/* ---------- Overflow guards (never let anything cause a horizontal scrollbar) ---------- */
/* overflow-x: clip prevents sideways scroll WITHOUT breaking the sticky header (unlike overflow:hidden). */
html, body { overflow-x: clip; max-width: 100%; }
img, svg, iframe, video, table { max-width: 100%; }
/* Grid/flex children default to min-width:auto, which lets long content blow out the row — reset it. */
.grid > *, .split > *, .stats > *, .footer-grid > *, .contact-grid > *, .field-row > *, .nav > * { min-width: 0; }
h1, h2, h3, h4, .lead, p, a { overflow-wrap: break-word; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: var(--lh);
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  transition: background var(--transition), color var(--transition);
}
img { max-width: 100%; display: block; }
a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { color: var(--color-heading); line-height: 1.2; margin: 0 0 .6em; }
p { margin: 0 0 1rem; }
ul { margin: 0 0 1rem; padding-left: 1.2rem; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 4px; }

/* ---------- Layout helpers ---------- */
.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }
.section { padding-block: clamp(3rem, 7vw, 5.5rem); }
.section--alt { background: var(--color-bg-alt); }
.section__head { max-width: 760px; margin-bottom: 2.4rem; }
.section__head.center { margin-inline: auto; text-align: center; }
.eyebrow {
  display: inline-block; font-size: .78rem; font-weight: 700; letter-spacing: .13em;
  text-transform: uppercase; color: var(--color-accent-dark); margin-bottom: .7rem;
}
:root[data-theme="dark"] .eyebrow { color: var(--color-accent); }
h2.section__title { font-size: var(--fs-h2); }
.lead { font-size: 1.13rem; color: var(--color-muted); }

/* ---------- Buttons ---------- */
.btn {
  --btn-bg: var(--color-primary); --btn-fg: var(--color-on-primary);
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .8rem 1.5rem; border-radius: 999px; font-weight: 600; font-size: .97rem;
  background: var(--btn-bg); color: var(--btn-fg); border: 2px solid var(--btn-bg);
  cursor: pointer; transition: transform var(--transition), background var(--transition), box-shadow var(--transition);
  text-decoration: none; white-space: nowrap;
}
.btn:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow); }
.btn--accent { --btn-bg: var(--color-accent); --btn-fg: #17233a; border-color: var(--color-accent); }
.btn--ghost  { --btn-bg: transparent; --btn-fg: var(--color-on-primary); border-color: rgba(255,255,255,.6); }
.btn--outline{ --btn-bg: transparent; --btn-fg: var(--color-primary); border-color: var(--color-primary); }
.btn--lg { padding: .95rem 1.9rem; font-size: 1.02rem; }

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--color-bg) 88%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--color-border);
}
.nav { display: flex; align-items: center; gap: 1.4rem; height: 70px; }
.brand { display: inline-flex; align-items: baseline; gap: .5rem; font-weight: 800; letter-spacing: .02em; }
.brand:hover { text-decoration: none; }
.brand__mark {
  font-size: 1.4rem; color: var(--color-primary);
  padding: .12em .42em; border-radius: 8px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
  color: #fff;
}
.brand__word { font-size: .78rem; font-weight: 600; letter-spacing: .04em; color: var(--color-muted); text-transform: uppercase; }
.brand__logo { height: 44px; width: auto; display: block; }
.footer-brand .brand__logo--white { height: 42px; margin-bottom: .3rem; }
/* CTA in the nav list is only for the mobile dropdown — hidden on desktop to avoid a duplicate of the header button */
.mobile-cta { display: none; }
.nav__links { display: flex; align-items: center; gap: .3rem; margin-left: auto; list-style: none; padding: 0; margin-block: 0; }
.nav__links a {
  display: inline-block; padding: .5rem .72rem; border-radius: 8px; font-weight: 500;
  color: var(--color-text); font-size: .95rem;
}
.nav__links a:hover { background: var(--color-surface-2); text-decoration: none; }
.nav__links a.is-active { color: var(--color-primary); font-weight: 700; }
.nav__actions { display: flex; align-items: center; gap: .6rem; }

.theme-toggle {
  width: 40px; height: 40px; border-radius: 999px; border: 1px solid var(--color-border);
  background: var(--color-surface); color: var(--color-heading); cursor: pointer;
  display: inline-grid; place-items: center; font-size: 1.05rem; transition: background var(--transition);
}
.theme-toggle:hover { background: var(--color-surface-2); }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun  { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: inline; }

.nav__toggle {
  display: none; width: 42px; height: 42px; border: 1px solid var(--color-border);
  background: var(--color-surface); border-radius: 10px; cursor: pointer; padding: 0;
}
.nav__toggle span, .nav__toggle span::before, .nav__toggle span::after {
  content: ""; display: block; width: 20px; height: 2px; background: var(--color-heading);
  margin: 0 auto; position: relative; transition: transform var(--transition), opacity var(--transition);
}
.nav__toggle span::before { position: absolute; top: -6px; }
.nav__toggle span::after  { position: absolute; top: 6px; }

/* ---------- Hero ---------- */
.hero {
  position: relative; color: #fff;
  background: var(--hero-overlay), radial-gradient(circle at 80% 20%, #1c477f, #0f2b5b 70%);
  overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; inset: 0; opacity: .12; pointer-events: none;
  background-image: linear-gradient(var(--color-accent) 1px, transparent 1px), linear-gradient(90deg, var(--color-accent) 1px, transparent 1px);
  background-size: 46px 46px; mask-image: linear-gradient(120deg, #000, transparent 70%);
}
.hero__inner { position: relative; z-index: 1; padding-block: clamp(3.5rem, 9vw, 7rem); max-width: 760px; }
.hero h1 { color: #fff; font-size: var(--fs-hero); margin-bottom: 1rem; }
.hero p.lead { color: rgba(255,255,255,.9); font-size: 1.2rem; }
.hero__cta { display: flex; flex-wrap: wrap; gap: .9rem; margin-top: 1.8rem; }
.page-hero { position: relative; color:#fff; background: var(--hero-overlay), radial-gradient(circle at 85% 10%, #1c477f, #0f2b5b 75%); }
.page-hero__inner { position: relative; z-index:1; padding-block: clamp(2.6rem, 6vw, 4.2rem); max-width: 780px; }
.page-hero h1 { color:#fff; font-size: clamp(1.9rem, 4.5vw, 3rem); }
.page-hero p { color: rgba(255,255,255,.9); font-size: 1.12rem; margin-bottom: 0; }
.breadcrumb { font-size: .85rem; color: rgba(255,255,255,.7); margin-bottom: .8rem; }
.breadcrumb a { color: rgba(255,255,255,.85); }

/* ---------- Grid & cards ---------- */
.grid { display: grid; gap: 1.4rem; }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }

.card {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius); padding: 1.6rem; box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--color-accent) 55%, var(--color-border)); }
.card h3 { font-size: var(--fs-h3); margin-bottom: .5rem; }
.card p:last-child, .card ul:last-child { margin-bottom: 0; }
.card__icon {
  width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center;
  font-size: 1.3rem; margin-bottom: 1rem;
  background: color-mix(in srgb, var(--color-primary) 12%, transparent); color: var(--color-primary);
}
.card--accent { border-top: 4px solid var(--color-accent); }

.check-list { list-style: none; padding: 0; }
.check-list li { position: relative; padding-left: 1.75rem; margin-bottom: .55rem; }
.check-list li::before {
  content: "✓"; position: absolute; left: 0; top: 0; font-weight: 800;
  color: var(--color-accent-dark);
}
:root[data-theme="dark"] .check-list li::before { color: var(--color-accent); }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem; }
.stat {
  text-align: center; padding: 1.8rem 1rem; border-radius: var(--radius);
  background: var(--color-surface); border: 1px solid var(--color-border); box-shadow: var(--shadow);
}
.stat__num { font-size: clamp(1.9rem, 4vw, 2.7rem); font-weight: 800; color: var(--color-primary); line-height: 1; }
.stat__num .unit { color: var(--color-accent-dark); }
:root[data-theme="dark"] .stat__num .unit { color: var(--color-accent); }
.stat__label { margin-top: .5rem; color: var(--color-muted); font-size: .95rem; }

/* Stats on dark hero band */
.stats--onprimary .stat { background: rgba(255,255,255,.07); border-color: rgba(255,255,255,.18); box-shadow: none; }
.stats--onprimary .stat__num { color: #fff; }
.stats--onprimary .stat__num .unit { color: var(--color-accent); }
.stats--onprimary .stat__label { color: rgba(255,255,255,.82); }

/* ---------- Split / media rows ---------- */
.split { display: grid; grid-template-columns: 1.1fr .9fr; gap: clamp(1.5rem, 4vw, 3rem); align-items: center; }
.panel {
  background: var(--color-surface-2); border-radius: var(--radius); padding: 1.8rem;
  border: 1px solid var(--color-border);
}
.value-row { display: flex; gap: 1rem; align-items: flex-start; margin-bottom: 1.2rem; }
.value-row .num { flex: 0 0 auto; width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; background: var(--color-primary); color:#fff; }
.value-row h4 { margin: 0 0 .2rem; }
.value-row p { margin: 0; color: var(--color-muted); }

/* Sector list on home */
.pill-list { display: flex; flex-wrap: wrap; gap: .6rem; list-style: none; padding: 0; }
.pill-list li { background: var(--color-surface-2); border: 1px solid var(--color-border); padding: .5rem 1rem; border-radius: 999px; font-weight: 600; font-size: .92rem; }

/* ---------- CTA band ---------- */
.cta-band { background: var(--hero-overlay), radial-gradient(circle at 20% 20%, #1c477f, #0f2b5b 75%); color: #fff; text-align: center; }
.cta-band h2 { color: #fff; }
.cta-band p { color: rgba(255,255,255,.9); max-width: 620px; margin-inline: auto; }

/* ---------- Contact ---------- */
.contact-grid { display: grid; grid-template-columns: 1fr 1.1fr; gap: clamp(1.5rem, 4vw, 3rem); align-items: start; }
.contact-info { padding: 0; margin: 0; }
.contact-info li { list-style: none; margin-bottom: 1rem; display: flex; gap: .7rem; align-items: flex-start; }
.contact-info .ci-icon { flex: 0 0 auto; }
.field { margin-bottom: 1.1rem; }
.field label { display: block; font-weight: 600; margin-bottom: .35rem; font-size: .92rem; }
.field .req { color: #d64545; }
.field input, .field select, .field textarea {
  width: 100%; padding: .75rem .9rem; border: 1px solid var(--color-border); border-radius: var(--radius-sm);
  background: var(--color-bg); color: var(--color-text); font: inherit; transition: border-color var(--transition), box-shadow var(--transition);
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--color-primary); box-shadow: var(--ring); outline: none; }
.field textarea { min-height: 130px; resize: vertical; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.map-embed { position: relative; width: 100%; aspect-ratio: 16 / 7; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--color-border); box-shadow: var(--shadow); }
.map-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
@media (max-width: 560px) { .map-embed { aspect-ratio: 4 / 3; } }
.form-note { font-size: .85rem; color: var(--color-muted); }
.alert { padding: .9rem 1.1rem; border-radius: var(--radius-sm); margin-bottom: 1.4rem; font-weight: 500; }
.alert--ok  { background: #e7f6ec; color: #1c6b3a; border: 1px solid #b7e2c6; }
.alert--err { background: #fdeaea; color: #a12626; border: 1px solid #f3c2c2; }
:root[data-theme="dark"] .alert--ok  { background: rgba(46,160,90,.15); color: #7fe0a3; border-color: rgba(46,160,90,.4); }
:root[data-theme="dark"] .alert--err { background: rgba(200,60,60,.15); color: #f0a3a3; border-color: rgba(200,60,60,.4); }

/* ---------- Footer ---------- */
.site-footer { background: var(--color-primary-dark); color: rgba(255,255,255,.82); padding-block: 3rem 1.5rem; }
:root[data-theme="dark"] .site-footer { background: #060f1c; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 2rem; margin-bottom: 2rem; }
.site-footer h4 { color: #fff; font-size: 1rem; margin-bottom: 1rem; }
.site-footer a { color: rgba(255,255,255,.82); }
.site-footer a:hover { color: #fff; }
.footer-links { list-style: none; padding: 0; margin: 0; }
.footer-links li { margin-bottom: .5rem; }
.footer-brand .brand__mark { display: inline-block; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.15); padding-top: 1.2rem; font-size: .85rem; display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem; color: rgba(255,255,255,.65); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .grid--4 { grid-template-columns: repeat(2, 1fr); }
  .grid--3 { grid-template-columns: repeat(2, 1fr); }
  .split, .contact-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .nav__toggle { display: block; margin-left: auto; }
  .nav__actions .btn { display: none; }
  .nav__links {
    position: fixed; inset: 70px 0 auto 0; flex-direction: column; align-items: stretch;
    background: var(--color-bg); border-bottom: 1px solid var(--color-border); padding: .6rem var(--gutter) 1.2rem;
    gap: .1rem; box-shadow: var(--shadow); transform: translateY(-120%); transition: transform var(--transition); margin-left: 0;
  }
  .nav__links.is-open { transform: translateY(0); }
  .nav__links a { padding: .85rem .6rem; border-radius: 8px; font-size: 1.02rem; }
  .nav__links a.is-active { background: var(--color-surface-2); }
  .mobile-cta { display: block; }
  .nav__links .mobile-cta { margin-top: .6rem; }
  /* Tighter vertical rhythm on phones */
  .section { padding-block: clamp(2.4rem, 9vw, 3.4rem); }
  .hero__inner { padding-block: clamp(2.6rem, 12vw, 4rem); }
  .page-hero__inner { padding-block: clamp(2rem, 9vw, 3rem); }
  .hero__cta .btn { flex: 1 1 auto; justify-content: center; }
}
@media (max-width: 560px) {
  .grid--4, .grid--3, .grid--2, .stats, .field-row { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .brand__logo { height: 38px; }              /* keep the header comfortable on small phones */
  .card { padding: 1.3rem; }
  .btn--lg { padding: .85rem 1.4rem; }
  .hero h1 { font-size: clamp(1.9rem, 8.5vw, 2.6rem); }
  .stat { padding: 1.4rem 1rem; }
  .section__head { margin-bottom: 1.8rem; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
