/* Merit Advisory Energy Services — site styles
   Brand colours sampled from the corporate mark: navy #03438C, swoosh blue #3E92DE

   Type: Source Serif 4 (headings) + Source Sans 3 (body), both SIL OFL, self-hosted.
   Serif is shipped as static 600/700 rather than the variable file — the variable
   build carries an optical-size axis we do not use and costs 119KB against 21KB.
   unicode-range means latin-ext is only fetched if a page actually contains those
   characters, so a normal first load is ~70KB of font. */

/* ---------- Fonts ---------- */

@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/source-serif-4-600-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
                 U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
                 U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/source-serif-4-600-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
                 U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
                 U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/source-serif-4-700-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
                 U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
                 U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/source-serif-4-700-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
                 U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
                 U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Sans ships as a variable font — 400..700 in 28KB is cheaper than two statics */
@font-face {
  font-family: "Source Sans 3";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/source-sans-3-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
                 U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
                 U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Source Sans 3";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/source-sans-3-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
                 U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
                 U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --navy:        #03438C;
  --navy-deep:   #042B5C;
  --navy-dark:   #021E42;
  --blue:        #3E92DE;
  --blue-pale:   #E8F1FB;

  --ink:         #16202D;
  --muted:       #5C6875;
  --line:        #E1E7EF;
  --panel:       #F5F8FC;
  --white:       #FFFFFF;

  --measure:     68ch;
  --wrap:        1140px;
  --radius:      6px;

  --sans: "Source Sans 3", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
}

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

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

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 18px;          /* Source Sans 3 has a smaller x-height than system SF */
  line-height: 1.6;
  color: var(--ink);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--serif);
  color: var(--navy-deep);
  line-height: 1.15;
  margin: 0 0 0.6em;
  letter-spacing: -0.012em;
  text-wrap: balance;       /* stops one-word orphan lines in headings */
}

/* Large sizes carry weight optically, so the display sizes take 600 and the
   small ones 700 — a single weight across the range looks heavy at the top
   and thin at the bottom. */
h1 { font-size: 3rem;    font-weight: 600; }
h2 { font-size: 2.05rem; font-weight: 600; }
h3 { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.005em; }
h4 { font-size: 1rem;    font-weight: 700; }

p, ul, ol { margin: 0 0 1.1em; }
p { text-wrap: pretty; }
li { margin-bottom: 0.4em; }

a { color: var(--navy); }
a:hover { color: var(--blue); }

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

.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.measure { max-width: var(--measure); }


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

