:root {
  --offwhite: #fdf8ed;
  --paper: #f7f4ee;
  --dark: #282725;
  --navy: #102a47;
  --navy-soft: #1d3b5f;
  --line: rgba(16, 42, 71, 0.48);
  --line-soft: rgba(16, 42, 71, 0.18);
  --ink: #1e1d1b;
  --muted: rgba(34, 32, 30, 0.72);
  --shadow: 0 25px 60px rgba(16, 42, 71, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--offwhite);
  color: var(--ink);
  font-family: "Archivo", "Arial", sans-serif;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

button,
input,
textarea {
  font: inherit;
}

.site-main {
  min-height: 100vh;
}

.container {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
}

.landing-screen {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 5.5rem 0 0;
  background: transparent;
}

/*
  The image sits in the flow below the hero text and keeps its native aspect
  ratio (1376x768). Its top ~36% is empty sky, so a negative top margin pulls
  that sky up behind the text while the mountain peaks always start just below
  it, at any screen size.
*/
.hero-image {
  --hero-w: max(100%, 900px);
  position: relative;
  z-index: 0;
  order: 1;
  flex: none;
  width: var(--hero-w);
  aspect-ratio: 1376 / 768;
  margin: calc(var(--hero-w) * -0.2 + 1rem) calc((100% - var(--hero-w)) / 2) 0;
  background-image: url('../images/Background.jpg');
  background-size: 100% 100%;
  background-repeat: no-repeat;
  /* Eased fade (smoothstep) so the image blends into the page without a visible edge. */
  --hero-fade: linear-gradient(
    180deg,
    #000 0%,
    #000 55%,
    rgba(0, 0, 0, 0.97) 59.5%,
    rgba(0, 0, 0, 0.9) 64%,
    rgba(0, 0, 0, 0.79) 68.5%,
    rgba(0, 0, 0, 0.65) 73%,
    rgba(0, 0, 0, 0.5) 77.5%,
    rgba(0, 0, 0, 0.35) 82%,
    rgba(0, 0, 0, 0.21) 86.5%,
    rgba(0, 0, 0, 0.1) 91%,
    rgba(0, 0, 0, 0.03) 95.5%,
    rgba(0, 0, 0, 0) 100%
  );
  -webkit-mask-image: var(--hero-fade);
  mask-image: var(--hero-fade);
}

.brand-mark {
  position: absolute;
  top: 1.2rem;
  left: 1.4rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 74px;
  min-height: 54px;
  padding: 0.4rem 0.8rem;
  border: 2px solid rgba(15, 26, 38, 0.7);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 2px 0 rgba(15, 26, 38, 0.15);
  z-index: 2;
}

.mark-core {
  font-family: "Courier Prime", monospace;
  font-size: 1.05rem;
  letter-spacing: 0.12em;
  font-weight: 700;
  color: var(--ink);
}

.hero-row {
  position: relative;
  z-index: 2;
  order: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  width: 100%;
  margin: 0;
  padding: 2.1rem 0.5in 0;
}

.intro-block {
  display: inline-block;
  text-align: left;
  text-shadow: 0 1px 0 rgba(255,255,255,0.18);
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Libre Baskerville", "Georgia", serif;
  letter-spacing: -0.06em;
}

h1 {
  font-size: clamp(5rem, 9vw, 11rem);
  letter-spacing: calc(-0.06em + 3px);
  line-height: 0.82;
  font-weight: 700;
  color: var(--ink);
  text-transform: uppercase;
}

.subtitle {
  margin-top: 0.5rem;
  font-family: "Libre Baskerville", "Georgia", serif;
  font-size: clamp(1.3rem, 2.6vw, 2.86rem);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--ink);
}

.hero-tagline {
  max-width: none;
  margin: 0;
  font-family: "Libre Baskerville", "Georgia", serif;
  font-size: clamp(1.05rem, 2vw, 1.75rem);
  line-height: 1.1;
  color: #3a3a3a;
  text-align: right;
}

.hero-tagline.section-tagline {
  margin: 0 0 2rem;
  font-size: clamp(1.575rem, 3vw, 2.625rem);
  text-align: center;
  color: #3a3a3a;
}

#additional-services,
#engineered-solutions {
  scroll-margin-top: 58px;
}

.hero-tagline.section-tagline.section-tagline-next {
  color: var(--offwhite);
}

.services-section #engineered-solutions {
  color: var(--offwhite) !important;
}

.hero-tagline.section-tagline-next {
  margin-top: 4rem;
  scroll-margin-top: calc(58px + 2rem);
}

.section-title {
  margin: 0 0 1.5rem;
  font-family: "Libre Baskerville", "Georgia", serif;
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  line-height: 1.1;
  color: #3a3a3a;
  scroll-margin-top: calc(58px + 2rem);
}

.services-section {
  position: relative;
  padding: 5rem 0 0.5in;
  /* Eased fade from off-white to navy (no hard start line). */
  background-color: var(--offwhite);
  background-image: linear-gradient(
    180deg,
    rgba(16, 42, 71, 0) 0%,
    rgba(16, 42, 71, 0.03) 4%,
    rgba(16, 42, 71, 0.1) 8%,
    rgba(16, 42, 71, 0.21) 12%,
    rgba(16, 42, 71, 0.35) 16%,
    rgba(16, 42, 71, 0.5) 20%,
    rgba(16, 42, 71, 0.65) 24%,
    rgba(16, 42, 71, 0.79) 28%,
    rgba(16, 42, 71, 0.9) 32%,
    rgba(16, 42, 71, 0.97) 36%,
    rgba(16, 42, 71, 1) 40%,
    rgba(16, 42, 71, 1) 100%
  );
  scroll-margin-top: 58px;
}

.services-section .section-title {
  color: #3a3a3a;
}

.services-section .service-grid {
  margin-bottom: 2rem;
  align-items: stretch;
}

.services-cta-row {
  display: flex;
  justify-content: center;
  margin: 0 0 1.5rem;
}

.services-cta {
  min-width: 180px;
  background: var(--offwhite);
  color: var(--dark);
  border-color: rgba(253, 248, 237, 0.9);
  box-shadow: 0 16px 30px rgba(16, 42, 71, 0.16);
}

