/*
 * Antre-JV adaptive theme override layer.
 *
 * This file is intentionally loaded AFTER app.css.  app.css contains historical
 * design snapshots with hard-coded white/beige backgrounds.  Keeping the theme
 * layer separate makes the cascade deterministic and prevents a backend-only
 * release from accidentally reviving those legacy colors.
 *
 * Dark is the server-side/default theme.  layouts/app.php switches to light only
 * when the browser explicitly reports prefers-color-scheme: light.
 */

html[data-theme="dark"] {
  color-scheme: dark;
  --ajv-bg: #080a0d;
  --ajv-wall: #0c1014;
  --ajv-surface: #12171c;
  --ajv-surface-2: #181e24;
  --ajv-surface-3: #212931;
  --ajv-surface-soft: #151b21;
  --ajv-field: #0e1318;
  --ajv-field-focus: #111820;
  --ajv-text: #cbd1d8;
  --ajv-text-strong: #e0e4e9;
  --ajv-muted: #858f9b;
  --ajv-border: #2b343e;
  --ajv-border-soft: #242c35;
  --ajv-row-alt: #151b21;
  --ajv-row-hover: #1d2730;
  --ajv-unread: #1b252d;
  --ajv-link: #8eaebe;
  --ajv-link-hover: #a8bfcb;
}

/* Entire browser canvas. */
html[data-theme="dark"],
html[data-theme="dark"] body,
html[data-theme="dark"] body.theme-homepage-01,
html[data-theme="dark"] body.theme-homepage-01[class*="design-css-"] {
  min-height: 100%;
  background: var(--ajv-bg) !important;
  background-color: var(--ajv-bg) !important;
  background-image: none !important;
  color: var(--ajv-text) !important;
}
html[data-theme="dark"] body.theme-homepage-01 {
  min-height: 100vh !important;
}

/* Outer walls are deliberately darker than the centered content sheet. */
html[data-theme="dark"] body.theme-homepage-01 :where(
  .jvc-content-bg,
  .jvc-forum-home-bg,
  .jvc-forum-wall,
  .jvc-reader-bg,
  .jvc-review-bg,
  .jvc-profile-bg,
  .jvc-profile-notif-bg,
  .jvc-games-bg,
  .jvc-game-detail-bg,
  .jvc-tests-bg,
  .jvc-video-bg,
  .jvc-mp-bg,
  .jvc-chronicle-bg,
  .app-page-bg,
  .app-admin-bg,
  .app-utility-bg
) {
  background: var(--ajv-wall) !important;
  background-color: var(--ajv-wall) !important;
  background-image: none !important;
  color: var(--ajv-text) !important;
  border-color: var(--ajv-border) !important;
}

/* Every page sheet, including the homepage utility class that historically forced #eee. */
html[data-theme="dark"] body.theme-homepage-01 :where(
  main.page,
  .page,
  .u-53d281d3e8,
  .jvc-home-wire-dynamic,
  .jvc-home-dynamic,
  .jvc-forum-page,
  .jvc-forum-home,
  .jvc-news-page,
  .jvc-article-page,
  .jvc-compose-page,
  .jvc-video-page,
  .jvc-tests-page,
  .jvc-test-detail-page,
  .jvc-releases-page,
  .jvc-reader-page,
  .jvc-reader-review-page,
  .jvc-search-page,
  .jvc-auth-page,
  .jvc-games-list-page,
  .jvc-game-detail-page,
  .jvc-dossier-page,
  .jvc-chronicle-page,
  .jvc-news-revisions-page,
  .jvc-history-page,
  .jvc-profile-page,
  .jvc-mp-page,
  .jvc-help-page,
  .jvc-moderation-page,
  .app-utility-page,
  .app-admin-page,
  .app-error-page,
  .jvc-error-page,
  .content-white,
  .npf,
  .shp-page,
  .shp-content
) {
  background: var(--ajv-surface) !important;
  background-color: var(--ajv-surface) !important;
  background-image: none !important;
  color: var(--ajv-text) !important;
  border-color: var(--ajv-border) !important;
}

