/* ===== Zairen Mobile Fixes ===== */

/* ----- Touch device: bypass scroll-triggered reveal animations -----
   IntersectionObserver with custom root is unreliable on mobile;
   force all .reveal / .wipe elements fully visible on touch devices. */
@media (hover: none) and (pointer: coarse) {
  .reveal, .wipe {
    opacity: 1 !important;
    transform: none !important;
    clip-path: none !important;
  }

  .hero-tag, .hero-sub, .hero-meta, .scrollcue, .ledger {
    opacity: 1 !important;
    animation: none !important;
  }
}

/* ----- Prevent iOS Safari auto-zoom on form inputs ----- */
input, select, textarea {
  font-size: max(16px, inherit) !important;
}

/* ----- WCAG touch target minimums ----- */
button, .menu-btn, .backlink, a[role="button"],
.consent button, .card a, #motionToggle, .submit button.cta {
  min-height: 44px;
  min-width: 44px;
}

/* ----- Eliminate 300ms tap delay ----- */
a, button, [role="button"], input, select, textarea, summary,
label.checks label, .navlinks a, .menu-btn {
  touch-action: manipulation;
}

/* ----- Prevent horizontal overflow ----- */
body {
  overflow-x: hidden;
}

/* Consent banner button spacing */
.consent .cbtns {
  gap: 12px;
}

/* ----- ≤760px Breakpoint ----- */
@media (max-width: 760px) {

  /* Prevent main content from being hidden behind fixed nav */
  main {
    padding-top: 90px;
  }

  /* Mobile nav links: touch-friendly tap targets */
  .navlinks a:not(.nav-cta) {
    min-height: 48px;
    display: flex;
    align-items: center;
  }

  /* Menu button sizing */
  .menu-btn {
    min-height: 48px;
    min-width: 48px;
    font-size: 13px;
    padding: 10px 14px;
  }

  /* Mobile nav overlay: scrollable, CTA always visible */
  .navlinks.open {
    display: flex;
    max-height: calc(100svh - 54px);
    overflow-y: auto;
    padding: 8px 0 32px 0;
  }

  /* Book a demo CTA in mobile nav - keep full border */
  .navlinks.open .nav-cta {
    margin: 12px var(--pad) 10px;
    padding: 13px 20px;
    text-align: center;
    border-radius: 6px;
    border-bottom: 1px solid var(--ink);
    font-size: 12px;
    flex-shrink: 0;
  }

  /* Backdrop for closing nav on outside tap */
  .navlinks.open::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background: transparent;
    cursor: pointer;
  }

  /* ----- Form & Grid fixes ----- */
  form.demo {
    grid-template-columns: 1fr;
  }

  .topics {
    grid-template-columns: 1fr;
  }

  .topic {
    border-right: none;
  }

  .cards {
    grid-template-columns: 1fr;
  }

  .card {
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  .card:last-child {
    border-bottom: none;
  }

  /* Big heading text - match desktop proportions */
  .shead h2 {
    font-size: clamp(32px, 6vw, 52px);
  }

  .moment h2 {
    font-size: clamp(36px, 8vw, 82px);
  }

  .phil blockquote {
    font-size: clamp(36px, 8vw, 74px);
  }

  #motionToggle {
    font-size: 12px;
    padding: 10px 16px;
    bottom: 90px;
    right: 12px;
  }

  header {
    grid-template-columns: 1fr;
    gap: 40px;
    padding-top: 120px;
  }

  .hero-tag {
    font-size: clamp(17px, 5vw, 22px);
  }

  .hero-sub {
    font-size: 14px;
    line-height: 1.6;
  }

  .ledger {
    min-height: 280px;
  }

  .row {
    padding: 12px 14px;
    grid-template-columns: 1fr auto;
    gap: 10px;
  }

  .fw-grid {
    grid-template-columns: 1fr;
  }

  .fw {
    border-right: none !important;
    border-bottom: 1px solid var(--line);
    padding: 24px 20px;
  }

  .fw:last-child {
    border-bottom: none;
  }

  .fw h3 {
    font-size: 17px;
  }

  .step {
    grid-template-columns: auto 1fr;
    gap: 20px;
    padding: 28px 0;
  }

  .step .glyph {
    display: none;
  }

  .step .num {
    font-size: clamp(28px, 10vw, 40px);
  }

  .step .body h3 {
    font-size: clamp(17px, 4vw, 22px);
  }

  .split, .svc, .co {
    grid-template-columns: 1fr;
  }

  .scrollcue {
    display: none;
  }

  .hero-meta {
    position: static;
    margin-top: 34px;
    bottom: auto;
    right: auto;
    gap: 14px 10px;
  }

  .info dl {
    grid-template-columns: 100px 1fr;
  }

  .info dt, .info dd {
    padding: 14px 0;
    font-size: 13px;
  }

  #ring {
    display: none;
  }
}