.services-cta:hover {
  background: #fffdf7;
  color: var(--dark);
}

.services-cta:active {
  background: #f5efe1;
}

.services-section .card-face {
  border-color: rgba(255, 255, 255, 0.28);
}

.services-section .flip-card:hover .card-face,
.services-section .flip-card:focus-visible .card-face {
  border-color: rgba(255, 255, 255, 0.7);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35), 0 30px 70px rgba(0, 0, 0, 0.35);
}

.panel-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.5rem;
}

.flip-card {
  perspective: 1200px;
  min-height: calc(410px - 1in);
  cursor: pointer;
  outline: none;
  transition: transform 0.25s ease;
}

.flip-card:hover,
.flip-card:focus-visible {
  transform: translateY(-6px);
}

.flip-card .card-face {
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.flip-card:hover .card-face,
.flip-card:focus-visible .card-face {
  border-color: rgba(16, 42, 71, 0.6);
  box-shadow: 0 0 0 2px rgba(16, 42, 71, 0.35), 0 30px 70px rgba(16, 42, 71, 0.22);
}

.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: calc(410px - 1in);
  transition: transform 0.8s cubic-bezier(0.2, 0.7, 0.2, 1);
  transform-style: preserve-3d;
}

.flip-card.is-flipped .card-inner {
  transform: rotateY(180deg);
}

.flip-card.static-card {
  cursor: default;
  min-height: calc(245px + 0.5in);
  height: 100%;
}

.flip-card.static-card .card-inner {
  height: 100%;
  min-height: calc(245px + 0.5in);
}

.flip-card.static-card .card-face {
  position: relative;
  height: 100%;
  min-height: calc(245px + 0.5in);
}

.card-face {
  position: absolute;
  inset: 0;
  padding: 1.5rem 1.5rem 1.25rem;
  border-radius: 24px;
  backface-visibility: hidden;
  border: 1px solid rgba(16, 42, 71, 0.22);
  background: rgba(255,255,255,0.22);
  box-shadow: var(--shadow);
}

.card-front {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  transform: rotateY(0deg);
  background: var(--offwhite);
  color: var(--dark);
}

.card-back {
  transform: rotateY(180deg);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  background: var(--dark);
  color: var(--offwhite);
}

.card-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: rgba(16,42,71,0.08);
  color: var(--navy);
  font-family: "Archivo", "Arial", sans-serif;
  font-weight: 800;
  margin-bottom: 2rem;
}

.card-front h3,
.card-back h3 {
  font-family: "Libre Baskerville", "Georgia", serif;
  font-size: clamp(1.3rem, 2vw, 2rem);
  line-height: 1.1;
  color: var(--navy);
}

.card-front h3,
.card-front p,
.card-front .card-list {
  color: var(--dark);
}

.card-back h3 {
  color: var(--offwhite);
  margin-bottom: 0.8rem;
}

.card-front p,
.card-back p {
  margin: 0.8rem 0 0;
  font-family: "Archivo", "Arial", sans-serif;
  font-size: 0.96rem;
  color: var(--muted);
  line-height: 1.6;
}

.card-back p {
  color: var(--offwhite);
}

.card-list {
  margin: 0.8rem 0 0;
  padding-left: 1.2rem;
  font-family: "Archivo", "Arial", sans-serif;
  font-size: 0.96rem;
  line-height: 1.6;
  color: var(--muted);
}

.card-list li + li {
  margin-top: 0.35rem;
}

.card-back .card-list {
  color: var(--offwhite);
}

.flip-hint {
  margin: -1.4rem 0 2rem;
  text-align: center;
  font-family: "Archivo", "Arial", sans-serif;
  font-size: 0.72rem;
  font-style: italic;
  letter-spacing: 0.04em;
  color: #c8c8c8;
}

.coming-soon {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.8rem;
}

/* Reserve two lines for titles so content lines up across cards. */
.services-section .card-face h3 {
  min-height: 2.2em;
}

.cube-scene {
  width: 90px;
  height: 90px;
  perspective: 600px;
}

.cube {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  animation: cube-spin 8s linear infinite;
}

.cube-face {
  position: absolute;
  inset: 0;
  border: 2px solid rgba(58, 58, 58, 0.85);
  background: rgba(16, 42, 71, 0.08);
}

.cube-front  { transform: translateZ(45px); }
.cube-back   { transform: rotateY(180deg) translateZ(45px); }
.cube-right  { transform: rotateY(90deg) translateZ(45px); }
.cube-left   { transform: rotateY(-90deg) translateZ(45px); }
.cube-top    { transform: rotateX(90deg) translateZ(45px); }
.cube-bottom { transform: rotateX(-90deg) translateZ(45px); }

@keyframes cube-spin {
  from { transform: rotateX(-24deg) rotateY(0deg); }
  to   { transform: rotateX(-24deg) rotateY(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .cube {
    animation: none;
    transform: rotateX(-24deg) rotateY(35deg);
  }
}

.card-back .coming-soon-text {
  margin: 0;
  font-family: "Archivo", "Arial", sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--offwhite);
}

.card-back .cube-face {
  border-color: rgba(253, 248, 237, 0.85);
  background: rgba(253, 248, 237, 0.06);
}

.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 20;
  padding: 0;
  background: rgba(252, 248, 237, 0.98);
  border-bottom: 1px solid rgba(16, 42, 71, 0.16);
}

.top-bar-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 0.75rem;
  min-height: 58px;
  width: 100%;
  margin: 0;
  padding: 0.55rem 0.5in;
  background: rgba(252, 248, 237, 1);
  border: none;
  backdrop-filter: none;
  box-shadow: none;
}

.top-bar-leading {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-self: start;
  gap: 0.6rem;
  min-width: 0;
}

.logo-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: center;
  gap: 0.55rem;
  min-height: 38px;
  font-family: "Archivo", "Arial", sans-serif;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-size: 0.6rem;
  color: rgba(16, 42, 71, 0.7);
}

.logo-slot img {
  display: block;
  height: 40px;
  width: auto;
}

.logo-wordmark {
  display: inline-block;
  font-family: "Libre Baskerville", "Georgia", serif;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  line-height: 1;
  color: #3a3a3a;
  text-transform: uppercase;
  white-space: nowrap;
}

