/* IOTCASA site updates: navigation, enquiry form, brand film, FAQ and the not-found page.
   Load after the page's own styles. Pairs with js/nav.js, js/enquiry.js and js/film.js. */

:root {
  --nav-bg: #1E1E1E;
  --nav-panel: #2A2A2A;
  --nav-cream: #F7F1EA;
  --nav-muted: #C8BCB5;
  --nav-accent: #E3A15F;
  --nav-icon: #EF9800;
  --nav-line: rgba(247, 241, 234, 0.16);
  --nav-display: "Bricolage Grotesque", "Bricolage Fallback", Arial, sans-serif;
  --nav-body: Inter, "Inter Fallback", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --nav-h: 57px;
}

/* #root's inline overflow-x:hidden turned it into a scroll container, so the
   sticky header stuck to #root instead of the screen and scrolled away.
   `clip` keeps the horizontal clipping without creating a scroll container;
   browsers that lack it fall back to clipping on the page itself. */
#root { overflow: visible !important; overflow-x: clip !important; }
html { overflow-x: hidden; }
html.nav-open { overflow: hidden; }

main:focus { outline: none; }

.skip {
  position: fixed; left: 12px; top: -80px; z-index: 70;
  padding: 12px 16px;
  background: var(--nav-accent); color: var(--nav-bg);
  font: 700 16px/1.2 var(--nav-body);
}
.skip:focus { top: 12px; }

/* ---- Header: one slim row with a Menu button below 1100px ---- */

.nav-btn {
  display: none; align-items: center; gap: 10px; flex: none;
  min-height: 44px; padding: 0 14px;
  border: 1px solid var(--nav-line); background: none; color: var(--nav-cream);
  font: 600 13px/1 var(--nav-body); letter-spacing: 0.14em; text-transform: uppercase;
  cursor: pointer;
}
.nav-btn svg { width: 18px; height: 18px; flex: none; }

@media (max-width: 1099px) {
  .nav-on #root > header > div { flex-wrap: nowrap !important; padding-top: 6px !important; padding-bottom: 6px !important; }
  .nav-on #root > header .cnav { display: none !important; }
  .nav-on #root > header .hide-m { margin-left: auto; }
  .nav-on .nav-btn { display: inline-flex; }
}

/* Guides, privacy, thank you and not found: logo, phone, Menu. No link row at any width. */
.nav-compact .nav-btn { display: inline-flex; }
.nav-compact body > header .hcall { margin-left: auto; min-width: 44px; min-height: 44px; justify-content: center; }

/* ---- Full-screen menu ---- */

.nav-menu {
  position: fixed; inset: 0; z-index: 60;
  display: flex; flex-direction: column;
  background: var(--nav-bg); color: var(--nav-cream);
  font-family: var(--nav-body); font-size: 16px; line-height: 1.5;
  animation: nav-menu-in 180ms ease-out;
}
.nav-menu[hidden] { display: none; }
@keyframes nav-menu-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: none; }
}
.nav-menu a { color: inherit; text-decoration: none; }
.nav-menu ul { list-style: none; margin: 0; padding: 0; }

.nav-menu-top {
  flex: none;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 57px; padding: 6px clamp(20px, 5vw, 48px);
  border-bottom: 1px solid var(--nav-line);
}
.nav-menu-top .nav-btn { display: inline-flex; }

.nav-menu-body {
  flex: 1 1 auto; min-height: 0;
  overflow-y: auto; overscroll-behavior: contain;
  padding: 8px clamp(20px, 5vw, 48px) 24px;
}
.nav-menu-pages a {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 60px;
  border-bottom: 1px solid var(--nav-line);
  font-family: var(--nav-display); font-weight: 800; font-size: 28px; line-height: 1.1; letter-spacing: -0.03em;
}
.nav-menu-pages svg { width: 20px; height: 20px; flex: none; color: var(--nav-muted); }
.nav-menu-pages a[aria-current="page"] { color: var(--nav-accent); }
.nav-here {
  font: 600 11px/1 var(--nav-body); letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--nav-muted);
}

.nav-menu-guides { margin-top: 28px; }
.nav-menu-guides h2 {
  margin: 0 0 8px;
  font: 600 12px/1.5 var(--nav-body); letter-spacing: 0.3em; text-transform: uppercase;
  color: var(--nav-muted);
}
.nav-menu-guides a { display: flex; align-items: center; min-height: 48px; font-size: 17px; font-weight: 500; }
.nav-menu-guides small { margin-left: 8px; font-size: 14px; font-weight: 400; color: var(--nav-muted); }
.nav-menu-guides a[aria-current="page"] { color: var(--nav-accent); }
.nav-menu-guides .nav-here { margin-left: 12px; }

