/* ==========================================================================
   willfreee — CSS Design System & Stylesheet
   Palette: Deep Navy (#0A2540), Cyan Teal (#008A96), Warm Gold (#E5A93C)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Theme Variables & Base Setup
   -------------------------------------------------------------------------- */
:root,
html[data-theme="light"] {
  --brand-navy: #0A2540;
  --brand-teal: #008A96;
  --brand-gold: #E5A93C;

  /* Surface & Backgrounds */
  --bg-main: #F8FAFC;
  --bg-card: #FFFFFF;
  --bg-header: rgba(255, 255, 255, 0.85);
  --bg-button-hover: #F1F5F9;

  /* Typography */
  --text-primary: #0A2540;
  --text-secondary: #475569;
  --text-muted: #64748B;

  /* Borders & Shadows */
  --border-color: #E2E8F0;
  --border-hover: #008A96;
  --shadow-sm: 0 1px 3px rgba(10, 37, 64, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(10, 37, 64, 0.06), 0 2px 4px -2px rgba(10, 37, 64, 0.04);
  --shadow-hover: 0 12px 20px -3px rgba(0, 138, 150, 0.12), 0 4px 6px -2px rgba(10, 37, 64, 0.05);
}

html[data-theme="dark"] {
  --brand-navy: #38BDF8; /* Lighter accent for high dark mode contrast */
  --brand-teal: #14B8A6;
  --brand-gold: #FBBF24;

  /* Surface & Backgrounds */
  --bg-main: #0F172A;
  --bg-card: #1E293B;
  --bg-header: rgba(15, 23, 42, 0.85);
  --bg-button-hover: #334155;

  /* Typography */
  --text-primary: #F8FAFC;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;

  /* Borders & Shadows */
  --border-color: #334155;
  --border-hover: #14B8A6;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  --shadow-hover: 0 12px 24px -4px rgba(20, 184, 166, 0.2);
}

/* Reset & Layout Core */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  background-color: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.25s ease, color 0.25s ease;
  -webkit-font-smoothing: antialiased;
}

.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* --------------------------------------------------------------------------
   2. Header & Navigation
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--bg-header);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 4.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-logo {
  border-radius: 6px;
  object-fit: contain;
}

.brand-name {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: -0.025em;
}

.brand-name span {
  color: var(--brand-teal);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn-github {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 0.9rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  background-color: transparent;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  text-decoration: none;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.btn-github:hover {
  background-color: var(--bg-button-hover);
  border-color: var(--brand-teal);
}

.theme-toggle-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.45rem 0.65rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: var(--text-primary);
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.theme-toggle-btn:hover {
  background-color: var(--bg-button-hover);
  border-color: var(--brand-teal);
}

/* --------------------------------------------------------------------------
   3. Main Content & Hero Section
   -------------------------------------------------------------------------- */
.site-main {
  flex: 1;
  padding-bottom: 5rem;
}

.hero-section {
  padding: 4.5rem 0 3rem;
  text-align: center;
}

.hero-title {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
  letter-spacing: -0.03em;
  margin-bottom: 1.25rem;
}

.hero-description {
  max-width: 720px;
  margin: 0 auto;
  font-size: 1.125rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* --------------------------------------------------------------------------
   4. Book Grid & Cards
   -------------------------------------------------------------------------- */
.catalog-section {
  padding-top: 1rem;
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

/* Replace Section 4 (.book-card styles) in style.css */
.book-card {
  display: flex;
  flex-direction: column;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.75rem;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
}

.book-card:hover {
  box-shadow: var(--shadow-md);
}

.book-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.35;
  margin-bottom: 0.75rem;
}

.book-tagline {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

.book-tagline {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

/* --------------------------------------------------------------------------
   5. Footer
   -------------------------------------------------------------------------- */
.site-footer {
  background-color: var(--bg-card);
  border-top: 1px solid var(--border-color);
  padding: 2.5rem 0;
  margin-top: auto;
  font-size: 0.9rem;
  color: var(--text-muted);
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

.footer-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  text-align: center;
}

.site-footer a {
  color: var(--text-secondary);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.2s ease;
}

.site-footer a:hover {
  color: var(--brand-teal);
}

.footer-links {
  font-size: 0.875rem;
}

/* --------------------------------------------------------------------------
   6. Responsive Adjustments
   -------------------------------------------------------------------------- */
@media (max-width: 640px) {
  .hero-section {
    padding: 3rem 0 2rem;
  }

  .book-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .book-card {
    padding: 1.25rem;
  }
}