:root {
  --primary-color: #fce138;
  --secondary-color: #024e76;
  --tertiary-color: #39a6b2;

  /* Responsive type scales (improves readability/engagement) */
  --step--1: clamp(0.875rem, 0.82rem + 0.2vw, 0.95rem);
  --step-0: clamp(1rem, 0.95rem + 0.4vw, 1.125rem);
  --step-1: clamp(1.25rem, 1.05rem + 0.9vw, 1.5rem);
  --step-2: clamp(1.5rem, 1.2rem + 1.4vw, 1.875rem);
  --step-3: clamp(2rem, 1.6rem + 2vw, 2.75rem);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: Helvetica, Arial, sans-serif;
  font-size: var(--step-0);
  line-height: 1.6;
}

/* Utility: hidden but accessible (for SEO-friendly single H1) */
.visually-hidden {
  position: absolute !important;
  height: 1px;
  width: 1px;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  white-space: nowrap;
}

/* Focus styles (keyboard + accessibility -> better UX metrics) */
:focus-visible {
  outline: 3px solid var(--primary-color);
  outline-offset: 3px;
}

/* Link hover/active states: clearer affordance + contrast */
a {
  color: inherit;
  text-decoration: none;
}
a:hover,
a:focus-visible { text-decoration: underline; }

/* HEADER / NAV BAR */
header {
  padding: 20px 35px;
  background-color: var(--tertiary-color);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 9999;
  /* prevent layout shift when sticky engages */
  will-change: transform;
  background: #024e76;
  background-size: cover;
  background-attachment: fixed;
  background-position: 80%;
}

header h1 {
  font-weight: bold;
  margin: 0;
  font-size: var(--step-3);
  color: var(--primary-color);
  text-shadow: 0 0 10px rgba(0, 0, 0, .5);
}

header a { color: var(--primary-color); }

header nav { margin: 7px 0; }

header nav ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  list-style: none;
  gap: .25rem .5rem;
}

/* Replace vw-based font size (can get tiny) with clamp for readability */
header nav ul li a {
  padding: 12px 16px; /* larger tap targets (>=44px combined with line-height) */
  font-weight: 500;
  font-size: clamp(1rem, .6rem + .9vw, 1.25rem);
  line-height: 1.2;
  border-radius: 12px;
  text-shadow: 0 0 10px rgba(0, 0, 0, .5);
}

header nav ul li a:hover {
  background: var(--primary-color);
  color: var(--secondary-color);
  border-radius: 12px;
  text-shadow: none;
}

/* FOOTER */
footer {
  background: var(--primary-color);
  padding: 40px 35px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  width: 100%;
}

footer h2 {
  color: var(--secondary-color);
  font-size: var(--step-2);
  margin: 0;
}

footer div {
  line-height: 1.5;
  text-align: right;
}

footer a { color: var(--secondary-color); }

/* GLOBAL SECTIONS */
section { padding: 60px; }

/* HERO */
.hero {
  background-color: #08608f;
  background-size: cover;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  align-items: flex-start;
  background-attachment: fixed;
  background-position: 80%;
}

.hero-cta {
  width: 35%;
  text-align: right;
  margin: 3.5%;
  color: #fff;
  font-size: var(--step-0);
  line-height: 1.4;
}

.hero-cta h2 {
  font-style: italic;
  font-size: clamp(2rem, 1rem + 3vw, 3.4rem);
  color: var(--primary-color);
  text-shadow: 0 0 10px rgba(0, 0, 0, .5);
}

/* Form card: keeps consistent size to reduce CLS when fonts/images load */
.hero-form {
  border: 3px solid var(--secondary-color);
  background-color: rgba(255, 225, 56, .8);
  padding: 20px;
  color: var(--secondary-color);
  width: 40%;
  margin: 3.5%;
  border-radius: 15px;
  box-shadow: 0 0 10px rgba(0, 0, 0, .5);
  min-height: 360px; /* reserve space to prevent shift */
}