.nav-menu-actions {
  flex: none;
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  padding: 12px clamp(20px, 5vw, 48px) calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--nav-line);
}
.nav-menu-actions a {
  display: flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 16px;
  border: 1px solid var(--nav-line);
  font-weight: 700; letter-spacing: 0.04em; text-align: center;
}
.nav-menu-actions a:first-child { background: var(--nav-accent); border-color: var(--nav-accent); color: var(--nav-bg); }

/* ---- Home: headline and three starting points ---- */

.start { background: var(--nav-bg); color: var(--nav-cream); padding: 28px clamp(20px, 5vw, 48px) 12px; }
.start-in { max-width: 1200px; margin: 0 auto; }
.start-eyebrow {
  margin: 0;
  font-size: 12px; font-weight: 600; line-height: 1.5; letter-spacing: 0.3em; text-transform: uppercase;
  color: var(--nav-muted);
}
.start h1 {
  margin: 14px 0 0;
  font-family: var(--nav-display); font-weight: 800; font-size: clamp(36px, 6vw, 60px); line-height: 1.04; letter-spacing: -0.035em;
  text-wrap: balance;
}
.start h1 span { color: var(--nav-accent); }
.start-lede { margin: 14px 0 0; max-width: 34em; font-size: 17px; line-height: 1.55; color: var(--nav-muted); text-wrap: pretty; }

.start-paths { display: block; margin-top: 28px; }
.start-paths ul { display: grid; gap: 10px; list-style: none; margin: 12px 0 0; padding: 0; }
.start-paths a {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 76px; padding: 14px 16px;
  background: var(--nav-panel); border: 1px solid var(--nav-line);
  transition: border-color 150ms;
}
.start-paths a:hover { border-color: var(--nav-accent); }
.start-paths strong { display: block; font-family: var(--nav-display); font-weight: 700; font-size: 19px; line-height: 1.2; letter-spacing: -0.02em; }
.start-paths small { display: block; margin-top: 2px; font-size: 14px; line-height: 1.4; color: var(--nav-muted); }
.start-paths svg { width: 20px; height: 20px; flex: none; color: var(--nav-icon); }

[id^="route-"] { scroll-margin-top: calc(var(--nav-h) + 56px); }

@media (min-width: 760px) {
  .start { padding-top: 56px; padding-bottom: 24px; }
  .start-paths ul { grid-template-columns: repeat(3, 1fr); }
  .start-paths a { align-items: flex-start; min-height: 112px; height: 100%; }
}

/* ---- Jump links on long pages (Products, Brands) ---- */

.jump { background: var(--nav-bg); border-top: 1px solid var(--nav-line); border-bottom: 1px solid var(--nav-line); }
.nav-on .jump { position: sticky; top: var(--nav-h); z-index: 5; }
.jump ul {
  display: flex; gap: 8px; list-style: none;
  max-width: 1200px; margin: 0 auto; padding: 8px clamp(20px, 5vw, 48px);
  overflow-x: auto; scrollbar-width: none; scroll-behavior: smooth;
}
.jump ul::-webkit-scrollbar { display: none; }
.jump li { flex: none; }
.jump a {
  display: inline-flex; align-items: center;
  min-height: 44px; padding: 0 14px;
  border: 1px solid var(--nav-line);
  font-size: 14px; font-weight: 600; white-space: nowrap;
  color: var(--nav-muted);
}
.jump a[aria-current="true"] { background: var(--nav-accent); border-color: var(--nav-accent); color: var(--nav-bg); }
.jump-scope [id] { scroll-margin-top: calc(var(--nav-h) + 68px) !important; }

/* ---- Back to top ---- */

.nav-top {
  position: fixed; right: 16px; bottom: 24px; z-index: 15;
  display: inline-flex; align-items: center; justify-content: center;
  width: 46px; height: 46px; padding: 0;
  background: var(--nav-panel); border: 1px solid var(--nav-line); color: var(--nav-cream);
  cursor: pointer;
  opacity: 0; visibility: hidden; transform: translateY(6px);
  transition: opacity 180ms, transform 180ms, visibility 180ms;
}
.nav-top.is-shown { opacity: 1; visibility: visible; transform: none; }
.nav-top svg { width: 20px; height: 20px; }

@media (max-width: 760px) {
  .nav-top { bottom: calc(84px + env(safe-area-inset-bottom)); }
  footer p > a, footer span > a { display: inline-flex; align-items: center; min-height: 44px; }
}

/* ---- Enquiry form on the main pages (amber "Schedule a visit" section) ---- */

/* Five fields in two columns: the last one spans the row instead of leaving a gap. */
form[data-enquiry] > div:first-child > label:last-child:nth-child(odd) { grid-column: 1 / -1; }

