/* ============================================================
   2026 Reading Challenge — "Obsidian & Ember" dark mode
   Activated automatically by theme.js, which sets
   html[data-theme="dark"] based on the device setting
   (prefers-color-scheme) unless the user overrides it in Settings.
   Orange accents (#f27c22) and cover/image colors are untouched.
   ============================================================ */

/* Tell the browser this is a dark UI so it renders native controls,
   scrollbars and (importantly) does NOT apply its own auto-dark
   color transforms on top of our explicit palette. */
html[data-theme="light"] {
  color-scheme: light;
}
html[data-theme="dark"] {
  color-scheme: dark;
  background: #080808;
}

html[data-theme="dark"] body {
  background: #080808;
  color: #F5F5F5;
}

/* ---- Page shell (the main canvas) ---- */
html[data-theme="dark"] .page-shell,
html[data-theme="dark"] #page-shell {
  background: #080808;
  color: #F5F5F5;
}

/* ---- Bubbles: obsidian surface with a Lunar Halo (white shadow) ---- */
html[data-theme="dark"] .bubble {
  background: #141414;
  color: #F5F5F5;
  box-shadow: 0 8px 32px rgba(255, 255, 255, 0.08),
              inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}
html[data-theme="dark"] .bubble:hover {
  box-shadow: 0 10px 40px rgba(255, 255, 255, 0.12),
              inset 0 0 0 1px rgba(255, 255, 255, 0.10);
}

/* ---- Headings: keep Ember orange ---- */
html[data-theme="dark"] h2,
html[data-theme="dark"] .bubble h3,
html[data-theme="dark"] .page-header-row h1 {
  color: #f27c22;
}

/* ---- Secondary / muted text -> Bone White (gray is unreadable on black) ---- */
html[data-theme="dark"] .timestamp,
html[data-theme="dark"] .dt-display,
html[data-theme="dark"] .welcome-sub,
html[data-theme="dark"] .reader-card-progress-text,
html[data-theme="dark"] .reader-summary-subtitle,
html[data-theme="dark"] .reader-stats-line,
html[data-theme="dark"] .date-value {
  color: #F5F5F5;
}

/* ---- Dark text declared on common elements -> Bone White ---- */
html[data-theme="dark"] .submission-info > div,
html[data-theme="dark"] .stars-label,
html[data-theme="dark"] .dt-fieldlabel,
html[data-theme="dark"] .modal-body p,
html[data-theme="dark"] .welcome-progress-label {
  color: #F5F5F5;
}

/* Inline (JS-set) gray text anywhere -> Bone White (gray unreadable on black) */
html[data-theme="dark"] div[style*="color:#555"],
html[data-theme="dark"] div[style*="color:#666"],
html[data-theme="dark"] div[style*="color:#777"],
html[data-theme="dark"] div[style*="color:#888"],
html[data-theme="dark"] div[style*="color:#999"],
html[data-theme="dark"] div[style*="color:#aaa"],
html[data-theme="dark"] span[style*="color:#555"],
html[data-theme="dark"] span[style*="color:#666"],
html[data-theme="dark"] span[style*="color:#777"],
html[data-theme="dark"] span[style*="color:#888"],
html[data-theme="dark"] span[style*="color:#999"],
html[data-theme="dark"] span[style*="color:#aaa"] {
  color: #F5F5F5 !important;
}

/* Inline (JS-set) dark text inside known containers -> Bone White.
   !important is required to override inline style="" color declarations. */
html[data-theme="dark"] #promptInfo div,
html[data-theme="dark"] #promptNotes div,
html[data-theme="dark"] .submission-info div[style*="color"],
html[data-theme="dark"] #submitSuccessBubble div[style*="color"],
html[data-theme="dark"] .bubble div[style*="color:#000"],
html[data-theme="dark"] .bubble div[style*="color:#333"],
html[data-theme="dark"] .bubble div[style*="color:#222"],
html[data-theme="dark"] .bubble div[style*="color:#666"],
html[data-theme="dark"] .bubble strong[style*="color:#000"],
html[data-theme="dark"] .bubble strong[style*="color:#333"] {
  color: #F5F5F5 !important;
}

