/* =========================================================
   Rix Engineering – main stylesheet
   Layout and navy palette modelled on rallyxtreme.co.uk,
   with gold/red accents from the Rix logo. Change the palette here.
   ========================================================= */
:root {
  --header-bg: #010f7d;        /* navy header */
  --dark: #010f7d;             /* navy services band */
  --dark-2: #0a1a9a;
  --footer-bg: #151d60;
  --light: #cfcabe;            /* warm beige sections */
  --card: #f7f7f5;
  --white: #ffffff;
  --text: #333333;
  --muted: #666666;
  --heading: #010f7d;
  --accent: #f7c843;           /* logo gold */
  --accent-2: #f0a030;         /* warm gold */
  --accent-3: #d8402b;         /* logo red */
  --radius: 10px;
  --header-h: 88px;
  --maxw: 1140px;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: var(--header-h); }

body {
  margin: 0;
  font-family: "Roboto", "Helvetica Neue", Arial, sans-serif;
  font-weight: 300;
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  background: var(--white);
}

img { max-width: 100%; display: block; }
a { color: var(--accent-3); }

.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding-inline: 20px;
}

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--accent); color: var(--header-bg); padding: 8px 14px; z-index: 200;
}
.skip-link:focus { left: 10px; top: 10px; }

/* ---------- Header ---------- */
.site-header {
  position: fixed; inset: 0 0 auto 0;
  height: var(--header-h);
  background: var(--header-bg);
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,.35);
}
.header-inner {
  height: 100%;
  display: flex; align-items: center; justify-content: space-between;
}
.logo img { height: 58px; width: auto; }

.site-nav ul {
  list-style: none; margin: 0; padding: 0;
  display: flex; gap: 44px;
}
.site-nav a {
  color: #fcfcfc;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  position: relative;
  padding: 6px 0;
}
.site-nav a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0;
  height: 2px; background: var(--accent);
  transform: scaleX(0); transition: transform .25s ease;
}
.site-nav a:hover::after,
.site-nav a.active::after { transform: scaleX(1); }
.site-nav a:hover, .site-nav a.active { color: var(--accent); }

.nav-toggle {
  display: none;
  background: none; border: 0; cursor: pointer;
  width: 44px; height: 44px; padding: 10px;
}
.nav-toggle span {
  display: block; height: 2px; background: #fff; margin: 6px 0;
  transition: transform .25s, opacity .25s;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

/* ---------- Hero ---------- */
.hero { padding-top: var(--header-h); background: var(--header-bg); }
.hero-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  height: min(62vh, 560px);
}
.hero-strip img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.hero-band {
  background: var(--footer-bg);
  border-top: 3px solid var(--accent);
  color: #fcfcfc;
  text-align: center;
}
.hero-band p {
  margin: 0; padding: 14px 0;
  font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; font-size: .95rem;
}
.hero-band .dot { margin: 0 10px; color: var(--accent); }

/* ---------- Sections ---------- */
.section { padding: 70px 0; }
.section--light { background: var(--light); }
.section--white { background: var(--white); }
.section--dark {
  background-color: var(--dark);
  background-image:
    radial-gradient(circle at 15% 25%, rgba(60,90,255,.35) 0, transparent 45%),
    radial-gradient(circle at 85% 75%, rgba(0,5,70,.6) 0, transparent 50%),
    repeating-linear-gradient(45deg, rgba(255,255,255,.035) 0 2px, transparent 2px 16px);
}

.section-title {
  font-weight: 700;
  font-size: clamp(1.9rem, 3.5vw, 2.6rem);
  line-height: 1.2;
  color: var(--heading);
  margin: 0 0 24px;
}
.section-title::after {
  content: ""; display: block;
  width: 64px; height: 4px; margin-top: 12px;
  background: var(--accent);
  border-radius: 2px;
}
.card--split .section-title,
.card--services > .section-title { text-align: center; }
.card--split .section-title::after,
.card--services > .section-title::after,
.section-title--center::after { margin-inline: auto; }
.section-title--center { text-align: center; }

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 44px;
  box-shadow: 0 6px 24px rgba(0,0,0,.12);
}
.section--dark .card + .card { margin-top: 36px; }

.card--split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: center;
}
.card-text { text-align: center; }
.card-text p { margin: 0 0 16px; }
.card-media img {
  width: 100%; border-radius: 6px;
  aspect-ratio: 4 / 3; object-fit: cover;
}

.btn {
  display: inline-block;
  margin-top: 8px;
  background: var(--header-bg);
  color: #fcfcfc;
  border: 0;
  border-radius: var(--radius);
  padding: 12px 30px;
  font: 500 1rem "Roboto", Arial, sans-serif;
  text-decoration: none;
  cursor: pointer;
  transition: background .2s, color .2s;
}
.btn:hover, .btn:focus-visible { background: var(--accent); color: var(--header-bg); }

/* ---------- Services ---------- */
.service {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: center;
}
.service--reverse .service-box { order: 2; }

.service-box {
  border: 5px solid var(--light);
  border-radius: 6px;
  padding: 28px 30px;
  text-align: center;
  color: var(--muted);
  background: var(--card);
}
.service-box h3 {
  margin: 0 0 16px;
  color: var(--heading);
  font-weight: 700;
  font-size: 1.15rem;
}
.service-box h3::after {
  content: ""; display: block; width: 36px; height: 3px;
  margin: 10px auto 0; background: var(--accent);
}
.service-box p { margin: 0 0 14px; }
.service-box p:last-child { margin-bottom: 0; }