/* ----- ≤600px Breakpoint ----- */
@media (max-width: 600px) {

  .cta-line, .cta-line a {
    font-size: clamp(24px, 7vw, 48px);
    word-break: break-word;
  }

  :root {
    --pad: clamp(16px, 4.5vw, 84px);
  }

  .frow {
    flex-direction: column;
    align-items: flex-start;
    gap: 32px;
  }

  .fcol {
    gap: 10px;
  }

  .fcol a, .fcol span {
    font-size: 13px;
    padding: 2px 0;
  }

  .consent {
    flex-direction: column;
    align-items: flex-start;
    padding: 16px 18px;
  }

  .consent p {
    font-size: 14px;
  }

  .consent button {
    font-size: 12px;
    padding: 10px 18px;
  }

  .cta-line {
    margin-bottom: 28px;
  }
}

/* ----- ≤500px Breakpoint ----- */
@media (max-width: 500px) {

  .phead h1 {
    font-size: clamp(22px, 7vw, 38px);
    line-height: 1.08;
  }

  .phead p {
    font-size: 14px;
  }

  .prose h2 {
    font-size: 17px;
    margin: 28px 0 8px;
  }

  .prose p, .note {
    font-size: 14px;
    line-height: 1.65;
  }

  .card {
    padding: 22px 18px;
  }

  .card h2 {
    font-size: 16px;
  }

  .card li {
    font-size: 13.5px;
  }

  .card .subtitle {
    font-size: 11px;
  }

  .card a {
    font-size: 11px;
    padding: 10px 18px;
  }

  .faq summary {
    font-size: 15px;
    padding: 4px 0;
  }

  .faq p {
    font-size: 14px;
  }

  .topic {
    padding: 18px 20px;
  }

  .topic [role="heading"] {
    font-size: 15px;
  }

  footer {
    padding: 48px var(--pad) 32px;
  }

  .eyebrow {
    font-size: 10px;
    letter-spacing: .18em;
  }

  .badge {
    font-size: 10px;
    padding: 6px 11px;
  }

  .stamp {
    font-size: 11px;
  }

  input, select, textarea {
    padding: 10px 12px;
  }

  label {
    font-size: 10.5px;
  }

  button.cta {
    font-size: 11px;
    padding: 12px 22px;
  }

  .note {
    padding: 14px 16px;
  }

  /* ----- Index-specific: small breakpoint ----- */

  .wm-inner span {
    font-size: clamp(38px, 15vw, 52px);
    text-shadow: 1px 1px 0 #303336, 2px 2px 8px rgba(0,0,0,.14);
  }

  .row .ctrl {
    font-size: 11px;
  }

  .ledger-head, .ledger-foot {
    font-size: 10px;
    padding: 10px 12px;
  }

  .split, .svc, .co {
    gap: 28px;
  }

  .phil blockquote {
    font-size: clamp(28px, 9vw, 74px);
  }

  .feat li {
    padding: 14px 0;
    gap: 12px;
  }

  .feat li .v b {
    font-size: 15px;
  }

  .feat li .v span {
    font-size: 13px;
  }

  .approach-text {
    font-size: clamp(16px, 3vw, 20px);
  }

  .shead h2 {
    font-size: clamp(28px, 7vw, 52px);
  }

  .moment h2 {
    font-size: clamp(32px, 9vw, 82px);
  }

  .hero-sub {
    font-size: 16px;
  }

  .fw p, .svc p, .step .body p, .feat li .v span {
    font-size: 14px;
  }

  .fw h3 {
    font-size: clamp(16px, 3vw, 20px);
  }

  .person .name {
    font-size: 17px;
  }

  .person .role {
    font-size: 13px;
  }

  .info dd {
    font-size: 14px;
  }

  .pill {
    font-size: 10px;
  }

  .split .lead {
    font-size: clamp(18px, 3.2vw, 34px);
  }
}

/* ----- ≤380px Breakpoint ----- */
@media (max-width: 380px) {

  .wm-inner span {
    font-size: clamp(32px, 14vw, 44px);
  }

  header {
    padding-top: 80px;
    gap: 24px;
  }

  .pill {
    font-size: 9px;
    padding: 5px 10px;
  }

  .phead h1 {
    font-size: clamp(20px, 8vw, 32px);
  }

  .cta-line, .cta-line a {
    font-size: clamp(20px, 7vw, 36px);
  }

  .hero-tag {
    font-size: 16px;
  }

  .hero-sub {
    font-size: 13px;
  }

  .fw {
    padding: 18px 16px;
  }

  .step {
    padding: 22px 0;
    gap: 14px;
  }

  .step .num {
    font-size: clamp(24px, 10vw, 34px);
  }
}

