* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Urbanist', sans-serif;
}

:root {
  --bg-primary: #f4f4f4;
  --bg-secondary: #fff;
  --bg-tertiary: #f8f8f8;
  --text-primary: #111;
  --text-secondary: #333;
  --border-color: #ccc;
  --border-light: #f0f0f0;
  --shadow-sm: rgba(0, 0, 0, 0.04);
  --shadow-md: rgba(0, 0, 0, 0.08);
  --shadow-lg: rgba(0, 0, 0, 0.15);
  --shadow-xl: rgba(0, 0, 0, 0.1);
  --card-bg: #fff;
  --btn-bg: #f0f0f0;
}

body.dark-mode {
  --bg-primary: #1a1a1a;
  --bg-secondary: #242424;
  --bg-tertiary: #2a2a2a;
  --text-primary: #f0f0f0;
  --text-secondary: #d0d0d0;
  --border-color: #444;
  --border-light: #2a2a2a;
  --shadow-sm: rgba(0, 0, 0, 0.3);
  --shadow-md: rgba(0, 0, 0, 0.4);
  --shadow-lg: rgba(0, 0, 0, 0.5);
  --shadow-xl: rgba(0, 0, 0, 0.6);
  --card-bg: #242424;
  --btn-bg: #2a2a2a;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  /* Theme transition: all color properties transition smoothly over 300ms (Requirement 2.5) */
  transition: background-color 300ms ease, color 300ms ease;
}

/* ==================== SKIP LINK ==================== */
.skip-link {
  position: absolute;
  top: -100px;
  left: 0;
  background: #e60000;
  color: #fff;
  padding: 12px 24px;
  text-decoration: none;
  font-weight: 600;
  z-index: 10000;
  border-radius: 0 0 8px 0;
  transition: top 300ms ease;
}

.skip-link:focus {
  top: 0;
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* Main content focus - remove outline when focused programmatically */
#main-content:focus {
  outline: none;
}

/* ==================== GLOBAL FOCUS STYLES (Task 4.1) ==================== */
/* Global focus indicator for keyboard navigation (Requirements 3.3, 4.1, 4.2, 4.3, 4.4) */
*:focus {
  outline: 2px solid #e60000;
  outline-offset: 2px;
}

/* Remove outline for mouse users only - show only for keyboard navigation */
*:focus:not(:focus-visible) {
  outline: none;
}

/* Ensure focus-visible works for keyboard users */
*:focus-visible {
  outline: 2px solid #e60000;
  outline-offset: 2px;
}

/* Global theme transition for all elements using CSS custom properties */
*,
*::before,
*::after {
  /* Ensure smooth theme transitions for color-related properties */
  transition-property: background-color, color, border-color, box-shadow, fill, stroke, background, border;
  transition-duration: 300ms;
  transition-timing-function: ease;
}

/* Elements with specific animation transitions will override the above */

/* Page Load Animation */
body.loading {
  overflow: hidden;
}

/* Page transition fade-in effect (Task 11.1 - Requirement 8.1) */
body:not(.loading) {
  animation: pageFadeIn 500ms ease-out;
}

@keyframes pageFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.page-loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.page-loader.hidden {
  opacity: 0;
  visibility: hidden;
}

.loader-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid var(--border-color);
  border-top-color: #e60000;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* NAVBAR IMPROVED */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 80px;
  background: var(--bg-secondary);
  box-shadow: 0 4px 20px var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 1000;
  transition: background 0.3s ease;
}

/* LOGO */
.logo img {
  height: 32px;
  object-fit: contain;
  transition: filter 0.3s ease;
}

body.dark-mode .logo img {
  filter: brightness(0) invert(1);
}

.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  z-index: 1001;
}

.hamburger:focus,
.hamburger:focus-visible {
  outline: 2px solid #e60000;
  outline-offset: 2px;
}

.hamburger:focus:not(:focus-visible) {
  outline: none;
}

.hamburger span {
  width: 25px;
  height: 3px;
  background: var(--text-primary);
  border-radius: 3px;
  transition: all 0.3s ease;
}

.hamburger.active span:nth-child(1) {
  transform: rotate(45deg) translate(8px, 8px);
}

