/* ==========================================================================
   BO2K — Design System & Editorial Variables
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Newsreader:ital,opsz,wght@0,6..72,300..700;1,6..72,300..700&family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

:root {
  /* Editorial Palette */
  --bg-primary: #F8F5EE;        /* Warm Ivory base */
  --bg-surface: #F2EDE2;        /* Paper surface elevation */
  --bg-surface-elevated: #ECE5D8; /* Slightly deeper card backing */
  --bg-tint-paper: #FBF9F4;      /* Pure book page highlight */

  --text-primary: #11110F;      /* Deep Ink */
  --text-secondary: #34332F;    /* Charcoal */
  --text-muted: #6B675E;        /* Warm Stone */
  --text-faint: #9A958A;        /* Faint Archive Numbers */

  --border-subtle: #D8D3C8;     /* Warm Gray hairline */
  --border-fine: rgba(52, 51, 47, 0.12);
  --border-strong: #11110F;

  /* Subtle Bookish Accents */
  --accent-leather: #8C4A2F;    /* Rich Bookcloth Russet */
  --accent-sage: #4E594D;       /* Archival Sage */
  --accent-ink: #1C232B;        /* Deep Midnight */

  /* Typography */
  --font-serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Geometry & Rhythm */
  --radius-sm: 2px;
  --radius-md: 4px;
  --radius-lg: 6px;
  --radius-pill: 9999px;

  /* Shadows (Subtle, physical book-like drop) */
  --shadow-subtle: 0 1px 3px rgba(17, 17, 15, 0.04), 0 4px 12px rgba(17, 17, 15, 0.03);
  --shadow-book: 2px 4px 16px rgba(17, 17, 15, 0.08), 0 1px 3px rgba(17, 17, 15, 0.06);
  --shadow-book-raised: 4px 10px 30px rgba(17, 17, 15, 0.12), 0 2px 6px rgba(17, 17, 15, 0.05);

  /* Transitions */
  --transition-fast: 160ms cubic-bezier(0.2, 0.0, 0.2, 1);
  --transition-normal: 260ms cubic-bezier(0.2, 0.0, 0.2, 1);
  --transition-smooth: 420ms cubic-bezier(0.16, 1, 0.3, 1);

  /* Mobile App Shell Specs */
  --header-height: 60px;
  --bottom-nav-height: 64px;
  --max-content-width: 1160px;
  --max-reading-width: 680px;
}

/* Reading Atmosphere Theme Variations */
[data-theme="sepia"] {
  --bg-primary: #F4EEDB;
  --bg-surface: #EBE3CE;
  --bg-surface-elevated: #DFD5BC;
  --bg-tint-paper: #F9F5EA;
  --text-primary: #2B2118;
  --text-secondary: #48392B;
  --text-muted: #756350;
  --border-subtle: #D1C4AA;
  --accent-leather: #9A5333;
}

[data-theme="midnight"] {
  --bg-primary: #12151B;
  --bg-surface: #181D26;
  --bg-surface-elevated: #222834;
  --bg-tint-paper: #1B212C;
  --text-primary: #F0F2F6;
  --text-secondary: #CBD2DE;
  --text-muted: #8491A5;
  --border-subtle: #2B3342;
  --border-fine: rgba(255, 255, 255, 0.08);
  --border-strong: #F0F2F6;
}

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

html {
  font-size: 16px;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
  font-family: var(--font-sans);
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  position: relative;
}

/* Subtle tactile paper texture overlay */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.018;
  z-index: 9999;
  background-image: radial-gradient(var(--text-primary) 1px, transparent 1px);
  background-size: 24px 24px;
}

/* Typography Presets */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  font-weight: 400;
  color: var(--text-primary);
  line-height: 1.18;
  letter-spacing: -0.015em;
}

p {
  color: var(--text-secondary);
}

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

button {
  font-family: var(--font-sans);
  border: none;
  background: transparent;
  cursor: pointer;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

input {
  font-family: var(--font-sans);
  border: none;
  outline: none;
  background: transparent;
}

/* Micro-editorial typographic utilities */
.font-serif {
  font-family: var(--font-serif);
}

.font-sans {
  font-family: var(--font-sans);
}

.meta-label {
  font-family: var(--font-sans);
  font-size: 0.6875rem; /* 11px */
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 600;
  color: var(--text-muted);
}

.section-divider {
  width: 100%;
  height: 1px;
  background-color: var(--border-subtle);
  margin: 3rem 0;
  border: none;
}

/* Subtle interactive button style */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background-color: var(--text-primary);
  color: var(--bg-primary);
  padding: 0.875rem 1.625rem;
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  border-radius: var(--radius-sm);
  transition: all var(--transition-normal);
}

.btn-primary:hover {
  background-color: #242422;
  transform: translateY(-1px);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background-color: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  padding: 0.875rem 1.625rem;
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  border-radius: var(--radius-sm);
  transition: all var(--transition-normal);
}

.btn-secondary:hover {
  border-color: var(--text-primary);
  background-color: rgba(52, 51, 47, 0.03);
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color var(--transition-fast);
}

.btn-ghost:hover {
  color: var(--text-primary);
}

/* Accessibility & Focus Rings */
:focus-visible {
  outline: 2px solid var(--text-primary);
  outline-offset: 2px;
}
