/* ==========================================================================
   Service Detail Modal — full-screen shutter that rises from the bottom
   when a service subcategory tile is clicked. Mirrors the pattern used by
   the "Start a Project" contact modal (dark surface, white lockup logo,
   circular close button top-right).
   ========================================================================== */

/* ---- Shutter root ------------------------------------------------------ */
.svc-modal {
  position: fixed;
  inset: 0;
  /* Was a hand-escalated 10000, which sat ABOVE --z-cursor (600) and so hid the
     custom cursor behind the shutter — the arrow was correctly recoloured
     orange, it just never painted. Exactly the regression tests/PROTECTED.md
     item 8 documents ("must render above the fixed header — it regressed once
     when the header kept a higher z-index than the cursor").
     --z-modal (500) clears the header (100), menu (200), ripple (300) and
     grain (400) while staying under the cursor. The 1 / 2 / 4 values further
     down this file are scoped inside this element's own stacking context and
     are unaffected. */
  z-index: var(--z-modal);
  pointer-events: none;
  visibility: hidden;
  transition: visibility 0s linear 0.9s;
}
.svc-modal[aria-hidden="false"] {
  visibility: visible;
  pointer-events: auto;
  transition-delay: 0s;
}

.svc-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 10, 0.55);
  opacity: 0;
  transition: opacity 0.55s var(--ease-in-out);
}
/* backdrop-filter is applied only while the dialog is open. Declared on the
   base rule it held a full-viewport compositor layer (~5 MB) permanently, and
   Safari keeps sampling the content behind a backdrop-filtered element even at
   opacity: 0 — so a closed modal was costing blur work on every scroll frame. */
.svc-modal[aria-hidden="false"] .svc-modal__backdrop {
  opacity: 1;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* ---- Panel (rises bottom → top) --------------------------------------- */
.svc-modal__panel {
  position: absolute;
  inset: 0;
  background: #0a0a0a;
  color: #f2ead5;
  transform: translateY(100%);
  transition: transform 0.85s var(--ease-in-out);
  overflow: hidden;
}
/* Likewise will-change: promoting a full-viewport panel that is off-screen and
   closed bought nothing and cost another ~5 MB layer. */
.svc-modal[aria-hidden="false"] .svc-modal__panel {
  transform: translateY(0);
  will-change: transform;
}

.svc-modal__panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255, 145, 77, 0.06), transparent 60%),
    radial-gradient(ellipse at 100% 100%, rgba(255, 145, 77, 0.04), transparent 60%);
  pointer-events: none;
  z-index: 1;
}

/* ---- Top bar: logo (flows with content) + close (fixed) --------------- */
.svc-modal__logo {
  display: inline-block;
  text-decoration: none;
  opacity: 0;
  transition: opacity 0.35s var(--ease-in-out) 0.5s;
  margin-bottom: clamp(48px, 7vh, 88px);
}
.svc-modal[aria-hidden="false"] .svc-modal__logo { opacity: 1; }
.svc-modal__logo-img {
  height: 68px;
  width: auto;
  display: block;
  filter: brightness(0) invert(1);
}
@media (max-width: 991.98px) { .svc-modal__logo-img { height: 52px; } }
@media (max-width: 575.98px) { .svc-modal__logo-img { height: 44px; } }

.svc-modal__close {
  position: absolute;
  top: 32px;
  right: clamp(24px, 4vw, 60px);
  width: 52px;
  height: 52px;
  background: transparent;
  border: 1px solid rgba(242, 234, 213, 0.24);
  border-radius: 50%;
  color: #f2ead5;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 4;
  opacity: 0;
  transition: opacity 0.35s var(--ease-in-out) 0.55s,
              background-color 0.3s ease, border-color 0.3s ease, transform 0.4s ease;
}
.svc-modal[aria-hidden="false"] .svc-modal__close { opacity: 1; }
.svc-modal__close:hover {
  background: rgba(242, 234, 213, 0.08);
  border-color: rgba(242, 234, 213, 0.5);
  transform: rotate(90deg);
}
.svc-modal__close svg { width: 22px; height: 22px; }
@media (max-width: 575.98px) {
  .svc-modal__close { top: 20px; right: 20px; width: 42px; height: 42px; }
  .svc-modal__close svg { width: 18px; height: 18px; }
}

/* Body lock while modal is open */
body.svc-modal-open { overflow: hidden; }

/* ---- Cursor within the modal -----------------------------------------
   Default arrow is charcoal — invisible on the modal's black surface.
   While the shutter is open, switch the arrow to brand orange. When the
   pointer enters a cream / lime tile (how-we-work cards, active chip,
   yellow accent) we flip back to a black arrow via .svc-cursor-dark. */
body.svc-modal-open .custom-cursor {
  background-color: var(--accent);
  filter: drop-shadow(0 2px 6px rgba(248, 133, 61, 0.4));
}
body.svc-modal-open.svc-cursor-dark .custom-cursor {
  background-color: #0d0d0d;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.35));
}

