/* Jiffy Day Author Website - Modern Responsive Styles */
/* Performance optimized for Cloudflare Pages */

:root {
  --color-primary: #1a365d;
  --color-secondary: #2d5a87;
  --color-accent: #c9a227;
  --color-text: #1a1a1a;
  --color-text-light: #4a5568;
  --color-bg: #ffffff;
  --color-bg-alt: #f7f9fc;
  --color-border: #e2e8f0;
  --font-heading: 'Georgia', 'Times New Roman', serif;
  --font-body: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --max-width: 1200px;
  --spacing-xs: 0.5rem;
  --spacing-sm: 1rem;
  --spacing-md: 2rem;
  --spacing-lg: 3rem;
  --spacing-xl: 4rem;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--color-text);
  background-color: var(--color-bg);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--color-secondary);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--color-primary);
}

/* Focus styles for accessibility */
a:focus,
button:focus,
input:focus,
textarea:focus,
select:focus {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}

a:focus:not(:focus-visible),
button:focus:not(:focus-visible) {
  outline: none;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  color: var(--color-primary);
  line-height: 1.3;
  margin: 0 0 var(--spacing-sm);
}

h1 { font-size: clamp(2rem, 5vw, 3rem); }
h2 { font-size: clamp(1.5rem, 4vw, 2.25rem); }
h3 { font-size: clamp(1.25rem, 3vw, 1.5rem); }

p {
  margin: 0 0 var(--spacing-sm);
}

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--spacing-sm);
}

/* Skip to content link for accessibility */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--color-primary);
  color: #fff;
  padding: 8px 16px;
  z-index: 1000;
  transition: top 0.3s;
}

.skip-link:focus {
  top: 0;
}

/* Header & Navigation */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-bg);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-sm) 0;
}

.site-logo {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-primary);
  letter-spacing: 0.02em;
}

.site-logo:hover {
  color: var(--color-secondary);
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--spacing-xs);
}

.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--color-primary);
  margin: 5px 0;
  transition: transform 0.3s, opacity 0.3s;
}

.nav-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.nav-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

.main-nav ul {
  display: flex;
  gap: var(--spacing-md);
  list-style: none;
  margin: 0;
  padding: 0;
}

.main-nav a {
  display: block;
  padding: var(--spacing-xs) 0;
  font-weight: 500;
  color: var(--color-text);
  border-bottom: 2px solid transparent;
  transition: border-color 0.2s, color 0.2s;
}

.main-nav a:hover,
.main-nav a[aria-current="page"] {
  color: var(--color-primary);
  border-bottom-color: var(--color-accent);
}

/* Hero Section */
.hero {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
  color: #fff;
  padding: var(--spacing-xl) 0;
  text-align: center;
}

.hero h1 {
  color: #fff;
  margin-bottom: var(--spacing-sm);
}

.hero-subtitle {
  font-size: 1.25rem;
  opacity: 0.9;
  max-width: 600px;
  margin: 0 auto var(--spacing-md);
}

.hero-image {
  max-width: 800px;
  margin: var(--spacing-md) auto 0;
}

.hero-image img {
  width: 100%;
  border-radius: 8px;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.875rem 2rem;
  font-weight: 600;
  text-align: center;
  border-radius: 4px;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
  cursor: pointer;
  border: none;
}

.btn-primary {
  background: var(--color-accent);
  color: var(--color-primary);
}

.btn-primary:hover {
  background: #d4af37;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  color: var(--color-primary);
}

.btn-secondary {
  background: transparent;
  color: #fff;
  border: 2px solid #fff;
}

.btn-secondary:hover {
  background: #fff;
  color: var(--color-primary);
}

.btn-amazon {
  background: #ff9900;
  color: #111;
}

.btn-amazon:hover {
  background: #ffad33;
  color: #111;
}

/* Sections */
.section {
  padding: var(--spacing-xl) 0;
  position: relative;
}

.section-alt {
  background: var(--color-bg-alt);
}

.section-title {
  text-align: center;
  margin-bottom: var(--spacing-lg);
  position: relative;
}

/* Section title with decorative underline */
.section-title::after {
  content: '';
  display: block;
  width: 60px;
  height: 3px;
  background: var(--color-accent);
  margin: var(--spacing-sm) auto 0;
  border-radius: 2px;
}

/* Decorative section divider */
.section-divider {
  text-align: center;
  margin: var(--spacing-md) 0;
}

.section-divider::before {
  content: '***';
  letter-spacing: 0.5em;
  color: var(--color-accent);
  font-size: 1.25rem;
}

/* About Section */
.about-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--spacing-lg);
  align-items: center;
}

.about-image img {
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.about-content blockquote {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-style: italic;
  color: var(--color-text-light);
  border-left: 4px solid var(--color-accent);
  padding-left: var(--spacing-md);
  margin: var(--spacing-md) 0;
}

/* Books Grid */
.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--spacing-md);
}

.book-card {
  background: var(--color-bg);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
  transition: transform 0.3s, box-shadow 0.3s;
}

.book-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.12);
}

.book-cover {
  aspect-ratio: 2/3;
  overflow: hidden;
  background: var(--color-bg-alt);
}

.book-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.book-info {
  padding: var(--spacing-md);
}

.book-info h3 {
  margin-bottom: var(--spacing-xs);
}

.book-series {
  font-size: 0.875rem;
  color: var(--color-accent);
  font-weight: 600;
  margin-bottom: var(--spacing-xs);
}

.book-rating {
  color: #fbbf24;
  margin-bottom: var(--spacing-xs);
}

