/* Site behaviour and mobile navigation.
   Kept separate from site.css, which is the compiled Tailwind output. */

/* ------------------------------------------------- smooth anchor scrolling */
html { scroll-behavior: smooth; }
:target, [id] { scroll-margin-top: 1.5rem; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* -------------------------------------------------------------- affordance */
button,
summary,
[role="button"],
[type="button"],
[type="submit"],
[type="reset"],
label:has(input[type="checkbox"]),
label:has(input[type="radio"]) { cursor: pointer; }

button:disabled, [type="submit"]:disabled { cursor: not-allowed; }

/* Visible focus for keyboard users, without a ring on mouse clicks. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--sky-deep);
  outline-offset: 2px;
}

/* --------------------------------------------------------- expand / collapse */
[data-expand] svg { transition: transform .2s ease; }
[data-expand][aria-expanded="true"] svg { transform: rotate(90deg); }

/* ------------------------------------------------------------ mobile nav */
.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  margin-right: -0.625rem;
  border: 0;
  background: none;
  color: inherit;
}
.nav-toggle-bars { display: block; width: 1.25rem; }
.nav-toggle-bars span {
  display: block;
  height: 1.5px;
  background: currentColor;
  transition: transform .22s ease, opacity .15s ease;
}
.nav-toggle-bars span + span { margin-top: 5px; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

.mobile-nav {
  border-top: 1px solid var(--border);
  padding: .5rem 1.5rem 1.25rem;
  display: flex;
  flex-direction: column;
}
.mobile-nav[hidden] { display: none; }
.mobile-nav a {
  padding: .875rem 0;
  font-size: 1rem;
  border-bottom: 1px solid var(--border);
}
.mobile-nav a:last-child { border-bottom: 0; }
.mobile-nav a:hover { color: var(--sky-deep); }

@media (min-width: 768px) {
  .nav-toggle, .mobile-nav { display: none !important; }
}