.service-media {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.service-media img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 6px;
}

/* ---------- Gallery ---------- */
.gallery {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.gallery a { display: block; overflow: hidden; border-radius: 4px; }
.gallery img {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover;
  transition: transform .4s ease, filter .4s ease;
}
.gallery a:hover img { transform: scale(1.06); filter: brightness(1.08); }

/* ---------- Contact ---------- */
.section--white .section-title { color: var(--heading); }
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 50px;
  margin-top: 10px;
}
.contact-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px 30px;
  align-content: start;
}
.info-block h3 {
  margin: 0 0 6px;
  font-size: .8rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--accent-3);
}
.info-block p, .info-block address { margin: 0; font-style: normal; color: var(--text); }
.info-block a { color: var(--heading); font-weight: 500; text-decoration: none; word-break: break-word; }
.info-block a:hover { color: var(--accent-3); }

.hours { border-collapse: collapse; width: 100%; }
.hours th, .hours td { padding: 3px 0; text-align: left; font-size: .95rem; }
.hours th { font-weight: 500; color: var(--heading); padding-right: 14px; }
.hours td { color: var(--text); white-space: nowrap; }

.contact-form .form-row { margin-bottom: 20px; }
.contact-form label {
  display: block; margin-bottom: 6px;
  font-weight: 500; font-size: .95rem; color: var(--heading);
}
.req { color: var(--accent-3); }
.contact-form input,
.contact-form textarea {
  width: 100%;
  font: 400 1rem "Roboto", Arial, sans-serif;
  padding: 10px 12px;
  border: 1px solid #c4c4c4;
  border-radius: 3px;
  background: #fff;
  transition: border-color .2s, box-shadow .2s;
}
.contact-form input:focus,
.contact-form textarea:focus {
  outline: none;
  border-color: var(--header-bg);
  box-shadow: 0 0 0 3px rgba(1,15,125,.15);
}
.contact-form textarea { resize: vertical; }
.name-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.name-fields small { display: block; font-size: .8rem; color: var(--muted); margin-top: 2px; }
.form-error { color: var(--accent-3); font-weight: 500; margin: 0 0 12px; }

.map {
  margin-top: 50px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 5px solid var(--light);
}
.map iframe { display: block; width: 100%; height: 360px; border: 0; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--footer-bg);
  color: #d8d8d8;
  text-align: center;
  font-size: .9rem;
  border-top: 3px solid var(--accent);
}
.site-footer p { margin: 0; padding: 24px 0; }

/* ---------- Page top button ---------- */
.page-top {
  position: fixed; right: 20px; bottom: 20px;
  width: 42px; height: 42px;
  display: grid; place-items: center;
  background: var(--footer-bg); color: #fff;
  border: 1px solid rgba(255,255,255,.35); border-radius: 3px;
  opacity: 0; visibility: hidden;
  transition: opacity .3s, visibility .3s, background .2s;
  z-index: 90;
}
.page-top.show { opacity: 1; visibility: visible; }
.page-top:hover { background: var(--accent); color: var(--header-bg); }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(1,8,60,.94);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.lightbox[hidden] { display: none; }
.lightbox img { max-height: 88vh; max-width: min(1100px, 100%); border-radius: 4px; }
.lightbox button {
  position: absolute; background: none; border: 0; color: #fff;
  font-size: 3rem; line-height: 1; cursor: pointer; padding: 10px 16px;
}
.lightbox button:hover { color: var(--accent); }
.lightbox-close { top: 10px; right: 14px; }
.lightbox-prev { left: 10px; top: 50%; transform: translateY(-50%); }
.lightbox-next { right: 10px; top: 50%; transform: translateY(-50%); }

/* ---------- Scroll reveal (like the original's fade-in-up) ---------- */
.reveal { opacity: 0; transform: translateY(30px); transition: opacity .7s ease, transform .7s ease; }
.reveal.visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  :root { --header-h: 72px; }
  .logo img { height: 44px; }

  .nav-toggle { display: block; }
  .site-nav {
    position: absolute; top: var(--header-h); left: 0; right: 0;
    background: var(--header-bg);
    max-height: 0; overflow: hidden;
    transition: max-height .3s ease;
  }
  .site-nav.open { max-height: 320px; border-top: 1px solid rgba(255,255,255,.15); }
  .site-nav ul { flex-direction: column; gap: 0; padding: 8px 20px 16px; }
  .site-nav a { display: block; padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,.1); }
  .site-nav a::after { display: none; }

  .card--split, .service, .contact-grid { grid-template-columns: 1fr; gap: 28px; }
  .service--reverse .service-box { order: 0; }
  .gallery { grid-template-columns: repeat(2, 1fr); }
  .hero-strip { height: 46vh; }
}

@media (max-width: 600px) {
  .section { padding: 48px 0; }
  .card { padding: 24px 18px; }
  .service-box { padding: 22px 16px; }
  .hero-strip { grid-template-columns: 1fr 1fr; height: auto; }
  .hero-strip img { aspect-ratio: 1; }
  .hero-strip img:first-child { grid-column: 1 / -1; aspect-ratio: 16 / 10; }
  .hero-band p { font-size: .8rem; }
  .hero-band .dot { display: none; }
  .contact-info { grid-template-columns: 1fr; }
  .gallery { gap: 8px; }
  .map iframe { height: 280px; }
}