.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: 74px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  color: var(--navy-deep);
  flex-shrink: 0;
}
.brand img { width: 42px; height: auto; display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.brand-tag {
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Direct child only — the dropdown is also a <ul> inside .nav */
.nav > ul {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 1.6rem;
  margin: 0;
  padding: 0;
}
.nav a {
  text-decoration: none;
  color: var(--ink);
  font-size: 0.93rem;
  padding: 0.4rem 0;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.nav a:hover { color: var(--navy); border-bottom-color: var(--blue); }
.nav a[aria-current="page"] { color: var(--navy); border-bottom-color: var(--navy); }

/* CSS-only services dropdown */
.has-menu { position: relative; }
.has-menu > button {
  font: inherit;
  font-size: 0.93rem;
  color: var(--ink);
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 0.4rem 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.has-menu > button::after {
  content: "";
  width: 0; height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  opacity: 0.6;
}
.has-menu:hover > button,
.has-menu:focus-within > button { color: var(--navy); border-bottom-color: var(--blue); }

.menu {
  position: absolute;
  top: 100%;
  left: -1rem;
  min-width: 260px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(4, 43, 92, 0.12);
  padding: 0.5rem 0;
  display: none;
  flex-direction: column;
  gap: 0;
  list-style: none;
  margin: 0;
}
.has-menu:hover .menu,
.has-menu:focus-within .menu { display: flex; }
.menu li { margin: 0; }
.menu a {
  display: block;
  padding: 0.55rem 1.1rem;
  border-bottom: 0;
  font-size: 0.92rem;
}
.menu a:hover { background: var(--blue-pale); border-bottom: 0; }


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

.btn {
  display: inline-block;
  padding: 0.7rem 1.5rem;
  border-radius: var(--radius);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 600;
  border: 2px solid var(--navy);
  background: var(--navy);
  color: var(--white);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.btn:hover { background: var(--navy-deep); border-color: var(--navy-deep); color: var(--white); }

.btn-ghost { background: transparent; color: var(--navy); }
.btn-ghost:hover { background: var(--navy); color: var(--white); }

.btn-on-dark { border-color: var(--white); background: var(--white); color: var(--navy-deep); }
.btn-on-dark:hover { background: transparent; color: var(--white); border-color: var(--white); }

.btn-outline-light { border-color: var(--white); background: transparent; color: var(--white); }
.btn-outline-light:hover { background: var(--white); color: var(--navy-deep); border-color: var(--white); }

.btn-row { display: flex; flex-wrap: wrap; gap: 0.9rem; }


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

.hero {
  background: linear-gradient(140deg, var(--navy-deep) 0%, var(--navy) 65%, #0A56A8 100%);
  color: var(--white);
  padding: 5.5rem 0 5rem;
}
.hero h1 { color: var(--white); max-width: 20ch; }
.hero .lead {
  font-size: 1.18rem;
  color: rgba(255, 255, 255, 0.88);
  max-width: 58ch;
  margin-bottom: 2rem;
}
.hero .eyebrow { color: var(--blue); }

/* Compact hero for interior pages */
.page-head {
  background: var(--navy-deep);
  color: var(--white);
  padding: 3.5rem 0 3rem;
}
.page-head h1 { color: var(--white); margin-bottom: 0.4rem; font-size: 2.25rem; }
.page-head .lead {
  color: rgba(255, 255, 255, 0.85);
  font-size: 1.1rem;
  max-width: 62ch;
  margin: 0;
}
.page-head .eyebrow { color: var(--blue); }


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

section { padding: 4.5rem 0; }
section.tight { padding: 3rem 0; }
.band-panel { background: var(--panel); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.band-navy { background: var(--navy-deep); color: var(--white); }
.band-navy h2, .band-navy h3 { color: var(--white); }
.band-navy p { color: rgba(255, 255, 255, 0.85); }

.eyebrow {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-weight: 700;
  color: var(--blue);
  margin: 0 0 0.7rem;
}

.section-head { max-width: 62ch; margin-bottom: 2.5rem; }
.section-head.centred { margin-left: auto; margin-right: auto; text-align: center; }
.section-head p { color: var(--muted); font-size: 1.08rem; margin-bottom: 0; }
.band-navy .section-head p { color: rgba(255, 255, 255, 0.85); }


/* ---------- Grids and cards ---------- */

.grid { display: grid; gap: 1.5rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-2x2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.8rem;
  border-top: 3px solid var(--navy);
}
.card h3 { margin-bottom: 0.5rem; }
.card p { color: var(--muted); font-size: 0.97rem; margin-bottom: 0; }
.card .card-link {
  display: inline-block;
  margin-top: 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
}
.card .card-link::after { content: " →"; }

.card-plain { border-top-color: var(--line); }

.numbered .num {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--blue);
  display: block;
  margin-bottom: 0.4rem;
}


/* ---------- Feature list ---------- */

.ticks { list-style: none; padding: 0; }
.ticks li {
  position: relative;
  padding-left: 1.6rem;
  margin-bottom: 0.65rem;
}
.ticks li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 8px;
  height: 8px;
  background: var(--blue);
  border-radius: 50%;
}

.excludes {
  background: var(--panel);
  border-left: 3px solid var(--line);
  padding: 1.1rem 1.4rem;
  font-size: 0.93rem;
  color: var(--muted);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.excludes strong { color: var(--ink); }
.excludes p:last-child { margin-bottom: 0; }


/* ---------- Case studies ---------- */

.case {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.9rem;
  background: var(--white);
}
.case .client {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  font-weight: 700;
  color: var(--blue);
  margin-bottom: 0.5rem;
}
.case h3 { font-size: 1.15rem; }
.case dl { margin: 1.1rem 0 0; }
.case dt {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  font-weight: 700;
  color: var(--navy);
  margin-top: 1rem;
}
.case dd { margin: 0.25rem 0 0; color: var(--muted); font-size: 0.96rem; }


/* ---------- Bios ---------- */

.bio {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 2rem;
  align-items: start;
}
.bio + .bio { margin-top: 3.5rem; padding-top: 3.5rem; border-top: 1px solid var(--line); }
/* Source photos differ in aspect ratio — crop to a common frame */
.bio-photo {
  width: 150px;
  height: 185px;
  object-fit: cover;
  object-position: center 25%;
  border-radius: var(--radius);
  display: block;
  border: 1px solid var(--line);
}
.bio .role {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  font-weight: 700;
  color: var(--blue);
  margin: -0.4em 0 1rem;
}
.bio h2 { margin-bottom: 0.15em; }
/* Small uppercase labels stay in the sans — tracked-out serif caps at this
   size read as decorative rather than as a label */
.bio h4 {
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--navy);
  margin: 1.8rem 0 0.7rem;
}
.bio .contact-line { font-size: 0.94rem; color: var(--muted); }
.bio .contact-line a { text-decoration: none; }

.cols-2 { columns: 2; column-gap: 2.5rem; }
.cols-2 li { break-inside: avoid; }


/* ---------- Stats ---------- */

.stat .figure {
  font-family: var(--serif);
  font-size: 2.7rem;
  font-weight: 600;
  color: var(--navy);
  line-height: 1.05;
  letter-spacing: -0.02em;
  display: block;
}
.band-navy .stat .figure { color: var(--blue); }
.stat .caption { font-size: 0.95rem; color: var(--muted); }
.band-navy .stat .caption { color: rgba(255, 255, 255, 0.85); }


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

.contact-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.8rem;
  background: var(--white);
}
.contact-card .name { font-weight: 700; font-size: 1.15rem; color: var(--navy-deep); }
.contact-card .role {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--blue);
  font-weight: 700;
  margin-bottom: 0.9rem;
}
.contact-card a { display: block; text-decoration: none; margin: 0.3rem 0; font-size: 0.97rem; }


/* ---------- CTA ---------- */

.cta { text-align: center; }
.cta h2 { color: var(--white); }
.cta p { max-width: 56ch; margin-left: auto; margin-right: auto; }
.cta .btn-row { justify-content: center; margin-top: 2rem; }


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

.site-footer {
  background: var(--navy-dark);
  color: rgba(255, 255, 255, 0.66);
  padding: 3rem 0 2rem;
  font-size: 0.9rem;
}
.site-footer a { color: rgba(255, 255, 255, 0.85); text-decoration: none; }
.site-footer a:hover { color: var(--white); }
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}
.footer-grid h4 {
  color: var(--white);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  margin-bottom: 0.9rem;
}
.footer-grid ul { list-style: none; padding: 0; margin: 0; }
.footer-grid li { margin-bottom: 0.45rem; }
.footer-bottom {
  padding-top: 1.5rem;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.83rem;
  color: rgba(255, 255, 255, 0.5);
}


/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  h1 { font-size: 2.1rem; }
  h2 { font-size: 1.6rem; }
  .hero { padding: 3.5rem 0; }
  section { padding: 3.25rem 0; }

  /* The flattened nav is several lines tall — sticky would eat the viewport */
  .site-header { position: static; }
  .site-header .wrap {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    padding-top: 0.9rem;
    padding-bottom: 0.9rem;
    min-height: 0;
  }
  .nav a, .menu a { font-size: 0.88rem; }
  .nav > ul { flex-wrap: wrap; gap: 0.4rem 1.1rem; }
  .grid-2x2 { grid-template-columns: 1fr; }

  /* Flatten the dropdown on small screens */
  .has-menu > button { display: none; }
  .menu {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    position: static;
    min-width: 0;
    border: 0;
    box-shadow: none;
    padding: 0;
    gap: 0.4rem 1.1rem;
    background: transparent;
  }
  .menu a { padding: 0.4rem 0; }
  .menu a:hover { background: transparent; }

  .bio { grid-template-columns: 1fr; gap: 1.2rem; }
  .cols-2 { columns: 1; }
  .footer-grid { grid-template-columns: 1fr; gap: 1.8rem; }
}

@media (max-width: 480px) {
  body { font-size: 17px; }
  h1 { font-size: 2rem; }
  h2 { font-size: 1.6rem; }
  .hero .lead { font-size: 1.05rem; }
}


/* ---------- Motion ----------
   Every rule below is optional decoration. All of it sits inside
   prefers-reduced-motion: no-preference, and the feature-driven parts sit
   inside @supports, so a browser without them — or a visitor who has asked
   their OS for less motion — gets exactly the static site.

   This matters commercially, not just ethically: WCAG 2.1 AA is the baseline
   expectation in Australian Commonwealth digital procurement, and several of
   our prospects are government-owned. */

/* Cross-document view transitions: pages cross-fade instead of white-flashing.
   Chrome 126+, Safari 18.2+, Firefox 144+. Everyone else navigates as before. */
@supports (view-transition-name: none) {
  @view-transition { navigation: auto; }

  /* Pin the header so it stays put while the body changes underneath it */
  .site-header { view-transition-name: site-header; }

  @media (prefers-reduced-motion: no-preference) {
    ::view-transition-old(root) { animation: vt-out 140ms ease-in both; }
    ::view-transition-new(root) { animation: vt-in 220ms ease-out both; }
  }
  /* Reduced motion still gets the transition, just without the movement */
  @media (prefers-reduced-motion: reduce) {
    ::view-transition-old(root),
    ::view-transition-new(root) { animation: none; }
  }
}

@keyframes vt-out { to   { opacity: 0; } }
@keyframes vt-in  { from { opacity: 0; transform: translateY(6px); } }

@media (prefers-reduced-motion: no-preference) {

  /* Entrance reveals, driven by scroll position rather than a timer, so they
     track the scrollbar and cannot fire off-screen. No JavaScript and no
     IntersectionObserver. Support is ~84% (Firefox still behind a flag), and
     the @supports guard means the other 16% simply see the content. */
  @supports (animation-timeline: view()) {
    .card,
    .case,
    .stat,
    .bio,
    .contact-card {
      animation: reveal linear both;
      animation-timeline: view();
      animation-range: entry 10% cover 25%;
    }
  }

  @keyframes reveal {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: none; }
  }

  /* Card hover: a small lift, 180ms — inside the range where motion reads as
     responsive rather than as an effect being performed at you. */
  .card,
  .case,
  .contact-card {
    transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
  }
  .card:hover,
  .case:hover,
  .contact-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 28px rgba(4, 43, 92, 0.10);
    border-color: #CFDCEC;
  }

  /* Underline that draws in from the left rather than switching on */
  .card-link {
    background-image: linear-gradient(currentColor, currentColor);
    background-size: 0% 1px;
    background-repeat: no-repeat;
    background-position: 0 100%;
    transition: background-size 250ms ease;
  }
  .card-link:hover { background-size: 100% 1px; }

  .btn { transition: background 150ms ease, color 150ms ease, border-color 150ms ease, transform 150ms ease; }
  .btn:active { transform: translateY(1px); }
}

/* A scroll-driven reveal has no scroll position when printing, so anything
   below the first page would otherwise come out blank. Same guard covers
   full-page screenshot and archiving tools. */
@media print {
  .card, .case, .stat, .bio, .contact-card {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
    box-shadow: none !important;
  }
}

/* Keyboard users must still see where they are */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
  border-radius: 2px;
}