.top-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-self: end;
  justify-content: flex-end;
  gap: 0.6rem;
  min-width: 0;
}

.nav-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.copy-email,
.nav-button {
  appearance: none;
  border: 1px solid rgba(58, 58, 58, 0.24);
  background: #3a3a3a;
  color: #f4f4f4;
  min-width: 120px;
  min-height: 38px;
  padding: 0.7rem 1.1rem;
  border-radius: 999px;
  font-family: "Archivo", "Arial", sans-serif;
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}

.copy-email:hover,
.nav-button:hover {
  transform: translateY(-1px);
  background: #2a2a2a;
}

.copy-email:active,
.nav-button:active {
  transform: translateY(0);
}

.contact-wrap {
  position: relative;
}

.top-bar-leading .contact-wrap {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  margin-left: 0;
}

body#top .top-bar-leading .contact-wrap {
  margin-left: 0;
}

.contact-popover {
  position: absolute;
  top: 50%;
  left: calc(100% + 0.6rem);
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.6rem 0.6rem 1rem;
  background: transparent;
  border: none;
  border-radius: 12px;
  box-shadow: none;
  white-space: nowrap;
  z-index: 30;
}

.contact-popover[hidden] {
  display: none;
}

.contact-email {
  font-family: "Archivo", "Arial", sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  color: #3a3a3a;
}

.contact-email:hover {
  text-decoration: underline;
}

.copy-icon {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid rgba(58, 58, 58, 0.24);
  border-radius: 8px;
  background: #3a3a3a;
  color: #f4f4f4;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.copy-icon:hover {
  background: #2a2a2a;
  border-color: rgba(58, 58, 58, 0.4);
}

.copy-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.copy-icon .icon-check,
.copy-icon.is-copied .icon-copy {
  display: none;
}

.copy-icon.is-copied .icon-check {
  display: block;
}

.copy-icon.is-copied {
  color: #9be3b4;
}

.copy-status {
  position: absolute;
  top: calc(100% + 0.35rem);
  right: 0.6rem;
  font-family: "Archivo", "Arial", sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #3a3a3a;
}

.bottom-bar {
  position: relative;
  z-index: 16;
  background: #3a3a3a;
  color: var(--offwhite);
  border-top: 1px solid rgba(0, 0, 0, 0.3);
}

.bottom-bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 58px;
  width: min(1440px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 0.55rem 0;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  padding-left: calc(0.2rem + 0.5in);
  font-family: "Archivo", "Arial", sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.footer-brand img {
  height: 32px;
  width: auto;
}

/* Highlight the nav button for the page you're on. */
.nav-button.is-current {
  background: var(--navy);
  border-color: var(--navy);
}

.nav-button.is-current:hover {
  background: var(--navy-soft);
}

.analysis-page .nav-button.is-current {
  background: var(--offwhite);
  color: var(--dark);
  border-color: rgba(58, 58, 58, 0.24);
}

.analysis-page .nav-button.is-current:hover {
  background: #fffdf7;
}

/* ---------- Analysis page (Python calculators) ---------- */
.analysis-main {
  padding: calc(58px + 3.5rem) 0 4rem;
}

/* Use the same content gutters as the homepage on every analysis page. */
.analysis-page .analysis-main > .container {
  width: min(1180px, calc(100% - 2rem));
}

.analysis-title {
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  letter-spacing: -0.02em;
  line-height: 1.05;
  text-transform: none;
  color: #3a3a3a;
}

.analysis-intro {
  max-width: 640px;
  margin: 0.9rem 0 0;
  font-size: 1rem;
  color: var(--muted);
}

.py-status {
  min-height: 1.4em;
  margin: 0.8rem 0 1.8rem;
  font-size: 0.78rem;
  font-style: italic;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.calc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.calc-card {
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  border: 1px solid rgba(16, 42, 71, 0.22);
  border-radius: 24px;
  background: #fffdf8;
  box-shadow: var(--shadow);
}

.calc-card h2 {
  font-size: clamp(1.3rem, 2vw, 1.7rem);
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--navy);
}

.calc-desc {
  margin: 0.5rem 0 1.2rem;
  font-size: 0.92rem;
  color: var(--muted);
}

.calc-fields {
  display: grid;
  gap: 0.9rem;
}

.calc-fields label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #3a3a3a;
}

.calc-fields input,
.calc-fields select {
  width: 100%;
  min-height: 42px;
  padding: 0.55rem 0.75rem;
  border: 1px solid rgba(16, 42, 71, 0.28);
  border-radius: 10px;
  background: var(--offwhite);
  color: var(--ink);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.calc-fields input:focus,
.calc-fields select:focus {
  outline: 2px solid rgba(16, 42, 71, 0.45);
  outline-offset: 1px;
}

.calc-button {
  align-self: flex-start;
  margin-top: 1.3rem;
  min-height: 40px;
  padding: 0.7rem 1.4rem;
  border: none;
  border-radius: 999px;
  background: var(--navy);
  color: var(--offwhite);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s ease;
}

.calc-button:hover {
  background: var(--navy-soft);
}

.calc-button:disabled {
  opacity: 0.45;
  cursor: wait;
}

.calc-result {
  display: block;
  min-height: 1.6em;
  margin-top: 1rem;
  font-family: "Libre Baskerville", "Georgia", serif;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--navy);
}

.calc-result.is-error {
  font-family: "Archivo", "Arial", sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  color: #a3362b;
}

/* Card on the Analysis page that links to a full calculator page. */
.tool-card {
  color: inherit;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.tool-card > img {
  width: 100%;
  height: auto;
  margin-bottom: 1.25rem;
  border-radius: 16px;
}

.tool-card:hover,
.tool-card:focus-visible {
  transform: translateY(-4px);
  border-color: rgba(16, 42, 71, 0.5);
}

.tool-link {
  margin-top: auto;
  padding-top: 1rem;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--navy);
}

/* ---------- CDU heat exchanger calculator ---------- */
.back-link {
  display: inline-flex;
  margin-bottom: 1rem;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--navy);
}

.back-link:hover {
  text-decoration: underline;
}

.hx-app {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 1.5rem;
  align-items: stretch;
}

