/* The app shell's left sidebar (islands/app components/Sidebar.tsx), on
   desktops and large tablets only (owner, 2026-11-11). Below 1024px it is
   never shown and nothing here applies: phones and small tablets keep the app
   bar, its tile launcher and Home's tiles.

   <html class="mdb-side"> turns the layout on. public/js/theme.js sets it
   before first paint from the last page's answer, so the column is reserved
   (and the app bar hidden) before the island decides; the island then keeps
   or drops it (lib/sidebarLayout.ts).

   Fixed light values, as the app bar's CSS (shared-components.js): the
   design-tokens vars flip under prefers-color-scheme, the web's Light does
   not. Dark (Settings > Appearance) is the block at the end, the pairs
   app-dark.css uses. Values from the mockup: 256px column, 44px rows,
   secondaryBackground panel, accentDark active text on a white row with a
   3px accent rail. */

.mdb-sidebar { display: none; }

@media (min-width: 1024px) {
  html.mdb-side body { padding-left: 256px; }
  html.mdb-side #shared-header,
  html.mdb-side #shared-footer { display: none; }
  /* The panel's ground, there from first paint while the chunk loads. */
  html.mdb-side body::before {
    content: ""; position: fixed; inset: 0 auto 0 0; width: 256px; z-index: 39;
    background: #F8F6F4; border-right: 1px solid #E0DDD8;
  }
  /* The cookie banner (consent.js) sits beside the panel, not over its Sign in. Inline left:0, hence !important. */
  html.mdb-side #mdb-consent-banner { left: 256px !important; }
  /* Narration (devotional, Rosary): the docked player, the sample banner and
     the voice glow span the column beside the panel, so the player centres
     under the text and the glow runs from the panel to the window's right
     edge. The glow's left:0 is inline, hence !important. */
  html.mdb-side [data-narration-dock],
  html.mdb-side [data-testid="narration-sample-banner"],
  html.mdb-side [data-testid="voice-glow"] { left: 256px !important; }
  /* Full-bleed pages (Timeline, Map) span the column beside the sidebar, not the window. */
  html.mdb-side [data-testid="app-page-full"] {
    width: calc(100vw - 256px);
    margin-left: calc(50% - 50vw + 128px);
  }

  .mdb-sidebar {
    color-scheme: light;
    display: flex; flex-direction: column;
    position: fixed; inset: 0 auto 0 0; width: 256px; z-index: 40;
    padding: 1rem .75rem;
    background: #F8F6F4; border-right: 1px solid #E0DDD8;
    color: #3F414E; font-size: .9375rem;
  }
}

.mdb-side-skip {
  position: absolute; left: .75rem; top: -4rem; z-index: 2;
  padding: .5rem .75rem; border-radius: .5rem; background: #6B3FA0; color: #FFFFFF; font-weight: 700;
}
.mdb-side-skip:focus { top: .75rem; }

.mdb-side-brand {
  display: flex; align-items: center; gap: .5rem; min-height: 44px; padding: 0 .5rem;
  font-weight: 800; font-size: 1.0625rem; color: #111111; text-decoration: none;
}
.mdb-side-brand img { width: 28px; height: 28px; border-radius: 22.37%; }

