/*
 * Dark theme for the lifeorch.net pages built with the Tailwind CDN
 * (index.html, privacy-policy.html, terms-of-service.html, camera*.html).
 *
 * These pages are written with light Tailwind classes only (bg-white, text-gray-600 …).
 * Instead of adding a dark: variant to every element, this file remaps those classes
 * when the browser or OS asks for dark (prefers-color-scheme: dark). Link it from
 * every Tailwind page, after the Tailwind script:
 *     <link rel="stylesheet" href="site-dark.css">
 *
 * Selectors start with "html " so they beat Tailwind's own single-class rules, which
 * the CDN script injects at runtime (after this file). A class used on a new page
 * that is missing here stays light in dark mode: add it below.
 * The help sites (vocabex/help, name_memorize/help, numify_life/help) have their own
 * dark block at the end of their style.css. lifeorch.net/vocabex itself is the
 * Flutter web app, which picks its theme in the app.
 *
 * QR codes keep their white background in both themes so phones can scan them.
 */

:root { color-scheme: light dark; }

/* App icons, in both themes: shaped like a launcher icon (rounded square). The
   icon files are each app's store icon (iOS App Store icon, or the Play Store icon
   for Reference Camera), opaque squares, so the shape comes from here; the white
   background only shows behind the LifeOrch logo. Matches every image whose file
   name ends in icon.png (pics/icon.png, *_icon.png, reference-camera-icon.png);
   name new icons the same way. The icons are 512 px copies of:
     vocabex/help/images/vocabex_icon.png             <- vocab_ai/assets/icon/icon_ios.png
     name_memorize/help/images/name_memorize_icon.png <- name_recall/assets/icon/icon_ios.png
     numify_life/help/images/numify_life_icon.png     <- NumifyLife/assets/icon/icon_ios.png
     pics/reference-camera-icon.png                   <- ReferenceCamera/app/src/main/ic_launcher-playstore.png
   Copy them again when an app's icon changes. */
html img[src$="icon.png"] { background-color: #ffffff; border-radius: 22%; }

@media (prefers-color-scheme: dark) {
    /* Surfaces: page, cards, sticky header */
    html .bg-gray-50  { background-color: #0b1120; }
    html .bg-white    { background-color: #111827; }
    html .bg-white\/80 { background-color: rgba(17, 24, 39, 0.8); }
    html .bg-gray-100,
    html .hover\:bg-gray-100:hover { background-color: #1f2937; }
    html .bg-gray-800 { background-color: #1f2937; }
    html .bg-gray-900 { background-color: #030712; }
    html .bg-indigo-50,
    html .hover\:bg-indigo-50:hover { background-color: rgba(99, 102, 241, 0.14); }
    html .bg-indigo-100 { background-color: rgba(99, 102, 241, 0.22); }

    /* Text: grays get lighter as they get darker in the light theme */
    html .text-gray-900 { color: #f9fafb; }
    html .text-gray-800 { color: #f3f4f6; }
    html .text-gray-700 { color: #e5e7eb; }
    html .text-gray-600 { color: #d1d5db; }
    html .text-gray-500 { color: #9ca3af; }
    html .text-gray-400 { color: #9ca3af; }
    html .hover\:text-gray-900:hover { color: #ffffff; }

    /* Links and accents (indigo-600 is too dark to read on a dark background) */
    html .text-indigo-600 { color: #818cf8; }
    html .text-indigo-700,
    html .text-indigo-800 { color: #a5b4fc; }
    html .hover\:text-indigo-800:hover { color: #c7d2fe; }
    /* …but text on an indigo button stays white */
    html .bg-indigo-600.text-white,
    html .bg-indigo-500.text-white { color: #ffffff; }

    /* Borders */
    html .border-gray-100 { border-color: #1f2937; }
    html .border-gray-200 { border-color: #374151; }
    html .border-indigo-100 { border-color: #3730a3; }

    /* Shadows on a dark page need more weight to show */
    html .shadow-sm { box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5); }
    html .shadow-md,
    html .shadow-lg { box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.4); }
}
