/* -------------------------------------------------
   Global Variables & Reset
-------------------------------------------------- */
:root {
  --primary-color: #007bff;
  --secondary-color: #1e1e2f;
  --bg-light: #f4f6f9;
  --text-dark: #333;
  --white: #fff;

  --header-h: 72px;
  --header-bg: #171822;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  scroll-behavior: smooth;
}

html, body {
  height: 100%;
}

html { background: var(--header-bg); }

body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: calc(var(--header-h) + env(safe-area-inset-top, 0px));
  background: var(--header-bg);
  z-index: 1098;
  pointer-events: none;
}

body {
  background: linear-gradient(120deg, #f4f6f9, #edf1f5);
  color: var(--text-dark);
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* -------------------------------------------------
   Header
-------------------------------------------------- */
header {
  background: var(--header-bg);
  padding: 14px 20px;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 1100;
  box-shadow: 0 6px 20px rgba(10,10,20,0.20);
  display: flex;
  justify-content: center;
  align-items: center;
  height: var(--header-h);
}

header nav {
  width: 100%;
  max-width: 1100px;
  display: flex;
  justify-content: center;
  align-items: center;
}

header nav ul {
  list-style: none;
  display: flex;
  gap: 18px;
  align-items: center;
  margin: 0;
  padding: 0;
  flex-wrap: nowrap;
  white-space: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

header nav ul::-webkit-scrollbar { height: 6px; }
header nav ul::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.06);
  border-radius: 6px;
}

.header-btn {
  --bg-1: #3e3e50; --bg-2: #2f2f40;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border-radius: 10px;
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  background-image: linear-gradient(180deg, var(--bg-1), var(--bg-2));
  box-shadow: 0 6px 18px rgba(30,30,40,0.35);
  border: 0;
  cursor: pointer;
  transition: transform .22s, box-shadow .22s, background-position .8s, opacity .18s;
  position: relative;
  overflow: hidden;
}

.header-btn .icon-circle {
  width: 30px; height: 30px; min-width: 30px;
  border-radius: 8px;
  display: inline-grid;
  place-items: center;
  background: rgba(255,255,255,0.04);
  transition: background .2s, transform .22s;
}


.header-btn::after {
  content: "";
  position: absolute;
  left: -110%;
  top: -50%;
  width: 60%;
  height: 220%;
  background: linear-gradient(90deg, rgba(255,255,255,0.06), rgba(255,255,255,0.18), rgba(255,255,255,0.06));
  transform: rotate(18deg);
  transition: left .9s cubic-bezier(.2,.9,.2,1);
  pointer-events: none;
}

.header-btn:hover,
.header-btn:focus {
  transform: translateY(-6px);
  box-shadow: 0 18px 36px rgba(50,40,90,0.28);
}

.header-btn:hover::after { left: 120%; }

.header-btn:hover .icon-circle {
  transform: translateY(-3px);
  background: rgba(255,255,255,0.08);
}

.header-btn.primary {
  --bg-1: #ff6b4a;
  --bg-2: #e64a3c;
  background-image: linear-gradient(90deg,var(--bg-1),var(--bg-2));
  color: #fff;
}

/* -------------------------------------------------
   Hero
-------------------------------------------------- */
.hero {
  padding-top: calc(var(--header-h) + 40px);
  padding-bottom: 40px;
  text-align: center;
  color: #fff;
  position: relative;
  overflow: hidden;
  z-index: 2;
  background: linear-gradient(-45deg, #6a0dad, #8a2be2, #7b68ee, #6a0dad);
  background-size: 400% 400%;
  animation: gradientShift 15s ease infinite;
}

.hero-video {
  position: absolute;
  left: 0; right: 0;
  top: calc(-1 * var(--header-h));
  height: calc(100% + var(--header-h));
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

#hero-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: translateZ(0);
}

.hero-video-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.18), rgba(0,0,0,0.42));
}

.hero > *:not(.hero-video) {
  position: relative;
  z-index: 2;
}

/* -------------------------------------------------
   (REPLACED) Featured collection title styles
   — using title wrapper & title inside the container
-------------------------------------------------- */
.ad-container {
  overflow: hidden;
  padding: 50px 0 40px; /* increased top padding so the title has breathing room */
  background: #fff;
  border-block: 2px solid #eee;
  position: relative;
}

/* NEW: wrapper that holds the title inside the container and centers it */
.ad-title-wrapper {
  width: 100%;
  display: flex;
  justify-content: center; /* centers the title horizontally */
  align-items: center;
  margin-bottom: 25px;     /* space between title and book row */
  padding-inline: 20px;    /* aligns with ad-content padding */
  box-sizing: border-box;
}

/* Actual title element (inside wrapper) */
.ad-title {
  font-size: 28px;
  font-weight: 700;
  color: #1e1e2f;
  text-align: center;
  margin: 0;
  line-height: 1;
  white-space: nowrap; /* avoid wrapping on small screens */
}

/* -------------------------------------------------
   Auto-scroll Book Covers
-------------------------------------------------- */
.ad-content {
  display: flex;
  gap: 30px;
  padding-inline: 20px;
  width: max-content;
  animation: scrollBooks 25s linear infinite;
}

.ad-card {
  flex: 0 0 auto;
  width: 200px;
  height: 300px;
  border-radius: 12px;
  overflow: hidden;
  background: #fefefe;
  box-shadow: 0 4px 10px rgba(0,0,0,.1);
  transition: transform .3s;
}

.ad-card:hover { transform: scale(1.05); }

.ad-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* -------------------------------------------------
   Keyframes
-------------------------------------------------- */
@keyframes scrollBooks {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* -------------------------------------------------
   Responsive tweaks
-------------------------------------------------- */
@media (max-width: 768px) {
  :root { --header-h: 64px; }

  .hero h1,
  .home-hero h1 {
    font-size: 32px;
  }

  .search-bar {
    flex-direction: column;
  }

  .search-bar input,
  .search-bar select,
  .search-bar button {
    width: 100%;
  }

  .book-card {
    width: 90%;
  }

  .ad-card {
    width: 140px;
    height: 210px;
  }

  header nav ul {
    flex-direction: row;
    align-items: center;
    gap: 10px;
    padding: 8px;
  }

  .hero h1 {
    font-size: 2rem;
  }

  .hero p {
    font-size: 1rem;
  }

  .white-box {
    padding: 20px 15px;
  }

  .button {
    width: 90%;
    display: block;
    margin: 10px auto;
  }

  .header-btn {
    padding: 8px 12px;
    font-size: .9rem;
    border-radius: 8px;
  }

  .header-btn .icon-circle {
    width: 26px;
    height: 26px;
    min-width: 26px;
  }

  .ad-title {
    font-size: 20px;
    padding: 0 6px;
    white-space: normal;
    text-wrap: balance;
  }

  .ad-title-wrapper { margin-bottom: 18px; padding-inline: 12px; }
}


