/* ══ GLOBAL CSS – Brook Farm Race Day ══ */
:root {
  --green-dark:  #2d5a27;
  --green-mid:   #3a7a32;
  --green-light: #4e9e44;
  --green-pale:  #c8dfc6;
  --cream:       #f5efe0;
  --cream-light: #fdf8ef;
  --gold:        #d4a843;
  --white:       #ffffff;
  --text-dark:   #1a2e18;
  --text-mid:    #3d5c39;
  --radius: 12px;
  --shadow:      rgba(45,90,39,.18);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  overflow-x: hidden; /* Fix: cegah horizontal scroll di Chrome mobile */
}

body {
  font-family: 'Instrument Sans', sans-serif;
  background: #ffffff;
  color: var(--text-dark);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  overflow-x: hidden; /* Fix: Chrome mobile horizontal scroll */
  -webkit-text-size-adjust: 100%; /* Fix: Chrome mobile auto font scaling */
}

main {
  background: #ffffff;
  display: flex;
  flex-direction: column;
  flex: 1;
}

#backToTop {
  position: fixed;
  bottom: 32px;
  right: 32px;
  z-index: 99;
  font-size: 18px;
  border: none;
  outline: 10px;
  background-color: rgb(189 25 25 / 30%);
  width: 50px;
  height: 50px;
  color: white;
  cursor: pointer;
  padding: 17px;
  border-radius: 100%;
  display: none;
  /* Tersembunyi saat dimuat */
  transition: background-color 0.3s;
  text-decoration: none;
  margin-bottom:50px;
}

#backToTop:hover {
  background-color: darkred;
  /* Warna saat hover */
}


/* ══ NAVBAR (from kontak.html) ══ */
nav {
  position: sticky;
  top: 0;
  z-index: 200;
  background-image: url(images/navbarsf.webp);
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  height: 58px;
  box-shadow: 0 3px 20px rgba(0,0,0,.3);
}
.nav-logo {
  
  text-decoration: none;
}
.nav-logo img
{    position: relative;
    width: 80px;
    border-radius: 2px;
    height: 60px;
    margin-left: 70px;}
.nav-links {
  display: flex; gap: 6px; list-style: none; align-items: center;
}
.nav-links li { position: relative; }
.nav-links a, .nav-links button {
  text-decoration: none;
  font-family: 'Montserrat', sans-serif;
  font-weight: 600; font-size: 14px;
  color: rgba(255,255,255,.82);
  padding: 8px 16px; border-radius: 6px;
  border: none; background: none; cursor: pointer;
  display: flex; align-items: center; gap: 5px;
  transition: background .18s, color .18s;
}
.nav-links a:hover, .nav-links button:hover {
  background: rgba(255,255,255,.14); color: var(--white);
}
.nav-links a.active {
  background: #ffffff; color: #77333b;
  font-weight: 700; border-radius: 5px; padding: 7px 18px;
}
.nav-links button.active {
  background: rgba(255,255,255,.2); color: var(--white);
}
.caret { font-size: 10px; transition: transform .22s; }
.dropdown-open .caret { transform: rotate(180deg); }

