/* ── CSS-only interactivity (zero client scripting) ─────────── */
/* All interactive patterns use native HTML + CSS only:
   - Desktop dropdowns: :focus-within
   - Mobile menu: checkbox hack
   - FAQ accordions: <details>/<summary>
   - Deployment tabs: radio buttons + :checked
   - Testimonials: scroll-snap
   - Cookie consent: checkbox dismiss
   - Back-to-top: anchor + scroll-behavior
*/

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* ── Skip Link ──────────────────────────────────────────────── */
#skip-to-content {
  position: absolute;
  left: -9999px;
  top: 1rem;
  z-index: 60;
  padding: 0.75rem 1rem;
  border-radius: 0;
  background: white;
  color: rgb(var(--surface-950));
  border: 1px solid rgb(var(--surface-950));
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

#skip-to-content:focus {
  left: 1rem;
}

.skip-to-content {
  position: absolute;
  top: -64px;
  left: 0;
  z-index: 10000;
  padding: 12px 24px;
  border-radius: 0;
  background: rgb(var(--primary));
  color: white !important;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  text-decoration: none;
  transition: top 0.2s cubic-bezier(0.23, 1, 0.32, 1);
  border: 1px solid rgb(var(--surface-950));
}

.skip-to-content:focus {
  top: 0;
  outline: none;
}

/* Account for lg:h-20 header on larger screens */
@media (min-width: 1024px) {
  .skip-to-content {
    top: -80px;
  }
  .skip-to-content:focus {
    top: 0;
  }
}

/* ── Focus Rings ────────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid rgb(var(--primary));
  outline-offset: 2px;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid rgb(var(--primary));
  outline-offset: 2px;
}
:focus:not(:focus-visible) {
  outline: none;
}

/* ── Interactive island loading states ─────────────────────── */
.island-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  border-radius: 2px;
  background: rgb(var(--surface-50));
  border: 1px solid rgb(var(--surface-200));
  animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ── Pricing trust badges ──────────────────────────────────── */
.social-proof {
  text-align: center;
  margin-bottom: 32px;
  padding: 16px;
}
.trust-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 16px;
}
.trust-badge {
  background: rgb(var(--surface-50));
  border: 1px solid rgb(var(--surface-200));
  border-radius: 0;
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgb(var(--surface-600));
}
.trust-message {
  font-size: 13px;
  color: rgb(var(--surface-500));
}

