/* ==========================================================================
   Reusable components — header, nav, buttons, cards, forms, footer
   ========================================================================== */

/* --- Site header --------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  height: var(--header-height);
  display: flex;
  align-items: center;
  background-color: var(--color-bg);
  border-bottom: 1px solid transparent;
  transition: border-color var(--transition), box-shadow var(--transition);
}

/* .is-scrolled is added by nav.js once the page scrolls */
.site-header.is-scrolled {
  border-bottom-color: var(--color-border);
  box-shadow: var(--shadow-sm);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  width: 100%;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  font-weight: 700;
  font-size: var(--text-lg);
  color: var(--color-heading);
  letter-spacing: -0.02em;
}

.logo__mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background-color: var(--color-brand);
  color: #fff;
  font-size: var(--text-sm);
  font-weight: 700;
}

/* --- Primary navigation --------------------------------------------------- */

.nav {
  display: flex;
  align-items: center;
  gap: var(--space-5);
}

.nav__list {
  display: flex;
  align-items: center;
  gap: var(--space-5);
}

.nav__link {
  position: relative;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  padding-block: var(--space-2);
  transition: color var(--transition);
}

.nav__link:hover {
  color: var(--color-heading);
}

/* aria-current="page" marks the active page in each HTML file */
.nav__link[aria-current="page"] {
  color: var(--color-brand);
  font-weight: 600;
}

.nav__link[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 2px;
  background-color: var(--color-brand);
  border-radius: var(--radius-full);
}

/* Hamburger — hidden on desktop, shown under 860px */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: var(--space-2);
  border-radius: var(--radius-sm);
}

.nav-toggle__bar {
  display: block;
  width: 22px;
  height: 2px;
  background-color: var(--color-heading);
  border-radius: var(--radius-full);
  transition: transform var(--transition), opacity var(--transition);
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(2) {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* --- Theme toggle --------------------------------------------------------- */

.theme-toggle {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  transition: color var(--transition), border-color var(--transition);
}

.theme-toggle:hover {
  color: var(--color-heading);
  border-color: var(--color-text-muted);
}

.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }

[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.4;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  text-align: center;
  transition: background-color var(--transition), border-color var(--transition),
    color var(--transition), transform var(--transition);
}

.btn:active {
  transform: translateY(1px);
}

.btn--primary {
  background-color: var(--color-brand);
  color: #fff;
}

.btn--primary:hover {
  background-color: var(--color-brand-dark);
}

.btn--secondary {
  background-color: transparent;
  color: var(--color-heading);
  border-color: var(--color-border);
}

.btn--secondary:hover {
  border-color: var(--color-brand);
  color: var(--color-brand);
}

.btn--ghost {
  background-color: #fff;
  color: var(--color-brand);
}

.btn--ghost:hover {
  background-color: rgba(255, 255, 255, 0.88);
}

.btn--block {
  width: 100%;
}

.btn[disabled],
.btn[aria-disabled="true"] {
  opacity: 0.55;
  pointer-events: none;
}

/* --- Cards ---------------------------------------------------------------- */

.card {
  display: flex;
  flex-direction: column;
  padding: var(--space-6);
  background-color: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: border-color var(--transition), box-shadow var(--transition),
    transform var(--transition);
}

/* Only lift cards that are actually clickable */
a.card:hover,
.card--interactive:hover {
  border-color: var(--color-brand);
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}

.card__icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: var(--space-4);
  border-radius: var(--radius-sm);
  background-color: var(--color-brand-light);
  color: var(--color-brand);
}

.card__title {
  margin-bottom: var(--space-3);
}

.card__text {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

/* --- Feature badges ------------------------------------------------------- */

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-brand);
  background-color: var(--color-brand-light);
  border-radius: var(--radius-full);
}

/* Sits on the dark CTA band, where brand-on-brand-light has no contrast */
.badge--onDark {
  color: #fff;
  background-color: rgba(255, 255, 255, 0.18);
}

/* --- Gallery -------------------------------------------------------------- */

.gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-5);
}

.gallery__item {
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background-color: var(--color-bg);
  width: 100%;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.gallery__item:hover {
  border-color: var(--color-brand);
  box-shadow: var(--shadow-md);
}

/*
  Every tile is the same size (3:4 portrait, matching most of the photos), and
  `contain` scales each photo to fit inside it whole — nothing is cropped.
  Photos that aren't exactly 3:4 sit against the tile background with a small
  margin at the sides or top; that gap is the cost of showing the full picture
  at a uniform size. Swap to `cover` only if you'd rather fill every tile edge
  to edge and lose the outer parts of the photo.
*/
.gallery__media {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: contain;
  background-color: var(--color-bg-alt);
}

/*
  Videos keep their own shape rather than being forced into a fixed box, so a
  portrait clip doesn't end up with heavy black bars either side. max-height
  stops a tall portrait video from filling the whole screen — without it a
  9:16 clip in a half-width column becomes roughly 1000px tall.
*/
video.gallery__media {
  aspect-ratio: auto;
  height: auto;
  max-height: 520px;
  object-fit: contain;
  background-color: #000;
}

.gallery__caption {
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  border-top: 1px solid var(--color-border);
}

/* --- Spec table ----------------------------------------------------------- */

.spec-table th,
.spec-table td {
  padding: var(--space-3) 0;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
  font-size: var(--text-sm);
}

.spec-table th {
  font-weight: 600;
  color: var(--color-heading);
  width: 45%;
}

.spec-table td {
  color: var(--color-text-muted);
}

/* --- Forms ---------------------------------------------------------------- */

.form {
  display: grid;
  gap: var(--space-5);
}

.form__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-5);
}

