/* =========================================================
   Digital Read — Design System
   Fonts: Playfair Display (display) / Inter (body)
   Brand: deep navy + amber-gold
   ========================================================= */

:root {
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;

  --shadow-sm: 0 2px 8px rgba(10, 22, 40, 0.08);
  --shadow-md: 0 8px 24px rgba(10, 22, 40, 0.12);
  --shadow-lg: 0 16px 48px rgba(10, 22, 40, 0.18);

  --transition: 180ms ease;
}

/* ---------- Dark theme (default) ---------- */
:root,
[data-theme="dark"] {
  --bg: #0A1628;
  --bg-elevated: #101F38;
  --bg-card: #12213D;
  --bg-inset: #0D1A30;
  --border: rgba(232, 160, 32, 0.14);
  --border-soft: rgba(255, 255, 255, 0.08);

  --text-primary: #F4F1EA;
  --text-secondary: #A9B4C7;
  --text-muted: #6E7A90;

  --accent: #E8A020;
  --accent-hover: #F4B03A;
  --accent-text: #1A1206;

  --success: #4CAF7D;
  --danger: #E8615C;

  color-scheme: dark;
}

/* ---------- Light theme ---------- */
[data-theme="light"] {
  --bg: #F7F5F0;
  --bg-elevated: #FFFFFF;
  --bg-card: #FFFFFF;
  --bg-inset: #EFEBE2;
  --border: rgba(10, 22, 40, 0.08);
  --border-soft: rgba(10, 22, 40, 0.06);

  --text-primary: #0A1628;
  --text-secondary: #46516B;
  --text-muted: #7C879C;

  --accent: #C9820F;
  --accent-hover: #B3730D;
  --accent-text: #FFFFFF;

  --success: #2F8F5F;
  --danger: #C7433D;

  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-body);
  min-height: 100vh;
  transition: background var(--transition), color var(--transition);
}

h1, h2, h3, h4, .font-display {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.01em;
}

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

::selection {
  background: var(--accent);
  color: var(--accent-text);
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- Layout shell ---------- */
.dr-shell {
  display: flex;
  min-height: 100vh;
}

.dr-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ---------- Navbar ---------- */
.dr-navbar {
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 40;
}

.dr-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
}

.dr-brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(145deg, var(--accent), #C9820F);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #1A1206;
  font-weight: 800;
  font-family: var(--font-body);
  font-size: 1rem;
  flex-shrink: 0;
}

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

/* ---------- Theme toggle ---------- */
.theme-toggle {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-inset);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color var(--transition), transform var(--transition);
}
.theme-toggle:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.theme-toggle svg { width: 18px; height: 18px; }
[data-theme="dark"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: none; }

/* ---------- Buttons ---------- */
.btn-dr-primary {
  background: var(--accent);
  color: var(--accent-text);
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.65rem 1.4rem;
  font-weight: 600;
  transition: background var(--transition), transform var(--transition);
}
.btn-dr-primary:hover {
  background: var(--accent-hover);
  color: var(--accent-text);
  transform: translateY(-1px);
}

.btn-dr-outline {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 1.4rem;
  font-weight: 600;
  transition: border-color var(--transition), background var(--transition);
}
.btn-dr-outline:hover {
  border-color: var(--accent);
  background: var(--bg-inset);
  color: var(--text-primary);
}

.btn-dr-ghost {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-weight: 500;
}
.btn-dr-ghost:hover { color: var(--accent); }

/* ---------- Sidebar ---------- */
.dr-sidebar {
  width: 250px;
  flex-shrink: 0;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.dr-sidebar .dr-brand { padding: 0 0.5rem 1.25rem; }

.dr-nav-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.94rem;
}
.dr-nav-link:hover {
  background: var(--bg-inset);
  color: var(--text-primary);
}
.dr-nav-link.active {
  background: rgba(232, 160, 32, 0.12);
  color: var(--accent);
  font-weight: 600;
}
.dr-nav-link svg { width: 18px; height: 18px; flex-shrink: 0; }

.dr-sidebar-footer {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border-soft);
}

/* ---------- Cards ---------- */
.dr-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.dr-card:hover {
  border-color: var(--border);
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}

.dr-content-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.dr-thumb {
  aspect-ratio: 16/10;
  background: var(--bg-inset);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  position: relative;
  overflow: hidden;
}

.dr-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  background: rgba(232, 160, 32, 0.14);
  color: var(--accent);
}

.dr-progress {
  height: 6px;
  border-radius: 999px;
  background: var(--bg-inset);
  overflow: hidden;
}
.dr-progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
}

/* ---------- Forms ---------- */
.dr-auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  background:
    radial-gradient(circle at 15% 20%, rgba(232, 160, 32, 0.10), transparent 45%),
    var(--bg);
}

.dr-auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.25rem;
  box-shadow: var(--shadow-lg);
}

.form-label {
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.85rem;
}

.form-control, .form-select {
  background: var(--bg-inset);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.9rem;
}
.form-control:focus, .form-select:focus {
  background: var(--bg-inset);
  border-color: var(--accent);
  color: var(--text-primary);
  box-shadow: 0 0 0 3px rgba(232, 160, 32, 0.15);
}
.form-control::placeholder { color: var(--text-muted); }

/* ---------- Utility ---------- */
.text-secondary-dr { color: var(--text-secondary) !important; }
.text-muted-dr { color: var(--text-muted) !important; }
.divider-dr {
  border-color: var(--border-soft);
}
.dr-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
}

/* ---------- Player pages ---------- */
.dr-player-stage {
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
}

.dr-audio-cover {
  aspect-ratio: 1/1;
  max-width: 340px;
  margin: 0 auto;
  border-radius: var(--radius-md);
  background: linear-gradient(150deg, var(--bg-inset), var(--bg-card));
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}

.dr-control-btn {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-inset);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}
.dr-control-btn:hover { border-color: var(--accent); color: var(--accent); }

.dr-control-btn-play {
  width: 60px;
  height: 60px;
  background: var(--accent);
  color: var(--accent-text);
  border: none;
}
.dr-control-btn-play:hover { background: var(--accent-hover); transform: scale(1.04); }

.dr-seek {
  width: 100%;
  accent-color: var(--accent);
}

.dr-reader-page {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: clamp(1.5rem, 5vw, 4rem);
  max-width: 760px;
  margin: 0 auto;
  line-height: 1.8;
  font-size: 1.08rem;
}
.dr-reader-page.serif-mode { font-family: var(--font-display); }

/* Mobile */
@media (max-width: 900px) {
  .dr-sidebar { display: none; }
}

/* Offcanvas mobile sidebar reuses dr-sidebar styles */
.offcanvas.dr-sidebar-mobile {
  background: var(--bg-elevated);
  width: 260px;
}

/* ---------- Content protection ---------- */
[data-protect-text] {
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
}

.dr-watermark {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 2;
}
.dr-watermark span {
  position: absolute;
  color: rgba(255, 255, 255, 0.06);
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
  transform: rotate(-28deg);
}
[data-theme="light"] .dr-watermark span {
  color: rgba(10, 22, 40, 0.06);
}

.dr-player-stage { position: relative; }

@media print {
  [data-protect-page] { display: none !important; }
  body::after {
    content: "Printing is disabled for licensed Digital Read content.";
    display: block;
    padding: 2rem;
    font-family: sans-serif;
  }
}