.book-description {
  font-size: 0.9375rem;
  color: var(--color-text-light);
  margin-bottom: var(--spacing-sm);
}

/* Featured Books (Homepage) */
.featured-books {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--spacing-md);
  margin-top: var(--spacing-md);
}

.featured-books img {
  border-radius: 4px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
  transition: transform 0.3s;
}

.featured-books a:hover img {
  transform: scale(1.05);
}

/* Video Section */
.video-container {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  max-width: 800px;
  margin: 0 auto;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.video-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* YouTube Lazy Load Facade */
.youtube-facade {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  background-color: #000;
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.youtube-facade::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.2);
  transition: background 0.3s;
}

.youtube-facade:hover::before,
.youtube-facade:focus::before {
  background: rgba(0, 0, 0, 0.1);
}

.youtube-facade .play-btn {
  position: relative;
  z-index: 1;
  width: 68px;
  height: 48px;
  background: #e62117;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, background 0.2s;
}

.youtube-facade:hover .play-btn,
.youtube-facade:focus .play-btn {
  background: #ff0000;
  transform: scale(1.1);
}

.youtube-facade .play-btn::after {
  content: '';
  border-style: solid;
  border-width: 10px 0 10px 18px;
  border-color: transparent transparent transparent #fff;
  margin-left: 4px;
}

.youtube-facade:focus {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}

/* Press/News Section */
.press-article {
  background: var(--color-bg);
  border-radius: 8px;
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-md);
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.press-article h3 {
  margin-bottom: var(--spacing-xs);
}

.press-meta {
  font-size: 0.875rem;
  color: var(--color-text-light);
  margin-bottom: var(--spacing-sm);
}

.press-image {
  float: right;
  max-width: 300px;
  margin: 0 0 var(--spacing-sm) var(--spacing-md);
  border-radius: 4px;
}

/* Contact Section */
.contact-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--spacing-md);
}

.contact-card {
  background: var(--color-bg);
  padding: var(--spacing-md);
  border-radius: 8px;
  text-align: center;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.contact-card svg {
  width: 48px;
  height: 48px;
  color: var(--color-accent);
  margin-bottom: var(--spacing-sm);
}

.social-links {
  display: flex;
  justify-content: center;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-md);
}

.social-links a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--color-bg-alt);
  color: var(--color-primary);
  transition: background 0.2s, color 0.2s, transform 0.2s;
}

.social-links a:hover {
  background: var(--color-primary);
  color: #fff;
  transform: translateY(-2px);
}

.social-links svg {
  width: 24px;
  height: 24px;
}

/* Footer */
.site-footer {
  background: var(--color-primary);
  color: #fff;
  padding: var(--spacing-lg) 0 var(--spacing-md);
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-md);
}

.footer-section h4 {
  color: var(--color-accent);
  margin-bottom: var(--spacing-sm);
}

.footer-section ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-section li {
  margin-bottom: var(--spacing-xs);
}

.footer-section a {
  color: rgba(255,255,255,0.9);
  text-decoration: underline;
  text-decoration-color: rgba(255,255,255,0.3);
  text-underline-offset: 2px;
}

.footer-section a:hover {
  color: #fff;
  text-decoration-color: var(--color-accent);
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding-top: var(--spacing-md);
  border-top: 1px solid rgba(255,255,255,0.2);
  font-size: 0.9375rem;
}

.footer-bottom p {
  margin: 0;
}

.footer-bottom a {
  color: rgba(255,255,255,0.9);
  text-decoration: underline;
  text-decoration-color: rgba(255,255,255,0.3);
}

.footer-bottom a:hover {
  color: #fff;
  text-decoration-color: var(--color-accent);
}

.footer-credit {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9375rem;
}

.footer-credit img {
  height: 32px;
  width: auto;
  filter: brightness(0) invert(1);
  opacity: 0.9;
  transition: opacity 0.2s;
}

.footer-credit a:hover img {
  opacity: 1;
}

@media (max-width: 600px) {
  .footer-bottom {
    flex-direction: column;
    text-align: center;
  }
}

/* Responsive Design */
@media (min-width: 768px) {
  .container {
    padding: 0 var(--spacing-md);
  }

  .about-grid {
    grid-template-columns: 1fr 1.5fr;
  }

  .featured-books {
    grid-template-columns: repeat(6, 1fr);
  }
}

@media (max-width: 767px) {
  .nav-toggle {
    display: block;
  }

  .main-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-bg);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    display: none;
  }

  .main-nav.is-open {
    display: block;
  }

  .main-nav ul {
    flex-direction: column;
    padding: var(--spacing-sm);
    gap: 0;
  }

  .main-nav a {
    padding: var(--spacing-sm);
    border-bottom: 1px solid var(--color-border);
  }

  .featured-books {
    grid-template-columns: repeat(2, 1fr);
  }

  .press-image {
    float: none;
    max-width: 100%;
    margin: 0 0 var(--spacing-sm) 0;
  }

  .hero {
    padding: var(--spacing-lg) 0;
  }

  .section {
    padding: var(--spacing-lg) 0;
  }
}

/* Print Styles */
@media print {
  .site-header,
  .nav-toggle,
  .btn,
  .social-links,
  .video-container {
    display: none;
  }

  body {
    font-size: 12pt;
    line-height: 1.5;
  }

  a {
    text-decoration: underline;
  }

  a[href^="http"]::after {
    content: " (" attr(href) ")";
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
  :root {
    --color-primary: #000;
    --color-secondary: #000;
    --color-text: #000;
    --color-bg: #fff;
    --color-border: #000;
  }

  .btn {
    border: 2px solid currentColor;
  }
}