.hx-tabs {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: stretch;
  margin-bottom: 1.1rem;
  padding: 0.3rem;
  border: 1px solid var(--line-soft);
  border-radius: 18px;
  background: #e0e0e0;
}

.hx-tabs::before {
  content: "";
  position: absolute;
  z-index: 0;
  top: 0.3rem;
  bottom: 0.3rem;
  left: 0.3rem;
  width: calc((100% - 0.6rem) / 2);
  border: 1px solid rgba(16, 42, 71, 0.22);
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 4px 12px rgba(16, 42, 71, 0.14);
  transition: transform 200ms ease;
  pointer-events: none;
}

.hx-tabs[data-selected="1"]::before {
  transform: translateX(100%);
}

@media (prefers-reduced-motion: reduce) {
  .hx-tabs::before {
    transition: none;
  }
}

.hx-tabs[hidden],
.hx-app > .hx-panel[hidden] {
  display: none;
}

.hx-tab {
  position: relative;
  z-index: 1;
  flex: 1;
  min-width: 0;
  min-height: 48px;
  padding: 0.8rem 0.5rem;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  font-family: "Libre Baskerville", "Georgia", serif;
  font-size: clamp(0.85rem, 2.4vw, 1.1rem);
  letter-spacing: -0.02em;
  font-weight: 700;
  cursor: pointer;
}

.hx-tab[aria-selected="true"] {
  color: var(--navy);
}

.hx-tab:focus-visible {
  z-index: 3;
  outline: 2px solid var(--navy);
  outline-offset: 2px;
}

.hx-panel {
  padding: 1.5rem;
  border: 1px solid rgba(16, 42, 71, 0.22);
  border-radius: 24px;
  background: #fffdf8;
  box-shadow: var(--shadow);
}

.hx-panel h2 {
  margin-bottom: 1.1rem;
  font-size: clamp(1.2rem, 1.8vw, 1.5rem);
  letter-spacing: -0.02em;
  color: var(--navy);
}

#hxDesignTitle small,
#hxOpTitle small,
.hx-capacity-note {
  font-family: "Archivo", "Arial", sans-serif;
  font-size: 1rem;
  font-style: italic;
  font-weight: 400;
  letter-spacing: normal;
  color: var(--muted);
}

.hx-panel h2 span:not(.hx-panel-title) {
  margin-left: 0.4rem;
  font-family: "Archivo", "Arial", sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.hx-form {
  display: grid;
  gap: 0.45rem;
}

.hx-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px 40px 64px;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.hx-row .hx-select {
  grid-column: 2 / -1;
}

.hx-label {
  font-weight: 600;
  color: #3a3a3a;
}

.hx-unit,
.hx-extra {
  font-size: 0.78rem;
  font-style: italic;
  color: var(--navy-soft);
  white-space: nowrap;
}

.hx-unit-wide {
  grid-column: span 2;
}

.hx-divider {
  height: 1px;
  margin: 0.5rem 0;
  background: rgba(16, 42, 71, 0.14);
}

.hx-divider-strong {
  height: 2px;
  background: rgba(16, 42, 71, 0.24);
}

.hx-input,
.hx-select,
.hx-readout {
  width: 100%;
  min-height: 36px;
  padding: 0.4rem 0.55rem;
  border: 1px solid #000000;
  border-radius: 8px;
  background: #fff;
  color: #3a3a3a;
  font-size: 0.95rem;
  text-align: center;
}

.hx-select {
  text-align: left;
}

.hx-input:focus,
.hx-select:focus {
  outline: 2px solid rgba(16, 42, 71, 0.45);
  outline-offset: 1px;
}

/* Solved (read-only) temperatures and calculated values. */
.hx-input.is-solved,
.hx-input[readonly],
.hx-readout {
  border-color: #d0d0d0;
  background: rgba(16, 42, 71, 0.07);
  color: #3a3a3a;
  font-weight: 700;
}

.hx-input.is-solved {
  cursor: default;
}

.hx-readout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.hx-flowrow {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.8rem 1.4rem;
}

.hx-field {
  display: grid;
  justify-items: center;
  gap: 0.25rem;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #3a3a3a;
}

.hx-field-box {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.hx-field-box .hx-input,
.hx-field-box .hx-readout {
  width: 88px;
}

.hx-field-box em {
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--navy-soft);
}

.hx-loops {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr) minmax(0, 1fr);
  align-items: center;
  gap: 1rem 0.8rem;
  margin: 1.3rem 0;
}

.hx-temp {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}

.hx-temp .hx-field-box .hx-input {
  width: 80px;
  background: #fff;
  color: #3a3a3a;
}

.hx-temp .hx-field-box .hx-input.is-solved {
  border-color: #d0d0d0;
  background: #e9e9e9;
  color: #3a3a3a;
}

.hx-mode {
  appearance: none;
  padding: 0.35rem 0.7rem;
  border: 1px solid rgba(16, 42, 71, 0.28);
  border-radius: 999px;
  background: #e9e9e9;
  color: #3a3a3a;
  font-size: 0.62rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.hx-mode:hover {
  box-shadow: 0 0 0 2px rgba(40, 39, 37, 0.2);
}

.hx-mode.is-active {
  border-color: var(--dark);
  background: #ffffff;
  color: var(--dark);
  font-weight: 700;
}

/* Heat exchanger diagram: red secondary loop on top, blue primary below. */
.hx-loop {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 66px;
  padding: 0 0.7rem;
  border-radius: 10px;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
}

.hx-loop-sec {
  padding-bottom: 14px;
  border: 2px solid #922b21;
  background: #c0392b;
}

.hx-loop-pri {
  padding-top: 14px;
  border: 2px solid #154360;
  background: #1a5276;
}

.hx-arrow {
  position: absolute;
  left: 14px;
  right: 14px;
  height: 3px;
  border-radius: 2px;
  background: #fff;
}

.hx-loop-sec .hx-arrow {
  bottom: 10px;
}

.hx-loop-pri .hx-arrow {
  top: 10px;
}

.hx-arrow::after {
  content: "";
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}

.hx-loop-sec .hx-arrow::after {
  right: -6px;
  border-left: 11px solid #fff;
}

.hx-loop-pri .hx-arrow::after {
  left: -6px;
  border-right: 11px solid #fff;
}

.hx-results {
  display: grid;
  gap: 0.7rem;
  margin-top: 1.3rem;
  padding-top: 1.1rem;
  border-top: 2px solid rgba(16, 42, 71, 0.16);
}

.hx-capacity-note {
  margin: 0;
  text-align: left;
}

.hx-result-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.92rem;
  color: #3a3a3a;
}

