/* ==========================================================================
   Rangiora RSA Club — Custom styles (used alongside Tailwind CDN)
   Colours: Poppy #C41E3A · Navy #1B2A41 · Cream #FAF6F0
   ========================================================================== */

:root {
  --poppy: #C41E3A;
  --poppy-dark: #9A1830;
  --navy: #1B2A41;
  --navy-dark: #111C2E;
  --cream: #FAF6F0;
}

html { scroll-behavior: smooth; }
body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

::selection { background: var(--poppy); color: #fff; }

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  background: var(--poppy); color: #fff; font-weight: 600;
  padding: .8rem 1.75rem; border-radius: 9999px;
  transition: all .3s ease; box-shadow: 0 4px 14px rgba(196, 30, 58, .35);
}
.btn-primary:hover { background: var(--poppy-dark); transform: translateY(-2px); box-shadow: 0 8px 22px rgba(196, 30, 58, .45); }

.btn-secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  background: transparent; color: #fff; font-weight: 600;
  padding: .8rem 1.75rem; border-radius: 9999px; border: 2px solid rgba(255,255,255,.7);
  transition: all .3s ease;
}
.btn-secondary:hover { background: #fff; color: var(--navy); transform: translateY(-2px); }

.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  color: var(--navy); font-weight: 600; padding: .8rem 1.5rem; border-radius: 9999px;
  border: 2px solid rgba(27,42,65,.2); transition: all .3s ease;
}
.btn-ghost:hover { border-color: var(--poppy); color: var(--poppy); }

.btn-navy {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  background: var(--navy); color: #fff; font-weight: 600;
  padding: .8rem 1.75rem; border-radius: 9999px; transition: all .3s ease;
}
.btn-navy:hover { background: var(--navy-dark); transform: translateY(-2px); }

/* --------------------------------------------------------------------------
   Navigation
   -------------------------------------------------------------------------- */
.nav-link { position: relative; padding: .25rem 0; transition: color .25s ease; }
.nav-link::after {
  content: ""; position: absolute; left: 0; bottom: -4px; height: 2px; width: 0;
  background: var(--poppy); transition: width .3s ease; border-radius: 2px;
}
.nav-link:hover, .nav-link.active { color: var(--poppy); }
.nav-link:hover::after, .nav-link.active::after { width: 100%; }

.dropdown {
  position: absolute; top: 100%; left: 50%; transform: translateX(-50%) translateY(8px);
  min-width: 12rem; background: #fff; border-radius: .75rem; padding: .5rem;
  box-shadow: 0 20px 40px rgba(17,28,46,.15); border: 1px solid rgba(0,0,0,.05);
  opacity: 0; visibility: hidden; transition: all .25s ease; z-index: 60;
}
.group:hover .dropdown, .group:focus-within .dropdown { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }
.dropdown a { display: block; padding: .55rem .9rem; border-radius: .5rem; font-weight: 500; color: var(--navy); }
.dropdown a:hover { background: var(--cream); color: var(--poppy); }

#site-header { transition: transform .3s ease, box-shadow .3s ease; will-change: transform; }
#site-header.nav-hidden { transform: translateY(-100%); }
#site-header.scrolled { box-shadow: 0 6px 24px rgba(17,28,46,.08); }

/* --------------------------------------------------------------------------
   Scroll-reveal animations (activated by main.js IntersectionObserver)
   -------------------------------------------------------------------------- */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity .8s cubic-bezier(.22,1,.36,1), transform .8s cubic-bezier(.22,1,.36,1); }
.reveal.is-visible { opacity: 1; transform: none; }
.reveal-left { opacity: 0; transform: translateX(-36px); transition: opacity .8s ease, transform .8s cubic-bezier(.22,1,.36,1); }
.reveal-right { opacity: 0; transform: translateX(36px); transition: opacity .8s ease, transform .8s cubic-bezier(.22,1,.36,1); }
.reveal-left.is-visible, .reveal-right.is-visible { opacity: 1; transform: none; }
.reveal-zoom { opacity: 0; transform: scale(.94); transition: opacity .8s ease, transform .8s cubic-bezier(.22,1,.36,1); }
.reveal-zoom.is-visible { opacity: 1; transform: scale(1); }
/* Stagger helpers */
.delay-1 { transition-delay: .12s; } .delay-2 { transition-delay: .24s; }
.delay-3 { transition-delay: .36s; } .delay-4 { transition-delay: .48s; }

