/* Dark mode inverts the whole page, then flips pictures back so they keep their real colours.
   The flip-back applies the two steps in the opposite order, which is the exact inverse. */
   This covers every page without restyling each one by hand. */
html.lt-pending { visibility: hidden; }

html[data-theme="dark"]:not([data-native="dark"]),
html[data-theme="light"][data-native="dark"] {
    filter: invert(1) hue-rotate(180deg);
    background: #ffffff;
}

html[data-theme="dark"]:not([data-native="dark"]) img,
html[data-theme="dark"]:not([data-native="dark"]) video,
html[data-theme="dark"]:not([data-native="dark"]) canvas,
html[data-theme="dark"]:not([data-native="dark"]) picture,
html[data-theme="dark"]:not([data-native="dark"]) iframe,
html[data-theme="dark"]:not([data-native="dark"]) embed,
html[data-theme="dark"]:not([data-native="dark"]) object,
html[data-theme="dark"]:not([data-native="dark"]) .theme-keep,
html[data-theme="dark"]:not([data-native="dark"]) [style*="url("],
html[data-theme="dark"]:not([data-native="dark"]) .lt-swatch,
html[data-theme="light"][data-native="dark"] img,
html[data-theme="light"][data-native="dark"] video,
html[data-theme="light"][data-native="dark"] canvas,
html[data-theme="light"][data-native="dark"] picture,
html[data-theme="light"][data-native="dark"] iframe,
html[data-theme="light"][data-native="dark"] embed,
html[data-theme="light"][data-native="dark"] object,
html[data-theme="light"][data-native="dark"] .theme-keep,
html[data-theme="light"][data-native="dark"] [style*="url("],
html[data-theme="light"][data-native="dark"] .lt-swatch {
    filter: hue-rotate(180deg) invert(1);
}

/* Appearance panel */
.lt-overlay {
    position: fixed; inset: 0; z-index: 100000;
    display: flex; align-items: center; justify-content: center;
    padding: 16px; background: rgba(15, 23, 42, 0.45);
}
.lt-overlay[hidden] { display: none; }
html[data-theme="dark"]:not([data-native="dark"]) .lt-overlay,
html[data-theme="light"][data-native="dark"] .lt-overlay { background: rgba(226, 232, 240, 0.5); }
.lt-panel {
    width: 100%; max-width: 380px; background: #ffffff; color: #1e293b;
    border-radius: 20px; padding: 20px; font-family: 'Inter', system-ui, sans-serif;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
}
.lt-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; font-size: 1.05rem; }
.lt-close { border: 0; background: transparent; font-size: 1.6rem; line-height: 1; color: #64748b; cursor: pointer; padding: 0 4px; }
.lt-label { font-size: 0.72rem; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: #64748b; margin: 14px 0 8px; }
.lt-modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.lt-mode, .lt-accent {
    border: 1.5px solid #e2e8f0; background: #f8fafc; color: #334155; border-radius: 14px;
    cursor: pointer; font-weight: 600; font-size: 0.85rem; transition: border-color .15s, background .15s;
}
.lt-mode { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 6px; }
.lt-mode i { font-size: 1.2rem; }
.lt-accents { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.lt-accent { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 2px; font-size: 0.7rem; }
.lt-swatch { width: 26px; height: 26px; border-radius: 50%; display: block; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.6); }
.lt-mode[aria-pressed="true"], .lt-accent[aria-pressed="true"] { border-color: #10b981; background: #ecfdf5; color: #065f46; }
.lt-mode:focus-visible, .lt-accent:focus-visible, .lt-close:focus-visible { outline: 2px solid #10b981; outline-offset: 2px; }
.lt-note { margin: 14px 0 0; font-size: 0.78rem; color: #64748b; }
@media (max-width: 400px) {
    .lt-accents { grid-template-columns: repeat(3, 1fr); }
}

/* Floating appearance button for pages that have no button in their navbar */
.lt-fab {
    position: fixed; left: 14px; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); z-index: 1040;
    width: 42px; height: 42px; border-radius: 50%; border: 1px solid rgba(100, 116, 139, 0.25);
    background: rgba(255, 255, 255, 0.92); color: #475569; font-size: 1.05rem;
    display: flex; align-items: center; justify-content: center; cursor: pointer;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.14); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.lt-fab[hidden] { display: none; }
.lt-fab.lt-fab-raised { bottom: calc(92px + env(safe-area-inset-bottom, 0px)); }
.lt-fab:focus-visible { outline: 2px solid #10b981; outline-offset: 2px; }
@media print { .lt-fab, .lt-overlay { display: none !important; } }

/* ==========================================================================
   Typography: one steady scale for every page.
   global-premium.css used to force h1..h6 to 2rem..1rem on phones (the h2 was 24px, the h3 21px), which
   crowded the cards. These sizes replace that scale; rules with a class selector (such as .card h2) still win.
   ========================================================================== */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; }
p, li, dd { line-height: 1.6; }
h1, h2, h3, h4, h5, h6 { line-height: 1.2; text-wrap: balance; }
p { text-wrap: pretty; }

@media (max-width: 768px) {
    html h1 { font-size: clamp(1.75rem, 7.5vw, 2.1rem) !important; }
    html h2 { font-size: clamp(1.35rem, 5.8vw, 1.65rem) !important; }
    html h3 { font-size: 1.2rem !important; }
    html h4 { font-size: 1.1rem !important; }
    html h5 { font-size: 1rem !important; }
    html h6 { font-size: .95rem !important; }
}

/* Long names wrap on two lines instead of being cut off with "..." */
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