/* Elements that were Ember orange in light mode stay Ember in dark mode
   (the submission-info rule above would otherwise white them out) */
html[data-theme="dark"] .submission-info .prompt-tag,
html[data-theme="dark"] .prompt-tag {
  color: #f27c22;
}

/* ---- Footer logo: dedicated dark variant with black background ---- */
html[data-theme="dark"] .footer-logo,
html[data-theme="dark"] .footer-logo img {
  content: url("reading-challenge-logo-dark.png");
}

/* ---- Cover thumbnails: keep full color, just darken the placeholder frame ---- */
html[data-theme="dark"] .submission-card img,
html[data-theme="dark"] .editor-cover {
  background: #1a1a1a;
}

/* ============================================================
   Header / Navigation (from menu.css)
   ============================================================ */
/* Transparent header sits over the dark canvas -> light chrome */
html[data-theme="dark"] header:not(.scrolled) .site-name,
html[data-theme="dark"] header:not(.scrolled) .site-name span,
html[data-theme="dark"] header:not(.scrolled) nav.menu a,
html[data-theme="dark"] header:not(.scrolled) .menu-toggle {
  color: #F5F5F5;
}
/* Scrolled header keeps its Ember bar + dark text (accent) */
html[data-theme="dark"] header.scrolled {
  background: #f27c22;
}
/* Desktop dropdown over dark header */
html[data-theme="dark"] header:not(.scrolled) nav.menu .submenu {
  background: #141414;
  box-shadow: 0 8px 32px rgba(255, 255, 255, 0.08);
}
html[data-theme="dark"] header:not(.scrolled) nav.menu .submenu a {
  color: #F5F5F5;
}

/* ============================================================
   Submission cards, editor, inputs
   ============================================================ */
html[data-theme="dark"] .editor-field,
html[data-theme="dark"] .rating-input,
html[data-theme="dark"] .dt-box,
html[data-theme="dark"] .dt-dd-btn {
  background: #141414;
  color: #F5F5F5;
}
html[data-theme="dark"] .editor-field::placeholder {
  color: #b3b3b3;
}

/* ---- Search bars: black background, light gray text (weight unchanged) ---- */
html[data-theme="dark"] #searchInput {
  background: #000;
  color: #d9d9d9;
}
html[data-theme="dark"] #searchInput::placeholder {
  color: #9a9a9a;
}
html[data-theme="dark"] .dt-dd-btn .dt-dd-selected {
  color: #F5F5F5;
}

/* ============================================================
   Menus, dropdowns, modals (white surfaces -> obsidian)
   ============================================================ */
html[data-theme="dark"] .card-menu,
html[data-theme="dark"] .reader-dd-menu,
html[data-theme="dark"] .float-menu,
html[data-theme="dark"] .modal {
  background: #141414;
  color: #F5F5F5;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.6),
              inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}
html[data-theme="dark"] .card-menu,
html[data-theme="dark"] .reader-dd-menu,
html[data-theme="dark"] .float-menu {
  border-color: rgba(255, 255, 255, 0.08);
}
html[data-theme="dark"] .menu-item,
html[data-theme="dark"] .reader-dd-item,
html[data-theme="dark"] .float-item {
  color: #F5F5F5;
  background: #141414;
}
html[data-theme="dark"] .menu-item:hover,
html[data-theme="dark"] .reader-dd-item:hover,
html[data-theme="dark"] .float-item:hover {
  background: rgba(255, 255, 255, 0.06);
}
/* Selected option in submit-book dropdowns keeps its Ember accent
   (the dark item rule outranks the pages' own .active rule otherwise) */