@media (prefers-reduced-motion: reduce) {
  .reveal, .reveal-left, .reveal-right, .reveal-zoom { opacity: 1; transform: none; transition: none; }
  .kenburns { animation: none; }
}

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */
.kenburns { animation: kenburns 18s ease-in-out infinite alternate; }
@keyframes kenburns {
  from { transform: scale(1) translateY(0); }
  to   { transform: scale(1.08) translateY(-1.5%); }
}
.hero-overlay {
  background: linear-gradient(to bottom, rgba(17,28,46,.55) 0%, rgba(17,28,46,.35) 45%, rgba(17,28,46,.75) 100%);
}
.scroll-cue { animation: cue 2.2s ease-in-out infinite; }
@keyframes cue { 0%,100% { transform: translateY(0); opacity:.9; } 50% { transform: translateY(10px); opacity:.5; } }

/* --------------------------------------------------------------------------
   Cards & imagery
   -------------------------------------------------------------------------- */
.card-hover { transition: transform .35s cubic-bezier(.22,1,.36,1), box-shadow .35s ease; transform-style: preserve-3d; perspective: 900px; }
.card-hover:hover { transform: translateY(-6px) rotateX(2deg) rotateY(-2deg); box-shadow: 0 24px 48px rgba(17,28,46,.14); }
.img-zoom { overflow: hidden; }
.img-zoom img { transition: transform .6s cubic-bezier(.22,1,.36,1); }
.img-zoom:hover img { transform: scale(1.06); }

/* --------------------------------------------------------------------------
   Parallax (scroll-linked, JS-driven via main.js; respects reduced-motion)
   -------------------------------------------------------------------------- */
.parallax-img { will-change: transform; transform: translate3d(0,0,0) scale(1.15); }
@media (prefers-reduced-motion: reduce) { .parallax-img { transform: none !important; } }

/* Scroll cue */
.scroll-cue-wrap { position: absolute; left: 50%; bottom: 1.75rem; transform: translateX(-50%); z-index: 20; }

/* Poppy divider flourish */
.poppy-divider { display: flex; align-items: center; justify-content: center; gap: .75rem; }
.poppy-divider::before, .poppy-divider::after {
  content: ""; height: 1px; width: 64px; background: linear-gradient(90deg, transparent, var(--poppy));
}
.poppy-divider::after { background: linear-gradient(90deg, var(--poppy), transparent); }

.eyebrow { letter-spacing: .22em; text-transform: uppercase; font-size: .75rem; font-weight: 700; color: var(--poppy); }

/* --------------------------------------------------------------------------
   Timeline (About page)
   -------------------------------------------------------------------------- */
.timeline { position: relative; }
.timeline::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: 1.1rem; width: 2px;
  background: linear-gradient(to bottom, var(--poppy), rgba(196,30,58,.15));
}
@media (min-width: 768px) { .timeline::before { left: 50%; transform: translateX(-50%); } }
.timeline-dot {
  position: absolute; left: .55rem; top: .4rem; width: 1.15rem; height: 1.15rem;
  background: #fff; border: 4px solid var(--poppy); border-radius: 9999px; z-index: 1;
}
@media (min-width: 768px) { .timeline-dot { left: 50%; transform: translateX(-50%); } }

/* --------------------------------------------------------------------------
   Accordion (FAQ)
   -------------------------------------------------------------------------- */
.accordion-panel { max-height: 0; overflow: hidden; transition: max-height .45s cubic-bezier(.22,1,.36,1); }
.accordion-item.open .accordion-panel { max-height: 24rem; }
.menu-accordion .accordion-item.open .accordion-panel { max-height: 60rem; }
.accordion-item .acc-icon { transition: transform .35s ease; }
.accordion-item.open .acc-icon { transform: rotate(45deg); }

/* --------------------------------------------------------------------------
   Lightbox (Gallery)
   -------------------------------------------------------------------------- */
