/* ==========================================================================
   Loable Books - Core Design System
   Cinematic Noir Literary Aesthetic
   ========================================================================== */

/* --------------------------------------------------------------------------
   CSS Custom Properties
   -------------------------------------------------------------------------- */
:root {
  /* Dark cinematic palette */
  --color-bg: #0B0A0F;
  --color-bg-elevated: #13121A;
  --color-bg-card: #1A1924;
  --color-bg-hover: #222133;
  --color-surface: #1E1D2B;
  --color-surface-light: #2A2940;

  /* Warm gold accent system */
  --color-accent: #C8A24E;
  --color-accent-light: #DABB6A;
  --color-accent-glow: rgba(200, 162, 78, 0.15);
  --color-accent-dim: #8B7235;

  /* Text hierarchy */
  --color-text: #E8E6EF;
  --color-text-secondary: #9D9BAE;
  --color-text-muted: #6B697D;
  --color-text-bright: #FFFFFF;

  /* Borders & separators */
  --color-border: rgba(255, 255, 255, 0.06);
  --color-border-accent: rgba(200, 162, 78, 0.2);

  /* On-accent (text on accent backgrounds) */
  --color-on-accent: #0B0A0F;

  /* Header backgrounds */
  --color-header-bg: rgba(11, 10, 15, 0.85);
  --color-header-bg-scrolled: rgba(11, 10, 15, 0.95);

  /* Functional */
  --color-success: #4ADE80;
  --color-danger: #F87171;

  /* Typography */
  --font-display: 'Cormorant Garamond', 'Georgia', serif;
  --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 2rem;
  --font-size-4xl: 2.75rem;
  --font-size-5xl: 3.5rem;
  --font-size-6xl: 4.5rem;
  --font-size-hero: 6rem;

  --line-height-tight: 1.1;
  --line-height-snug: 1.3;
  --line-height-base: 1.65;
  --line-height-relaxed: 1.8;

  --letter-spacing-tight: -0.02em;
  --letter-spacing-wide: 0.08em;
  --letter-spacing-wider: 0.15em;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  --space-32: 8rem;
  --space-40: 10rem;

  /* Layout */
  --max-width: 1280px;
  --max-width-narrow: 720px;
  --max-width-wide: 1440px;

  /* Shadows - dramatic */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.6);
  --shadow-xl: 0 24px 64px rgba(0, 0, 0, 0.7);
  --shadow-glow: 0 0 40px rgba(200, 162, 78, 0.1);
  --shadow-cover: 0 8px 32px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.05);

  /* Border Radius */
  --radius-sm: 0.25rem;
  --radius: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-dramatic: 600ms cubic-bezier(0.16, 1, 0.3, 1);

  /* Z-index */
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-modal: 300;
  --z-overlay: 400;
}

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

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

body {
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

::selection {
  background: rgba(200, 162, 78, 0.3);
  color: var(--color-text-bright);
}

/* --------------------------------------------------------------------------
   Typography
   -------------------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: var(--line-height-tight);
  color: var(--color-text-bright);
}

h1 {
  font-size: var(--font-size-5xl);
  letter-spacing: var(--letter-spacing-tight);
  margin-bottom: var(--space-6);
}

h2 {
  font-size: var(--font-size-4xl);
  letter-spacing: var(--letter-spacing-tight);
  margin-bottom: var(--space-5);
}

h3 {
  font-size: var(--font-size-2xl);
  margin-bottom: var(--space-4);
}

h4 {
  font-size: var(--font-size-xl);
  margin-bottom: var(--space-3);
}

p {
  margin-bottom: var(--space-4);
  color: var(--color-text-secondary);
}

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-accent-light);
}

strong, b {
  font-weight: 600;
  color: var(--color-text-bright);
}

em, i {
  font-style: italic;
}

small {
  font-size: var(--font-size-sm);
}

blockquote {
  position: relative;
  border-left: 2px solid var(--color-accent);
  padding: var(--space-6) var(--space-8);
  margin: var(--space-8) 0;
  background: var(--color-accent-glow);
  border-radius: 0 var(--radius) var(--radius) 0;
}

blockquote p {
  font-family: var(--font-display);
  font-size: var(--font-size-xl);
  font-style: italic;
  color: var(--color-text);
  line-height: var(--line-height-snug);
  margin: 0;
}

/* Quote hero (large centered blockquote) */
.quote-hero {
  border: none;
  background: none;
  padding: 0;
  margin: 0;
}

.quote-hero p {
  font-family: var(--font-display);
  font-size: var(--font-size-xl);
  font-weight: 300;
  font-style: italic;
  color: var(--color-text);
  line-height: 1.4;
  margin-bottom: var(--space-6);
}

@media (min-width: 640px) {
  .quote-hero p {
    font-size: var(--font-size-2xl);
  }
}

@media (min-width: 768px) {
  .quote-hero p {
    font-size: var(--font-size-3xl);
  }
}

/* --------------------------------------------------------------------------
   Layout
   -------------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.container-narrow {
  max-width: var(--max-width-narrow);
}

.container-wide {
  max-width: var(--max-width-wide);
}

.section {
  padding: var(--space-20) 0;
}

.section-sm {
  padding: var(--space-12) 0;
}

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

/* --------------------------------------------------------------------------
   Grid
   -------------------------------------------------------------------------- */
.grid {
  display: grid;
  gap: var(--space-6);
}

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

/* --------------------------------------------------------------------------
   Flex Utilities
   -------------------------------------------------------------------------- */
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

/* --------------------------------------------------------------------------
   Text Utilities
   -------------------------------------------------------------------------- */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-sm { font-size: var(--font-size-sm); }
.text-lg { font-size: var(--font-size-lg); }
.text-xl { font-size: var(--font-size-xl); }
.text-muted { color: var(--color-text-muted); }
.text-secondary { color: var(--color-text-secondary); }
.text-accent { color: var(--color-accent); }
.text-bright { color: var(--color-text-bright); }

.label {
  font-family: var(--font-body);
  font-size: var(--font-size-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wider);
  color: var(--color-accent);
}

/* --------------------------------------------------------------------------
   Spacing Utilities
   -------------------------------------------------------------------------- */
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }
.mb-12 { margin-bottom: var(--space-12); }
.my-4 { margin-top: var(--space-4); margin-bottom: var(--space-4); }
.pt-6 { padding-top: var(--space-6); }
.pb-6 { padding-bottom: var(--space-6); }

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