/* Homepage: sheet -> section -> inner widgets. */
html[data-theme="dark"] body.theme-homepage-01 .jvc-home-wire-dynamic {
  background: var(--ajv-surface) !important;
  box-shadow: 0 2px 18px rgba(0, 0, 0, .46) !important;
}
html[data-theme="dark"] body.theme-homepage-01 .jvc-home-wire-dynamic > .wire-section,
html[data-theme="dark"] body.theme-homepage-01 .jvc-home-wire-dynamic .wire-section {
  background: var(--ajv-surface-2) !important;
  background-color: var(--ajv-surface-2) !important;
  background-image: none !important;
  color: var(--ajv-text) !important;
  border-color: var(--ajv-border) !important;
}
html[data-theme="dark"] body.theme-homepage-01 .jvc-home-wire-dynamic :where(
  .wire-list,
  .wire-news,
  .twocol,
  .media-row,
  .wire-feature,
  .jvc-wire-aside
) {
  background: transparent !important;
  background-color: transparent !important;
  color: var(--ajv-text) !important;
}
html[data-theme="dark"] body.theme-homepage-01 .jvc-home-wire-dynamic .jvc-wire-row {
  background: transparent !important;
  color: var(--ajv-text) !important;
  border-color: var(--ajv-border-soft) !important;
}
html[data-theme="dark"] body.theme-homepage-01 .jvc-home-wire-dynamic .jvc-wire-row:hover {
  background: var(--ajv-row-hover) !important;
}
html[data-theme="dark"] body.theme-homepage-01 :where(
  .jvc-home-stats strong,
  .jvc-home-wire-dynamic .sidebar-block,
  .jvc-home-wire-dynamic .wire-feature .caption,
  .jvc-home-wire-dynamic .agenda
) {
  background: var(--ajv-surface-3) !important;
  background-color: var(--ajv-surface-3) !important;
  background-image: none !important;
  color: var(--ajv-text) !important;
  border-color: var(--ajv-border) !important;
}
html[data-theme="dark"] body.theme-homepage-01 .jvc-home-wire-dynamic .sidebar-block h3 {
  background: #29323b !important;
  color: var(--ajv-text-strong) !important;
  border-color: var(--ajv-border) !important;
}

/* Cards, panels and secondary containers used across public/community/admin views. */
html[data-theme="dark"] body.theme-homepage-01 :where(
  .panel,
  .panel-body,
  .card,
  .subsection,
  .formbox,
  .tabs,
  .profile-box,
  .profile-box h3,
  .feed-row,
  .review,
  .filters,
  .jvc-panel,
  .app-card,
  .app-auth,
  .app-form,
  .app-admin-card,
  .app-admin-editor,
  .app-admin-links,
  .app-admin-stat,
  .app-role-form,
  .app-utility-card,
  .app-form-help,
  .app-global-ban-box,
  .app-markdown-grid,
  .app-report-preview,
  .app-report-row,
  .app-feature-row,
  .app-extended-ok,
  .app-extended-warning,
  .jvc-news-tools,
  .jvc-news-days,
  .jvc-top-news,
  .jvc-related,
  .jvc-video-caption,
  .jvc-profile-summary,
  .jvc-follow-card,
  .jvc-dossier-side,
  .jvc-dossier-summary,
  .jvc-chronicle-body,
  .jvc-release-filters,
  .jvc-release-side,
  .jvc-reader-bars,
  .jvc-reader-side,
  .jvc-search-head form,
  .jvc-search-filters,
  .jvc-search-users > a,
  .jvc-search-none,
  .jvc-auth-card,
  .jvc-auth-side,
  .jvc-auth-switch,
  .jvc-comment-bg,
  .jvc-comment-form,
  .jvc-comment,
  .jvc-info-card,
  .jvc-info-box,
  .jvc-info-note,
  .jvc-revision-current,
  .jvc-forum-card,
  .jvc-forum-kick-box form,
  .jvc-forum-kick-notice,
  .jvc-poll-box,
  .jvc-poll-create,
  .jvc-topic-bulk-actions,
  .jvc-post-moderation-row,
  .jvc-moderated-placeholder,
  .jvc-moderation-actions,
  .jvc-login-compose,
  .jvc-share-box,
  .jvc-share-card,
  .jvc-shop-card,
  .jvc-game-filters section,
  .jvc-games-result-head,
  .jvc-game-info,
  .jvc-game-opinions article,
  .jvc-game-review-form,
  .jvc-subscription-add,
  .jvc-fixed-username,
  .jvc-empty-feature,
  .jvc-empty-row,
  .jvc-profile-empty,
  .jvc-profile-filter,
  .jvc-profile-form-fields,
  .jvc-profile-media-preview,
  .jvc-social-unavailable,
  .jvc-unavailable-inline,
  .jvc-thread-move,
  .jvc-mp-toolbar,
  .jvc-mp-table,
  .jvc-mp-pop,
  .jvc-mp-sidebar,
  .jvc-mp-move,
  .jvc-private-message,
  .jvc-private-message header,
  .jvc-ignored-message,
  .jvc-attachments a,
  .jvc-reactions button,
  .jvc-reactions span,
  .jvc-subscriptions,
  .jvc-file-label,
  .jvc-forum-post,
  .jvc-forum-search,
  .jvc-inline-moderation button,
  .jvc-mp-counter,
  .jvc-pagination,
  .jvc-poll-bar,
  .jvc-test-inline,
  .jvc-test-score,
  .jvc-top-content,
  .jvc-video-filter,
  .js-markdown-preview
) {
  background: var(--ajv-surface-2) !important;
  background-color: var(--ajv-surface-2) !important;
  background-image: none !important;
  color: var(--ajv-text) !important;
  border-color: var(--ajv-border) !important;
}

