/* CSS Reset and Variables */
:root {
  /* Elegant Color Palette */
  --hue: 30;
  --primary: hsl(var(--hue), 90%, 45%);        /* Deep rich orange/gold */
  --primary-hover: hsl(var(--hue), 90%, 35%);
  --primary-foreground: #ffffff;
  
  --background: hsl(0, 0%, 98%);
  --foreground: hsl(0, 0%, 9%);
  
  --card: #ffffff;
  --card-foreground: hsl(0, 0%, 9%);
  
  --muted: hsl(0, 0%, 96%);
  --muted-foreground: hsl(0, 0%, 45%);
  
  --accent: hsl(var(--hue), 20%, 95%);
  --accent-foreground: hsl(var(--hue), 90%, 25%);
  
  --border: hsl(0, 0%, 90%);
  --ring: hsla(var(--hue), 90%, 45%, 0.3);

  --radius: 12px;
  
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-headline: 'Literata', serif;
  
  /* Layout */
  --header-height: 4rem;
  --container-max: 1280px;
  
  /* Shadow & Glow */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --glow: 0 0 20px hsla(var(--hue), 90%, 45%, 0.4);
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: hsl(0, 0%, 4%);
    --foreground: hsl(0, 0%, 98%);
    
    --card: hsl(0, 0%, 6%);
    --card-foreground: hsl(0, 0%, 98%);
    
    --muted: hsl(0, 0%, 12%);
    --muted-foreground: hsl(0, 0%, 65%);
    
    --accent: hsl(var(--hue), 30%, 15%);
    --accent-foreground: hsl(var(--hue), 90%, 65%);
    
    --border: hsl(0, 0%, 15%);
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.5), 0 4px 6px -4px rgb(0 0 0 / 0.5);
  }
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  background-color: var(--background);
  color: var(--foreground);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4, .font-headline {
  font-family: var(--font-headline);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

a {
  text-decoration: none;
  color: inherit;
  transition: all 0.2s ease;
}

img {
  max-width: 100%;
  display: block;
}

/* Layout Utilities */
.app-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.main-content {
  flex: 1;
}

.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Base Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: calc(var(--radius) - 4px);
  border: none;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
}

.btn:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

.btn-primary {
  background-color: var(--primary);
  color: var(--primary-foreground);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.1);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  box-shadow: var(--glow);
  transform: translateY(-1px);
}

.btn-outline {
  background-color: transparent;
  border: 1px solid var(--border);
  color: var(--foreground);
}

.btn-outline:hover {
  background-color: var(--accent);
  color: var(--accent-foreground);
  border-color: var(--accent);
}

.btn-ghost {
  background-color: transparent;
  color: var(--foreground);
}

.btn-ghost:hover {
  background-color: var(--accent);
  color: var(--accent-foreground);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: calc(var(--radius) - 4px);
  color: var(--foreground);
  transition: all 0.2s;
}

.icon-btn:hover {
  background-color: var(--accent);
  color: var(--accent-foreground);
}

.btn-icon, .link-icon {
  transition: transform 0.2s;
}

.btn:hover .btn-icon, .btn-link:hover .link-icon {
  transform: translateX(4px);
}

.btn-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  color: var(--primary);
  text-underline-offset: 4px;
}
.btn-link:hover {
  text-decoration: underline;
}

/* Header & Nav */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  width: 100%;
  border-bottom: 1px solid var(--border);
  background-color: hsla(var(--hue), 0%, 98%, 0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

@media (prefers-color-scheme: dark) {
  .header {
    background-color: hsla(0, 0%, 4%, 0.7);
  }
}

.header-container {
  display: flex;
  height: var(--header-height);
  align-items: center;
  justify-content: space-between;
}

.logo-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo-image {
  display: block;
  max-height: 48px;
  width: auto;
}

.header .logo-link {
  pointer-events: none;
  cursor: default;
}

.logo-icon {
  color: var(--primary);
}

.logo-text {
  font-family: var(--font-headline);
  font-weight: 700;
  font-size: 1.25rem;
  display: none;
}

@media (min-width: 640px) {
  .logo-text { display: block; }
}

.desktop-nav {
  display: none;
  align-items: center;
  gap: 1.5rem;
  margin-left: 2rem;
  margin-right: auto;
}

@media (max-width: 767px) {
  .desktop-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    gap: 0.75rem;
    margin: 0;
    padding: 1rem 1.25rem 1.25rem;
    background-color: hsla(var(--hue), 0%, 98%, 0.98);
    border-bottom: 1px solid var(--border);
    z-index: 40;
  }

  .desktop-nav.mobile-open {
    display: flex;
  }

  .desktop-nav .nav-link {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
  }

  .desktop-nav .nav-link:hover {
    background-color: hsla(var(--hue), 0%, 90%, 0.5);
  }

  .header-container {
    align-items: center;
  }

  .mobile-menu-btn {
    z-index: 50;
  }
}