.hamburger.active span:nth-child(2) {
  opacity: 0;
}

.hamburger.active span:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -7px);
}

/* NAV MENU */
.nav-menu ul {
  display: flex;
  align-items: center;
  gap: 25px;
  list-style: none;
}

/* LINKS */
.nav-menu ul li a {
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 20px;
  transition: background 300ms ease, color 300ms ease, box-shadow 300ms ease;
}

/* HOVER EFFECT */
.nav-menu ul li a:hover,
.nav-menu ul li a:focus {
  background: var(--bg-tertiary);
}

.nav-menu ul li a:focus {
  outline: 2px solid #e60000;
  outline-offset: 2px;
  transition: outline 300ms ease, outline-offset 300ms ease, background 300ms ease;
}

.nav-menu ul li a:focus:not(:focus-visible) {
  outline: none;
}

/* ACTIVE PAGE (IMPORTANT 🔥) */
.nav-menu ul li a.active {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  box-shadow: inset 0 2px 4px var(--shadow-xl);
}

/* DROPDOWN */
.dropdown {
  position: relative;
}

.dropdown > a::after {
  content: " ▾";
  font-size: 0.75rem;
  margin-left: 2px;
}

.dropdown-menu {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  top: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  background: var(--bg-secondary);
  border-radius: 14px;
  box-shadow: 0 10px 40px var(--shadow-lg);
  list-style: none;
  min-width: 190px;
  padding: 10px 0;
  z-index: 999;
  transition: opacity 300ms ease, visibility 300ms ease, transform 300ms ease, background 300ms ease;
  transition-delay: 0s;
  display: flex;
  flex-direction: column;
}

.dropdown-menu::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 12px;
  height: 12px;
  background: var(--bg-secondary);
  border-radius: 2px;
  transform: translateX(-50%) rotate(45deg);
  box-shadow: -2px -2px 5px var(--shadow-md);
}

.dropdown-menu li {
  position: relative;
  z-index: 1;
}

.dropdown-menu li a {
  display: block;
  padding: 10px 24px;
  color: var(--text-primary);
  font-weight: 500;
  font-size: 0.95rem;
  text-decoration: none;
  transition: background 300ms ease, color 300ms ease, padding-left 300ms ease;
  position: relative;
}

.dropdown-menu li a::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 0;
  background: #e60000;
  border-radius: 2px;
  transition: height 300ms ease;
}

.dropdown-menu li a:hover {
  background: var(--bg-tertiary);
  color: #e60000;
  padding-left: 28px;
}

.dropdown-menu li a:hover::before {
  height: 16px;
}

.dropdown:hover .dropdown-menu,
.dropdown-menu:hover,
.dropdown-menu.show {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
  transition-delay: 0s;
}

/* THEME TOGGLE */
.theme-toggle {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 50px;
  width: 45px;
  height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 300ms ease;
  position: relative;
  overflow: hidden;
  margin-left: 10px;
}

.theme-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px var(--shadow-md);
}

.theme-toggle .sun-icon,
.theme-toggle .moon-icon {
  font-size: 20px;
  position: absolute;
  transition: transform 300ms ease, opacity 300ms ease;
}

.theme-toggle .sun-icon {
  transform: rotate(0deg) scale(1);
  opacity: 1;
}

.theme-toggle .moon-icon {
  transform: rotate(180deg) scale(0);
  opacity: 0;
}

body.dark-mode .theme-toggle .sun-icon {
  transform: rotate(-180deg) scale(0);
  opacity: 0;
}

body.dark-mode .theme-toggle .moon-icon {
  transform: rotate(0deg) scale(1);
  opacity: 1;
}

/* MAIN */
.container {
  padding: 60px 80px;
  position: relative;
}

.title {
  font-size: 38px;
  font-weight: 800;
  position: relative;
  margin-bottom: 40px;
  opacity: 0;
  animation: fadeInDown 0.8s ease-out forwards;
}

.title::after {
  content: "";
  width: 55px;
  height: 5px;
  background: #e60000;
  position: absolute;
  left: 0;
  bottom: -10px;
  border-radius: 5px;
  transform: scaleX(0);
  transform-origin: left;
  animation: scaleX 0.6s ease-out 0.4s forwards;
}