/* Lists and rows. */
html[data-theme="dark"] body.theme-homepage-01 :where(
  .list-row:nth-child(even),
  .jvc-topic-line,
  .jvc-activity-line,
  .jvc-news-item,
  .jvc-game-row,
  .jvc-search-result,
  .jvc-search-topic,
  .jvc-dossier-row,
  .jvc-test-list-row,
  .app-inbox-row,
  .app-topic-row,
  .app-draft-row,
  .jvc-release-table tr,
  .jvc-mp-table tbody tr
) {
  background: var(--ajv-surface-soft) !important;
  background-color: var(--ajv-surface-soft) !important;
  color: var(--ajv-text) !important;
  border-color: var(--ajv-border) !important;
}
html[data-theme="dark"] body.theme-homepage-01 :where(
  .jvc-topic-line:nth-child(even),
  .jvc-activity-line:nth-child(odd),
  .jvc-mp-table tbody tr:nth-child(even),
  .app-inbox-row:nth-child(even),
  .jvc-release-table tr:nth-child(even)
) {
  background: var(--ajv-row-alt) !important;
}
html[data-theme="dark"] body.theme-homepage-01 :where(
  .jvc-topic-line:hover,
  .jvc-activity-line:hover,
  .jvc-wire-row:hover
) {
  background: var(--ajv-row-hover) !important;
}
html[data-theme="dark"] body.theme-homepage-01 :where(
  .jvc-topic-line.is-unread-topic,
  .jvc-activity-line.is-unread-topic,
  .app-inbox-row.unread,
  .jvc-mp-table tbody tr.unread
) {
  background: var(--ajv-unread) !important;
}

/* Headings and horizontal bars that were historically light grey. */
html[data-theme="dark"] body.theme-homepage-01 :where(
  .notice-title,
  .schedule th,
  .jvc-activity-head,
  .jvc-topic-head,
  .jvc-games-result-head,
  .jvc-poll-create > strong,
  .app-admin-tabs,
  .jvc-search-head,
  .jvc-compose-footer,
  .jvc-editor-toolbar,
  .jvc-post-mode
) {
  background: var(--ajv-surface-3) !important;
  background-color: var(--ajv-surface-3) !important;
  background-image: none !important;
  color: var(--ajv-text-strong) !important;
  border-color: var(--ajv-border) !important;
}

/* Breadcrumbs and end strip. */
html[data-theme="dark"] body.theme-homepage-01 :where(
  .crumb,
  .jvc-breadcrumb,
  .jvc-mp-breadcrumb,
  .endstrip,
  .jvc-endstrip
) {
  background: #10151a !important;
  background-color: #10151a !important;
  background-image: none !important;
  color: var(--ajv-muted) !important;
  border-color: var(--ajv-border) !important;
}

/* Missing media placeholders may be lighter than cards, but never beige/white. */
html[data-theme="dark"] body.theme-homepage-01 :where(
  .graybox,
  .media-thumb,
  .adbox,
  .coverph,
  .jvc-card-image,
  .jvc-game-cover,
  .jvc-game-gallery,
  .jvc-news-thumb,
  .jvc-test-list-img,
  .jvc-video-thumb,
  .jvc-notif-thumb,
  .jvc-feed-thumb,
  .jvc-search-image,
  .npf .result .pic,
  .chronique .video,
  .thumb-grid .t
) {
  background: #252d35 !important;
  background-color: #252d35 !important;
  color: #909aa6 !important;
  border-color: #36414c !important;
}
html[data-theme="dark"] body.theme-homepage-01 .graybox::before,
html[data-theme="dark"] body.theme-homepage-01 .graybox::after {
  background: #3a444f !important;
}