.hx-result-line .hx-readout {
  width: auto;
  min-width: 84px;
}

.hx-big {
  font-size: 1.1rem;
}

.hx-input-sm {
  width: 64px;
}

#hx-target_return {
  width: 80px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

#hx-ua,
#hx-kw,
#hx-pct_design {
  color: #b42318;
}

.hx-note {
  min-height: 1.2em;
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  text-align: center;
  color: #a3362b;
}

/* Expandable calculation tables. */
.hx-steps {
  margin-top: 1.5rem;
  padding: 0.4rem 1.5rem;
}

.hx-steps details + details {
  border-top: 1px solid rgba(16, 42, 71, 0.12);
}

.hx-steps summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0;
  font-family: "Libre Baskerville", "Georgia", serif;
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--navy);
  list-style: none;
  cursor: pointer;
}

.hx-steps summary::-webkit-details-marker {
  display: none;
}

.hx-steps summary::after {
  content: "Show \25B6";
  flex: none;
  font-family: "Archivo", "Arial", sans-serif;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.hx-steps details[open] summary::after {
  content: "Hide \25BC";
}

.hx-table-wrap {
  overflow-x: auto;
  padding-bottom: 1rem;
}

.hx-table {
  width: 100%;
  min-width: 1000px;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.hx-table th:nth-child(1) {
  width: 17%;
}

.hx-table th:nth-child(2) {
  width: 32%;
}

.hx-table th:nth-child(3) {
  width: 37%;
}

.hx-table th:nth-child(4) {
  width: 14%;
}

.hx-table th,
.hx-table td {
  padding: 0.5rem 0.7rem;
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.hx-table thead th {
  border-bottom: 1px solid rgba(16, 42, 71, 0.2);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--navy-soft);
}

.hx-table tbody tr:nth-child(odd) {
  background: rgba(16, 42, 71, 0.04);
}

.hx-table tbody th {
  font-weight: 600;
  white-space: nowrap;
}

.hx-table .hx-eq,
.hx-table .hx-num,
.hx-table tbody .hx-u {
  font-family: Arial, sans-serif;
  font-size: 0.85rem;
  font-style: normal;
  font-weight: 400;
  color: var(--navy);
}

.hx-table .hx-eq,
.hx-table tbody .hx-u {
  font-style: italic;
}

.hx-table .hx-num {
  white-space: normal;
}

#hx-ua-7 strong,
#hx-ntu-10 strong,
#hx-ntu-11 strong {
  color: #b42318;
  font-weight: 700;
}

.hx-table .hx-u {
  text-align: right;
  white-space: normal;
}

@media (max-width: 900px) {
  .hx-app {
    grid-template-columns: 1fr;
  }

  .hx-app > [role="tabpanel"] .hx-panel-title,
  .hx-app > [role="tabpanel"] .hx-panel-title + br {
    display: none;
  }
}

@media (max-width: 600px) {
  .hx-panel {
    padding: 1.1rem;
    border-radius: 18px;
  }

  .hx-row {
    grid-template-columns: minmax(0, 1fr) 84px 34px 56px;
    gap: 0.35rem;
    font-size: 0.84rem;
  }

  .hx-field-box .hx-input,
  .hx-field-box .hx-readout {
    width: 72px;
  }

  .hx-loops {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) minmax(0, 1fr);
    gap: 0.8rem 0.4rem;
  }

  .hx-temp .hx-field-box .hx-input,
  #hx-target_return {
    width: 64px;
  }

  .hx-loop {
    padding: 0 0.4rem;
    font-size: 0.66rem;
  }

  .hx-mode {
    padding: 0.3rem 0.5rem;
    font-size: 0.56rem;
    letter-spacing: 0.05em;
  }

  .hx-steps {
    padding: 0.3rem 1.1rem;
  }
}

/*
  Layered water flowing left to right. It fills the navy section from the top
  of the first row of cards down to the footer; the top edge fades out into
  the page background. --water-top is set in main.js from the card position.
*/
.services-section {
  padding-bottom: 0.5in;
}

.services-section > .container {
  position: relative;
  z-index: 1;
}

.water-flow {
  --fade: 180px;
  --fade-mask: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0) 0,
    rgba(0, 0, 0, 0.04) calc(var(--fade) * 0.15),
    rgba(0, 0, 0, 0.14) calc(var(--fade) * 0.3),
    rgba(0, 0, 0, 0.32) calc(var(--fade) * 0.45),
    rgba(0, 0, 0, 0.55) calc(var(--fade) * 0.6),
    rgba(0, 0, 0, 0.78) calc(var(--fade) * 0.75),
    rgba(0, 0, 0, 0.94) calc(var(--fade) * 0.9),
    #000 var(--fade)
  );
  position: absolute;
  top: var(--water-top, 35%);
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  pointer-events: none;
  -webkit-mask-image: var(--fade-mask);
  mask-image: var(--fade-mask);
}