html[data-theme="dark"] .float-item.active,
html[data-theme="dark"] .reader-dd-item.active {
  background: rgba(242, 124, 34, 0.18);
  color: #f27c22;
}
html[data-theme="dark"] .modal-header {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}
html[data-theme="dark"] .modal-close {
  background: rgba(255, 255, 255, 0.06);
  color: #F5F5F5;
}
html[data-theme="dark"] .modal-close:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* ---- Buttons: keep Ember primary; ghost -> subtle light ---- */
html[data-theme="dark"] .btn-ghost {
  background: rgba(255, 255, 255, 0.08);
  color: #F5F5F5;
}
html[data-theme="dark"] .editor-cancel-btn {
  background: #141414;
  color: #e05a5a;
}

/* ---- Modal overlay scrim ---- */
html[data-theme="dark"] .modal-overlay {
  background: rgba(0, 0, 0, 0.6);
}

/* ---- Separator lines ---- */
html[data-theme="dark"] .dt-sep {
  background: rgba(255, 255, 255, 0.12);
}

/* ---- Progress bar track ---- */
html[data-theme="dark"] .progress-bar-container {
  background: #1f1f1f;
}

/* ============================================================
   Page-specific cards that aren't .bubble (home, prompts, login, etc.)
   ============================================================ */
html[data-theme="dark"] .welcome-progress-card,
html[data-theme="dark"] .quote-widget,
html[data-theme="dark"] .skeleton-card,
html[data-theme="dark"] .reader-card,
html[data-theme="dark"] .prompt-card,
html[data-theme="dark"] .loading-bubble,
html[data-theme="dark"] .rc-loader-bubble,
html[data-theme="dark"] .signout-bubble,
html[data-theme="dark"] .filter-btn {
  background: #141414;
  color: #F5F5F5;
  box-shadow: 0 8px 32px rgba(255, 255, 255, 0.08),
              inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}
/* Filter buttons keep their Ember outline + accent text */
html[data-theme="dark"] .filter-btn {
  color: #f27c22;
  border-color: #f27c22;
}
html[data-theme="dark"] .filter-btn:hover,
html[data-theme="dark"] .filter-btn.active {
  background: #f27c22;
  color: #fff;
}
/* Sign-out pill keeps Ember outline + accent text */
html[data-theme="dark"] .signout-bubble {
  color: #f27c22;
  border-color: #f27c22;
}
html[data-theme="dark"] .signout-bubble:hover {
  background: #f27c22;
  color: #fff;
}

/* Muted/secondary text inside these cards -> Bone White */
html[data-theme="dark"] #gr_quote_body,
html[data-theme="dark"] .welcome-progress-label,
html[data-theme="dark"] .welcome-progress-meta,
html[data-theme="dark"] .reader-caption { color: #F5F5F5; }
html[data-theme="dark"] .welcome-progress-track { background: #1f1f1f; }
/* Kept dim on purpose, but legible on the obsidian surface */
html[data-theme="dark"] .prompt-card.grayed-out { color: #9a9a9a; }

/* ============================================================
   Mobile menu: obsidian drawer; current page bold + Ember
   (replaces the bright orange drawer in dark mode)
   ============================================================ */
html[data-theme="dark"] .mobile-menu {
  background: #141414;
  color: #F5F5F5;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}
html[data-theme="dark"] .mobile-menu a,
html[data-theme="dark"] .mobile-menu .has-submenu > a,
html[data-theme="dark"] .mobile-menu.active a,
html[data-theme="dark"] .mobile-menu .menu-close,
html[data-theme="dark"] #loginStatusMobile {
  color: #F5F5F5;
}
html[data-theme="dark"] .mobile-menu a.active {
  color: #f27c22;
  font-weight: 800;
}
html[data-theme="dark"] .mobile-menu a.active::after {
  background: #f27c22;
}

/* ============================================================
   Smooth bubble hover (the pages' transform transition must
   survive here — without it the hover scale is abrupt) and a
   quick (not flashy) scheme change. Dark mode only.
   ============================================================ */
html[data-theme="dark"] body,
html[data-theme="dark"] .page-shell,
html[data-theme="dark"] #page-shell,
html[data-theme="dark"] .bubble {
  transition: transform 0.3s ease,
              background-color 0.3s ease-in-out,
              box-shadow 0.3s ease-in-out,
              color 0.3s ease-in-out;
}
