/* ============================================================
   HARBOUR GLASS - Structural Components
   Source: prototype css/main.css lines 127-800 + animations.css 184-197
   Covers: skip-link, preloader, cursor, header, nav-overlay,
           footer, page-transition, responsive breakpoints.
   Consumes design tokens from tokens.css. Pure ASCII only.
   ============================================================ */

/* --- GLOBAL BASE --- */
/* Body cursor is hidden ONLY when the custom cursor shell is present
   (avoids "where's my cursor" when hg_body_open_shell is dormant). */
body:has(.cursor) { cursor: none; }

/* Screen-reader only utility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --- SKIP LINK (accessibility) --- */
.skip-link {
  position: absolute;
  top: -100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--purple);
  color: var(--text-primary);
  padding: 0.75rem 1.5rem;
  z-index: calc(var(--z-cursor) + 1);
  border-radius: 0 0 0.5rem 0.5rem;
  font-weight: 600;
  text-decoration: none;
  transition: top var(--duration-fast) var(--ease-out);
}
.skip-link:focus {
  top: 0;
}

/* --- CUSTOM CURSOR --- */
.cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid var(--purple-light);
  pointer-events: none;
  z-index: var(--z-cursor);
  transition: width 0.3s var(--ease-spring),
              height 0.3s var(--ease-spring),
              border-color 0.3s var(--ease-out),
              background-color 0.3s var(--ease-out);
  transform: translate(-50%, -50%);
  mix-blend-mode: difference;
}
.cursor.is-hovering {
  width: 50px;
  height: 50px;
  border-color: var(--lime);
  background: rgba(186, 211, 0, 0.08);
}
.cursor.is-clicking {
  width: 16px;
  height: 16px;
}
.cursor-dot {
  position: fixed;
  top: 0;
  left: 0;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--purple-light);
  pointer-events: none;
  z-index: var(--z-cursor);
  transform: translate(-50%, -50%);
}
@media (hover: none) and (pointer: coarse) {
  .cursor, .cursor-dot { display: none; }
  body { cursor: auto; }
  .btn, a { cursor: pointer; }
}

/* --- PRELOADER --- */
.preloader {
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-modal) + 100);
  background: var(--bg-base);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 2rem;
  transition: opacity 0.6s var(--ease-out), visibility 0.6s;
}
.preloader.is-loaded {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}
.preloader.is-dismissed {
  display: none !important;
}
.preloader__brand {
  font-family: 'Bradley Hand', cursive;
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--text-primary);
  opacity: 0;
  animation: preloaderFadeIn 0.8s 0.2s var(--ease-out) forwards;
}
.preloader__bar {
  width: 120px;
  height: 2px;
  background: var(--bg-elevated);
  border-radius: 2px;
  overflow: hidden;
}
.preloader__bar-fill {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--purple), var(--lime));
  border-radius: 2px;
  animation: preloaderBar 1.8s 0.4s var(--ease-in-out) forwards;
}
@keyframes preloaderFadeIn { to { opacity: 1; } }
@keyframes preloaderBar    { to { width: 100%; } }

/* --- HEADER (fluid-glass pill, fixed top centre) ---
   Mobile: tight pill (520px max) so HG/Menu sit close together.
   Desktop: stretches to 92% viewport so the pill visually contains the
   sticky product-nav links. Background near-transparent on desktop so
   the lime nav links show through and the pill reads as a glass frame
   rather than an opaque bar. */
.header {
  position: fixed;
  top: var(--space-sm);
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-nav);
  width: min(92%, clamp(520px, 90vw, 1400px));
  transition: top var(--duration-slow) var(--ease-out),
              background var(--duration-normal) var(--ease-out);
}

.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 1.25rem;
  background: rgba(15, 15, 30, 0.18);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid var(--border-subtle);
  border-radius: 100px;
  transition: all var(--duration-normal) var(--ease-out);
}
/* Mobile: keep the pill compact and slightly more opaque so nav text
   doesn't show through (mobile doesn't have a sticky product-nav at
   the same level). */
@media (max-width: 767px) {
  .header { width: min(92%, 520px); }
  .header__inner { background: var(--bg-glass); }
}

.header__logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  flex-shrink: 0;
}
.header__logo-img {
  height: 28px;
  width: auto;
}
.header__logo-text {
  font-family: 'Bradley Hand', cursive;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
  line-height: 1;
}

.header__page-name {
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-weight: 400;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.header__menu-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: var(--text-sm);
  cursor: pointer;
  padding: 0.25rem;
  transition: color var(--duration-fast) var(--ease-out);
}
.header__menu-btn:hover {
  color: var(--text-primary);
}