/* Race dropdown */
.dropdown-menu {
  position: absolute; top: calc(100% + 8px); left: 50%;
  transform: translateX(-50%) scaleY(.88);
  transform-origin: top center;
  background: var(--white); border-radius: 10px;
  box-shadow: 0 12px 36px rgba(0,0,0,.22);
  min-width: 140px; overflow: hidden;
  opacity: 0; pointer-events: none;
  transition: opacity .22s, transform .22s;
}
.dropdown-menu.show {
  opacity: 1; pointer-events: all;
  transform: translateX(-50%) scaleY(1);
}
.dropdown-menu a {
  display: block; padding: 11px 22px;
  font-family: 'Montserrat', sans-serif;
  font-weight: 700; font-size: 13px;
  color: var(--green-dark); text-align: center;
  border-radius: 0; background: none;
  transition: background .15s;
}
.dropdown-menu a:hover { background: var(--green-pale); color: var(--green-dark); }
.dropdown-menu a.sub-active { background: var(--green-mid); color: var(--white); }
.dropdown-menu a + a { border-top: 1px solid #eee; }

/* ══ FOOTER ══ */
footer {
  background-image: url(images/navbarsf1.webp);
  background-size: cover;
  background-position: center;
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 15px;
  margin-top: auto;
  color: #ffffff; /* opsional */
}
footer p { font-size: 16px; color: #ffffff; font-family: 'Lato', sans-serif; }
.footer-icons { display: flex; gap: 10px; }
.footer-icon {
  width: 30px; height: 30px;
  background: rgba(255,255,255,.12); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background .2s; color: var(--white);
}
.footer-icon:hover { background: rgba(255,255,255,.26); }
.footer-icon svg { width: 20px; height: 20px; fill: black; }

/* ══ HAMBURGER BUTTON ══ */
.hamburger {
  display: none;
  flex-direction: column; justify-content: center; align-items: center;
  gap: 5px; width: 38px; height: 38px;
  background: rgba(255,255,255,.15); border: 1.5px solid rgba(255,255,255,.3);
  border-radius: 8px; cursor: pointer; padding: 0;
  transition: background .2s;
  z-index: 210;
}
.hamburger:hover { background: rgba(255,255,255,.25); }
.hamburger span {
  display: block; width: 20px; height: 2px;
  background: var(--white); border-radius: 2px;
  transition: transform .28s ease, opacity .2s;
}
/* Animated X when open */
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile close row hidden on desktop */
.mobile-close-row { display: none; }

/* Overlay */
.mobile-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 205;
  backdrop-filter: blur(2px);
}
.mobile-overlay.show { display: block; }

/* ══ MOBILE MEDIA QUERY ══ */

/* Tablet Landscape / Large Tablet */
@media (max-width: 768px) {
  .nav-logo img {
    margin-left: 10px;
    width: 70px;
    height: 52px;
  }
  
  nav {
    padding: 0 24px;
    height: 54px;
  }
  
  .nav-links a, .nav-links button {
    font-size: 13px;
    padding: 7px 12px;
  }
  
  #backToTop {
    bottom: 24px;
    right: 20px;
    width: 44px;
    height: 44px;
    padding: 14px;
    margin-bottom: 40px;
  }
  
  footer {
    padding: 14px 24px;
    gap: 12px;
  }
  
  footer p {
    font-size: 15px;
  }
}