#lightbox { backdrop-filter: blur(6px); }
#lightbox.hidden { display: none; }
#lightbox img { max-height: 82vh; box-shadow: 0 30px 80px rgba(0,0,0,.5); }

/* --------------------------------------------------------------------------
   Events filter
   -------------------------------------------------------------------------- */
.filter-btn { transition: all .25s ease; }
.filter-btn.active { background: var(--poppy); color: #fff; border-color: var(--poppy); }
.event-card.hidden-card { display: none; }

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */
.form-input {
  width: 100%; border: 1.5px solid rgba(27,42,65,.15); border-radius: .65rem;
  padding: .75rem 1rem; background: #fff; color: var(--navy);
  transition: border-color .25s ease, box-shadow .25s ease;
}
.form-input:focus { outline: none; border-color: var(--poppy); box-shadow: 0 0 0 3px rgba(196,30,58,.12); }
.form-label { display: block; font-weight: 600; font-size: .875rem; color: var(--navy); margin-bottom: .4rem; }

/* --------------------------------------------------------------------------
   Misc
   -------------------------------------------------------------------------- */
#back-to-top { opacity: 0; pointer-events: none; transition: opacity .3s ease, transform .3s ease; transform: translateY(10px); }
#back-to-top.show { opacity: 1; pointer-events: auto; transform: translateY(0); }

.stat-number { font-variant-numeric: tabular-nums; }

/* Marquee for section chips (home page) */
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.floaty { animation: floaty 5s ease-in-out infinite; }

/* --------------------------------------------------------------------------
   Continuous leftward-scrolling image marquee (Functions "More Views")
   -------------------------------------------------------------------------- */
.marquee-wrap { overflow: hidden; -webkit-mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent); mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent); }
.marquee-track { display: flex; width: max-content; gap: 1.5rem; animation: marquee-left 26s linear infinite; }
.marquee-wrap:hover .marquee-track { animation-play-state: paused; }
.marquee-item { flex: 0 0 auto; width: 21rem; height: 20rem; }
@media (max-width: 640px) { .marquee-item { width: 16rem; height: 16rem; } }
@keyframes marquee-left { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .marquee-track { animation: none; } }

/* Auto-sliding carousel */
.slider-track { will-change: transform; }

/* Custom scrollbar (subtle, webkit) */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--cream); }
::-webkit-scrollbar-thumb { background: #c9c2b8; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--poppy); }

/* Photo slideshows (data-slideshow): photos fade between each other */
[data-slideshow] .ss-img { opacity: 0; transition: opacity .8s ease, transform .6s cubic-bezier(.22,1,.36,1); }
[data-slideshow] .ss-img.is-on { opacity: 1; }

/* --------------------------------------------------------------------------
   Mobile (phones): centre-aligned layout
   -------------------------------------------------------------------------- */
@media (max-width: 639px) {
  main :is(h1, h2, h3, h4, p, figcaption):not(form *):not(li *):not(.keep-left),
  footer :is(h1, h2, h3, h4, p):not(.keep-left) { text-align: center; }
  main .flex-wrap, footer .flex-wrap { justify-content: center; }
  main .eyebrow.flex { justify-content: center; }
  main .max-w-3xl, main .max-w-2xl, main .max-w-xl, main .max-w-lg { margin-left: auto; margin-right: auto; }
  /* two side-by-side call-to-action buttons on one line */
  .cta-compact { font-size: .8125rem; padding: .7rem .9rem; white-space: nowrap; }
}

/* Mobile menu: compact grid so it always fits on screen - no scrolling */
@media (max-width: 639px), (max-height: 520px) {
  #mobile-menu { max-height: none !important; overflow: visible !important; }
  #mobile-menu > div {
    display: grid !important; grid-template-columns: repeat(2, 1fr); column-gap: .5rem; row-gap: 0;
    padding: .5rem 1.25rem 1rem !important; font-size: .9375rem !important; text-align: center;
  }
  #mobile-menu > div > a { margin-top: 0 !important; }
  #mobile-menu a.block { padding: .6rem 0 !important; }
  #mobile-menu .btn-primary { grid-column: 1 / -1; margin-top: .75rem !important; width: 100%; font-size: .9375rem; }
}
@media (max-height: 520px) and (min-width: 640px) {
  #mobile-menu > div { grid-template-columns: repeat(3, 1fr); padding-top: .25rem !important; padding-bottom: .5rem !important; }
  #mobile-menu a.block { padding: .3rem 0 !important; }
  #mobile-menu .btn-primary { margin-top: .4rem !important; padding-top: .55rem; padding-bottom: .55rem; }
}