@keyframes fadeInDown {
  0% {
    opacity: 0;
    transform: translateY(-30px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes scaleX {
  0% {
    transform: scaleX(0);
  }
  100% {
    transform: scaleX(1);
  }
}

/* GRID */
.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 30px;
  margin-top: 50px;
}

/* BOTTOM */
.bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 50px;
  opacity: 0;
  animation: fadeInUp 0.6s ease-out 0.7s forwards;
}

.card {
  border-radius: 14px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 8px 25px var(--shadow-md);
  transition: all 300ms ease;
  aspect-ratio: 9/16;
  opacity: 0;
  animation: fadeInUp 0.6s ease-out forwards;
}

.card:nth-child(1) { animation-delay: 0.1s; }
.card:nth-child(2) { animation-delay: 0.15s; }
.card:nth-child(3) { animation-delay: 0.2s; }
.card:nth-child(4) { animation-delay: 0.25s; }
.card:nth-child(5) { animation-delay: 0.3s; }
.card:nth-child(6) { animation-delay: 0.35s; }
.card:nth-child(7) { animation-delay: 0.4s; }
.card:nth-child(8) { animation-delay: 0.45s; }
.card:nth-child(9) { animation-delay: 0.5s; }
.card:nth-child(10) { animation-delay: 0.55s; }

@keyframes fadeInUp {
  0% {
    opacity: 0;
    transform: translateY(30px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.card:hover {
  transform: translateY(-10px) scale(1.02);
  box-shadow: 0 15px 40px var(--shadow-lg);
}

.card video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* FILTER BUTTONS */
.filters {
  display: flex;
  gap: 12px;
  align-items: center;
}

.btn {
  padding: 10px 22px;
  border-radius: 25px;
  border: 1px solid var(--border-color);
  background: var(--btn-bg);
  text-decoration: none;
  color: var(--text-secondary);
  display: inline-block;
  transition: all 300ms ease;
  white-space: nowrap;
}

.btn:hover {
  background: #e60000;
  color: #fff;
  border-color: #e60000;
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(230, 0, 0, 0.3);
}

.btn:focus,
.btn:focus-visible {
  outline: 2px solid #e60000;
  outline-offset: 2px;
}

.btn:focus:not(:focus-visible) {
  outline: none;
}

.active-btn {
  background: #ddd;
}

/* BACK BUTTON */
.back-btn {
  background: #e60000;
  color: #fff;
  padding: 10px 22px;
  border-radius: 25px;
  text-decoration: none;
  box-shadow: 0 5px 15px rgba(230, 0, 0, 0.3);
  transition: all 300ms ease;
  display: inline-block;
}

.back-btn:hover {
  background: #c40000;
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(230, 0, 0, 0.4);
}

/* RESPONSIVE */
@media (max-width: 992px) {
  .container {
    padding: 40px;
  }

  .navbar,
  .footer {
    padding-left: 40px;
    padding-right: 40px;
  }

  .grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
  }

  .title {
    font-size: 32px;
  }
}

@media (max-width: 768px) {
  .hamburger {
    display: flex;
  }

  .theme-toggle {
    width: 40px;
    height: 40px;
    margin-left: 0;
  }

  .theme-toggle .sun-icon,
  .theme-toggle .moon-icon {
    font-size: 18px;
  }

  .nav-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 280px;
    height: 100vh;
    background: var(--bg-secondary);
    box-shadow: -5px 0 15px var(--shadow-xl);
    transition: right 0.3s ease, background 0.3s ease;
    padding-top: 80px;
    z-index: 999;
  }

  .nav-menu.active {
    right: 0;
  }

  .nav-menu ul {
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: 20px;
  }

  .nav-menu ul li {
    width: 100%;
    border-bottom: 1px solid var(--border-light);
  }

  .nav-menu ul li a {
    display: block;
    width: 100%;
    padding: 15px 10px;
    border-radius: 0;
  }

  .dropdown-menu {
    position: static;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transform: none;
    box-shadow: none;
    background: var(--bg-tertiary);
    margin-top: 10px;
    display: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, background 0.3s ease;
  }

  .dropdown-menu.show {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    display: flex;
    max-height: 500px;
  }

  .dropdown-menu::before {
    display: none;
  }

  .dropdown > a::after {
    float: right;
  }

  .container {
    padding: 40px 20px;
  }

  .navbar {
    padding: 15px 20px;
  }

  .nav-menu ul {
    gap: 12px;
  }

  .nav-menu ul li a {
    padding: 6px 12px;
    font-size: 0.9rem;
  }

  .title {
    font-size: 28px;
  }

  .bottom {
    flex-direction: column;
    gap: 20px;
    align-items: center;
    margin-top: 80px;
  }

  .grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
  }

  .footer {
    padding: 20px;
    flex-direction: column;
    gap: 15px;
  }
}

@media (max-width: 480px) {
  .navbar {
    padding: 12px 15px;
  }

  .theme-toggle {
    width: 38px;
    height: 38px;
    margin-left: 0;
  }

  .theme-toggle .sun-icon,
  .theme-toggle .moon-icon {
    font-size: 16px;
  }

  .logo img {
    height: 28px;
  }

  .nav-menu ul {
    gap: 8px;
  }

  .nav-menu ul li a {
    padding: 5px 10px;
    font-size: 0.85rem;
  }

  .container {
    padding: 30px 15px;
  }

  .title {
    font-size: 24px;
  }

  .grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .back-btn,
  .btn {
    font-size: 0.85rem;
    padding: 8px 16px;
  }

  .filters {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
  }
}


/* FOOTER */
.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: #e60000;
  color: #fff;
  padding: 22px 80px;
  flex-wrap: wrap;
  transition: background 0.3s ease;
}