/* Tablet Portrait / Large Mobile */
@media (max-width: 640px) {
  .nav-logo img {
      margin-left:-5px;
    width: 65px;
    height: 48px;
  }
  
  nav { 
    padding: 0 18px; 
    height: 52px;
  }

  .hamburger { display: flex; }

  /* Slide-in drawer dari kanan */
  .nav-links {
    position: fixed;
    top: 0; right: -280px;
    width: 260px; height: 100vh;
    background: linear-gradient(160deg, #5a0000 0%, #800000 60%, #a00000 100%);
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0;
    box-shadow: -6px 0 32px rgba(0,0,0,.35);
    transition: right .3s cubic-bezier(.4,0,.2,1);
    z-index: 210;
    overflow-y: auto;
  }
  .nav-links.open { right: 0; }

  /* Close button row */
  .mobile-close-row {
    display: flex; justify-content: flex-end;
    padding: 14px 16px 8px;
    border-bottom: 1px solid rgba(255,255,255,.1);
  }
  .mobile-close-btn {
    background: rgba(255,255,255,.12);
    border: 1.5px solid rgba(255,255,255,.25);
    border-radius: 50%; width: 32px; height: 32px;
    color: var(--white); font-size: 14px; font-weight: 700;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: background .18s;
  }
  .mobile-close-btn:hover { background: rgba(255,255,255,.25); }

  /* Nav items stacked */
  .nav-links li { width: 100%; }
  .nav-links a, .nav-links button {
    width: 100%; padding: 15px 22px;
    border-radius: 0; font-size: 15px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    justify-content: space-between;
  }
  .nav-links a:hover, .nav-links button:hover {
    background: rgba(255,255,255,.1);
  }
  .nav-links a.active {
    background: rgba(255,255,255,.18);
    color: var(--white);
    border-radius: 0; padding: 15px 22px;
    border-left: 4px solid var(--gold);
  }

  /* Mobile dropdown – expand inline, override semua desktop styles */
  #race-menu { position: static; }
  .dropdown-menu {
    position: static !important;
    top: auto !important; left: auto !important;
    transform: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    min-width: 100% !important;
    background: rgba(0,0,0,.22);
    opacity: 1 !important;
    pointer-events: all !important;
    max-height: 0;
    overflow: hidden;
    transition: max-height .32s ease;
  }
  .dropdown-menu.show {
    max-height: 300px;
    transform: none !important;
  }
  .dropdown-menu a {
    color: rgba(255,255,255,.85) !important;
    padding: 13px 36px !important;
    border-bottom: 1px solid rgba(255,255,255,.06) !important;
    text-align: left !important;
    font-size: 14px !important;
    display: block;
  }
  .dropdown-menu a:hover { background: rgba(255,255,255,.1) !important; }
  .dropdown-menu a.sub-active {
    background: rgba(255,255,255,.15) !important;
    color: var(--white) !important;
    border-left: 3px solid var(--gold) !important;
  }
  .dropdown-menu a + a { border-top: none !important; }
  
  #backToTop {
    bottom: 20px;
    right: 16px;
    width: 40px;
    height: 40px;
    padding: 12px;
    margin-bottom: 35px;
    font-size: 16px;
  }
  
  footer {
    padding: 14px 18px;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
  }
  
  footer p {
    font-size: 14px;
  }
  
  .footer-icons { gap: 12px; }
  .footer-icon  { width: 34px; height: 34px; }
  .footer-icon svg { width: 17px; height: 17px; }
}

/* Small Mobile */
@media (max-width: 600px) {
  .nav-logo img {
      margin-left:-5px;
    width: 58px;
    height: 44px;
  }
  
  nav { 
    padding: 0 14px; 
    height: 48px;
  }
  
  .hamburger {
    width: 34px;
    height: 34px;
    gap: 4px;
  }
  
  .hamburger span {
    width: 18px;
    height: 2px;
  }
  
  .hamburger.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  .hamburger.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
  
  /* Slide-in drawer lebih sempit */
  .nav-links {
    right: -260px;
    width: 240px;
    background: linear-gradient(160deg, #5a0000 0%, #800000 60%, #a00000 100%);
  }
  
  .nav-links a, .nav-links button {
    padding: 13px 18px;
    font-size: 14px;
  }
  
  .nav-links a.active {
    padding: 13px 18px;
  }
  
  .mobile-close-row {
    padding: 12px 14px 6px;
  }
  
  .mobile-close-btn {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }
  
  .dropdown-menu a {
    padding: 11px 28px !important;
    font-size: 13px !important;
  }
  
  #backToTop {
    bottom: 16px;
    right: 12px;
    width: 36px;
    height: 36px;
    padding: 10px;
    margin-bottom: 30px;
    font-size: 14px;
  }
  
  footer {
    padding: 12px 14px;
    gap: 6px;
  }
  
  footer p {
    font-size: 13px;
  }
  
  .footer-icons { gap: 10px; }
  .footer-icon { 
    width: 32px; 
    height: 32px; 
  }
  .footer-icon svg { 
    width: 16px; 
    height: 16px; 
  }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.animated      { animation: fadeUp .6s ease both; }
.delay-1       { animation-delay: .1s; }
.delay-2       { animation-delay: .2s; }
.delay-3       { animation-delay: .3s; }