.mdb-side-search {
  display: flex; align-items: center; gap: .5rem; min-height: 44px; margin: .75rem 0; padding: 0 .75rem;
  background: #FFFFFF; border: 1px solid #E0DDD8; border-radius: .75rem; color: #6B7280;
}
.mdb-side-search:focus-within { border-color: #8A5FC0; box-shadow: 0 0 0 2px #8A5FC0; }
.mdb-side-search input {
  border: 0; outline: 0; font: inherit; font-size: .875rem; width: 100%; min-height: 42px;
  background: transparent; color: #3F414E;
}
.mdb-side-search input::placeholder { color: #6B7280; }
/* The field's ring is the box's (focus-within above), not a second one inside it. */
.mdb-sidebar .mdb-side-search input:focus-visible { outline: none; }

.mdb-side-scroll { flex: 1; overflow-y: auto; min-height: 0; margin: 0 -.25rem; padding: 0 .25rem; }
.mdb-side-nav h3 {
  font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  margin: 1rem .75rem .25rem; color: #3F414E;
}
.mdb-side-row {
  display: flex; align-items: center; gap: .75rem; min-height: 44px; padding: 0 .75rem;
  border-radius: .75rem; text-decoration: none; color: #3F414E; font-weight: 500;
}
a.mdb-side-row:hover { background: #FFFFFF; }
.mdb-side-row.is-on {
  background: #FFFFFF; color: #6B3FA0; font-weight: 700; box-shadow: inset 3px 0 0 #8A5FC0;
}
.mdb-side-row.is-soon { cursor: default; }
.mdb-side-row.is-soon .mdb-side-label { opacity: .75; }
.mdb-side-mark { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.mdb-side-label { flex: 1; min-width: 0; }
.mdb-side-badge {
  font-size: .6875rem; font-weight: 700; padding: 1px 6px; border-radius: 9999px; border: 1px solid #E0DDD8;
}

/* A seasonal row's mark (the Jesse Tree in Advent): Advent's violet, tinted. */
.mdb-side-badge.is-season { border-color: transparent; background: #EFE9F6; color: #5A3D85; }
html[data-theme="dark"] .mdb-side-badge.is-season { background: #3A2F4A; color: #C9B3E8; }

.mdb-side-premium {
  display: block; margin: .5rem 0; padding: .75rem 1rem; border-radius: .75rem;
  background: #FFF8E1; border: 1px solid #B591DE; color: #6B3FA0; font-weight: 800; text-decoration: none;
}
.mdb-side-premium:hover { border-color: #8A5FC0; }
.mdb-side-premium small { display: block; font-weight: 500; color: #3F414E; }

.mdb-side-foot {
  border-top: 1px solid #E0DDD8; padding-top: .5rem; display: flex; flex-direction: column; gap: .25rem;
}
.mdb-side-link {
  display: flex; align-items: center; gap: .5rem; min-height: 44px; padding: 0 .75rem; border-radius: .75rem;
  color: #3F414E; text-decoration: none; font: inherit; background: none; border: 0; text-align: left; cursor: pointer;
}
.mdb-side-link:hover { background: #FFFFFF; }
.mdb-side-link.is-on { background: #FFFFFF; color: #6B3FA0; font-weight: 700; }
.mdb-side-link img { width: 24px; height: 24px; border-radius: 9999px; object-fit: cover; }
.mdb-side-signin {
  display: flex; align-items: center; justify-content: center; min-height: 44px; margin-top: .25rem;
  border-radius: 9999px; background: #6B3FA0; color: #FFFFFF; font-weight: 700; text-decoration: none;
}
.mdb-side-signin:hover { background: #5A3488; }
.mdb-side-note { font-size: .75rem; line-height: 1.4; padding: 0 .5rem; }
.mdb-side-pair { display: flex; align-items: center; justify-content: space-between; gap: .25rem; }
.mdb-side-pair .mdb-side-link { flex: 1; }
.mdb-side-pair .mdb-side-signin { flex: 1; margin-top: 0; }
.mdb-side-me { min-height: 52px; min-width: 0; }
.mdb-side-me img, .mdb-side-initial { flex: none; width: 32px; height: 32px; border-radius: 9999px; }
.mdb-side-initial { display: inline-flex; align-items: center; justify-content: center; background: #EFE7F8; color: #6B3FA0; font-weight: 700; }
.mdb-side-who { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.mdb-side-who > span { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mdb-side-who small { font-size: .75rem; color: #6B6E7B; }
.mdb-side-chev { flex: none; margin-left: auto; color: #9A9CA8; }
.mdb-side-gear {
  flex: none; width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: .75rem; color: #3F414E;
}
.mdb-side-gear:hover { background: #FFFFFF; }
.mdb-side-gear.is-on { background: #FFFFFF; color: #6B3FA0; }
.mdb-sidebar :focus-visible { outline: 2px solid #6B3FA0; outline-offset: 2px; }

/* Dark (Settings > Appearance), app-dark.css's pairs. */
@media (min-width: 1024px) {
  html[data-theme="dark"].mdb-side body::before { background: #2C2C2E; border-color: #3A3A3C; }
  html[data-theme="dark"] .mdb-sidebar { color-scheme: dark; background: #2C2C2E; border-color: #3A3A3C; color: #F2F2F7; }
}
html[data-theme="dark"] .mdb-side-brand { color: #F2F2F7; }
html[data-theme="dark"] .mdb-side-search { background: #1C1C1E; border-color: #3A3A3C; color: #B0B3C0; }
html[data-theme="dark"] .mdb-sidebar .mdb-side-search input[type="search"] { color: #F2F2F7; background-color: transparent; border: 0; }
html[data-theme="dark"] .mdb-side-search input::placeholder { color: #B0B3C0; }
html[data-theme="dark"] .mdb-side-nav h3,
html[data-theme="dark"] .mdb-side-row,
html[data-theme="dark"] .mdb-side-link,
html[data-theme="dark"] .mdb-side-gear,
html[data-theme="dark"] .mdb-side-premium small { color: #F2F2F7; }
html[data-theme="dark"] a.mdb-side-row:hover,
html[data-theme="dark"] .mdb-side-link:hover,
html[data-theme="dark"] .mdb-side-gear:hover,
html[data-theme="dark"] .mdb-side-gear.is-on,
html[data-theme="dark"] .mdb-side-row.is-on,
html[data-theme="dark"] .mdb-side-link.is-on { background: #1C1C1E; }
html[data-theme="dark"] .mdb-side-row.is-on,
html[data-theme="dark"] .mdb-side-link.is-on,
html[data-theme="dark"] .mdb-side-premium,
html[data-theme="dark"] .mdb-side-gear.is-on { color: #B591DE; }
html[data-theme="dark"] .mdb-side-row.is-on { box-shadow: inset 3px 0 0 #B591DE; }
html[data-theme="dark"] .mdb-side-badge,
html[data-theme="dark"] .mdb-side-foot { border-color: #3A3A3C; }
html[data-theme="dark"] .mdb-side-premium { background: #3D3523; border-color: #8A5FC0; }
html[data-theme="dark"] .mdb-side-who small { color: #B0B3C0; }
html[data-theme="dark"] .mdb-side-initial { background: #3A2F4A; color: #B591DE; }
html[data-theme="dark"] .mdb-sidebar :focus-visible { outline-color: #B591DE; }

/* Settings switches (routes/Settings.tsx, the email row): a checkbox drawn as the app's toggle. */
.mdb-switch {
  appearance: none; -webkit-appearance: none; flex: none; position: relative; width: 51px; height: 31px; margin: 0;
  border-radius: 9999px; background: #E0DDD8; cursor: pointer; transition: background-color .2s;
}
.mdb-switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 9999px;
  background: #FFFFFF; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s;
}
.mdb-switch:checked { background: #6B3FA0; }
.mdb-switch:checked::after { transform: translateX(20px); }
.mdb-switch:disabled { opacity: .5; cursor: default; }
.mdb-switch:focus-visible { outline: 2px solid #6B3FA0; outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .mdb-switch, .mdb-switch::after { transition: none; } }
html[data-theme="dark"] .mdb-switch { background: #48484A; }
html[data-theme="dark"] .mdb-switch:checked { background: #8A5FC0; }
html[data-theme="dark"] .mdb-switch:focus-visible { outline-color: #B591DE; }
/* In-app legal pages: the published article's prose, without the site's Tailwind typography. */
.mdb-legal h2 { font-size: 1.375rem; font-weight: 700; margin: 2rem 0 .75rem; }
.mdb-legal h3 { font-size: 1.125rem; font-weight: 600; margin: 1.5rem 0 .5rem; }
.mdb-legal p, .mdb-legal li { line-height: 1.7; color: #3F414E; }
.mdb-legal p { margin: 0 0 1rem; }
.mdb-legal ul, .mdb-legal ol { margin: 0 0 1rem 1.25rem; list-style: disc; }
.mdb-legal ol { list-style: decimal; }
.mdb-legal a { color: #6B3FA0; text-decoration: underline; }
html[data-theme="dark"] .mdb-legal p, html[data-theme="dark"] .mdb-legal li { color: #D1D1D6; }
html[data-theme="dark"] .mdb-legal a { color: #B591DE; }