/* --------------------------------------------------------------------------
   Lists
   -------------------------------------------------------------------------- */
ul, ol {
  padding-left: var(--space-6);
  margin-bottom: var(--space-4);
  color: var(--color-text-secondary);
}

li {
  margin-bottom: var(--space-2);
}

.list-none {
  list-style: none;
  padding-left: 0;
}

/* --------------------------------------------------------------------------
   Divider
   -------------------------------------------------------------------------- */
.divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--color-border), transparent);
  margin: var(--space-8) 0;
}

/* --------------------------------------------------------------------------
   Noise texture overlay (applied via pseudo-element)
   -------------------------------------------------------------------------- */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

/* --------------------------------------------------------------------------
   Scroll Reveal Animations
   -------------------------------------------------------------------------- */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }

/* --------------------------------------------------------------------------
   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;
}

.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  background: var(--color-accent);
  color: var(--color-on-accent);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius);
  z-index: var(--z-overlay);
  font-weight: 600;
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: var(--space-4);
  color: var(--color-on-accent);
}

/* --------------------------------------------------------------------------
   Light Theme
   -------------------------------------------------------------------------- */
[data-theme="light"] {
  /* Warm parchment palette */
  --color-bg: #F7F4ED;
  --color-bg-elevated: #FFFFFF;
  --color-bg-card: #FFFFFF;
  --color-bg-hover: #EFEBE2;
  --color-surface: #F0ECE3;
  --color-surface-light: #E8E3D9;

  /* Deeper gold for light-bg contrast */
  --color-accent: #9B7B2C;
  --color-accent-light: #B8922E;
  --color-accent-glow: rgba(155, 123, 44, 0.08);
  --color-accent-dim: #7A6223;

  /* Warm dark text */
  --color-text: #3A3845;
  --color-text-secondary: #5C5968;
  --color-text-muted: #8C8999;
  --color-text-bright: #1A1820;

  /* Borders */
  --color-border: rgba(0, 0, 0, 0.08);
  --color-border-accent: rgba(155, 123, 44, 0.2);

  /* On-accent */
  --color-on-accent: #FFFFFF;

  /* Header backgrounds */
  --color-header-bg: rgba(247, 244, 237, 0.88);
  --color-header-bg-scrolled: rgba(247, 244, 237, 0.96);

  /* Functional */
  --color-success: #16A34A;
  --color-danger: #DC2626;

  /* Softer shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.08);
  --shadow-xl: 0 24px 64px rgba(0, 0, 0, 0.1);
  --shadow-glow: 0 0 40px rgba(155, 123, 44, 0.06);
  --shadow-cover: 0 8px 32px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] ::selection {
  background: rgba(155, 123, 44, 0.2);
  color: var(--color-text-bright);
}

[data-theme="light"] body::before {
  opacity: 0.018;
}