/* Inputs/editors must be darker than the card containing them. */
html[data-theme="dark"] body.theme-homepage-01.theme-homepage-01 :where(
  input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="reset"]),
  textarea,
  select
) {
  background: var(--ajv-field) !important;
  background-color: var(--ajv-field) !important;
  color: var(--ajv-text) !important;
  -webkit-text-fill-color: var(--ajv-text) !important;
  border-color: var(--ajv-border) !important;
  caret-color: var(--ajv-text-strong) !important;
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, .22) !important;
}
html[data-theme="dark"] body.theme-homepage-01.theme-homepage-01 :where(input, textarea, select):focus {
  background: var(--ajv-field-focus) !important;
  background-color: var(--ajv-field-focus) !important;
  color: var(--ajv-text-strong) !important;
  -webkit-text-fill-color: var(--ajv-text-strong) !important;
  border-color: #526674 !important;
  outline: 1px solid rgba(100, 130, 149, .34) !important;
}
html[data-theme="dark"] body.theme-homepage-01 :where(input, textarea)::placeholder {
  color: #697481 !important;
  opacity: 1 !important;
}
html[data-theme="dark"] body.theme-homepage-01 select option {
  background: var(--ajv-field) !important;
  color: var(--ajv-text) !important;
}
html[data-theme="dark"] body.theme-homepage-01 :where(
  input:-webkit-autofill,
  input:-webkit-autofill:hover,
  input:-webkit-autofill:focus,
  textarea:-webkit-autofill,
  select:-webkit-autofill
) {
  -webkit-text-fill-color: var(--ajv-text) !important;
  -webkit-box-shadow: 0 0 0 1000px var(--ajv-field) inset !important;
  box-shadow: 0 0 0 1000px var(--ajv-field) inset !important;
}
html[data-theme="dark"] body.theme-homepage-01 .jvc-editor-area {
  background: var(--ajv-field) !important;
  color: var(--ajv-text) !important;
  border-color: var(--ajv-border) !important;
}

/* Dark readable forum content remains 14px, regardless of the old 10px snapshot. */
html[data-theme="dark"] body.theme-homepage-01 .jvc-post-body,
body.theme-homepage-01 .jvc-post-body {
  font-size: 14px !important;
  line-height: 1.6 !important;
}
body.theme-homepage-01 .jvc-post-body :where(p, li, blockquote, dd, dt, td, th) {
  font-size: inherit !important;
  line-height: inherit !important;
}

/* Calm text colors: no cream/beige copy on charcoal. */
html[data-theme="dark"] body.theme-homepage-01 :where(
  p,
  li,
  td,
  th,
  label,
  dt,
  dd,
  summary
) {
  color: var(--ajv-text) !important;
}
html[data-theme="dark"] body.theme-homepage-01 :where(
  .muted,
  .small,
  .tiny,
  .signature,
  .jvc-post-signature,
  .jvc-home-meta,
  .app-meta,
  .jvc-news-meta,
  .jvc-article-meta,
  .jvc-game-row-meta,
  .jvc-search-users small
) {
  color: var(--ajv-muted) !important;
}
html[data-theme="dark"] body.theme-homepage-01 a:not(.btn):not(.app-btn):not(.jvc-post-button):not(.jvc-btn-blue):not(.jvc-btn-gray) {
  color: var(--ajv-link);
}
html[data-theme="dark"] body.theme-homepage-01 a:not(.btn):not(.app-btn):not(.jvc-post-button):not(.jvc-btn-blue):not(.jvc-btn-gray):hover {
  color: var(--ajv-link-hover);
}

/* These two raster/content surfaces intentionally stay light for scan/read reliability. */
html[data-theme="dark"] body.theme-homepage-01 .app-totp-qr,
html[data-theme="dark"] body.theme-homepage-01 .jvc-captcha-image {
  background: #fff !important;
  background-color: #fff !important;
  background-image: none;
  color: #111 !important;
}

/* Final legacy-subject coverage: no pale surface class used by a view is left unowned. */
html[data-theme="dark"] body.theme-homepage-01 :where(
  .app-flash,
  .jvc-captcha-box,
  .jvc-filter-more,
  .jvc-account-avatar,
  .jvc-post-avatar,
  .jvc-profile-avatar
) {
  background: var(--ajv-surface-3) !important;
  background-color: var(--ajv-surface-3) !important;
  color: var(--ajv-text) !important;
  border-color: var(--ajv-border) !important;
}
html[data-theme="dark"] body.theme-homepage-01 .app-flash.success {
  background: #18251d !important;
  color: #b9cfbd !important;
  border-color: #304738 !important;
}
html[data-theme="dark"] body.theme-homepage-01 .app-flash.error {
  background: #28191b !important;
  color: #d1afb2 !important;
  border-color: #503237 !important;
}