/* ----- Reduced Motion (accessibility) ----- */
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }

  .wm-inner span {
    opacity: 1 !important;
    transform: none !important;
  }

  .hero-tag, .hero-sub, .hero-meta, .scrollcue, .ledger {
    opacity: 1 !important;
    transform: none !important;
  }

  .reveal, .wipe {
    opacity: 1 !important;
    transform: none !important;
    clip-path: none !important;
  }

  #scroller {
    scroll-behavior: auto;
  }

  #bg {
    display: block;
  }
}

/* ----- Header dropdown navigation ----- */
.navdrop {
  position: relative;
}

.navdrop-btn {
  font-family: var(--font-body);
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-soft);
  background: none;
  border: none;
  cursor: pointer;
  padding: 7px 12px;
  min-height: 0;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 999px;
  transition: color .25s, background .25s;
}

.navdrop-btn::after {
  content: "";
  width: 6px;
  height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform .2s ease;
}

.navdrop-btn:hover,
.navdrop-btn:focus-visible {
  color: var(--ink);
  background: rgba(21, 24, 27, .06);
}

.navdrop.open .navdrop-btn::after {
  transform: rotate(225deg) translateY(-2px);
}

.navdrop-menu {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  min-width: 240px;
  background: rgba(238, 239, 234, .92);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 8px;
  box-shadow: 0 24px 60px rgba(21, 24, 27, .18);
  visibility: hidden;
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease, visibility .18s;
}

.navdrop:last-of-type .navdrop-menu {
  left: auto;
  right: 0;
}

.navdrop-menu a {
  display: block;
  padding: 10px 14px;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  transition: color .18s, background .18s, transform .18s;
}

.navdrop-menu a::after {
  display: none;
}

.navdrop-menu a:hover,
.navdrop-menu a:focus-visible {
  color: var(--ink);
  background: rgba(21, 24, 27, .07);
  transform: translateX(2px);
}

.navdrop-menu a.navdrop-cta {
  color: var(--ink);
  font-weight: 600;
  background: rgba(21, 24, 27, .06);
}

.navdrop-menu a.navdrop-cta:hover,
.navdrop-menu a.navdrop-cta:focus-visible {
  background: var(--ink);
  color: var(--paper);
  transform: none;
}

.navdrop-label {
  display: block;
  padding: 8px 14px 5px;
  font-family: var(--font-body);
  font-size: 9px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-soft);
  opacity: .55;
}

.navdrop-label:first-child {
  padding-top: 4px;
}

.navdrop-sep {
  display: block;
  height: 1px;
  margin: 6px 8px;
  background: var(--line-soft);
}

.navdrop.open > .navdrop-menu {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

@media (min-width: 761px) {
  .navdrop:hover > .navdrop-menu,
  .navdrop:focus-within > .navdrop-menu {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }

  .navdrop:hover .navdrop-btn::after,
  .navdrop:focus-within .navdrop-btn::after {
    transform: rotate(225deg) translateY(-2px);
  }
}

@media (max-width: 760px) {
  .navdrop {
    width: 100%;
  }

  .navdrop-btn {
    width: 100%;
    justify-content: space-between;
    padding: 14px var(--pad);
    font-size: 12px;
    border-radius: 0;
    border-bottom: 1px solid var(--line-soft);
    min-height: 48px;
    background: none;
  }

  .navdrop-menu {
    display: none;
    position: static;
    min-width: 0;
    border: none;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    background: transparent;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    visibility: visible;
    opacity: 1;
    transform: none;
    pointer-events: auto;
  }

  .navdrop.open > .navdrop-menu {
    display: block;
  }

  .navdrop-menu a {
    padding: 13px var(--pad) 13px calc(var(--pad) + 22px);
    border-bottom: 1px solid var(--line-soft);
    border-radius: 0;
    font-size: 12px;
  }

  .navdrop-menu a:hover {
    transform: none;
  }

  .navdrop-label {
    padding: 12px var(--pad) 4px calc(var(--pad) + 12px);
  }

  .navdrop-sep {
    margin: 6px var(--pad);
  }
}

/* Pill hover for standalone nav links (desktop) */
@media (min-width: 761px) {
  .navlinks > a:not(.nav-cta) {
    padding: 7px 12px;
    border-radius: 999px;
    transition: color .25s, background .25s;
  }

  .navlinks > a:not(.nav-cta)::after {
    display: none;
  }

  .navlinks > a:not(.nav-cta):hover,
  .navlinks > a:not(.nav-cta):focus-visible {
    background: rgba(21, 24, 27, .06);
  }
}

/* Scrolled nav: heavier glass + soft shadow */
nav.scrolled {
  background: rgba(238, 239, 234, .72);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 30px rgba(21, 24, 27, .08);
}