.hero-form h3 {
  font-size: var(--step-1);
  margin: 0;
}

.hero-form p { margin: 5px 0 15px; }

.hero-form button:hover { background-color: var(--tertiary-color); }

.form-input {
  border: 1px solid var(--secondary-color);
  display: block;
  padding: 10px 14px;
  font-size: 1rem;
  color: var(--secondary-color);
  width: 100%;
  margin-bottom: 15px;
  border-radius: 10px;
  background-color: rgba(255, 255, 255, .75);
}

.form-input:focus {
  background-color: rgba(255, 255, 255, 1);
  outline: none;
}

.hero-form label { margin: 0 5px; }

.hero-form button {
  color: var(--primary-color);
  background-color: var(--secondary-color);
  border: none;
  padding: 12px 20px;
  font-size: 1rem;
  border-radius: 10px;
  cursor: pointer;
}

/* Custom inputs */
.checkbox-wrapper input,
.radio-wrapper input { opacity: 0; }

.checkbox-wrapper label,
.radio-wrapper label {
  position: relative;
  left: 10px;
  margin: 10px;
  line-height: 1.6;
}

.checkbox-wrapper label::before,
.radio-wrapper label::before {
  content: "";
  height: 20px;
  width: 20px;
  background: rgba(255, 255, 255, .75);
  border: 1px solid var(--secondary-color);
  position: absolute;
  top: -4px;
  left: -30px;
}

.radio-wrapper label::before { border-radius: 50%; }

.radio-wrapper label::after {
  content: "";
  height: 20px;
  width: 20px;
  border-radius: 50%;
  position: absolute;
  left: -29px;
  top: -3px;
  background-image: radial-gradient(circle, var(--tertiary-color), var(--secondary-color));
}

.checkbox-wrapper label::after {
  content: "";
  height: 6px;
  width: 14px;
  border-left: 2px solid var(--secondary-color);
  border-bottom: 2px solid var(--secondary-color);
  position: absolute;
  left: -26px;
  top: 1px;
  transform: rotate(-58deg);
}

.checkbox-wrapper input + label::after,
.radio-wrapper input + label::after { content: none; }

.checkbox-wrapper input:checked + label::after,
.radio-wrapper input:checked + label::after { content: ""; }

/* SECTION TITLES */
.section-title {
  font-size: var(--step-2);
  border-bottom: 3px solid;
  color: var(--secondary-color);
  padding-bottom: 20px;
  text-align: center;
  margin: 0 auto 35px;
  width: min(50%, 820px);
}

.primary-border { border-color: var(--primary-color); }
.secondary-border { border-color: var(--tertiary-color); }

/* INTRO */
.intro p {
  line-height: 1.8;
  color: var(--tertiary-color);
  width: min(80%, 75ch);
  margin: 0 auto;
  font-size: var(--step-0);
  text-align: center;
}

/* PORTFOLIO GRID */
.trainers {
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-around;
  gap: 20px;
}

.trainer {
  margin: 0;
  flex: 1 1 300px;
  background: var(--secondary-color);
  color: var(--primary-color);
  border-radius: 12px;
  overflow: hidden;
}

