/* Optimized CSS for Synergic Swift Publication */

:root {
  color-scheme: light;
  --brand-primary: #2c3e50;
  --brand-accent: #c8a97e;
  --brand-cream: #fcfaf8;
}

/* Performance optimizations */
* {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* GPU acceleration for animations */
.book-spine,
.book-card,
.related-card,
.policy-card {
  will-change: transform;
  transform: translateZ(0);
}

body {
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--brand-cream);
  color: #333;
  line-height: 1.6;
}

a {
  color: inherit;
  text-decoration: none;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--brand-accent);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -100px;
  background-color: var(--brand-primary);
  color: #fff;
  padding: 0.5rem 1rem;
  z-index: 100;
  border-radius: 4px;
  transition: top 0.2s ease-in-out;
}

.skip-link:focus {
  top: 1rem;
}

.cormorant {
  font-family: 'Cormorant Garamond', 'Times New Roman', serif;
}

.icon-button {
  background: none;
  border: 0;
  cursor: pointer;
  padding: 0;
}

.icon-button:focus-visible {
  outline: 2px solid var(--brand-accent);
  outline-offset: 2px;
}

.nav-link {
  position: relative;
  transition: color 0.2s ease-in-out;
}

.nav-link::after {
  content: '';
  position: absolute;
  width: 0;
  height: 2px;
  bottom: -2px;
  left: 0;
  background-color: var(--brand-accent);
  transition: width 0.3s ease;
}

.nav-link:hover::after,
.nav-link[aria-current='page']::after {
  width: 100%;
}

.book-card,
.related-card,
.policy-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.book-card:hover,
.related-card:hover,
.policy-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.hero-pattern {
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23c8a97e' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.banner-slide {
  animation: slide 20s linear infinite;
}

@keyframes slide {
  0% {
    transform: translateX(0);
  }

  100% {
    transform: translateX(-50%);
  }
}

.search-highlight {
  outline: 2px solid var(--brand-accent);
  outline-offset: 4px;
}

.book-spine {
  position: relative;
  height: 280px;
  width: 40px;
  background: linear-gradient(90deg, var(--brand-accent) 0%, #e2d2b8 100%);
  transform: perspective(500px) rotateY(25deg);
  transform-origin: left;
  box-shadow: 5px 5px 15px rgba(0, 0, 0, 0.2);
  transition: transform 0.3s ease;
}

.book-spine:hover {
  transform: perspective(500px) rotateY(15deg);
}

.book-spine-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-90deg);
  white-space: nowrap;
  color: #fff;
  font-weight: 600;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
  width: 250px;
  text-align: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(200, 169, 126, 0.12);
  color: var(--brand-accent);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.75rem;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.book-cover-art {
  border: 1px solid rgba(255, 255, 255, 0.35);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  color: #fff;
  padding: 2.5rem 1.5rem;
  min-height: 380px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
}

.related-card {
  border: 1px solid #e2d2b8;
  background-color: #fff;
  padding: 1.5rem;
}

.policy-card {
  border: 1px solid rgba(44, 62, 80, 0.08);
  background-color: #fff;
  padding: 1.75rem;
  border-radius: 12px;
}

.mobile-menu {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(44, 62, 80, 0.98);
  z-index: 50;
  padding: 2rem;
  overflow-y: auto;
}

.mobile-menu.active {
  display: block;
}

.mobile-menu[aria-hidden='true'] {
  display: none;
}

.book-cover-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
  .icon-button,
  button,
  a {
    min-height: 44px;
    min-width: 44px;
  }
}

/* Tablet styles */
@media (max-width: 1024px) {
  .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .hero-pattern {
    padding: 2rem 0;
  }
}

/* Mobile styles */
@media (max-width: 768px) {
  .book-card,
  .policy-card,
  .related-card {
    min-height: 100%;
  }

  .book-spine {
    height: 200px;
    width: 30px;
  }

  .book-spine-text {
    width: 180px;
    font-size: 0.9rem;
  }

  /* Better mobile navigation */
  .nav-link {
    padding: 0.75rem 1rem;
    display: block;
  }

  /* Mobile typography improvements */
  h1 {
    font-size: 2rem !important;
    line-height: 1.2;
  }

  h2 {
    font-size: 1.75rem !important;
  }

  /* Mobile spacing */
  section {
    padding-top: 2rem;
    padding-bottom: 2rem;
  }
}

@media (max-width: 640px) {
  .book-spine-container {
    transform: scale(0.8);
    transform-origin: center left;
  }

  /* Extra small mobile improvements */
  .container {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  /* Stack content vertically on very small screens */
  .grid {
    gap: 1rem !important;
  }
}

/* Landscape mobile */
@media (max-width: 900px) and (orientation: landscape) {
  .hero-pattern {
    padding: 1rem 0;
  }
}

/* Additional performance optimizations */
img {
  max-width: 100%;
  height: auto;
}

/* Critical loading performance */
.lazyload {
  opacity: 0;
  transition: opacity 0.3s;
}

.lazyloaded {
  opacity: 1;
}

/* Focus management for accessibility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Mobile usability enhancements */
body {
  -webkit-text-size-adjust: 100%;
}

img,
svg,
video {
  max-width: 100%;
  height: auto;
}

@media (max-width: 640px) {
  html,
  body {
    overflow-x: hidden;
  }

  button,
  .nav-link,
  .mobile-nav-link,
  .icon-button,
  .skip-link,
  a[role='button'] {
    min-height: 44px;
    min-width: 44px;
  }

  input,
  select,
  textarea {
    font-size: 16px;
  }

}
