/* ==========================================================
   HRX Tech Thailand — custom styles (atop Tailwind)
   ========================================================== */

:root {
  --navy: #002149;
  --cream: #FAFAFA;
  --slate-mid: #5C5C5C;
  --ash: #BFBFBF;
  --focus: #0B61CD;
  --mint: #A8E8E2;
}

html {
  scroll-behavior: smooth;
}

body {
  letter-spacing: -0.01em;
}

/* Headings get the tight HRX look */
h1, h2, h3, h4 {
  letter-spacing: -0.03em;
  line-height: 1.05;
}

/* ---------------- ANNOUNCEMENT BAR ---------------- */
.ann-slide {
  opacity: 0;
  transition: opacity 0.4s ease, transform 0.4s ease;
  transform: translateY(6px);
  pointer-events: none;
}
.ann-slide[data-active="true"] {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* ---------------- NAV / MEGA MENU ---------------- */
.nav-link {
  position: relative;
  display: inline-block;
  padding: 0.6rem 1.25rem;
  color: var(--navy);
  border-radius: 9999px;
  transition: background-color 0.25s ease, color 0.25s ease;
  white-space: nowrap;
}
.nav-link:hover,
.nav-item:hover > .nav-link,
.nav-item:focus-within > .nav-link {
  background: var(--navy);
  color: #fff;
}
.nav-link--accent {
  color: #F5A623;
}
.nav-link--accent:hover,
.nav-link--accent:focus {
  background: #F5A623;
  color: #fff;
}
/* active page indicator */
.nav-link.is-active {
  background: var(--navy);
  color: #fff;
}
.nav-link--accent.is-active {
  background: #F5A623;
  color: #fff;
}

.mega-menu {
  position: absolute;
  top: calc(100% + 12px);
  left: 0;
  transform: translateY(8px);
  min-width: 240px;
  background: #fff;
  box-shadow: 0 25px 60px -10px rgba(0,0,0,0.18);
  border-radius: 14px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s linear 0.25s;
  z-index: 30;
}
.nav-item:hover .mega-menu,
.nav-item:focus-within .mega-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s;
}
/* invisible bridge so hover doesn't drop */
.nav-item::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  bottom: -14px;
  height: 14px;
}

/* mega-menu links */
.mega-link {
  display: block;
  padding: 0.65rem 1.25rem;
  font-weight: 500;
  font-size: 1rem;
  color: var(--navy);
  border-radius: 8px;
  transition: background-color 0.2s ease, color 0.2s ease;
  white-space: nowrap;
}
.mega-link:hover {
  background: rgba(0, 33, 73, 0.06);
  color: var(--navy);
}

/* ---------------- MEGA MENU FLY-OUT SUB-PANEL ---------------- */
.mega-item--has-sub {
  position: relative;
}

/* invisible bridge so hover doesn't drop when moving to sub-panel */
.mega-item--has-sub::after {
  content: '';
  position: absolute;
  right: -10px;
  top: 0;
  width: 10px;
  height: 100%;
}

.mega-fly-panel {
  position: absolute;
  left: calc(100% + 10px);
  top: -8px;
  min-width: 190px;
  background: #fff;
  box-shadow: 0 25px 60px -10px rgba(0,0,0,0.18);
  border-radius: 14px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0s 0.2s;
  z-index: 31;
}

.mega-item--has-sub:hover .mega-fly-panel,
.mega-item--has-sub:focus-within .mega-fly-panel {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 0.2s ease;
}

/* highlight Drivers row when hovered */
.mega-item--has-sub:hover > a {
  background: rgba(0, 33, 73, 0.06);
  color: var(--navy);
}

/* ---------------- BUTTONS ---------------- */
.btn-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.85rem 1.75rem;
  border-radius: 3.75rem;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}
.btn-pill--filled {
  background: var(--navy);
  color: #fff;
}
.btn-pill--filled:hover {
  background: #0a3162;
  transform: translateY(-1px);
  box-shadow: 0 10px 30px -10px rgba(0,33,73,0.5);
}
.btn-pill--outline {
  border: 2px solid var(--navy);
  color: var(--navy);
  background: transparent;
}
.btn-pill--outline:hover {
  background: var(--navy);
  color: #fff;
  transform: translateY(-1px);
}

/* ---------------- COLLECTION CARDS ---------------- */
.card .arrow-icon {
  display: inline-flex;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: rgba(255,255,255,0.95);
  color: var(--navy);
  align-items: center;
  justify-content: center;
  transform: translateY(0);
  transition: transform 0.4s ease, background 0.3s ease;
}
.card:hover .arrow-icon {
  transform: translate(4px, -2px);
  background: #fff;
}

/* sub-collection card arrow (Drivers page) */
.card-arrow {
  display: inline-flex;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: var(--navy);
  color: #fff;
  align-items: center;
  justify-content: center;
  transition: transform 0.35s ease, background 0.25s ease;
  flex-shrink: 0;
}
.card-arrow--sm {
  width: 30px;
  height: 30px;
}
.card:hover .card-arrow {
  transform: translateX(4px);
  background: #0a3162;
}

/* "More information" toggle content area */
.info-content {
  transition: max-height 0.6s ease, opacity 0.4s ease;
  opacity: 1;
}