/* ── Header Dropdowns (CSS :focus-within) ──────────────────── */
[data-dropdown] [data-dropdown-menu] {
  display: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 150ms ease, transform 150ms ease;
  pointer-events: none;
}
[data-dropdown]:hover [data-dropdown-menu],
[data-dropdown]:focus-within [data-dropdown-menu] {
  display: block;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* ── Mobile Menu (checkbox hack) ────────────────────────────── */
/* Off-screen positioning instead of clip-based sr-only to maintain
   keyboard focusability (clip:rect can break Tab focus in some browsers). */
.nav-toggle-input {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}
/* Ensure close icon is hidden by default (overrides header partial) */
#menu-icon-close { display: none; }
#nav-toggle:checked ~ #site-header #mobile-menu { display: block !important; }
#nav-toggle:checked ~ #site-header #menu-icon-open { display: none !important; }
#nav-toggle:checked ~ #site-header #menu-icon-close { display: block !important; }

/* ── FAQ Accordion (<details>/<summary>) ────────────────────── */
details.faq-item summary {
  cursor: pointer;
  list-style: none;
}
details.faq-item summary::-webkit-details-marker { display: none; }
details.faq-item summary::marker { display: none; }
details.faq-item .faq-icon {
  transition: transform 200ms ease;
}
details.faq-item[open] .faq-icon {
  transform: rotate(180deg);
  color: rgb(var(--brand-600));
}

/* ── Deployment Options (radio tabs) ────────────────────────── */
.deploy-radio { display: none; }
.deploy-panel { display: none; }
#deploy-shared:checked ~ .deploy-tabs [for="deploy-shared"],
#deploy-dedicated:checked ~ .deploy-tabs [for="deploy-dedicated"],
#deploy-private:checked ~ .deploy-tabs [for="deploy-private"],
#deploy-byoc:checked ~ .deploy-tabs [for="deploy-byoc"] {
  background-color: rgb(var(--surface-900));
  color: white;
  box-shadow: 0 1px 2px 0 rgba(0,0,0,0.05);
}
html.dark #deploy-shared:checked ~ .deploy-tabs [for="deploy-shared"],
html.dark #deploy-dedicated:checked ~ .deploy-tabs [for="deploy-dedicated"],
html.dark #deploy-private:checked ~ .deploy-tabs [for="deploy-private"],
html.dark #deploy-byoc:checked ~ .deploy-tabs [for="deploy-byoc"] {
  background-color: rgb(var(--brand-700));
  border-color: rgb(var(--brand-500));
  color: rgb(255 255 255);
}
@media (prefers-color-scheme: dark) {
  html:not(.light) #deploy-shared:checked ~ .deploy-tabs [for="deploy-shared"],
  html:not(.light) #deploy-dedicated:checked ~ .deploy-tabs [for="deploy-dedicated"],
  html:not(.light) #deploy-private:checked ~ .deploy-tabs [for="deploy-private"],
  html:not(.light) #deploy-byoc:checked ~ .deploy-tabs [for="deploy-byoc"] {
    background-color: rgb(var(--brand-700));
    border-color: rgb(var(--brand-500));
    color: rgb(255 255 255);
  }
}
#deploy-shared:checked ~ .deploy-panels #panel-shared,
#deploy-dedicated:checked ~ .deploy-panels #panel-dedicated,
#deploy-private:checked ~ .deploy-panels #panel-private,
#deploy-byoc:checked ~ .deploy-panels #panel-byoc {
  display: block;
}

/* ── Testimonials (scroll-snap) ─────────────────────────────── */
.testimonials-track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  gap: 1.5rem;
}
.testimonials-track::-webkit-scrollbar { display: none; }
.testimonials-track > .testimonial-card {
  scroll-snap-align: start;
  flex: 0 0 100%;
  min-width: 0;
}

/* ── Back-to-Top (CSS-only visibility via :target or fixed) ── */
#back-to-top {
  /* Always visible as a simple anchor link — no JS scroll detection needed */
  opacity: 0.7;
  transition: opacity 200ms;
}
#top[data-js="true"] #back-to-top {
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 200ms, transform 200ms;
}
#top[data-js="true"] #back-to-top.is-visible {
  opacity: 0.7;
  pointer-events: auto;
  transform: translateY(0);
}
#back-to-top:hover {
  opacity: 1;
}

#cookie-consent-banner:not([hidden]) ~ #back-to-top {
  display: none;
}

/* ── Status page auto-refresh indicator ──────────────────────── */
.status-refresh-notice {
  font-size: 0.75rem;
  color: rgb(var(--surface-500));
  text-align: center;
  padding: 0.5rem;
}

/* ── Private Cloud latency comparison ────────────────────────── */
.compare-hero-wedge { clip-path: polygon(100% 0, 0% 0, 100% 100%); }

.progress-width-98 { width: 98%; }
.progress-width-96 { width: 96%; }
.progress-width-94 { width: 94%; }
.progress-width-87 { width: 87%; }
.progress-width-72 { width: 72%; }

.latency-width-2 { --bar-width: 2%; }
.latency-width-8 { --bar-width: 8%; }
.latency-width-65 { --bar-width: 65%; }
.latency-width-100 { --bar-width: 100%; }

@keyframes grow-bar {
  from { width: 0; }
  to { width: var(--bar-width, 0%); }
}

.latency-bar {
  width: var(--bar-width, 0%);
  animation: grow-bar 1s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@media (prefers-reduced-motion: reduce) {
  .latency-bar { animation: none; }
}
