/* ==========================================================================
   Custovia Security: components
   Header, navigation, buttons, sections, cards, footer, forms.
   ========================================================================== */

/* ---------- Dark surfaces: light text and a light focus ring ---------- */

.site-header,
.site-footer,
.mobile-menu,
.section--dark,
.page-hero,
.cta-band { --focus-ring: var(--steel-300); }

.section--dark,
.page-hero,
.cta-band { color: var(--grey-300); }

.section--dark :is(h1, h2, h3, h4),
.page-hero :is(h1, h2, h3, h4),
.cta-band :is(h1, h2, h3, h4) { color: var(--white); }

/* ---------- Layout helpers ---------- */

.section {
  position: relative;
  padding-block: clamp(4rem, 3rem + 5vw, 7.5rem);
}
.section--tint { background: var(--grey-50); }
.section--dark {
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(90, 127, 179, 0.22), transparent 60%),
    linear-gradient(180deg, var(--navy-900), var(--navy-950));
}

.section__head {
  display: grid;
  gap: 1rem;
  max-width: 46rem;
  margin-bottom: clamp(2.5rem, 2rem + 2vw, 4rem);
}
.section__head--center { margin-inline: auto; text-align: center; justify-items: center; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-sans);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--grey-600);
}
.eyebrow::before {
  content: "";
  width: 2rem;
  height: 1px;
  background: currentColor;
  opacity: 0.6;
}
.section--dark .eyebrow,
.page-hero .eyebrow,
.cta-band .eyebrow { color: var(--steel-300); }

.lead {
  max-width: 60ch;
  font-size: clamp(1.08rem, 1rem + 0.4vw, 1.28rem);
  line-height: 1.6;
  color: var(--grey-600);
}
.section--dark .lead,
.page-hero .lead,
.cta-band .lead { color: var(--grey-300); }

.prose > * + * { margin-top: 1.1em; }

.grid { display: grid; gap: clamp(1.25rem, 1rem + 1.5vw, 2.25rem); }
@media (min-width: 720px) {
  .grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 860px) {
  .grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.9rem;
}

/* ---------- Motion: hero entrance (CSS only) and scroll reveal (armed by site.js) ---------- */

@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}
.rise {
  animation: rise 0.9s var(--ease) both;
  animation-delay: var(--rise-delay, 0ms);
}
.rise--1 { --rise-delay: 90ms; }
.rise--2 { --rise-delay: 180ms; }
.rise--3 { --rise-delay: 270ms; }
.rise--4 { --rise-delay: 360ms; }

/* Content is visible by default. site.js adds .is-armed only to blocks below the
   fold, then .is-in as they scroll into view, so nothing stays hidden if the
   script fails or never loads. */
.reveal.is-armed {
  opacity: 0;
  transform: translateY(20px);
}
.reveal.is-armed.is-in {
  opacity: 1;
  transform: none;
  transition:
    opacity 0.8s var(--ease) var(--reveal-delay, 0ms),
    transform 0.8s var(--ease) var(--reveal-delay, 0ms);
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  min-height: 3rem;
  padding: 0.8rem 1.5rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.015em;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color 0.2s,
    color 0.2s,
    border-color 0.2s,
    transform 0.2s var(--ease),
    box-shadow 0.2s;
}
.btn:active { transform: translateY(1px); }

.btn--primary {
  background: var(--navy-700);
  color: var(--white);
  box-shadow: 0 6px 18px -8px rgba(18, 48, 94, 0.7);
}
.btn--primary:hover {
  background: var(--navy-600);
  transform: translateY(-1px);
  box-shadow: 0 12px 24px -10px rgba(18, 48, 94, 0.7);
}

.btn--light { background: var(--white); color: var(--navy-900); }
.btn--light:hover { background: var(--grey-100); transform: translateY(-1px); }

.btn--ghost { background: transparent; color: var(--navy-900); border-color: var(--grey-300); }
.btn--ghost:hover { background: var(--grey-50); border-color: var(--navy-700); }

.section--dark .btn--ghost,
.page-hero .btn--ghost,
.cta-band .btn--ghost,
.mobile-cta .btn--ghost {
  color: var(--white);
  border-color: rgba(255, 255, 255, 0.32);
}
.section--dark .btn--ghost:hover,
.page-hero .btn--ghost:hover,
.cta-band .btn--ghost:hover,
.mobile-cta .btn--ghost:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.6);
}

.btn--sm { min-height: 2.75rem; padding: 0.6rem 1.1rem; font-size: 0.88rem; }
.btn--block { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.6; cursor: not-allowed; transform: none; }

.btn__arrow { transition: transform 0.25s var(--ease); }
.btn:hover .btn__arrow { transform: translateX(3px); }

/* ---------- Header and navigation ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  isolation: isolate;
}
/* The tinted, blurred backdrop lives on a pseudo-element: backdrop-filter on the
   header itself would trap the fixed mobile menu inside the header's box. */