/* Native pointer inside modal — cursor:none is inherited from body,
   but ensure the interactive elements still trigger hovering states. */
.svc-modal, .svc-modal * { cursor: none; }

/* ---- Scroll container ------------------------------------------------- */
.svc-modal__scroll {
  position: absolute;
  inset: 0;
  padding: clamp(32px, 5vh, 56px) clamp(24px, 6vw, 96px) 0;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 2;
  scrollbar-width: thin;
  scrollbar-color: rgba(242, 234, 213, 0.18) transparent;
}
.svc-modal__scroll::-webkit-scrollbar { width: 8px; }
.svc-modal__scroll::-webkit-scrollbar-thumb { background: rgba(242, 234, 213, 0.18); border-radius: 4px; }
.svc-modal__inner { max-width: 1400px; margin: 0 auto; padding-bottom: clamp(64px, 10vh, 128px); }

/* ---- Hero ------------------------------------------------------------- */
.sd-hero { padding: 0 0 clamp(48px, 8vh, 96px); border-bottom: 1px solid rgba(242, 234, 213, 0.1); }
.sd-hero__kicker {
  display: inline-block;
  font-family: 'Onest', sans-serif;
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #f2ead5;
  padding: 8px 14px;
  border: 1px solid rgba(242, 234, 213, 0.35);
  border-radius: 999px;
  margin-bottom: clamp(32px, 6vh, 72px);
}
.sd-hero__title {
  font-family: 'Onest', sans-serif;
  font-weight: 900;
  font-size: clamp(2.6rem, 7.2vw, 8rem);
  line-height: 0.92;
  letter-spacing: -0.02em;
  color: #f2ead5;
  text-transform: uppercase;
  margin: 0;
  max-width: 22ch;
}
.sd-hero__title em {
  font-family: 'Instrument Serif', serif;
  font-weight: 400;
  font-style: italic;
  color: #ff914d;
  text-transform: none;
  letter-spacing: -0.01em;
}

/* ---- Intro two-column ------------------------------------------------- */
.sd-intro {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(32px, 6vw, 96px);
  padding: clamp(40px, 6vh, 80px) 0 clamp(24px, 4vh, 48px);
}
.sd-intro__col p {
  font-family: 'Onest', sans-serif;
  font-size: clamp(0.98rem, 1.05vw, 1.1rem);
  line-height: 1.55;
  color: rgba(242, 234, 213, 0.82);
  margin: 0 0 12px;
}
.sd-intro__title {
  font-family: 'Onest', sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  color: #f2ead5;
  margin: 0 0 14px;
}

/* ---- Chip strip ------------------------------------------------------- */
.sd-chips { display: flex; flex-wrap: wrap; gap: 10px; padding: 20px 0 clamp(40px, 6vh, 80px); }
.sd-chip {
  font-family: 'Onest', sans-serif;
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(242, 234, 213, 0.7);
  padding: 11px 20px;
  border: 1px solid rgba(242, 234, 213, 0.2);
  border-radius: 4px;
  text-decoration: none;
  transition: background 200ms ease, color 200ms ease, border-color 200ms ease;
}
.sd-chip:hover { color: #f2ead5; border-color: rgba(242, 234, 213, 0.55); }
.sd-chip--active { color: #0a0a0a; background: #f2ead5; border-color: #f2ead5; }

/* ---- Capability grid (5 cards + 1 accent tile, 3×2) ------------------- */
.sd-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: minmax(300px, auto);
  gap: 2px;
  background: rgba(242, 234, 213, 0.12);
  border: 1px solid rgba(242, 234, 213, 0.12);
  margin: 0 0 clamp(64px, 10vh, 128px);
}
.sd-grid > * {
  background: #0a0a0a;
  padding: clamp(24px, 2.6vw, 40px);
  display: flex;
  flex-direction: column;
}
.sd-grid__accent {
  background: #d5f34a;
  color: #0a0a0a;
  justify-content: flex-end;
  gap: 16px;
}
.sd-grid__accent-num {
  font-family: 'Onest', sans-serif;
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.7;
}
.sd-grid__accent-title {
  font-family: 'Onest', sans-serif;
  font-weight: 900;
  font-size: clamp(1.4rem, 2vw, 2rem);
  line-height: 0.98;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  color: #0a0a0a;
}
.sd-card h3 {
  font-family: 'Onest', sans-serif;
  font-weight: 800;
  font-size: clamp(1.05rem, 1.2vw, 1.25rem);
  letter-spacing: -0.01em;
  text-transform: uppercase;
  color: #f2ead5;
  margin: 0 0 clamp(16px, 2vh, 28px);
}
.sd-card p {
  font-family: 'Onest', sans-serif;
  font-size: 0.95rem;
  line-height: 1.55;
  color: rgba(242, 234, 213, 0.78);
  margin: 0 0 16px;
  flex: 1;
}
.sd-card ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.sd-card li {
  font-family: 'Onest', sans-serif;
  font-size: 0.9rem;
  color: rgba(242, 234, 213, 0.85);
  padding-left: 16px;
  position: relative;
}
.sd-card li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ff914d;
}