/* --------------------------------------------------------------------------
   iPad / tablet (touch screens 640-1366px wide): centre-aligned layout
   Desktop computers and phones are not affected by this block.
   -------------------------------------------------------------------------- */
@media (min-width: 640px) and (max-width: 1366px) and (hover: none) and (pointer: coarse) {
  html, body { overflow-x: clip; }
  main :is(h1, h2, h3, h4, p, figcaption):not(form *):not(li *):not(.keep-left),
  footer :is(h1, h2, h3, h4, p):not(.keep-left) { text-align: center; }
  main .flex-wrap, footer .flex-wrap { justify-content: center; }
  main .eyebrow.flex { justify-content: center; }
  main .max-w-3xl, main .max-w-2xl, main .max-w-xl, main .max-w-lg { margin-left: auto; margin-right: auto; }
  /* home hero text sits in the centre of the video */
  .ipad-hero { align-items: center !important; }
  .ipad-hero > div { width: min(36rem, 100%) !important; text-align: center; }
  .ipad-hero .flex { justify-content: center; }
  .ipad-hero .hero-address { justify-content: center; }
  /* keep the floating "$4M" badge inside the screen */
  .ipad-badge { right: .5rem !important; }
}

/* Home page: upcoming events scrolling left */
.events-marquee { overflow: hidden; -webkit-mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent); mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent); }
.events-track { display: flex; width: max-content; gap: 1.5rem; padding: .5rem 1.5rem .5rem 0; animation: marquee-left 50s linear infinite; }
.events-marquee:hover .events-track, .events-marquee:focus-within .events-track { animation-play-state: paused; }
.ev-card { flex: 0 0 auto; width: 17rem; }
.events-track .contents { display: contents; }
@media (max-width: 640px) { .ev-card { width: 14rem; } }
@media (prefers-reduced-motion: reduce) { .events-marquee { overflow-x: auto; } .events-track { animation: none; } }

/* --------------------------------------------------------------------------
   Phones and touch tablets: everything centred, including footers and lists.
   Desktop computers are not affected.
   -------------------------------------------------------------------------- */
@media (max-width: 639px), (min-width: 640px) and (max-width: 1366px) and (hover: none) and (pointer: coarse) {
  footer .grid > div { text-align: center; }
  footer ul, footer li { text-align: center; }
  footer li.flex.justify-between { flex-direction: column; align-items: center; gap: .1rem; justify-content: center; }
  footer .btn-primary, footer .btn-secondary { margin-left: auto; margin-right: auto; }
  main li:not(form *):not(details *):not(.keep-left) { text-align: center; }
  main li.flex:not(form *):not(details *) { display: block; text-align: center; }
  main li.flex:not(form *):not(details *) > span:first-child { margin-right: .4rem; display: inline; }
  main span[class*="rounded-xl"][class*="bg-poppy/10"], main div[class*="rounded-xl"][class*="bg-poppy/10"][class*="w-1"] { margin-left: auto; margin-right: auto; }
  main .flex.items-start:has(> span[class*="w-11"]),
  main .flex.items-start:has(> span[class*="w-12"]) { flex-direction: column; align-items: center; text-align: center; }
  main .flex.items-start:has(> span[class*="w-11"]) > div,
  main .flex.items-start:has(> span[class*="w-12"]) > div { text-align: center; }
  main .flex.items-start:has(> span[class*="w-11"]) p, main .flex.items-start:has(> span[class*="w-12"]) p { text-align: center; }
  main :not(.flex) > :is(.btn-primary, .btn-secondary, .btn-navy, .btn-ghost) { display: flex; width: fit-content; margin-left: auto; margin-right: auto; }
  main a.inline-block.font-semibold { display: block; text-align: center; }
  main .flex.items-center.justify-between:not(form *) { justify-content: center; flex-wrap: wrap; gap: .5rem 1rem; }
}
