/* Switchmoon: custom CSS that Tailwind utilities don't cover.
   Colour tokens live in the Tailwind config (includes/header.php).
   Hex values here mirror them: ink #101215, paper #FFFFFF, stone #EDEFF2, ember #2563EB. */

html { scroll-padding-top: 72px; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body { overflow-x: hidden; }
::selection { background: #2563EB; color: #101215; }

/* Focus: ink on light surfaces, ember on dark ones */
:focus-visible { outline: 2px solid #101215; outline-offset: 3px; }
.on-dark :focus-visible { outline-color: #2563EB; }

/* Header */
.site-header { transition: box-shadow .3s ease; }
.site-header.is-scrolled { box-shadow: 0 12px 30px -22px rgba(16,18,21, .5); }
.nav-link.is-active { box-shadow: inset 0 -2px 0 #2563EB; color: #101215; }

/* Desktop dropdown */
.dropdown-panel { opacity: 0; visibility: hidden; transform: translateY(6px); transition: opacity .25s ease, transform .25s ease, visibility .25s; }
.dropdown-panel[data-open="true"] { opacity: 1; visibility: visible; transform: none; }
/* Long menus: two columns when there are more than five entries, and always scrollable inside the window */
.dropdown-panel .dd-list { max-height: calc(100vh - 7rem); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.dd-wide { width: min(44rem, calc(100vw - 2rem)); }
.dd-wide .dd-list { display: grid; grid-template-columns: 1fr 1fr; align-content: start; }
.dd-wide .dd-list > li.mt-1 { grid-column: 1 / -1; position: sticky; bottom: -1px; background: #F6F7F9; }
.dd-wide .dd-list .text-muted { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 1100px) { .dd-wide .dd-list { grid-template-columns: 1fr; } .dd-wide { width: 24rem; } }
[data-dropdown-btn][aria-expanded="true"] svg { transform: rotate(180deg); }

/* Mobile menu */
.mobile-menu { visibility: hidden; opacity: 0; transform: translateY(-8px); transition: opacity .3s ease, transform .3s ease, visibility .3s; }
.mobile-menu[data-open="true"] { visibility: visible; opacity: 1; transform: none; }
.acc { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .3s ease; }
.acc > div { overflow: hidden; }
.acc[data-open="true"] { grid-template-rows: 1fr; }
[data-accordion-btn][aria-expanded="true"] svg { transform: rotate(180deg); }

/* Reveal on scroll (only when JS is running) */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .8s cubic-bezier(.2,.7,.2,1), transform .8s cubic-bezier(.2,.7,.2,1); transition-delay: var(--d, 0ms); }
.js .reveal.in { opacity: 1; transform: none; }

/* Blueprint grid used on dark surfaces */
.blueprint {
  background-image:
    linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px);
  background-size: 48px 48px;
}

/* Hero artwork: status LEDs and the live signal path */
.led { animation: led 3.4s ease-in-out infinite; }
.sig { stroke-dasharray: 3 7; animation: sig 3.2s linear infinite; }
@keyframes led { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
@keyframes sig { to { stroke-dashoffset: -50; } }

/* Services: numbered index */
.svc-tab { transition: background-color .3s ease; }
.svc-tab .svc-idx { color: rgba(255,255,255,.4); transition: color .3s ease; }
.svc-tab .svc-title { color: rgba(255,255,255,.5); transition: color .3s ease, transform .35s cubic-bezier(.2,.7,.2,1); }
.svc-tab .svc-tag { color: rgba(255,255,255,.28); transition: color .3s ease; }
.svc-tab:hover .svc-title { color: rgba(255,255,255,.85); }
.svc-tab[aria-selected="true"] { background: linear-gradient(90deg, rgba(37,99,235,.14), transparent 70%); }
.svc-tab[aria-selected="true"] .svc-idx,
.svc-tab[aria-selected="true"] .svc-tag { color: #2563EB; }
.svc-tab[aria-selected="true"] .svc-title { color: #FFFFFF; transform: translateX(10px); }
.svc-panel:not([hidden]) { animation: rise .5s cubic-bezier(.2,.7,.2,1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* Services: mobile accordion */
.svc-details { scroll-margin-top: 80px; }
.svc-details summary { list-style: none; }
.svc-details summary::-webkit-details-marker { display: none; }
.svc-plus { transition: transform .3s ease; }
.svc-details[open] .svc-plus { transform: rotate(45deg); }
.svc-details[open] summary span:nth-child(2) { color: #FFFFFF; }
.svc-details:not([open]) summary span:nth-child(2) { color: rgba(255,255,255,.6); }

/* Environments: expanding columns on large screens, stacked list below */
.env-plus { display: none; }
.env-head { transition: background-color .3s ease; }
.env-head:hover { background: #EDEFF2; }
@media (min-width: 1024px) {
  .env-grid { grid-template-columns: 2.6fr 1fr 1fr 1fr; transition: grid-template-columns .6s cubic-bezier(.2,.7,.2,1); }
  .env-grid[data-active="1"] { grid-template-columns: 1fr 2.6fr 1fr 1fr; }
  .env-grid[data-active="2"] { grid-template-columns: 1fr 1fr 2.6fr 1fr; }
  .env-grid[data-active="3"] { grid-template-columns: 1fr 1fr 1fr 2.6fr; }
  .env-col { min-height: 28rem; }
  .env-body { display: none; }
  .env-plus { display: block; }
  .env-grid[data-active="0"] [data-env-col="0"] .env-plus,
  .env-grid[data-active="1"] [data-env-col="1"] .env-plus,
  .env-grid[data-active="2"] [data-env-col="2"] .env-plus,
  .env-grid[data-active="3"] [data-env-col="3"] .env-plus { display: none; }
  .env-grid[data-active="0"] [data-env-col="0"] .env-body,
  .env-grid[data-active="1"] [data-env-col="1"] .env-body,
  .env-grid[data-active="2"] [data-env-col="2"] .env-body,
  .env-grid[data-active="3"] [data-env-col="3"] .env-body { display: block; animation: rise .5s cubic-bezier(.2,.7,.2,1) .12s both; }
}

/* Placeholder hatch for project and testimonial slots */
.hatch { background-image: repeating-linear-gradient(135deg, rgba(16,18,21,.06) 0 1px, transparent 1px 12px); }

/* Blog */
.filter-chip[aria-pressed="true"] { background: #101215; color: #FFFFFF; border-color: #101215; }
[data-post][hidden] { display: none; }
[data-toc].is-current { border-left-color: #2563EB; color: #101215; }
nav [data-toc].border-b-2.is-current { border-left-color: transparent; border-bottom-color: #2563EB; }

/* Partner marquee */
.marquee { display: flex; width: max-content; animation: marquee 45s linear infinite; }
.marquee:hover, .marquee:focus-within { animation-play-state: paused; }
.marquee-list { display: flex; flex-shrink: 0; }
@keyframes marquee { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) {
  .marquee { width: auto; flex-wrap: wrap; animation: none; padding-inline: 1.25rem; }
  .marquee-list[aria-hidden="true"] { display: none; }
  .marquee-list { flex-wrap: wrap; }
}

/* FAQ */
.faq summary { list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq[open] .svc-plus { transform: rotate(45deg); color: #2563EB; }

/* Back to top */
.to-top { opacity: 0; visibility: hidden; transform: translateY(12px); transition: opacity .3s ease, transform .3s ease, visibility .3s, background-color .3s, color .3s; }
.to-top.show { opacity: 1; visibility: visible; transform: none; }

/* ===== Loader: first-visit logo animation and page curtain ===== */
.loader { position: fixed; inset: 0; z-index: 200; display: none; place-items: center; background: #101215; color: #fff; will-change: transform; }
html.intro .loader, html.nav-in .loader, html.leaving .loader { display: grid; }
html.intro, html.intro body, html.leaving body { overflow: hidden; }
/* curved leading edges so the curtain feels like a surface, not a box */
.loader::before, .loader::after { content: ""; position: absolute; left: -10%; right: -10%; height: 14vh; background: #101215; }
.loader::after { top: calc(100% - 1px); border-radius: 0 0 50% 50% / 0 0 100% 100%; }
.loader::before { bottom: calc(100% - 1px); border-radius: 50% 50% 0 0 / 100% 100% 0 0; }
.loader-inner { display: flex; flex-direction: column; align-items: center; gap: 1.6rem; }
.loader-logo, .loader-line { display: none; }
.loader-moons svg { display: block; max-width: 70vw; height: auto; }
.loader-moons svg { animation: moonsIn .5s ease both; }
@keyframes moonsIn { from { opacity: 0; transform: scale(.92); } to { opacity: 1; transform: none; } }

/* Leaving a page: curtain rises from the bottom */
html.leaving .loader { animation: cover .5s cubic-bezier(.7, 0, .2, 1) both; }
@keyframes cover { from { transform: translateY(100%); } to { transform: none; } }
/* Arriving / intro finished: curtain lifts away */
.loader.is-done { animation: lift .9s cubic-bezier(.76, 0, .24, 1) both; }
@keyframes lift { from { transform: none; } to { transform: translateY(-115%); } }

/* First visit: wordmark wipes in, moons phase up, a hairline fills */
html.intro .loader-logo { display: block; clip-path: inset(0 100% 0 0); animation: wipe 1s cubic-bezier(.7, 0, .2, 1) .25s forwards; }
html.intro .loader-logo img { filter: invert(1); }
html.intro .loader-moons svg { clip-path: inset(0 100% 0 0); animation: wipe 1.1s cubic-bezier(.6, 0, .2, 1) .85s forwards; }
html.intro .loader-line { display: block; width: min(15rem, 56vw); height: 1px; background: rgba(255,255,255,.18); overflow: hidden; }
html.intro .loader-line span { display: block; height: 100%; background: #2563EB; transform: scaleX(0); transform-origin: left; animation: fill 1.5s cubic-bezier(.6, 0, .2, 1) .35s forwards; }
@keyframes wipe { to { clip-path: inset(0 0 0 0); } }
@keyframes fill { to { transform: scaleX(1); } }
/* Page-to-page: the moons simply breathe while the next page loads */
html.leaving .loader-moons svg, html.nav-in .loader-moons svg { animation: moonsIn .3s ease both, breathe 1s ease-in-out .3s infinite; }
@keyframes breathe { 50% { opacity: .35; } }

@media (prefers-reduced-motion: reduce) {
  .loader { display: none !important; }
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .js .reveal { opacity: 1; transform: none; }
}