/* Hand-designed light theme for the parts members see most. Loaded after the generated light.css, so these win.
   Editorial paper: an off-white page, slightly lighter cards on hairline borders, near black ink with grey secondary text,
   wine and bronze accents used sparingly, almost flat (no glows). The 3D temple (#app) and anything .keep-dark are left alone. */
html[data-theme="light"] {
    --l-page: #efece5;
    --l-card: #fbfaf7;
    --l-panel: #efede7;
    --l-border: #e3e0d8;
    --l-border-strong: #c9c5bb;
    --l-text: #1b1b19;
    --l-text-2: #4d4b46;
    --l-wine: #74222f;
    --l-gold: #5b4a26;
    --l-shadow: 0 1px 2px rgba(30, 28, 24, .04);
    --l-shadow-raised: 0 1px 2px rgba(30, 28, 24, .04), 0 8px 20px -12px rgba(30, 28, 24, .12);
}

@scope (html[data-theme="light"]) to (#app, .keep-dark) {
    /* Page: one calm color, no gradient and no wallpaper behind the content. */
    body { background: var(--l-page); color: var(--l-text); }
    body::before { opacity: 0; }

    /* Chrome: the navbar is a white strip that stands off the deeper page; menus and the task page's bottom bar match it. */
    nav.fixed { background: var(--l-card); border-color: var(--l-border-strong); box-shadow: 0 1px 3px rgba(30, 28, 24, .08); }
    #user-menu-dropdown, #mobile-menu, #nav-tasks-dropdown, #footer-bar {
        background: var(--l-card); border-color: var(--l-border); box-shadow: var(--l-shadow-raised);
    }

    /* Cards and dialogs: white, crisp border, soft shadow. */
    .dark-card, .magical-card, .glass-card-light, .rate-sheet-panel, .glossary-card, .task-display,
    [class*="bg-[#2d2323]"]:not([class*="bg-[#2d2323]/50"]), [class*="bg-[#1e1818]"], [class*="bg-[#1c1515]"],
    [class*="bg-[#120d0d]"], [class*="bg-[#130d0d]"], [class*="bg-[#140e0e]"], [class*="bg-[#1a1414]"]:not([class*="max-sm:bg-[#1a1414]"]),
    [class*="from-[#1f1512]"], [class*="from-[#1a1212]"], [class*="from-[#2a2017]"], [class*="from-[#2a1a14]"] {
        background: var(--l-card); border-color: var(--l-border); box-shadow: var(--l-shadow); color: var(--l-text);
    }

    /* Inset panels inside cards: a soft grey step down, so groups read without heavy lines. */
    /* (Phone-only backgrounds, max-sm:bg-..., stay phone-only: they are left to the generated light.css.) */
    [class*="bg-[#2d2323]/50"], [class*="bg-[#1a1616]/70"], [class*="bg-[#160f0f]"]:not([class*="max-sm:bg-[#160f0f]"]), [class*="bg-[#0f0d0d]"],
    [class*="bg-black/30"], [class*="bg-black/40"], [class*="bg-white/5"], [class*="bg-white/[.03]"] {
        background: var(--l-panel); border-color: var(--l-border);
    }

    /* Dashboard banner: the animated gold-and-wine rings become a plain hairline; the banner is a raised card. */
    .home-frame, .home-panel-frame { background: var(--l-border); animation: none; box-shadow: var(--l-shadow-raised); }
    /* The progress card's 1px frame is its border: as clear as the other Dashboard cards. */
    .home-panel-frame { background: var(--l-border-strong); }
    .home-glow, .home-spark { display: none; }
    /* The progress panel is a white card on its hairline frame, not a grey well. */
    .home-panel.home-panel { background: var(--l-card); }  /* doubled so it outranks the inset-panel rule above */
    .home-title, .magical-heading, .magical-text { color: var(--l-text); text-shadow: none; }
    .home-identity { color: var(--l-gold); }

    /* Dashboard buttons under Continue (All Tasks, rank and meeting, the challenge): white on the card with a crisp edge, not grey wells. */
    .home-soft { background: var(--l-card); border-color: var(--l-border-strong); box-shadow: var(--l-shadow); }
    .home-soft:hover { border-color: var(--l-gold); }
    .home-soft > * + * { border-color: var(--l-border-strong); }

    /* Main call to action: solid wine with white text, a small shadow instead of a glow. */
    .home-cta { background: var(--l-wine); box-shadow: 0 2px 6px rgba(122, 35, 53, .25); animation: none; }

    /* Form fields read as white wells with a visible edge. */
    input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), textarea, select {
        background-color: var(--l-card); border-color: var(--l-border-strong); color: var(--l-text);
    }
    input::placeholder, textarea::placeholder { color: var(--l-text-2); }

    /* Task tiles: white, done ones get a calm green edge, the next one a deep gold edge and no glow. */
    .task-tile { background: var(--l-card); box-shadow: var(--l-shadow); }
    .task-todo { border-color: var(--l-border-strong); }
    /* Done tiles stay white with a soft green edge (the check badge says done), and their pictures show at full strength. */
    .task-done { background: var(--l-card); border-color: #b5dcc1; }
    .task-done:hover { border-color: #6fbb88; }
    .task-done .task-art { opacity: 1; }
    .task-next { border-color: var(--l-gold); animation: none; box-shadow: 0 0 0 3px rgba(138, 100, 32, .15); }
    .module-current { animation: none; box-shadow: 0 0 0 3px rgba(138, 100, 32, .15); border-color: var(--l-gold) !important; }

    /* Task pictures fill their tile edge to edge; symbol tiles get a soft panel behind the symbol. */
    .task-art { background: var(--l-panel); }

    /* Level arrows in the All Tasks footer: solid raised buttons with dark ink, a bronze edge on hover. */
    .level-nav { background: var(--l-card); border-color: var(--l-border-strong); color: var(--l-text); box-shadow: var(--l-shadow-raised); }
    .level-nav svg { color: var(--l-text); }
    .level-nav:hover { background: var(--l-card); border-color: var(--l-gold); color: var(--l-gold); }

    /* Quiz cards (Challenges and a finished quiz): white with a clear edge and lift, the rating footer and scores list on a
       soft panel behind a visible rule, progress tracks and thumbnails that read against white. */
    .quiz-card { background: var(--l-card); border-color: var(--l-border-strong); border-radius: .75rem; box-shadow: var(--l-shadow); }
    .quiz-card > * + * { border-color: var(--l-border); }
    .quiz-card .rate-compact { background: var(--l-card); }
    .quiz-card .quiz-scores, .quiz-card #quiz-summary, .quiz-card #quiz-scores { background: var(--l-panel); }
    .quiz-track { height: 4px; background: var(--l-border); }
    .quiz-track > div { background: #e8c06a; }
    .quiz-thumb { border-color: var(--l-border-strong); border-radius: .5rem; }
    .quiz-status b { color: var(--l-text); }

    /* One quiet palette: wine leads (Continue), bronze gold supports, green only ever means done. */
    /* Small icon tiles carry a faint bronze tint instead of grey. */
    .home-icon-tile { background: rgba(91, 74, 38, .08); border-color: rgba(91, 74, 38, .25); color: var(--l-gold); }

    /* Member initials on paper: a pale tint of their color with the initial in a deeper shade of it. */
    .avatar-tint { background: color-mix(in srgb, var(--av) 20%, #fbfaf7); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--av) 45%, #fbfaf7); color: color-mix(in srgb, var(--av) 80%, #1b1b19); }

    /* Rank badges on paper: a pale tint of the rank's color with the label in a deep shade of it. */
    .rank-pill { background: color-mix(in srgb, var(--rk) 16%, #fbfaf7); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--rk) 50%, #fbfaf7); color: color-mix(in srgb, var(--rk) 70%, #1b1b19); }

    /* Account menu hairlines use the theme's border tone so they read on white. */
    .menu-list > * + *::before { background: var(--l-border); }

    /* The picked quiz answer keeps a clear gold wash on white (the generated theme would fade it). */
    .quiz-question:not(:disabled) .quiz-option:has(input:checked) { background: rgba(232, 192, 106, .22); border-color: #c9a14a; box-shadow: inset 0 0 0 1px #c9a14a; }
    .quiz-question:not(:disabled) .quiz-option:has(input:checked) .quiz-letter { background: #e8c06a; border-color: #c9a14a; color: #1a1208; }

    /* Events: the next event's row and the Upcoming card stand out in warm gold. */
    .sched-next { background: #fcf3e2; box-shadow: inset 5px 0 0 #a8741a, inset 0 1px 0 #d9b468, inset 0 -1px 0 #d9b468; }
    .sched-next:hover { background: #f9ecd3; }
    .sched-next .sched-cal { border-color: #a8741a; background: #fffaf0; }
    .sched-next td, .sched-next .sched-date { color: var(--l-text); }
    .sched-next-tag { background: #a8741a; color: #fff; }
    .next-event { border-color: #a8741a; background: linear-gradient(135deg, #faefda, #fdf8ee); box-shadow: 0 6px 18px -10px rgba(120, 82, 18, .45); }
    .next-event-cal { border-color: #a8741a; background: #fffaf0; }
    .next-event-cal .sched-mon, .next-event-when { color: #8a6418; }
    .next-event-title, .next-event-day { color: var(--l-text); }
    .next-event-meta, .next-event-meta a { color: var(--l-text-2); }
    .next-event-meta a { text-decoration-color: #c9962e; }
    .sched-add { border-color: #c9962e; background: #fbefd2; color: #6b4a10; }
    .event-form input, .event-form textarea { color-scheme: light; }

    /* Notifications bell: a white panel, gold-tinted unread rows, badges ringed in the panel color. */
    .notif-bell { color: var(--l-text-2); }
    .notif-bell:hover, .notif-bell[aria-expanded="true"] { background: var(--l-panel); color: var(--l-text); }
    .notif-panel { background: var(--l-card); border-color: var(--l-border-strong); box-shadow: var(--l-shadow-raised); }
    .notif-count { box-shadow: 0 0 0 2px var(--l-card); }
    .notif-kind { box-shadow: 0 0 0 2px var(--l-card); }
    .notif-face { background: var(--l-panel); }
    .notif-item { color: var(--l-text-2); }
    .notif-item:hover { background: var(--l-panel); }
    .notif-body b, .notif-head { color: var(--l-text); }
    .notif-item.is-unread { background: #fbefd2; }
    .notif-item.is-unread .notif-time { color: #8a6418; }
    .notif-head a { color: #8a6418; }
    .notif-preview { background: var(--l-panel); color: var(--l-text-2); }
    .notif-item.is-direct { background: #f6e3e6; box-shadow: inset 3px 0 0 #74222f; }
    .notif-item.is-direct:hover { background: #f1d6da; }
    .notif-for-you { background: #74222f; color: #fff; }
    .sched-add:hover { background: #c9962e; color: #fff; }

    /* Secondary text everywhere gets one consistent graphite grey. */
    .dark-text-secondary, .dark-text-muted, [class*="text-gray-300"], [class*="text-gray-400"], [class*="text-gray-500"] { color: var(--l-text-2); }
}