/* ---- How we work ------------------------------------------------------ */
.sd-work { padding: clamp(48px, 8vh, 96px) 0 0; border-top: 1px solid rgba(242, 234, 213, 0.1); }
.sd-work__head {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  margin-bottom: clamp(40px, 6vh, 80px);
  align-items: end;
}
.sd-work__title {
  font-family: 'Onest', sans-serif;
  font-weight: 900;
  font-size: clamp(2.2rem, 4.4vw, 4.6rem);
  line-height: 0.96;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  color: #f2ead5;
  margin: 0;
}
.sd-work__head p {
  font-family: 'Onest', sans-serif;
  font-size: 1rem;
  line-height: 1.55;
  color: rgba(242, 234, 213, 0.72);
  margin: 0;
  text-align: right;
}
.sd-work__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(14px, 1.6vw, 24px);
}
.sd-work__card {
  background: #f2ead5;
  color: #0a0a0a;
  padding: clamp(22px, 2.4vw, 36px);
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  min-height: 320px;
}
.sd-work__num {
  font-family: 'Onest', sans-serif;
  font-weight: 700;
  font-size: 0.88rem;
  letter-spacing: 0.14em;
  color: #0a0a0a;
  border-bottom: 1px solid #0a0a0a;
  padding-bottom: 8px;
  margin-bottom: clamp(48px, 10vh, 112px);
  width: 100%;
}
.sd-work__card h3 {
  font-family: 'Onest', sans-serif;
  font-weight: 900;
  font-size: clamp(1.1rem, 1.3vw, 1.45rem);
  line-height: 1.05;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  color: #0a0a0a;
  margin: 0 0 clamp(20px, 3vh, 32px);
}
.sd-work__card p {
  font-family: 'Onest', sans-serif;
  font-size: 0.92rem;
  line-height: 1.5;
  color: rgba(10, 10, 10, 0.72);
  margin: 0;
  margin-top: auto;
}

/* ---- Reveal motion ---------------------------------------------------- */
/* Children start hidden. .is-revealing (added after the shutter starts
   rising) cascades them in with staggered delays. .is-swapping quickly
   fades the swappable children out during a chip swap. */
.svc-modal .sd-hero,
.svc-modal .sd-intro,
.svc-modal .sd-chips,
.svc-modal .sd-grid,
.svc-modal .sd-work {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.55s var(--ease-in-out),
              transform 0.55s var(--ease-in-out);
}
.svc-modal.is-revealing .sd-hero  { opacity: 1; transform: none; transition-delay: 0.55s; }
.svc-modal.is-revealing .sd-intro { opacity: 1; transform: none; transition-delay: 0.68s; }
.svc-modal.is-revealing .sd-chips { opacity: 1; transform: none; transition-delay: 0.78s; }
.svc-modal.is-revealing .sd-grid  { opacity: 1; transform: none; transition-delay: 0.88s; }
.svc-modal.is-revealing .sd-work  { opacity: 1; transform: none; transition-delay: 1.00s; }
.svc-modal.is-swapping .sd-hero,
.svc-modal.is-swapping .sd-intro,
.svc-modal.is-swapping .sd-chips,
.svc-modal.is-swapping .sd-grid {
  opacity: 0;
  transform: none;
  transition: opacity 0.2s ease;
}
@media (prefers-reduced-motion: reduce) {
  .svc-modal .sd-hero, .svc-modal .sd-intro, .svc-modal .sd-chips, .svc-modal .sd-grid, .svc-modal .sd-work {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ---- Responsive ------------------------------------------------------- */
@media (max-width: 991.98px) {
  .svc-modal__scroll { padding: clamp(24px, 4vh, 44px) clamp(24px, 6vw, 96px) 0; }
  .sd-hero__title { font-size: clamp(2.2rem, 9vw, 4.4rem); max-width: none; }
  .sd-intro { grid-template-columns: 1fr; gap: 28px; }
  .sd-grid { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 1fr; }
  .sd-grid__accent { grid-column: 1 / -1; min-height: auto; }
  .sd-work__head { grid-template-columns: 1fr; gap: 16px; align-items: start; }
  .sd-work__head p { text-align: left; }
  .sd-work__grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 575.98px) {
  .svc-modal__scroll { padding: 20px 20px 0; }
  .sd-hero__title { font-size: clamp(1.9rem, 10vw, 3.4rem); }
  .sd-grid { grid-template-columns: 1fr; grid-auto-rows: auto; gap: 1px; }
  .sd-grid > * { padding: 24px 20px; }
  .sd-grid__accent { min-height: auto; padding: 28px 20px; }
  .sd-work__grid { grid-template-columns: 1fr; }
  .sd-work__card { min-height: auto; padding: 24px 20px; }
}