.site-header::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--navy-900);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  transition: background-color 0.3s, box-shadow 0.3s;
}
.site-header.is-scrolled::before {
  background: rgba(8, 21, 41, 0.86);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  backdrop-filter: saturate(140%) blur(14px);
  box-shadow: 0 10px 30px -18px rgba(0, 0, 0, 0.6);
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  min-height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  color: var(--white);
  text-decoration: none;
}
.brand__logo {
  flex: none;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2), 0 8px 18px -8px rgba(0, 0, 0, 0.7);
}
.brand__text { display: flex; flex-direction: column; line-height: 1; }
.brand__name {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}
.brand__tag {
  margin-top: 0.4rem;
  padding-left: 0.1em;
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.52em;
  text-transform: uppercase;
  color: var(--steel-300);
}

.primary-nav { display: none; margin-left: auto; gap: 0.15rem; }
.nav-link {
  position: relative;
  padding: 0.6rem 0.8rem;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--grey-300);
  text-decoration: none;
  transition: color 0.2s;
}
.nav-link::after {
  content: "";
  position: absolute;
  left: 0.8rem;
  right: 0.8rem;
  bottom: 0.2rem;
  height: 2px;
  background: var(--steel-400);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s var(--ease);
}
.nav-link:hover,
.nav-link[aria-current="page"] { color: var(--white); }
.nav-link:hover::after,
.nav-link[aria-current="page"]::after { transform: scaleX(1); }

.nav-cta { display: none; }

.menu-toggle {
  display: grid;
  place-items: center;
  width: 2.9rem;
  height: 2.9rem;
  margin-left: auto;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-sm);
  color: var(--white);
}
.menu-toggle__bars,
.menu-toggle__bars::before,
.menu-toggle__bars::after {
  display: block;
  width: 1.25rem;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: transform 0.3s var(--ease), background-color 0.2s;
}
.menu-toggle__bars { position: relative; }
.menu-toggle__bars::before,
.menu-toggle__bars::after { content: ""; position: absolute; left: 0; }
.menu-toggle__bars::before { top: -6px; }
.menu-toggle__bars::after { top: 6px; }
.menu-toggle[aria-expanded="true"] .menu-toggle__bars { background: transparent; }
.menu-toggle[aria-expanded="true"] .menu-toggle__bars::before { transform: translateY(6px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] .menu-toggle__bars::after { transform: translateY(-6px) rotate(-45deg); }

.mobile-menu {
  position: fixed;
  inset: var(--header-h) 0 0 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 2rem;
  padding: 1.5rem var(--gutter) calc(2rem + env(safe-area-inset-bottom));
  overflow-y: auto;
  background: var(--navy-950);
  animation: rise 0.35s var(--ease) both;
}
.mobile-menu[hidden] { display: none; }
.mobile-menu__nav { display: grid; }
.mobile-menu__link {
  padding: 0.7rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 500;
  color: var(--white);
  text-decoration: none;
}
.mobile-menu__link[aria-current="page"] { color: var(--steel-300); }
.mobile-menu__foot { display: grid; gap: 1.25rem; }
.mobile-menu__contact { display: grid; gap: 0.5rem; font-size: 0.95rem; color: var(--grey-300); }
.mobile-menu__contact a { text-decoration: none; }

body.menu-open { overflow: hidden; }

@media (min-width: 960px) {
  .primary-nav { display: flex; }
  .nav-cta { display: inline-flex; }
  .menu-toggle { display: none; }
  .mobile-menu { display: none !important; }
  .brand__name { font-size: 1.5rem; }
}

/* Bottom action bar on phones and tablets: the two ways to start, always in reach. */
.mobile-cta {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 45;
  display: flex;
  gap: 0.6rem;
  padding: 0.7rem var(--gutter) calc(0.7rem + env(safe-area-inset-bottom));
  background: rgba(8, 21, 41, 0.94);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.mobile-cta .btn { flex: 1; min-height: 2.9rem; padding-inline: 0.75rem; }
body { padding-bottom: calc(4.6rem + env(safe-area-inset-bottom)); }
body[data-page="estimate"],
body[data-page="quote"] { padding-bottom: 0; }
body[data-page="estimate"] .mobile-cta,
body[data-page="quote"] .mobile-cta { display: none; }
@media (min-width: 960px) {
  .mobile-cta { display: none; }
  body { padding-bottom: 0; }
}

/* ---------- Page hero and call-to-action band ---------- */

.page-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding-block: clamp(4rem, 3rem + 5vw, 7rem);
  background:
    radial-gradient(1000px 520px at 88% -20%, rgba(90, 127, 179, 0.28), transparent 62%),
    linear-gradient(180deg, var(--navy-900) 0%, var(--navy-950) 100%);
}
/* A fine architectural grid that fades out away from the top-right glow. */
.page-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: radial-gradient(ellipse at 80% 0%, #000 0%, transparent 70%);
  mask-image: radial-gradient(ellipse at 80% 0%, #000 0%, transparent 70%);
}
.page-hero__inner { display: grid; justify-items: start; gap: 1.25rem; }
.page-hero__inner > h1 { max-width: 20ch; }

.cta-band {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding-block: clamp(4rem, 3rem + 4vw, 6.5rem);
  text-align: center;
  background:
    radial-gradient(800px 380px at 50% 120%, rgba(90, 127, 179, 0.3), transparent 65%),
    var(--navy-900);
}
.cta-band__inner {
  display: grid;
  gap: 1.25rem;
  justify-items: center;
  max-width: 44rem;
  margin-inline: auto;
}
.cta-band .actions { justify-content: center; margin-top: 0.75rem; }

/* ---------- Cards, badges, pills, lists ---------- */

.card {
  background: var(--white);
  border: 1px solid var(--grey-200);
  border-radius: var(--radius-md);
  padding: clamp(1.5rem, 1.2rem + 1vw, 2.25rem);
  box-shadow: var(--shadow-sm);
}
.card--link {
  display: block;
  color: inherit;
  text-decoration: none;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), border-color 0.3s;
}
.card--link:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--grey-300); }
.card--dark {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: none;
}