/* Each layer is a solid band with a wavy top edge, slid sideways forever. */
.wave {
  --wave-shape: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 60' preserveAspectRatio='none'%3E%3Cpath d='M0 30 C150 5 350 5 600 30 C850 55 1050 55 1200 30 L1200 60 L0 60 Z' fill='black'/%3E%3C/svg%3E");
  /* Never let the crest be taller than the layer itself. */
  --crest-h: min(var(--crest), 100%);
  position: absolute;
  bottom: 0;
  left: calc(var(--wave-w) * -1);
  width: calc(100% + var(--wave-w));
  height: var(--h);
  background: var(--c);
  -webkit-mask:
    var(--wave-shape) repeat-x 0 0 / var(--wave-w) var(--crest-h),
    linear-gradient(#000, #000) no-repeat 0 100% / 100% calc(100% - var(--crest-h) + 1px);
  mask:
    var(--wave-shape) repeat-x 0 0 / var(--wave-w) var(--crest-h),
    linear-gradient(#000, #000) no-repeat 0 100% / 100% calc(100% - var(--crest-h) + 1px);
  animation: wave-flow var(--speed) linear infinite;
  animation-delay: var(--delay, 0s);
  will-change: transform;
}

/* Layer sizes, speeds and colors are generated in main.js (data-layers on .water-flow). */

@keyframes wave-flow {
  from { transform: translateX(0); }
  to   { transform: translateX(var(--wave-w)); }
}

@media (prefers-reduced-motion: reduce) {
  .wave {
    animation: none;
  }
}

@media (max-width: 900px) {
  .hero-row {
    flex-direction: column;
    gap: 1.4rem;
    padding-top: 5rem;
  }

  .hero-tagline {
    align-self: flex-end;
  }

  .panel-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- Phone-only layout (iPhone and similar, up to 600px wide) ---------- */
@media (max-width: 600px) {
  .brand-mark {
    left: 0.8rem;
    top: 0.8rem;
    min-width: 62px;
    min-height: 46px;
  }

  .mark-core {
    font-size: 0.85rem;
    letter-spacing: 0.08em;
  }

  /* Top bar: tighter edges and smaller buttons so everything fits on one row. */
  .top-bar-inner {
    min-height: 54px;
    padding: 0.45rem 1rem;
    padding-top: calc(0.45rem + env(safe-area-inset-top, 0px));
    gap: 0.45rem;
  }

  .logo-slot img {
    height: 32px;
  }

  .top-bar-leading {
    gap: 0.4rem;
  }

  .top-actions {
    gap: 0.4rem;
  }

  .copy-email,
  .nav-button {
    min-width: 0;
    min-height: 34px;
    padding: 0.55rem 0.7rem;
    font-size: 0.6rem;
    letter-spacing: 0.08em;
  }

  /* Contact popover drops down as a full-width bar under the top bar
     instead of opening off the left edge of the screen. */
  .contact-wrap {
    position: static;
  }

  .contact-popover {
    position: fixed;
    top: calc(54px + env(safe-area-inset-top, 0px));
    left: 0;
    right: 0;
    transform: none;
    justify-content: center;
    flex-wrap: wrap;
    padding: 0.7rem 1rem;
    background: var(--offwhite);
    border-bottom: 1px solid rgba(16, 42, 71, 0.16);
    border-radius: 0;
    box-shadow: 0 10px 24px rgba(16, 42, 71, 0.12);
    white-space: normal;
  }

  .copy-status {
    position: static;
    flex-basis: 100%;
    text-align: center;
  }

  .copy-status:empty {
    display: none;
  }

  /* Hero: left-aligned branding with a right-aligned tagline below. */
  .landing-screen {
    padding-top: 0.6rem;
  }

  .hero-row {
    align-items: flex-start;
    gap: 1.1rem;
    padding: 4.5rem 1.25rem 0;
    text-align: left;
  }

  h1 {
    font-size: clamp(3.3rem, 20vw, 6rem);
  }

  .subtitle {
    font-size: 1.17rem;
  }

  .hero-tagline {
    align-self: flex-end;
    font-size: 1.05rem;
    line-height: 1.3;
    text-align: right;
  }

  .hero-tagline br {
    display: none;
  }

  /* Services: less empty space above, full-width single-column cards. */
  .container {
    width: calc(100% - 2rem);
  }

  .services-section {
    padding: calc(4rem + 1in) 0 0.5in;
    scroll-margin-top: 54px;
  }

  .water-flow {
    --fade: 120px;
  }

  .hero-tagline.section-tagline {
    margin-bottom: 1.6rem;
    font-size: 1.6rem;
    color: #3a3a3a;
  }

  /* Keep the second heading light since it sits on the navy background. */
  .hero-tagline.section-tagline.section-tagline-next {
    color: var(--offwhite);
  }

  .hero-tagline.section-tagline-next {
    margin-top: 3rem;
    scroll-margin-top: calc(54px + 1.5rem);
  }

  .flip-hint {
    margin: -1rem 0 1.4rem;
  }

  .panel-grid {
    gap: 1rem;
  }

  .flip-card,
  .card-inner {
    min-height: calc(380px - 1in);
  }

  .card-face {
    padding: 1.25rem 1.25rem 1rem;
    border-radius: 18px;
  }

  .card-front h3,
  .card-back h3 {
    font-size: 1.35rem;
  }

  .services-section .card-face h3 {
    min-height: 0;
  }

  .card-list {
    font-size: 0.92rem;
  }

  /* Footer: centered, no desktop indent. */
  .bottom-bar-inner {
    justify-content: center;
    width: calc(100% - 1.2rem);
    padding-bottom: calc(0.55rem + env(safe-area-inset-bottom, 0px));
  }

  .footer-brand {
    padding-left: 0;
    font-size: 0.62rem;
    letter-spacing: 0.1em;
  }

  .footer-brand img {
    height: 26px;
  }
}

/* Touch screens: no hover lift, which otherwise sticks after a tap. */
@media (hover: none) {
  .flip-card:hover {
    transform: none;
  }

  .copy-email:hover,
  .nav-button:hover {
    transform: none;
  }
}

/* Restore the logo and Analysis button on calculator/analysis pages. */
.analysis-page .logo-slot {
  display: inline-flex !important;
  grid-column: 2;
  justify-self: center;
}

.analysis-page .logo-wordmark {
  font-size: 0.84rem;
}

.analysis-page .top-actions {
  grid-column: 3;
  width: 100%;
  justify-self: stretch;
  justify-content: flex-end;
}

.analysis-page .nav-button {
  display: inline-flex !important;
  width: 120px;
  min-width: 120px;
  flex: 0 0 120px;
  background: #3a3a3a;
  color: #f4f4f4;
  border-color: rgba(58, 58, 58, 0.24);
}

.analysis-page .nav-button:hover {
  background: #2a2a2a;
}

.analysis-page .nav-button.is-current {
  background: var(--offwhite);
  color: var(--dark);
  border-color: rgba(58, 58, 58, 0.24);
}

.analysis-page .nav-button.is-current:hover {
  background: #fffdf7;
}

.header-home-link {
  display: inline-flex;
  width: 120px;
  min-width: 120px;
  flex: 0 0 120px;
  padding: 0.7rem 1.1rem;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  background: #3a3a3a;
  color: #f4f4f4;
  border-color: rgba(58, 58, 58, 0.24);
}

.header-home-link:hover {
  background: #2a2a2a;
}

/* Consultancy homepage: keep the shared calculator and catalog styles intact. */
.home-page .logo-brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
}

.home-page .logo-wordmark {
  font-size: 0.84rem;
  text-transform: none;
}

.home-page .logo-tagline {
  color: #3a3a3a;
  font-family: "Libre Baskerville", "Georgia", serif;
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.2;
  text-transform: none;
  white-space: nowrap;
}

.home-page .logo-tagline::before {
  content: "- ";
}

.home-page .hero-row {
  gap: 2.5rem;
  align-items: flex-start;
}

.home-page .intro-block {
  min-width: 0;
}

.home-page .hero-message {
  max-width: 430px;
  margin-bottom: 0.4rem;
  text-align: right;
}

.home-page .home-section-number {
  font-family: "Courier Prime", monospace;
  font-weight: 700;
  letter-spacing: 0.12em;
  font-size: 0.76rem;
}

.home-page .hero-tagline {
  font-size: clamp(1.15rem, 2vw, 1.7rem);
  line-height: 1.4;
}

.home-page .hero-link {
  display: inline-block;
  margin-top: 1.25rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid currentColor;
  color: var(--navy);
  font-size: clamp(1.1rem, 1.8vw, 1.4rem);
  font-weight: 700;
}

.home-page .hero-link:focus-visible,
.home-page .home-contact a:focus-visible {
  outline: 3px solid #cf9c4f;
  outline-offset: 5px;
}

.home-page .services-section {
  overflow: hidden;
  padding: 0 0 4rem;
  background: var(--offwhite);
}

.home-page .water-flow {
  --fade: 720px;
  background: var(--navy);
}

.home-page .home-group {
  position: relative;
  isolation: isolate;
  padding: clamp(4rem, 8vw, 7rem) 0;
  scroll-margin-top: 64px;
}

.home-page .home-group-light {
  color: var(--offwhite);
}

.home-page .home-group-heading {
  margin: 0 0 2.5rem;
}

.home-page #procurement .home-group-heading {
  text-align: right;
}

.home-page #procurement .home-group-heading p {
  margin-left: auto;
}