@media (min-width: 768px) {
  .desktop-nav { display: flex; }
}

.nav-link {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted-foreground);
  position: relative;
}

.nav-link:hover {
  color: var(--foreground);
}

.nav-link.active {
  color: var(--foreground);
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: var(--primary);
  border-radius: 2px;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.mobile-menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--foreground);
  width: 2.5rem;
  height: 2.5rem;
  border-radius: calc(var(--radius) - 4px);
  cursor: pointer;
}

@media (min-width: 768px) {
  .mobile-menu-btn { display: none; }
}

.action-buttons {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.cart-btn {
  position: relative;
}

.cart-badge {
  position: absolute;
  top: 0;
  right: 0;
  background: var(--primary);
  color: var(--primary-foreground);
  font-size: 0.65rem;
  font-weight: 600;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Sections */
.hero-section {
  position: relative;
  overflow: hidden;
  padding: 5rem 0;
  background: linear-gradient(135deg, var(--accent) 0%, var(--background) 100%);
}

@media (min-width: 768px) {
  .hero-section { padding: 8rem 0; }
}

.hero-bg-gradient {
  position: absolute;
  top: -20%;
  left: -10%;
  width: 50%;
  height: 80%;
  background: radial-gradient(circle, hsla(var(--hue), 90%, 50%, 0.08) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.hero-container {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr;
  gap: 3rem;
  align-items: center;
}

@media (min-width: 768px) {
  .hero-container {
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
  }
}

.hero-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.5rem;
}

.hero-title {
  color: var(--primary);
  font-size: clamp(2.5rem, 5vw, 4.5rem);
  line-height: 1.1;
  text-wrap: balance;
}

.hero-subtitle {
  font-size: clamp(1.125rem, 2vw, 1.25rem);
  color: var(--muted-foreground);
  max-width: 36rem;
}

.hero-btn {
  padding: 0.75rem 2rem;
  font-size: 1rem;
}

.hero-visual {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

.hero-logo {
  position: relative;
  width: 480px;
  height: auto;
  opacity: 0.95;
  z-index: 1;
  pointer-events: none;
}

.glass-orb {
  position: absolute;
  width: 240px;
  height: 240px;
  background: linear-gradient(135deg, hsla(var(--hue), 90%, 50%, 0.2), hsla(var(--hue), 90%, 50%, 0.05));
  border-radius: 50%;
  filter: blur(20px);
  z-index: 0;
  animation: float 6s ease-in-out infinite alternate;
}

.hero-icon {
  width: 12rem;
  height: 12rem;
  color: var(--primary);
  opacity: 0.15;
  z-index: 1;
}

@media (min-width: 768px) {
  .hero-icon {
    width: 16rem;
    height: 16rem;
  }
  .glass-orb { width: 320px; height: 320px; }
}

/* Animations */
@keyframes float {
  0% { transform: translateY(0px) scale(1); }
  100% { transform: translateY(-20px) scale(1.05); }
}

.reveal-up {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.8s cubic-bezier(0.5, 0, 0, 1);
}

.reveal-right {
  opacity: 0;
  transform: translateX(-30px);
  transition: all 0.8s cubic-bezier(0.5, 0, 0, 1);
}

.reveal-up.active, .reveal-right.active {
  opacity: 1;
  transform: translateY(0) translateX(0);
}

/* Featured Books Section */
.featured-section {
  padding: 4rem 0;
}

@media (min-width: 768px) {
  .featured-section { padding: 6rem 0; }
}

.section-header {
  text-align: center;
  margin-bottom: 3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.section-title {
  font-size: clamp(2rem, 3vw, 3rem);
  margin-bottom: 1rem;
}

.section-subtitle {
  color: var(--muted-foreground);
  font-size: 1.125rem;
  max-width: 42rem;
}

.books-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 640px) {
  .books-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
  .books-grid { grid-template-columns: repeat(3, 1fr); gap: 2rem; }
}

@media (min-width: 1280px) {
  /* Only 3 books in original design, so 3 columns max is good, or 4 if there are 4 */
  .books-grid { grid-template-columns: repeat(3, 1fr); }
}

.book-card {
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-sm);
}

.book-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}

.book-cover-container {
  position: relative;
  width: 100%;
  height: 280px;
  overflow: hidden;
  background: var(--muted);
}

.book-cover {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.5s ease;
}

.book-card:hover .book-cover {
  transform: scale(1.05);
}

.book-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.5) 0%, transparent 40%);
  opacity: 0;
  transition: opacity 0.3s;
}
.book-card:hover .book-overlay {
  opacity: 1;
}