/* Two ways to send the same enquiry — email and WhatsApp, side by side. */
.form__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.form__actions .btn {
  flex: 1 1 12rem;
}

.field {
  display: grid;
  gap: var(--space-2);
}

.field__label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-heading);
}

.field__required {
  color: var(--color-error);
}

.field__input,
.field__textarea,
.field__select {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  background-color: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.field__input:focus,
.field__textarea:focus,
.field__select:focus {
  outline: none;
  border-color: var(--color-brand);
  box-shadow: 0 0 0 3px var(--color-brand-light);
}

.field__textarea {
  min-height: 150px;
  resize: vertical;
}

.field__error {
  font-size: var(--text-xs);
  color: var(--color-error);
  min-height: 1em;
}

/* .has-error is set by form.js on failed validation */
.field.has-error .field__input,
.field.has-error .field__textarea,
.field.has-error .field__select {
  border-color: var(--color-error);
}

.field__hint {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* Honeypot — bots fill it, humans never see it */
.field--honeypot {
  position: absolute;
  left: -9999px;
  opacity: 0;
  pointer-events: none;
}

.form__status {
  padding: var(--space-4);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
}

.form__status:empty {
  display: none;
}

.form__status--success {
  background-color: rgba(26, 127, 71, 0.1);
  color: var(--color-success);
}

.form__status--error {
  background-color: rgba(199, 44, 44, 0.1);
  color: var(--color-error);
}

/* --- Contact details list ------------------------------------------------- */

.contact-list {
  display: grid;
  gap: var(--space-5);
}

.contact-list__item {
  display: flex;
  gap: var(--space-4);
  align-items: flex-start;
}

.contact-list__label {
  display: block;
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: var(--space-1);
}

/* --- Accordion (FAQ) ------------------------------------------------------ */

.accordion {
  border-top: 1px solid var(--color-border);
}

.accordion__item {
  border-bottom: 1px solid var(--color-border);
}

.accordion__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding-block: var(--space-5);
  font-weight: 600;
  color: var(--color-heading);
  cursor: pointer;
  list-style: none;
}

.accordion__summary::-webkit-details-marker {
  display: none;
}

.accordion__summary::after {
  content: "+";
  font-size: var(--text-xl);
  font-weight: 400;
  color: var(--color-brand);
  transition: transform var(--transition);
}

.accordion__item[open] .accordion__summary::after {
  content: "\2212"; /* minus */
}

.accordion__body {
  padding-bottom: var(--space-5);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

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

.site-footer {
  padding-block: var(--space-8) var(--space-5);
  background-color: var(--color-bg-alt);
  border-top: 1px solid var(--color-border);
  font-size: var(--text-sm);
}

.site-footer__grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: var(--space-6);
  margin-bottom: var(--space-7);
}

.site-footer__tagline {
  color: var(--color-text-muted);
  margin-top: var(--space-4);
  max-width: 32ch;
}

.site-footer__heading {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-heading);
  margin-bottom: var(--space-4);
}

.site-footer__list {
  display: grid;
  gap: var(--space-3);
}

.site-footer__list a {
  color: var(--color-text-muted);
  transition: color var(--transition);
}

.site-footer__list a:hover {
  color: var(--color-brand);
}

.site-footer__bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding-top: var(--space-5);
  border-top: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: var(--text-xs);
}

.social {
  display: flex;
  gap: var(--space-3);
}

.social a {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  transition: color var(--transition), border-color var(--transition);
}

.social a:hover {
  color: var(--color-brand);
  border-color: var(--color-brand);
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 860px) {
  .nav-toggle {
    display: flex;
  }

  /* Mobile drawer — .is-open is toggled by nav.js */
  .nav {
    position: fixed;
    inset: var(--header-height) 0 auto 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: var(--space-4) var(--gutter) var(--space-6);
    background-color: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-md);
    transform: translateY(-120%);
    visibility: hidden;
    transition: transform var(--transition), visibility var(--transition);
  }

  .nav.is-open {
    transform: translateY(0);
    visibility: visible;
  }

  .nav__list {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }

  .nav__link {
    display: block;
    padding: var(--space-4) 0;
    font-size: var(--text-base);
    border-bottom: 1px solid var(--color-border);
  }

  .nav__link[aria-current="page"]::after {
    display: none;
  }

  .nav .btn {
    margin-top: var(--space-5);
  }
}

@media (max-width: 860px) {
  .site-footer__grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 960px) {
  .gallery {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .form__row {
    grid-template-columns: 1fr;
  }

  .gallery {
    grid-template-columns: 1fr;
  }

  .site-footer__grid {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }
}