.header__hamburger {
  width: 22px;
  height: 14px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.header__hamburger span {
  display: block;
  width: 100%;
  height: 1.5px;
  background: currentColor;
  border-radius: 1px;
  transition: all var(--duration-normal) var(--ease-out);
  transform-origin: center;
}
.header__menu-btn.is-active .header__hamburger span:nth-child(1) {
  transform: translateY(6.25px) rotate(45deg);
}
.header__menu-btn.is-active .header__hamburger span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
.header__menu-btn.is-active .header__hamburger span:nth-child(3) {
  transform: translateY(-6.25px) rotate(-45deg);
}

/* --- FULL-SCREEN NAV OVERLAY --- */
.nav-overlay {
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-nav) - 1);
  background: var(--bg-base);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--duration-slow) var(--ease-out),
              visibility var(--duration-slow);
}
.nav-overlay.is-open {
  opacity: 1;
  visibility: visible;
}
.nav-overlay__inner {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}
.nav-overlay__links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  padding: 0;
  margin: 0;
}
.nav-overlay__link {
  display: block;
}
.nav-overlay .nav-overlay__link a,
.nav-overlay .nav-overlay__link a:link,
.nav-overlay .nav-overlay__link a:visited {
  font-family: 'fredericka-the-greatest', 'Fredericka the Great', cursive;
  font-size: var(--text-3xl);
  color: var(--text-muted) !important;
  transition: color var(--duration-normal) var(--ease-out),
              transform var(--duration-normal) var(--ease-out);
  display: inline-block;
  text-transform: none;
  letter-spacing: 0;
  text-shadow: none;
}
.nav-overlay .nav-overlay__link a:hover,
.nav-overlay .nav-overlay__link a.is-active {
  color: var(--text-primary) !important;
  transform: translateX(8px);
}
.nav-overlay__contact {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border-subtle);
}
.nav-overlay .nav-overlay__contact a,
.nav-overlay .nav-overlay__contact a:link,
.nav-overlay .nav-overlay__contact a:visited {
  font-size: var(--text-sm);
  color: var(--text-muted) !important;
}
.nav-overlay .nav-overlay__contact a:hover {
  color: var(--purple-light) !important;
}
.nav-overlay__social {
  display: flex;
  gap: var(--space-sm);
  justify-content: center;
  padding-top: var(--space-sm);
}
.nav-overlay__social a {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-subtle);
  border-radius: 50%;
  color: var(--text-muted);
  transition: all var(--duration-normal) var(--ease-out);
}
.nav-overlay__social a:hover {
  border-color: var(--purple);
  color: var(--purple-light);
}

/* --- FOOTER --- */
.footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  padding-block: var(--space-xl) var(--space-lg);
}
.footer__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-md);
}
.footer__brand-name {
  font-family: 'Bradley Hand', cursive;
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
  display: block;
}
.footer__tagline {
  color: var(--text-muted);
  font-size: var(--text-sm);
  margin-bottom: var(--space-md);
  line-height: 1.6;
}
/* Keep Fredericka (inherits from typography.css h4) - just spacing */
.footer__heading {
  margin-bottom: var(--space-sm);
}
.footer__links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0;
  margin: 0;
}
/* Footer column links: lime at rest (matches brand accent), purple-light on hover.
   Specificity (.footer + .footer__links + a:link) plus !important to beat
   any per-element Breakdance link override. */
.footer .footer__links a,
.footer .footer__links a:link,
.footer .footer__links a:visited {
  font-size: var(--text-sm);
  color: var(--lime) !important;
  transition: color var(--duration-fast) var(--ease-out),
              transform var(--duration-fast) var(--ease-out);
  display: inline-block;
}
.footer .footer__links a:hover,
.footer .footer__links a:focus-visible {
  color: var(--purple-light) !important;
  transform: translateX(3px);
}
.footer__bottom {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  justify-content: space-between;
  align-items: center;
  text-align: center;
  padding-top: var(--space-lg);
  margin-top: var(--space-lg);
  border-top: 1px solid var(--border-light);
  font-size: var(--text-xs);
  color: var(--text-muted);
}
/* Force divider colour to win over Breakdance global link/border colour (was rendering lime). */
.footer .footer__bottom,
.footer > .footer__bottom {
  border-top-color: var(--border-light) !important;
  border-top-style: solid !important;
  border-top-width: 1px !important;
}
.footer__social {
  display: flex;
  gap: 0.75rem;
}
/* Social icons: green at rest, purple-light on hover with a scale grow.
   SVG icons inside use fill/stroke="currentColor" so they follow this colour.
   Specificity (.footer + .footer__social + a:link) beats Breakdance's a:link. */
.footer .footer__social a,
.footer .footer__social a:link,
.footer .footer__social a:visited {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-light);
  border-radius: 50%;
  color: var(--green) !important;
  font-size: 0.85rem;
  transition: color var(--duration-normal) var(--ease-out),
              border-color var(--duration-normal) var(--ease-out),
              transform var(--duration-normal) var(--ease-spring);
  transform-origin: center;
  will-change: transform;
}
.footer .footer__social a:hover,
.footer .footer__social a:focus-visible {
  border-color: var(--purple);
  color: var(--purple-light) !important;
  transform: scale(1.18);
}

/* --- PAGE TRANSITIONS --- */
.page-transition {
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-modal) + 50);
  pointer-events: none;
  display: flex;
}
.page-transition__panel {
  flex: 1;
  background: var(--bg-surface);
  transform: scaleY(0);
  transform-origin: bottom;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* Mobile tweaks */
@media (max-width: 767px) {
  .header { width: 94%; }
  .nav-overlay__link a { font-size: var(--text-2xl); }
}

/* Tablet - footer 3-column */
@media (min-width: 768px) {
  .footer__grid {
    grid-template-columns: 1.5fr 1fr 1fr;
    gap: var(--space-lg);
  }
  .footer__bottom {
    flex-direction: row;
    text-align: left;
  }
}

/* Desktop - footer 4-column */
@media (min-width: 1024px) {
  .footer__grid {
    grid-template-columns: 1.5fr 1fr 1fr 1fr;
  }
}