.icon-badge {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: var(--grey-100);
  color: var(--navy-700);
}
.icon-badge svg { width: 1.4rem; height: 1.4rem; }
.section--dark .icon-badge,
.card--dark .icon-badge { background: rgba(255, 255, 255, 0.08); color: var(--steel-300); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.95rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--grey-300);
}
.badge svg { width: 1.1rem; height: 1.1rem; color: var(--steel-300); flex: none; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.7rem;
  border: 1px solid var(--grey-300);
  border-radius: 999px;
  background: var(--white);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--grey-600);
}
.pill--sample { border-style: dashed; }

.checklist { display: grid; gap: 0.8rem; }
.checklist li { position: relative; padding-left: 2rem; }
.checklist li::before {
  content: "";
  position: absolute;
  top: 0.5em;
  left: 0.15rem;
  width: 0.75rem;
  height: 0.4rem;
  border-bottom: 2px solid var(--navy-700);
  border-left: 2px solid var(--navy-700);
  transform: rotate(-45deg);
}
.section--dark .checklist li::before,
.card--dark .checklist li::before { border-color: var(--steel-300); }

/* Shown in draft mode for contact details that are not filled in yet. */
.placeholder-chip {
  display: inline-block;
  padding: 0.1rem 0.55rem;
  border: 1px dashed currentColor;
  border-radius: 4px;
  font-size: 0.85em;
  font-style: italic;
  opacity: 0.85;
}

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

.site-footer {
  padding-top: clamp(3.5rem, 3rem + 3vw, 5.5rem);
  background: var(--navy-950);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.95rem;
  color: var(--grey-400);
}
.site-footer a { text-decoration: none; transition: color 0.2s; }
.site-footer a:hover { color: var(--white); }
.site-footer__grid { display: grid; gap: 2.5rem; padding-bottom: 3rem; }
@media (min-width: 760px) {
  .site-footer__grid { grid-template-columns: 1.5fr 1fr 1.3fr; gap: 3rem; }
}
.site-footer__blurb { max-width: 34ch; margin-top: 1.25rem; }
.site-footer .badge { margin-top: 1.5rem; }
.site-footer__heading {
  margin-bottom: 1.1rem;
  font-family: var(--font-sans);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--white);
}
.footer-list { display: grid; gap: 0.7rem; }
.contact-row { display: flex; align-items: center; gap: 0.7rem; }
.contact-row svg { width: 1.1rem; height: 1.1rem; flex: none; color: var(--steel-300); }
.footer-coi { display: inline-flex; margin-top: 1.1rem; color: var(--steel-300); }
.footer-coi:hover { text-decoration: underline; }
.site-footer__bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  padding-block: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.85rem;
}

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

.field { display: grid; gap: 0.45rem; align-content: start; }
.field__label { font-size: 0.86rem; font-weight: 600; color: var(--grey-700); }
.field__hint { font-size: 0.82rem; color: var(--grey-600); }
.field__error { font-size: 0.85rem; font-weight: 500; color: var(--danger); }

.input {
  width: 100%;
  min-height: 3.25rem;
  padding: 0.8rem 1rem;
  border: 1px solid var(--grey-300);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--grey-900);
  transition: border-color 0.2s, box-shadow 0.2s;
}
textarea.input { min-height: 8.5rem; resize: vertical; line-height: 1.5; }
.input:hover { border-color: var(--grey-400); }
.input:focus {
  outline: none;
  border-color: var(--navy-600);
  box-shadow: 0 0 0 3px rgba(26, 65, 124, 0.2);
}
.input[aria-invalid="true"] { border-color: var(--danger); }
select.input {
  padding-right: 2.5rem;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--grey-600) 50%),
    linear-gradient(135deg, var(--grey-600) 50%, transparent 50%);
  background-position: calc(100% - 1.3rem) 55%, calc(100% - 0.95rem) 55%;
  background-size: 0.35rem 0.35rem;
  background-repeat: no-repeat;
}