form[data-enquiry] [aria-invalid="true"] { border-bottom: 2px solid var(--nav-bg); }

form[data-enquiry] .err {
  display: none; position: relative; margin: 0; padding-left: 32px;
  color: var(--nav-bg); font-size: 15px; font-weight: 700; line-height: 1.45;
}
form[data-enquiry] .err::before {
  content: "!"; position: absolute; left: 0; top: 0;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--nav-bg); color: var(--nav-accent);
  font-size: 14px; line-height: 22px; text-align: center;
}

.enq-submit {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 52px; padding: 0 30px;
  border: 1px solid var(--nav-bg); border-radius: 2px;
  background: var(--nav-bg); color: var(--nav-cream);
  font: inherit; font-weight: 700; letter-spacing: 0.06em;
  cursor: pointer;
}
.enq-submit:disabled { opacity: 0.7; cursor: progress; }

/* WhatsApp steps back to the second choice once there is a button that saves the enquiry. */
form[data-enquiry] a[data-wa] {
  background: none !important; color: var(--nav-bg) !important;
  border: 1px solid rgba(30, 30, 30, 0.6);
}
form[data-enquiry] a[data-wa] svg { stroke: var(--nav-bg) !important; }

.enq-consent { margin: 0; max-width: 52ch; font-size: 14px; line-height: 1.55; color: rgba(30, 30, 30, 0.85); text-wrap: pretty; }
.enq-consent a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }

@media (max-width: 560px) {
  .enq-submit, form[data-enquiry] a[data-wa] { flex: 1 1 100%; justify-content: center; }
}

/* ---- Brand film (Home) ---- */

.film-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; background: var(--nav-bg); }

.film-play {
  position: absolute; left: 16px; bottom: 16px; z-index: 2;
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 48px; padding: 0 20px 0 16px;
  border: 0; background: var(--nav-accent); color: var(--nav-bg);
  font: 700 15px/1 var(--nav-body); letter-spacing: 0.04em;
  cursor: pointer;
}
.film-play svg { width: 18px; height: 18px; flex: none; }
.film-play:focus-visible { outline-color: var(--nav-cream); }
.film-stage img { cursor: pointer; }

.film-bar { position: absolute; left: 16px; bottom: 16px; z-index: 2; display: none; gap: 8px; }
.film-stage.is-live .film-bar { display: flex; }
.film-stage.is-live .film-play { display: none; }
.film-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-width: 44px; min-height: 44px; padding: 0 16px;
  border: 1px solid rgba(247, 241, 234, 0.35);
  background: rgba(30, 30, 30, 0.72); color: var(--nav-cream);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  font: 600 14px/1 var(--nav-body); letter-spacing: 0.04em;
  cursor: pointer;
}
.film-btn svg { width: 18px; height: 18px; flex: none; }
.film-spin {
  width: 16px; height: 16px; flex: none;
  border: 2px solid rgba(247, 241, 234, 0.3); border-top-color: var(--nav-cream); border-radius: 50%;
  animation: film-spin 0.9s linear infinite;
}
@keyframes film-spin { to { transform: rotate(360deg); } }

@media (max-width: 560px) {
  .film-play, .film-bar { left: 8px; bottom: 8px; }
  .film-btn { padding: 0; }
  .film-btn .film-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}

/* ---- FAQ (How we work): the whole row is the tap target, not just the line of text ---- */

#faq details { padding: 0 !important; }
#faq summary { min-height: 60px !important; padding: 12px 0; }
#faq details > p { margin: 0 0 20px !important; }

/* ---- Page not found ---- */

.lost { padding: clamp(40px, 7vw, 88px) 0 clamp(56px, 8vw, 96px); }
.lost h1 { font-size: clamp(36px, 6vw, 60px); line-height: 1.04; letter-spacing: -0.035em; text-wrap: balance; }
.lost .sub { color: var(--nav-muted); }
.lost .start-paths a { color: var(--nav-cream); }
.lost .start-paths a:hover { color: var(--nav-cream); }
.lost-contact { display: flex; flex-wrap: wrap; align-items: center; gap: 0 24px; margin: 24px 0 0; color: var(--nav-muted); font-size: 16px; }
.lost-contact span { flex: 1 1 100%; }
.lost-contact a { display: inline-flex; align-items: center; min-height: 44px; text-decoration: underline; text-underline-offset: 4px; }
/* No quick-contact bar on this page, so no space is held for one. */
body.lost-page { padding-bottom: 0; }

@media (prefers-reduced-motion: reduce) {
  html, .jump ul { scroll-behavior: auto; }
  .nav-menu { animation: none; }
  .nav-top, .start-paths a { transition: none; }
  .film-spin { animation-duration: 3s; }
}