.book-badge {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: var(--background);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  z-index: 10;
}

.book-info {
  padding: 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.book-title {
  font-size: 1.25rem;
}

.book-desc {
  color: var(--muted-foreground);
  font-size: 0.875rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.book-footer {
  padding: 0 1.5rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.book-price {
  background: var(--accent);
  color: var(--accent-foreground);
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 1.125rem;
}

/* About Author */
.about-section {
  padding: 4rem 0;
  background-color: var(--accent);
}

@media (min-width: 768px) {
  .about-section { padding: 6rem 0; }
}

.about-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3rem;
  align-items: center;
}

@media (min-width: 768px) {
  .about-grid {
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
  }
}

.about-image-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

@media (min-width: 768px) {
  .about-image-wrapper {
    height: 480px;
    aspect-ratio: auto;
  }
}

.about-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.about-image-decor {
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 0 1px hsla(0,0%,100%,0.1);
  border-radius: var(--radius);
  pointer-events: none;
}

.about-content {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  align-items: flex-start;
}

.about-text {
  color: var(--muted-foreground);
  font-size: 1.125rem;
}

/* Footer */
.footer {
  border-top: 1px solid var(--border);
  background-color: var(--background);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3rem;
  padding: 3rem 0;
}

@media (min-width: 768px) {
  .footer-grid {
    grid-template-columns: 1fr 2fr;
  }
}

.footer-brand {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.footer-desc {
  color: var(--muted-foreground);
}

.newsletter-title {
  font-size: 1.25rem;
  font-family: var(--font-headline);
  margin-bottom: 0.5rem;
}

.newsletter-desc {
  color: var(--muted-foreground);
  margin-bottom: 1rem;
}

.newsletter-form {
  display: flex;
  flex-direction: column;
  max-width: 28rem;
  gap: 0.5rem;
}

@media (min-width: 480px) {
  .newsletter-form {
    flex-direction: row;
  }
}

.input-field {
  flex: 1;
  height: 2.5rem;
  border-radius: calc(var(--radius) - 4px);
  border: 1px solid var(--border);
  background: var(--background);
  padding: 0 0.75rem;
  font-size: 1rem;
  font-family: inherit;
  color: var(--foreground);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input-field::placeholder {
  color: var(--muted-foreground);
}

.input-field:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--ring);
}

.footer-bottom {
  border-top: 1px solid var(--border);
  background-color: var(--muted);
}

.footer-bottom-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem;
}

@media (min-width: 768px) {
  .footer-bottom-container {
    flex-direction: row;
  }
}

.copyright {
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

.social-links {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.social-links a {
  color: var(--muted-foreground);
  transition: transform 0.2s, color 0.2s;
}

.social-links a:hover {
  color: var(--foreground);
  transform: translateY(-2px);
}

/* E-commerce Styles */
.form-group {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--foreground);
}

.form-control {
  width: 100%;
  height: 2.75rem;
  padding: 0 0.75rem;
  border-radius: calc(var(--radius) - 4px);
  border: 1px solid var(--border);
  background-color: var(--background);
  color: var(--foreground);
  font-family: inherit;
  transition: all 0.2s;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--ring);
}

.cart-item {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border);
}

.cart-item:last-child {
  border-bottom: none;
}

.cart-item-image {
  width: 80px;
  height: 100px;
  object-fit: contain;
  border-radius: calc(var(--radius) / 2);
}

.cart-item-details {
  flex: 1;
}

.cart-item-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.cart-item-price {
  color: var(--muted-foreground);
}

.cart-item-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.qty-btn {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--background);
  color: var(--foreground);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.qty-btn:hover {
  background: var(--accent);
}

.summary-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
}

.summary-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 1rem;
  color: var(--muted-foreground);
}

.summary-total {
  display: flex;
  justify-content: space-between;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--foreground);
}

.payment-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.payment-modal.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--card);
  padding: 3rem;
  border-radius: var(--radius);
  text-align: center;
  max-width: 400px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  transform: scale(0.9);
  transition: transform 0.3s;
}

.payment-modal.open .modal-content {
  transform: scale(1);
}

.success-icon {
  color: hsl(142.1 76.2% 36.3%);
  width: 4rem;
  height: 4rem;
  margin: 0 auto 1.5rem;
}