.home-page #team .home-group-heading {
  text-align: center;
}

.home-page #team .home-group-heading p {
  margin-left: auto;
  margin-right: auto;
}

@media (min-width: 901px) {
  .home-page .home-group-heading {
    /* Match the hero's 0.5in left padding, outside the centered card grid. */
    margin-left: calc(0.5in - (100vw - min(1180px, 100vw - 2rem)) / 2);
  }

  .home-page #procurement .home-group-heading {
    margin-left: 0;
    margin-right: calc(0.5in - (100vw - min(1180px, 100vw - 2rem)) / 2);
  }

  .home-page #team .home-group-heading {
    margin-left: 0;
  }
}

.home-page .home-section-number {
  display: inline-block;
  margin-bottom: 1.25rem;
  padding: 0.4rem 0.75rem;
  border-radius: 4px;
  background: var(--navy);
  color: var(--offwhite);
  font-size: clamp(1rem, 1.7vw, 1.3rem);
}

.home-page .home-group-light .home-section-number {
  background: var(--offwhite);
  color: #3a3a3a;
}

.home-page .home-group-heading h2 {
  font-size: clamp(0.95rem, 3.8vw, 3.6rem);
  line-height: 1.15;
  white-space: nowrap;
}

.home-page .home-group-heading p {
  max-width: 630px;
  margin: 1.1rem 0 0;
  font-size: clamp(1rem, 1.6vw, 1.2rem);
  line-height: 1.7;
}

.home-page .services-section .service-grid {
  margin-bottom: 0;
}

.home-page .home-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
  gap: clamp(1.5rem, 3.5vw, 3rem);
}

.home-page .home-card,
.home-page .home-card .card-inner,
.home-page .home-card .card-face {
  min-height: 220px;
}

.home-page .home-card {
  width: 100%;
  height: 100%;
}

.home-page #procurement .home-card {
  min-height: var(--consulting-card-height, calc(245px + 0.5in));
}

.home-page #team .home-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
}

.home-page #team .home-card {
  width: 100%;
  margin: 0;
}

.home-page .home-card .card-face {
  display: flex;
  flex-direction: column;
  padding: clamp(1.5rem, 3vw, 2.25rem);
  background: #fffdf7;
  border: 1px solid rgba(16, 42, 71, 0.16);
  box-shadow: 0 18px 40px rgba(10, 26, 44, 0.1);
}

.home-page .home-card:hover,
.home-page .home-card:focus-visible {
  transform: none;
}

.home-page .services-section .home-card:hover .card-face,
.home-page .services-section .home-card:focus-visible .card-face {
  border-color: rgba(16, 42, 71, 0.16);
  box-shadow: 0 18px 40px rgba(10, 26, 44, 0.1);
}

.home-page .services-section .home-card h3 {
  min-height: 0;
  font-size: clamp(1.45rem, 2vw, 1.85rem);
  line-height: 1.2;
}

.home-page .home-card p {
  margin-top: 1rem;
  font-size: 1.248rem;
  line-height: 1.65;
}

.home-page .bio-card .card-face {
  min-height: 310px;
}

.home-page .bio-portrait {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  height: auto;
  flex-shrink: 0;
  margin-bottom: 1.5rem;
  border-radius: 14px;
  object-fit: cover;
}

.home-page .bio-card .bio-role {
  margin-top: 0.75rem;
  font-weight: 700;
}

.home-page .bio-card .bio-specialty {
  margin-top: 0.25rem;
}

.home-page .bio-card .card-front,
.home-page .bio-card .card-back {
  position: relative;
  height: auto;
  transform: none;
}

.home-page .bio-card .card-back {
  margin-top: 1rem;
  background: var(--navy);
  color: var(--offwhite);
}

.home-page .bio-card .card-back h3,
.home-page .bio-card .card-back p {
  color: var(--offwhite);
}

