/* ==========================================================================
   Sentinel Fire Protection (concept) : shared styles for every site page.
   Tailwind (CDN) handles layout and colour utilities in the HTML.
   This file holds the brand details and the motion system.

   Motion idea: "the line draws, the marks tick in".
   Hairlines draw themselves and due-date markers tick into place as you scroll.
   Only transform, opacity and stroke-dashoffset are animated.

   FAIL OPEN: every hidden start state lives behind the `js` class on <html>.
   No JS, a JS error, or reduced motion means everything is simply visible.
   ========================================================================== */

body { font-family: 'Inter', system-ui, sans-serif; }
.font-display { font-family: 'Oswald', system-ui, sans-serif; }
.font-mono { font-family: 'IBM Plex Mono', monospace; }

/* Sticky header is 4rem tall, so anchored sections stop just below it */
[id] { scroll-margin-top: 5.5rem; }

/* ---------- Portfolio "Spec work" menu (do not restyle) ---------- */
#specBtn.open .l1 { transform: translateY(5px) rotate(45deg); }
#specBtn.open .l2 { opacity: 0; }
#specBtn.open .l3 { transform: translateY(-5px) rotate(-45deg); }
.spec-line { transition: transform .3s ease, opacity .2s ease; }

/* ---------- Brand details carried over from the original design ---------- */
.blueprint {
  background-image: linear-gradient(rgba(93,109,126,.14) 1px, transparent 1px), linear-gradient(90deg, rgba(93,109,126,.14) 1px, transparent 1px);
  background-size: 32px 32px;
}
.hazard { height: 10px; background: repeating-linear-gradient(-45deg, #F0A202 0 18px, #171C1F 18px 36px); }
.code-badge { font-family: 'IBM Plex Mono', monospace; letter-spacing: .02em; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 44px; border-radius: 3px; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; font-size: .85rem; text-align: center;
}
.btn svg { transition: transform .25s ease; }
.btn:hover svg.arrow { transform: translateX(3px); }
.tag { position: relative; }
.tag::before {
  content: ''; position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  width: 10px; height: 10px; border-radius: 50%; background: #171C1F; box-shadow: inset 0 0 0 2px rgba(244,246,247,.5);
}

/* ---------- Keyboard focus (site only, the Spec work menu keeps its own look) ---------- */
:where(header, main, footer, #chatWrap, .mobile-bar) :where(a, button, input, select, textarea, summary):focus-visible {
  outline: 2px solid #F0A202; outline-offset: 2px;
}
.skip-link { position: absolute; left: -9999px; top: 0; z-index: 90; background: #F0A202; color: #171C1F; padding: .75rem 1rem; font-weight: 600; }
.skip-link:focus { left: 50%; transform: translateX(-50%); }

/* ---------- Header nav ---------- */
.nav-link {
  position: relative; display: inline-flex; align-items: center; min-height: 44px;
  padding: 0 .8rem; color: #8B98A3; transition: color .2s ease;
}
.nav-link::after {
  content: ''; position: absolute; left: .8rem; right: .8rem; bottom: 7px; height: 2px;
  background: #C0392B; transform: scaleX(0); transform-origin: left; transition: transform .3s cubic-bezier(.2,.7,.2,1);
}
.nav-link:hover { color: #F4F6F7; }
.nav-link:hover::after, .nav-link[aria-current="page"]::after { transform: scaleX(1); }
.nav-link[aria-current="page"] { color: #F4F6F7; }
.btn[aria-current="page"] { box-shadow: inset 0 -3px 0 #F0A202; }
.mnav-link { display: flex; align-items: center; min-height: 44px; padding: 0 .75rem; border-left: 2px solid transparent; color: #8B98A3; }
.mnav-link:hover { color: #F4F6F7; }
.mnav-link[aria-current="page"] { color: #F4F6F7; border-left-color: #C0392B; background: rgba(255,255,255,.04); }

/* Quiet scroll progress line along the bottom edge of the header */
.scroll-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; pointer-events: none; }
.scroll-progress span { display: block; height: 100%; background: #F0A202; transform: scaleX(0); transform-origin: left; opacity: .85; }

/* ---------- Section label with a hairline that draws in ---------- */
.eyebrow {
  display: flex; align-items: center; gap: .75rem;
  font-family: 'IBM Plex Mono', monospace; font-size: .75rem; line-height: 1rem;
  color: #F0A202; text-transform: uppercase; letter-spacing: .2em;
}
.eyebrow::before { content: ''; flex: none; width: 28px; height: 1px; background: #F0A202; transform-origin: left; }
.eyebrow.center { justify-content: center; }

/* ---------- Text links ---------- */
.more-link { display: inline-flex; align-items: center; gap: .5rem; min-height: 44px; font-weight: 600; color: #F0A202; }
.more-link svg { transition: transform .25s ease; }
.more-link:hover svg { transform: translateX(4px); }
.more-link:hover span { text-decoration: underline; text-underline-offset: 4px; }

/* ---------- Forms ---------- */
.field {
  display: block; width: 100%; min-height: 46px; border-radius: 3px; background: #2C3338; color: #F4F6F7;
  padding: .7rem .9rem; box-shadow: inset 0 0 0 1px rgba(255,255,255,.16); font-size: 1rem;
}
.field::placeholder { color: rgba(139,152,163,.7); }
.field:focus { outline: 2px solid #F0A202; outline-offset: 1px; }
.label { display: block; margin-bottom: .35rem; font-size: .875rem; font-weight: 500; color: #F4F6F7; }
.label small { font-weight: 400; color: #8B98A3; }

/* Checkbox and radio "chips" */
.chip { position: relative; display: inline-flex; }
.chip input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.chip span {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 .9rem; border-radius: 3px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); color: #8B98A3; font-size: .875rem; font-weight: 500;
  transition: background-color .2s ease, color .2s ease, box-shadow .2s ease;
}
.chip:hover span { color: #F4F6F7; }
.chip input:checked + span { background: rgba(240,162,2,.12); box-shadow: inset 0 0 0 1px #F0A202; color: #F4F6F7; }
.chip input:focus-visible + span { outline: 2px solid #F0A202; outline-offset: 2px; }

/* Confirmation panel shown after a demo form is "sent" */
.form-done { animation: sf-rise .45s cubic-bezier(.2,.7,.2,1) both; }
@keyframes sf-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- Services catalog ---------- */
.filter-pill { min-height: 44px; transition: background-color .2s ease, color .2s ease, border-color .2s ease; }
.filter-pill.active { background: #C0392B; border-color: #C0392B; color: #F4F6F7; }
.result-card { animation: sf-rise .4s cubic-bezier(.2,.7,.2,1) both; animation-delay: calc(var(--i, 0) * 28ms); }

/* ---------- Compliance calendar (the signature piece) ---------- */
.cal-months { display: grid; grid-template-columns: repeat(12, 1fr); font-family: 'IBM Plex Mono', monospace; font-size: 10px; letter-spacing: .04em; text-transform: uppercase; color: #5D6D7E; }
.cal-months span { padding: 0 0 4px 3px; border-left: 1px solid rgba(44,51,56,.14); overflow: hidden; }
.cal-track {
  position: relative; height: 46px;
  background-image: linear-gradient(90deg, rgba(44,51,56,.09) 1px, transparent 1px);
  background-size: calc(100% / 12) 100%;
}
.cal-line { position: absolute; left: 0; top: 17px; width: 100%; height: 2px; overflow: visible; }
.cal-line line { stroke: rgba(44,51,56,.38); stroke-width: 2; stroke-dasharray: 1; stroke-dashoffset: 0; }
.cal-mark, .cal-tick, .cal-lead, .cal-today, .cal-note { position: absolute; left: calc(var(--x) * 1%); }
/* Diamond: a visit by a technician */
.cal-mark { top: 18px; width: 12px; height: 12px; margin: -6px 0 0 -6px; background: #F0A202; box-shadow: 0 0 0 2px #F4F6F7; transform: rotate(45deg); }
.cal-mark.done { background: #5D6D7E; }
.cal-mark.due { background: #C0392B; }
/* Small tick: a quick visual check */
.cal-tick { top: 13px; width: 2px; height: 10px; margin-left: -1px; background: rgba(44,51,56,.45); }
/* Pale bar: the 30 days before a visit, when it gets booked */
.cal-lead { top: 15px; width: 8.2%; height: 6px; margin-left: -8.2%; background: rgba(240,162,2,.32); transform-origin: right; }
.cal-lead.due { background: rgba(192,57,43,.28); }
.cal-today { top: 0; bottom: 18px; width: 0; border-left: 1px dashed #C0392B; }
.cal-note { top: 28px; transform: translateX(-50%); font-family: 'IBM Plex Mono', monospace; font-size: 9.5px; letter-spacing: .03em; text-transform: uppercase; color: #5D6D7E; white-space: nowrap; }
.cal-key { display: inline-flex; align-items: center; gap: .5rem; }
.cal-key i { display: inline-block; flex: none; }
.cal-key .k-mark { width: 9px; height: 9px; background: #F0A202; transform: rotate(45deg); }
.cal-key .k-lead { width: 22px; height: 6px; background: rgba(240,162,2,.4); }
.cal-key .k-tick { width: 2px; height: 10px; background: rgba(44,51,56,.5); }
.cal-key .k-today { width: 0; height: 12px; border-left: 1px dashed #C0392B; }

/* ---------- Numbered steps (quote page) ---------- */
.steps { position: relative; }
.steps-line { position: absolute; left: 21px; top: 22px; bottom: 22px; width: 2px; background: rgba(240,162,2,.45); transform-origin: top; }
.step-num {
  position: relative; flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 3px;
  background: #171C1F; box-shadow: inset 0 0 0 1px rgba(240,162,2,.6); color: #F0A202;
  font-family: 'IBM Plex Mono', monospace; font-size: .9rem;
}

/* ---------- Check marks that draw ---------- */
.check { flex: none; }
.check path { stroke-dasharray: 1; stroke-dashoffset: 0; }

/* ---------- Cards that link somewhere ---------- */
.card-link { transition: box-shadow .25s ease, background-color .25s ease; }
.card-link:hover { background-color: rgba(255,255,255,.04); box-shadow: 0 0 0 1px rgba(192,57,43,.6); }

/* ==========================================================================
   MOTION. Everything below only applies when JS is running (html.js)
   and the visitor has not asked for reduced motion.
   ========================================================================== */
@media (prefers-reduced-motion: no-preference) {

  /* Staggered reveal. --i is set by site.js from the element's position among its siblings. */
  .js .reveal {
    opacity: 0; transform: translateY(16px);
    transition: opacity .7s cubic-bezier(.2,.7,.2,1), transform .7s cubic-bezier(.2,.7,.2,1);
    transition-delay: calc(var(--i, 0) * 80ms);
  }
  .js .reveal.in { opacity: 1; transform: none; }
  /* Linked cards keep their hover transition once revealed */
  .js .card-link.reveal { transition: opacity .7s cubic-bezier(.2,.7,.2,1), transform .7s cubic-bezier(.2,.7,.2,1), box-shadow .25s ease, background-color .25s ease; }

  /* Section label hairline draws in */
  .js .reveal .eyebrow::before, .js .eyebrow.reveal::before { transform: scaleX(0); transition: transform .8s cubic-bezier(.2,.7,.2,1) .25s; }
  .js .reveal.in .eyebrow::before, .js .eyebrow.reveal.in::before { transform: scaleX(1); }

  /* Check marks draw */
  .js .reveal .check path { stroke-dashoffset: 1; transition: stroke-dashoffset .5s ease calc(var(--i, 0) * 80ms + 300ms); }
  .js .reveal.in .check path { stroke-dashoffset: 0; }

  /* Calendar: each row's line draws left to right, markers tick in as the line reaches them */
  .js .cal .cal-line line { stroke-dashoffset: 1; transition: stroke-dashoffset 1.5s cubic-bezier(.45,0,.25,1) calc(var(--row, 0) * 150ms); }
  .js .cal.in .cal-line line { stroke-dashoffset: 0; }

  .js .cal .cal-mark { opacity: 0; transform: rotate(45deg) scale(.2); transition: opacity .25s ease, transform .5s cubic-bezier(.3,1.5,.5,1); transition-delay: calc(var(--row, 0) * 150ms + var(--x) * 14ms + 150ms); }
  .js .cal.in .cal-mark { opacity: 1; transform: rotate(45deg) scale(1); }

  .js .cal .cal-tick { opacity: 0; transform: scaleY(0); transition: opacity .2s ease, transform .3s ease; transition-delay: calc(var(--row, 0) * 150ms + var(--x) * 14ms + 100ms); }
  .js .cal.in .cal-tick { opacity: 1; transform: none; }

  .js .cal .cal-lead { transform: scaleX(0); transition: transform .5s cubic-bezier(.2,.7,.2,1); transition-delay: calc(var(--row, 0) * 150ms + var(--x) * 14ms + 450ms); }
  .js .cal.in .cal-lead { transform: none; }

  .js .cal .cal-note, .js .cal .cal-today, .js .cal .cal-status { opacity: 0; transition: opacity .5s ease 1.9s; }
  .js .cal.in .cal-note, .js .cal.in .cal-today, .js .cal.in .cal-status { opacity: 1; }

  /* Numbered steps: the connecting line draws down, numbers tick in */
  .js .steps .steps-line { transform: scaleY(0); transition: transform 1.6s cubic-bezier(.45,0,.25,1) .2s; }
  .js .steps.in .steps-line { transform: none; }
  .js .steps .step-num { opacity: 0; transform: scale(.6); transition: opacity .3s ease, transform .45s cubic-bezier(.3,1.5,.5,1); transition-delay: calc(var(--n, 0) * 240ms + 200ms); }
  .js .steps.in .step-num { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto !important; }
  .result-card, .form-done { animation: none; }
  .btn svg, .more-link svg, .nav-link::after { transition: none; }
  .scroll-progress { display: none; }
}

@media print {
  .js .reveal, .js .steps .steps-line, .js .steps .step-num, .js .cal .cal-tick, .js .cal .cal-lead { opacity: 1 !important; transform: none !important; }
  .js .cal .cal-mark { opacity: 1 !important; transform: rotate(45deg) !important; }
  .js .cal .cal-note, .js .cal .cal-today, .js .cal .cal-status { opacity: 1 !important; }
  .js .cal .cal-line line, .js .check path { stroke-dashoffset: 0 !important; }
  #specNav, #chatWrap, .mobile-bar, .scroll-progress { display: none !important; }
}