body.dark-mode .footer {
  background: #1a1a1a;
  border-top: 1px solid #333;
}

.footer-left,
.footer-right,
.copyright {
  display: flex;
  align-items: center;
  justify-content: center;
}

.footer-logo {
  height: 28px;
  width: auto;
}

.footer-logo-sm {
  height: 38px;
  width: auto;
}

.copyright p {
  font-size: 0.95rem;
  text-align: center;
}

/* LIGHTBOX */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 300ms ease, visibility 300ms ease;
}

.lightbox.active {
  opacity: 1;
  visibility: visible;
}

.lightbox-content {
  position: relative;
  max-width: 90%;
  max-height: 90%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.lightbox-img,
.lightbox-video {
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
  position: absolute;
  top: -50px;
  right: 0;
  font-size: 40px;
  color: #fff;
  cursor: pointer;
  transition: color 300ms ease;
  font-weight: 300;
  line-height: 1;
  background: none;
  border: none;
  padding: 8px;
}

.lightbox-close:hover {
  color: #e60000;
}

.lightbox-close:focus,
.lightbox-close:focus-visible {
  outline: 2px solid #e60000;
  outline-offset: 2px;
  color: #e60000;
}

.lightbox-close:focus:not(:focus-visible) {
  outline: none;
}

@media (max-width: 768px) {
  .lightbox-close {
    top: -40px;
    font-size: 35px;
  }
}

/* ==================== MOTION PREFERENCES (Task 13) ==================== */
/* Reduce/disable non-essential animations for users who prefer reduced motion (Requirement 14.1, 14.2, 14.3) */
@media (prefers-reduced-motion: reduce) {
  /* Reduce page transition duration to 100ms (Requirement 14.3) */
  body:not(.loading) {
    animation-duration: 100ms;
  }
  
  /* Disable non-essential animations (Requirement 14.1) */
  .card,
  .title,
  .bottom,
  @keyframes fadeInUp,
  @keyframes fadeInDown,
  @keyframes scaleX {
    animation: none;
    opacity: 1;
    transform: none;
  }
  
  /* Maintain essential animations for user feedback (Requirement 14.2) */
  /* Keep hover, focus, and loading animations */
  .card:hover,
  .btn:hover,
  .back-btn:hover,
  *:focus,
  *:focus-visible {
    transition-duration: 100ms;
  }
  
  .loader-spinner {
    animation: spin 1s linear infinite;
  }
}