/* ---------------- 3D PHOTO GALLERY (Championship page) ---------------- */
.gallery-grid {
  list-style: none;
  padding: 0;
  margin: 0;
  perspective: 1500px;
}
.gallery-tile {
  position: relative;
  height: 12rem;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border-radius: 12px;
  background-color: #e9e9e9;
  box-shadow: -5px 5px 30px rgba(0,0,0,0.3);
  transform: translateY(10vh) skew(60deg, -15deg) rotateX(40deg);
  transform-origin: center;
  transition: transform 0.9s cubic-bezier(.2, .8, .2, 1), box-shadow 0.6s ease;
}
@media (min-width: 768px) {
  .gallery-tile {
    height: 22rem;
  }
}
.gallery-grid.is-flat .gallery-tile {
  transform: translateY(0) skew(0, 0) rotateX(0);
  box-shadow: 0 14px 30px -10px rgba(0,0,0,0.25);
}
.gallery-tile:hover {
  filter: brightness(1.04);
}

/* ---------------- SCRIBBLE / SQUIGGLE ---------------- */
.scribble-circle {
  position: absolute;
  inset: -10% -8% -15% -8%;
  width: 116%;
  height: 130%;
  color: var(--navy);
  pointer-events: none;
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
}
.scribble-circle.is-visible {
  animation: scribble 1.4s ease-out forwards;
}
@keyframes scribble {
  to { stroke-dashoffset: 0; }
}

.squiggle-underline {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -10px;
  width: 100%;
  height: 18px;
  color: var(--navy);
  stroke-dasharray: 600;
  stroke-dashoffset: 600;
}
.squiggle-underline.is-visible {
  animation: scribble 1.2s ease-out 0.2s forwards;
}

/* ---------------- IMAGE COMPARE ---------------- */
#image-compare img {
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}
#image-compare {
  background: #ddd;
}
#ic-handle {
  cursor: ew-resize;
}

/* ---------------- FOOTER ---------------- */
.footer-col__head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,0.15);
  color: #fff;
  text-align: left;
}
.footer-chev {
  width: 1.1rem;
  height: 1.1rem;
  transition: transform 0.3s ease;
  color: rgba(255,255,255,0.85);
}
.footer-col__list {
  color: rgba(255,255,255,0.85);
}
.footer-col__list a {
  transition: color 0.2s ease, padding-left 0.25s ease;
}
.footer-col__list a:hover {
  padding-left: 4px;
}
.social-icon {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.35);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
}
.social-icon svg {
  width: 14px;
  height: 14px;
}
.social-icon:hover {
  background: #fff;
  color: var(--navy);
  border-color: #fff;
  transform: translateY(-2px);
}

/* Mobile: collapsible footer columns */
@media (max-width: 640px) {
  .footer-col__head { cursor: pointer; }
  .footer-col.is-open .footer-chev { transform: rotate(180deg); }
  .footer-col__list {
    display: none;
  }
  .footer-col.is-open .footer-col__list {
    display: block;
    animation: fadeSlide 0.3s ease;
  }
  @keyframes fadeSlide {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
  }
}
@media (min-width: 641px) {
  .footer-col__head { pointer-events: none; }
}

/* ---------------- DROPDOWNS ---------------- */
.dropdown-menu {
  animation: dropFade 0.18s ease;
}
@keyframes dropFade {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------------- STICKY HEADER POLISH ---------------- */
#site-header {
  transition: box-shadow 0.3s ease;
}
#site-header.is-scrolled {
  box-shadow: 0 6px 20px -10px rgba(0,0,0,0.15);
}

/* ---------------- UTILITIES ---------------- */
.no-scroll {
  overflow: hidden;
}

/* ---------------- DRAWERS — fix click stacking ---------------- */
/* Make the overlay sit beneath the aside so clicks on links inside the
   aside are received by the link, not swallowed by the close-overlay. */
#menu-drawer > div[data-drawer-close],
#cart-drawer > div[data-drawer-close],
#search-drawer > div[data-drawer-close] {
  z-index: 0;
}
#menu-drawer > aside,
#cart-drawer > aside,
#search-drawer > aside {
  z-index: 10;
}

/* Mobile drawer link feedback */
#menu-drawer a {
  transition: background-color 0.15s ease, padding-left 0.15s ease, color 0.15s ease;
  border-radius: 4px;
}
#menu-drawer a:hover,
#menu-drawer a:active {
  background: rgba(0, 33, 73, 0.06);
  padding-left: 8px;
  color: var(--navy);
}

/* ---------------- SCROLL REVEAL ---------------- */
.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal.is-visible {
  opacity: 1;
  transform: none;
}
/* fade-only variant (no Y movement) — for images / overlays */
.reveal--fade {
  transform: none;
  transition-duration: 1s;
}
/* stagger delays for grid children */
.reveal--d1 { transition-delay: 0.08s; }
.reveal--d2 { transition-delay: 0.16s; }
.reveal--d3 { transition-delay: 0.24s; }
.reveal--d4 { transition-delay: 0.32s; }
.reveal--d5 { transition-delay: 0.40s; }
.reveal--d6 { transition-delay: 0.48s; }
.reveal--d7 { transition-delay: 0.56s; }
/* respect user preference */
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
}