.trainers a { color: #fce138; }

/* Reserve image space with aspect-ratio to reduce CLS */
.trainer img {
  width: 100%;
  aspect-ratio: 16 / 9; /* keeps box height stable during load */
  object-fit: cover;    /* tighter crop for thumbnails */
  display: block;
}

.trainer-bio { padding: 18px; line-height: 1.3; }

.trainer-bio h3 { font-size: var(--step-1); }

.trainer-bio h4 {
  font-weight: 400;
  font-size: var(--step-0);
  margin-bottom: 10px;
}

.trainer-bio p { font-size: var(--step--1); }

#resume p,
#about-me p { text-align: left; color: black; }

/* CONTACT */
.contact { background: var(--secondary-color); }

.contact h2 { color: var(--primary-color); }

.contact-info {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
}

.contact-info > * { flex: 1; min-width: 280px; }

.contact-info iframe {
  height: 400px;
  min-height: 400px;
  width: 100%;          /* Reserve intrinsic size to avoid layout jump */
  aspect-ratio: 16 / 9;
  border: 0;
}

.contact-info div { color: #fff; }

.contact-info h3 {
  color: var(--primary-color);
  font-size: var(--step-1);
}

.contact-info p,
.contact-info address {
  margin: 20px 0;
  line-height: 1.6;
  font-size: var(--step--1);
  font-style: normal;
}

.contact-form input,
.contact-form textarea {
  border: 1px solid var(--secondary-color);
  display: block;
  padding: 10px 14px;
  font-size: 1rem;
  color: var(--secondary-color);
  width: 100%;
  margin: 5px 0 15px;
  border-radius: 10px;
  background-color: rgba(255, 255, 255, .75);
}

.contact-form input:focus,
.contact-form textarea:focus {
  background-color: #fff;
  outline: none;
}

.contact-form button {
  width: 100%;
  border: none;
  background: var(--primary-color);
  color: var(--secondary-color);
  text-align: center;
  padding: 15px 0;
  font-size: 1rem;
  border-radius: 10px;
  cursor: pointer;
}

.contact-form button:hover {
  color: var(--primary-color);
  background: var(--tertiary-color);
}

.contact-info a { color: var(--primary-color); }

/* UTILITIES */
.text-left { text-align: left; }
.text-right { text-align: right; }
.flex-row { display: flex; }

.columns {
  display: inline-block;
  width: 32%;
  padding: 8px;
}

.price {
  list-style-type: none;
  border: 1px solid #eee;
  margin: 0;
  padding: 0;
  transition: .3s;
}

.price:hover { box-shadow: 0 8px 12px 0 rgba(0, 0, 0, .2); }

.price .header {
  background-color: #024e76;
  color: #fce138;
  font-size: var(--step-1);
}

.price li {
  border-bottom: 1px solid #eee;
  padding: 20px;
  text-align: center;
}

.price .grey {
  background-color: #eee;
  font-size: var(--step-0);
}

.button {
  background-color: #024e76;
  border: none;
  color: #fce138;
  padding: 10px 25px;
  text-align: center;
  text-decoration: none;
  font-size: 1.125rem;
}

/* MEDIA QUERIES */
/* ≤ 980px */
@media screen and (max-width: 980px) {
  header {
    padding-bottom: 0;
    justify-content: center;
    position: relative;
  }

  header h1 {
    width: 100%;
    text-align: center;
  }

  header nav ul {
    margin-top: 20px;
    width: 100%;
    justify-content: center;
  }

  header nav ul li a { font-size: 1.125rem; }

  footer h2,
  footer div {
    text-align: center;
    width: 100%;
  }

  .hero-cta,
  .hero-form { width: 100%; }

  .hero-cta { text-align: center; }

  .section-title { width: 80%; }

  .trainer { flex: 0 1 70%; }

  .contact-info iframe { flex: 1 100%; }
}

/* ≤ 768px */
@media screen and (max-width: 768px) {
  section { padding: 30px 15px; }

  .step h3 { flex: 1 100%; text-align: center; }
  .step-info { flex: 2 100%; text-align: center; justify-content: center; }
  .step-img { flex: 0 32%; margin: 15px 0; }
  .step-text { flex: 100%; }

  .trainer-bio h3,
  .trainer-bio h4 { display: block; }
}

/* ≤ 600px */
@media only screen and (max-width: 600px) {
  .columns { width: 100%; }
}

/* ≤ 575px */
@media screen and (max-width: 575px) {
  .hero-form button { width: 100%; }
  .section-title { width: 95%; }
  .intro p { width: 100%; }
  .trainer { flex: 0 1 100%; }

  .contact-info { text-align: center; }
  .contact-info > * { flex: 0 1 100%; }
  .contact-form { order: 3; }
}

/* Respect user motion preferences (stability helps UX signals) */
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* --- Header logo & nav fixes --- */
header .brand {
  display: flex;
  align-items: center;
}

header .brand img {
  /* hard cap the logo size */
  max-height: 56px; /* adjust to taste: 48–64px works well */
  width: auto;
  height: auto;
  aspect-ratio: auto; /* prevents stretching */
  display: block;
  border-radius: 6px; /* optional */
}

/* give the logo a little breathing room from the left edge */
header { padding-left: 20px; }

/* tighten nav spacing & size so it doesn't feel oversized */
header nav ul { gap: 8px 20px; }

header nav ul li a {
  font-size: clamp(0.95rem, 0.7rem + 0.6vw, 1.1rem);
  padding: 10px 12px; /* good tap target without looking huge */
  border-radius: 10px;
}

/* prevent the hero from sitting too close under the sticky header */
.hero { scroll-margin-top: 80px; }

/* smaller screens: keep logo sensible and center header nicely */
@media (max-width: 980px) {
  header .brand img { max-height: 48px; }
  header { padding-left: 12px; }
}

@media (max-width: 575px) {
  header .brand img { max-height: 44px; }
}

/* --- Footer styling improvements --- */
footer {
  background: var(--primary-color);
  padding: 20px 35px;
  display: flex;
  justify-content: space-between;
  align-items: center; /* vertically align text + nav */
  flex-wrap: wrap;
}

footer p {
  margin: 0;
  color: #000; /* or var(--secondary-color) if you prefer */
  font-size: 0.95rem;
}

footer nav ul {
  list-style: none;
  display: flex;
  gap: 20px; /* spacing between links */
  margin: 0;
  padding: 0;
}

footer nav ul li { display: inline; }

footer nav ul li a {
  color: var(--secondary-color);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
}

footer nav ul li a:hover { text-decoration: underline; }

/* --- Mobile Styles Fix --- */
@media screen and (max-width: 768px) {
  /* Header */
  header {
    flex-direction: column;
    align-items: center;
    padding: 15px;
  }

  header .brand img {
    max-height: 48px;
    margin-bottom: 8px;
  }

  header nav ul { gap: 15px; }

  header nav ul li a {
    font-size: 1rem;
    padding: 6px 10px;
  }

  /* Hero */
  .hero-cta h2 {
    font-size: 2rem; /* shrink heading */
    text-align: center;
  }

  .hero-cta {
    width: 100%;
    text-align: center;
    margin: 15px 0;
    font-size: 1rem;
  }

  .hero-form {
    width: 100%;
    margin: 0;
  }

  /* About Me paragraph fix: single column */
  #about-me .flex-row {
    flex-direction: column;
    text-align: center;
  }

  #about-me p {
    width: 100% !important;
    text-align: center !important;
    font-size: 1rem;
    line-height: 1.6;
  }

  /* Portfolio spacing */
  .trainers {
    flex-direction: column;
    gap: 20px;
  }

  .trainer { flex: 1 1 100%; }

  .trainer img {
    max-height: 200px;
    object-fit: cover;
  }

  .trainer-bio h3 {
    font-size: 1.25rem;
    text-align: center;
  }

  /* Contact section */
  .contact-info {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .contact-form {
    order: 2;
    width: 100%;
  }

  iframe {
    width: 100% !important;
    height: 250px !important;
  }

  /* Footer cleanup */
  footer {
    flex-direction: column;
    text-align: center;
    gap: 10px;
  }

  footer nav ul {
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px;
  }

  footer nav ul li { display: inline-block; }
}

/* --- About Me: force single-column layout --- */
#about-me .flex-row {
  /* kill the row layout */
  display: block; /* or: flex-direction: column; gap: 1rem; */
}

#about-me p {
  /* readable width + spacing */
  max-width: 70ch;
  width: 100%;
  margin: 0 auto 1rem;
  text-align: left;
  color: #000; /* matches your later rule */
}

/* optional: tighten spacing under the section title */
#about-me .section-title { margin-bottom: 24px; }