.home-page .bio-card .card-back h4 {
  margin: 1.75rem 0 0;
  font-family: "Courier Prime", monospace;
  font-size: 1.1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.home-page .bio-card .card-back p {
  font-size: clamp(calc(1rem + 2px), calc(1.4vw + 2px), calc(1.15rem + 2px));
  line-height: 1.55;
}

.home-page .bio-card .card-back li {
  font-size: clamp(1rem, 1.4vw, 1.15rem);
  line-height: 1.55;
}

.home-page .bio-linkedin {
  align-self: center;
  margin-top: 4.5rem;
  color: var(--offwhite);
  font-family: "Courier Prime", monospace;
  font-size: 1.3em;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.home-page .bio-linkedin:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 4px;
}

.home-page .bio-card .card-back ul {
  margin: 0.8rem 0 0;
  padding-left: 1.25rem;
}

.home-page .bio-flip-cue {
  display: none;
  margin-top: auto;
  align-self: flex-end;
  padding-top: 1.25rem;
  text-align: right;
  font-family: "Courier Prime", monospace;
  font-size: 0.9rem;
  font-weight: 700;
}

.home-page.team-flip-ready .bio-card .bio-flip-cue {
  display: block;
}

.home-page.team-flip-ready .bio-card:focus-visible {
  outline: 3px solid var(--offwhite);
  outline-offset: 4px;
}

.home-page.team-flip-ready .bio-card .card-front {
  position: relative;
  height: 100%;
  transform: rotateY(0deg);
}

.home-page.team-flip-ready .bio-card .card-back {
  position: absolute;
  margin-top: 0;
  height: 100%;
  transform: rotateY(180deg);
  overflow-y: auto;
}

@media (prefers-reduced-motion: reduce) {
  .home-page .bio-card .card-inner {
    transition: none;
  }
}

.home-page .home-contact {
  padding: 3.5rem 0 1.5rem;
  text-align: center;
  color: var(--offwhite);
}

.home-page .home-contact p {
  margin: 0 0 0.8rem;
  font-family: "Courier Prime", monospace;
  font-size: clamp(1.25rem, 2.5vw, 1.75rem);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.home-page .home-contact a {
  display: inline-block;
  border-bottom: 1px solid currentColor;
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: clamp(1.3rem, 3vw, 2rem);
}

/* Cards stay visible unless JS explicitly enables the scroll reveal. */
@media (prefers-reduced-motion: no-preference) {
  .home-page.reveal-ready .home-card,
  .home-page.reveal-ready .hero-row,
  .home-page.reveal-ready .home-group-heading,
  .home-page.reveal-ready .home-contact {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 1.2s ease, transform 1.2s cubic-bezier(0.2, 0.7, 0.2, 1);
  }

  .home-page.reveal-ready .home-card.is-visible {
    transition-delay: calc(var(--reveal-order, 0) * 160ms);
  }

  .home-page.reveal-ready #procurement .home-card.is-visible {
    transition-delay: calc((2 - var(--reveal-order, 0)) * 160ms);
  }

  .home-page.reveal-ready .home-card.is-visible,
  .home-page.reveal-ready .hero-row.is-visible,
  .home-page.reveal-ready .home-group-heading.is-visible,
  .home-page.reveal-ready .home-contact.is-visible {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 900px) {
  .home-page .top-bar-inner {
    grid-template-columns: 1fr 1fr;
  }

  .home-page .top-bar-leading {
    grid-column: 1;
    grid-row: 1;
  }

  .home-page .top-actions {
    grid-column: 2;
    grid-row: 1;
  }

  .home-page .logo-slot {
    grid-column: 1 / -1;
    grid-row: 2;
    flex-direction: column;
    gap: 0.3rem;
    min-width: 0;
    text-align: center;
  }

  .home-page .logo-tagline {
    max-width: 100%;
    white-space: normal;
  }

  .home-page .logo-tagline::before {
    content: none;
  }

  .home-page .hero-row {
    align-items: flex-start;
  }

  .home-page .home-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-page .hero-message {
    align-self: flex-end;
  }

  .home-page .home-card,
  .home-page .home-card .card-inner,
  .home-page .home-card .card-face,
  .home-page .bio-card .card-face {
    min-height: 0;
  }

  .home-page .home-card .card-face {
    padding: 1.6rem;
  }

}

@media (max-width: 600px) {
  .home-page .water-flow {
    --fade: 520px;
  }

  .home-page .logo-slot {
    gap: 0.4rem;
  }

  .home-page .logo-tagline {
    font-size: clamp(0.64rem, 2.8vw, 0.84rem);
  }

  .home-page .services-section .panel-grid.home-card-grid,
  .home-page #team .home-card-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .home-page .home-card-grid .home-card {
    width: 100%;
    min-width: 0;
  }

  .home-page .hero-row {
    padding: 7rem 1.25rem 0;
  }

  .home-page .hero-message {
    max-width: 100%;
  }

  .home-page .hero-tagline {
    font-size: 1.08rem;
  }

  .home-page .home-group {
    padding: 4rem 0;
  }

  .home-page .home-group-heading {
    margin-bottom: 2rem;
  }

  @media (prefers-reduced-motion: no-preference) {
    .home-page.reveal-ready .home-card,
    .home-page.reveal-ready .hero-row,
    .home-page.reveal-ready .home-group-heading,
    .home-page.reveal-ready .home-contact {
      transform: translateY(24px);
    }

    .home-page.reveal-ready .home-card.is-visible,
    .home-page.reveal-ready .hero-row.is-visible,
    .home-page.reveal-ready .home-group-heading.is-visible,
    .home-page.reveal-ready .home-contact.is-visible {
      transform: translateY(0);
    }
  }
}

/* On very wide monitors, keep content inside six-inch side margins. */
@media (min-width: 2304px) {
  .home-page .top-bar-inner,
  .home-page .hero-row,
  .analysis-page .top-bar-inner {
    padding-left: 6in;
    padding-right: 6in;
  }

  .home-page .services-section > .container,
  .analysis-page .analysis-main > .container {
    width: calc(100% - 12in);
  }

  .home-page .home-group-heading,
  .home-page #procurement .home-group-heading,
  .home-page #team .home-group-heading {
    margin-left: 0;
    margin-right: 0;
  }
}
