/* ==========================================================================
   churchit: page layout shared by every website theme
   Structure for the pages this app renders (home landing page, portal,
   sermon series, missions map) plus two fixes for frappe's web template.
   Colours come only from frappe's tokens (--primary-color, --heading-color,
   --text-muted, --border-color, ...), so a page follows whichever Website
   Theme is active. The Churchit theme's look lives in scss/website.scss.
   ========================================================================== */

/* ---- Breadcrumbs ------------------------------------------------------------
   Keep frappe's breadcrumbs (the portal's way back: form -> list -> My
   Account), but hide them on Web Page documents and the Contact Us page,
   where the lone "Home" crumb is clutter. */
.page-content-wrapper:has(.web-page-content) .page-breadcrumbs,
.page-content-wrapper:has(.contact-content) .page-breadcrumbs {
  display: none;
}

.web-page-content audio {
  width: 100%;
}

/* ---- Navbar menu button -----------------------------------------------------
   frappe's navbar strips the stroke from the toggler icon, a rule from its
   filled icon set; the lucide menu icon it ships now is stroke-only, so on a
   phone the button that holds the whole nav painted nothing. */
.navbar-light .navbar-toggler .icon {
  stroke: var(--icon-stroke);
}

/* ---- Navbar links on one line -----------------------------------------------
   The links show on the bar from 1200px (templates/includes/navbar/navbar.html)
   and go into the menu button below that. Keep each label on one line. Below
   1440px frappe's container is narrower, so the links sit closer there: the
   shipped menu with Home, Locations, Give and Members' Corner then fits on one
   row. A longer menu moves whole links to a second row instead. */
@media (min-width: 1200px) {
  .navbar-expand-xl .navbar-nav {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  .navbar-expand-xl .navbar-nav .nav-link {
    white-space: nowrap;
    padding-left: 0.375rem;
    padding-right: 0.375rem;
  }
}
@media (min-width: 1440px) {
  .navbar-expand-xl .navbar-nav .nav-link {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }
}
/* bootstrap takes the side padding off a collapsed navbar's container and
   frappe pads the navbar only up to 992px, so above that the brand touched
   the edge of the screen. Keep frappe's page gutter there. */
@media (min-width: 992.02px) and (max-width: 1199.98px) {
  .navbar-expand-xl > .container {
    padding-left: 2.5rem;
    padding-right: 2.5rem;
  }
}

/* ---- Phone menu -------------------------------------------------------------
   frappe repeats the whole portal sidebar inside the collapsed navbar, after
   the site links. A portal page already shows that menu as a sideways row
   under the navbar, so the collapsed navbar keeps only the site links. */
.navbar-collapse .navbar-nav > .d-block.d-lg-none {
  display: none !important;
}

/* The brand links home, so the menu button's list leaves out the Home link.
   A signed-in visitor's navbar on a multi-church site also holds Locations and
   Members' Corner (body.has-locations-menu, set by church_website/context.py),
   so Home leaves the bar below 1280px too, to keep the links on one row. */
@media (max-width: 1199.98px) {
  .navbar-collapse
    .nav-item:has(> .nav-link:is([href="/home"], [href^="/home?"], [href="/"], [href^="/?"])) {
    display: none;
  }
}
@media (max-width: 1279.98px) {
  body.has-locations-menu[frappe-session-status="logged-in"]
    .navbar-collapse
    .nav-item:has(> .nav-link:is([href="/home"], [href^="/home?"], [href="/"], [href^="/?"])) {
    display: none;
  }
}

/* ---- Navbar dropdowns in the menu button's list -----------------------------
   In the collapsed navbar a dropdown (Locations) opens as an indented list
   under its item. frappe makes each nav item a flex row of a fixed height, so
   the item grows and the menu wraps onto its own line instead of floating
   beside the item. */
@media (max-width: 1199.98px) {
  .navbar-collapse .navbar-nav .nav-item.dropdown {
    flex-wrap: wrap;
    height: auto;
    min-height: var(--navbar-height);
  }
  .navbar-collapse .dropdown-menu {
    position: static;
    float: none;
    flex-basis: 100%;
    background-color: transparent;
    box-shadow: none;
    border: 0;
    padding-left: 1rem;
  }
}
/* frappe centers the list above 576px, so the open dropdown is centered too. */
@media (min-width: 576.02px) and (max-width: 1199.98px) {
  .navbar-collapse .navbar-nav .nav-item.dropdown {
    justify-content: center;
  }
  .navbar-collapse .dropdown-menu {
    padding-left: 0;
    text-align: center;
  }
}

/* ---- Skip link --------------------------------------------------------------
   nav_active_state.js adds it as the first element of the page. It hides
   above the page, not to the left, which a right-to-left page could scroll to. */
.skip-link {
  position: absolute;
  top: -999px;
  left: 1rem;
}
.skip-link:focus {
  top: 1rem;
  z-index: 2000;
  padding: 0.5rem 1rem;
  background: var(--card-bg);
}

/* ---- Muted text -------------------------------------------------------------
   bootstrap's .text-muted and frappe's help text keep their own grays, which
   fail AA contrast on the page and card grounds; both follow the theme token. */
body .text-muted,
body .text-extra-muted,
body .help-box,
body .grid-empty {
  color: var(--text-muted) !important;
}

/* ---- Space before the footer ------------------------------------------------
   frappe's <main> has no bottom spacing, so the gap above the footer was
   whatever margin the page's last element happened to have: none on the
   home page. Give every page the same one. */
.page-content-wrapper > main {
  padding-bottom: 3rem;
}

/* ---- Footer ---------------------------------------------------------------
   templates/includes/footer/footer.html: church name and founding year on
   the left, copyright in the middle, phone and address on the right, then
   the footer links centred underneath. Replaces frappe's stacked logo /
   link / info blocks, which sit in 3rem of padding and a 140px minimum
   height even when empty. That minimum was also what kept frappe's flex
   body from squashing the footer under a tall page. */
.web-footer {
  padding: 2rem 0 1.5rem;
  min-height: 0;
  flex-shrink: 0;
  font-size: var(--text-sm);
  line-height: 1.6;
  color: var(--text-muted);
}
.web-footer .footer-top {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 1rem 2rem;
}
.web-footer .footer-identity {
  grid-column: 1;
}
.web-footer .footer-copyright {
  grid-column: 2;
  align-self: center;
  text-align: center;
}
.web-footer .footer-contact {
  grid-column: 3;
  text-align: right;
}
.web-footer .footer-church-name {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--heading-color);
}
.web-footer .footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem 1.5rem;
  margin-top: 1.5rem;
}
.web-footer .footer-links:first-child {
  margin-top: 0;
}
.web-footer .footer-top a,
.web-footer .footer-link {
  color: var(--text-muted);
}
.web-footer .footer-link {
  font-weight: 500;
}
.web-footer .footer-top a:hover,
.web-footer .footer-link:hover {
  color: var(--primary-color);
  text-decoration: none;
}
/* frappe's .container has no side padding from 576px to 991px, so the footer
   touched the edge of the screen at 768px. Up to 992px, use the gutter that
   frappe gives the page content (.page-content-wrapper .container). */
@media (min-width: 576px) and (max-width: 992px) {
  .web-footer > .container {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}
@media (max-width: 575.98px) {
  .web-footer .footer-top {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .web-footer .footer-identity,
  .web-footer .footer-copyright,
  .web-footer .footer-contact {
    grid-column: 1;
    text-align: center;
  }
  .web-footer .footer-copyright {
    order: 1;
  }
}
/* ---- Light/dark switch and dark mode ----------------------------------------
   theme_mode.js sets data-theme on <html>. frappe's website bundle flips only
   its Espresso surface/ink tokens for that attribute and leaves bootstrap's
   compiled colours alone, so this maps the tokens the layouts and frappe's own
   pages read onto that dark palette and re-skins the bootstrap parts the site
   uses. Moon means "go dark", sun means "go light". */
.theme-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border: 0;
  cursor: pointer;
}
.theme-switch-sun,
[data-theme="dark"] .theme-switch-moon {
  display: none;
}
[data-theme="dark"] .theme-switch-sun {
  display: inline;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg-color: var(--surface-base);
  --fg-color: var(--surface-elevation-1);
  --card-bg: var(--surface-elevation-1);
  --subtle-fg: var(--surface-gray-1);
  --subtle-accent: var(--surface-gray-2);
  --control-bg: var(--surface-gray-1);
  --heading-color: var(--ink-gray-9);
  --text-color: var(--ink-gray-8);
  --text-muted: var(--ink-gray-7);
  --text-light: var(--ink-gray-6);
  --border-color: var(--outline-gray-2);
  --dark-border-color: var(--outline-gray-3);
  --bg-light-gray: var(--subtle-fg);
  --primary-color: var(--ink-gray-9);
  /* the menu button and theme switch icons are stroked; frappe leaves this at
     its light-mode gray, invisible on the dark navbar */
  --icon-stroke: var(--ink-gray-8);
}
[data-theme="dark"] body {
  color: var(--text-color);
  background-color: var(--bg-color);
}
[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4,
[data-theme="dark"] h5,
[data-theme="dark"] h6,
[data-theme="dark"] .series-sermon-link,
[data-theme="dark"] .series-back,
/* map controls keep Leaflet's own colors on their white boxes */
[data-theme="dark"] a:not(.leaflet-container a),
[data-theme="dark"] a:not(.leaflet-container a):hover {
  color: var(--heading-color);
}
[data-theme="dark"] hr {
  border-top-color: var(--border-color);
}

/* navbar and footer */
[data-theme="dark"] .navbar-light {
  background: var(--bg-color);
  border-bottom-color: var(--border-color);
}
[data-theme="dark"] .navbar-light .navbar-brand,
[data-theme="dark"] .navbar-light .navbar-brand:hover,
[data-theme="dark"] .navbar-light .navbar-nav .nav-link:hover,
[data-theme="dark"] .navbar-light .navbar-nav .nav-link:focus,
[data-theme="dark"] .navbar-light .navbar-nav .active > .nav-link {
  color: var(--heading-color);
}
[data-theme="dark"] .navbar-light .navbar-nav .nav-link,
[data-theme="dark"] .navbar-light .navbar-toggler,
[data-theme="dark"] .web-footer,
[data-theme="dark"] .web-footer a {
  color: var(--text-muted);
}
[data-theme="dark"] .web-footer {
  border-top-color: var(--border-color);
}

/* surfaces, menus, controls */
[data-theme="dark"] .card,
[data-theme="dark"] .list-group-item,
[data-theme="dark"] .modal-content,
[data-theme="dark"] .dropdown-menu {
  color: var(--text-color);
  background-color: var(--card-bg);
  border-color: var(--border-color);
}
[data-theme="dark"] .card-header,
[data-theme="dark"] .card-footer {
  background-color: var(--subtle-fg);
  border-color: var(--border-color);
}
[data-theme="dark"] .dropdown-item {
  color: var(--text-color);
}
[data-theme="dark"] .dropdown-item:hover,
[data-theme="dark"] .dropdown-item:focus {
  color: var(--heading-color);
  background-color: var(--subtle-fg);
}
[data-theme="dark"] .form-control,
[data-theme="dark"] .custom-select,
[data-theme="dark"] .input-group-text {
  color: var(--text-color);
  background-color: var(--control-bg);
  border-color: var(--border-color);
}
[data-theme="dark"] .form-control:focus {
  color: var(--heading-color);
  background-color: var(--subtle-accent);
  border-color: var(--border-color);
}
[data-theme="dark"] .btn-primary {
  color: var(--surface-base);
  background-color: var(--ink-gray-9);
  border-color: var(--ink-gray-9);
}
[data-theme="dark"] .btn-secondary,
[data-theme="dark"] .btn-default {
  color: var(--text-color);
  background-color: var(--surface-gray-3);
  border-color: var(--surface-gray-3);
}
[data-theme="dark"] .table {
  color: var(--text-color);
}
[data-theme="dark"] .table th,
[data-theme="dark"] .table td {
  border-color: var(--border-color);
}
[data-theme="dark"] .portal-row a {
  color: var(--text-color);
}
[data-theme="dark"] .sidebar-item a.active {
  color: var(--heading-color);
  background-color: var(--subtle-accent);
}

/* ---- Switches ---------------------------------------------------------------
   bootstrap fills an "on" switch with frappe's compiled near-black, which
   disappears on a dark page. Fill it with the theme's primary colour; in dark
   mode that is light, so the knob takes the page colour. */
.custom-switch .custom-control-input:checked ~ .custom-control-label::before {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}
.custom-switch .custom-control-input:focus-visible ~ .custom-control-label::before {
  box-shadow: 0 0 0 3px rgba(67, 56, 202, 0.45);
}
[data-theme="dark"] .custom-switch .custom-control-input:focus-visible ~ .custom-control-label::before {
  box-shadow: 0 0 0 3px rgba(165, 180, 252, 0.6);
}
[data-theme="dark"] .custom-switch .custom-control-input:checked ~ .custom-control-label::after {
  background-color: var(--bg-color);
}

/* ---- Select arrows ----------------------------------------------------------
   frappe takes the browser's arrow off every select.form-control and draws its
   own only inside web form controls (.frappe-control), so the filters and
   pickers on the www pages looked like plain text boxes. */
.page_content select.form-control:not(.frappe-control select) {
  padding-right: 1.75rem;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%2364748b' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3e%3cpath d='M3 4.5l3 3 3-3'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  background-size: 0.75rem;
}

/* ---- Web forms --------------------------------------------------------------
   Nothing is saved yet on a new form, and a prefilled field shows frappe's
   "Not Saved" badge at once, so it reads only as a warning. */
body[data-path$="/new"] #not-saved-badge {
  display: none;
}
/* frappe styles a section description only in the desk, so on a web form it
   showed at body size, larger than the field labels, and indented past them. */
.web-form-wrapper .form-section-description {
  padding: 0;
  margin-bottom: 0.75rem;
  font-size: var(--text-sm, 13px);
  color: var(--text-muted);
}

/* ---- Headings on a phone ----------------------------------------------------
   frappe makes h1 to h4 smaller below 576px but leaves h5 at 1.25rem, so the
   section headings of a portal page came out larger than its title. */
@media (max-width: 575.98px) {
  main h5,
  main .h5 {
    font-size: 1rem;
    font-weight: 600;
  }
}

/* ---- Portal headings --------------------------------------------------------
   A portal page title is an h1 and its sections h2 or h3, so a screen reader
   can move through the page by headings. Each keeps the look of the heading it
   was: .my-account-header that of an h3, .my-account-section that of an h4,
   and bootstrap's .h5 and .h6 their own, without the top margin and letter
   spacing that frappe and the theme give the larger headings. */
h1.my-account-header,
h2.my-account-section {
  font-size: 1.2rem;
  line-height: 1.2;
  margin-top: 2rem;
  margin-bottom: 0.5rem;
}
h2.my-account-section {
  font-size: 1.1rem;
}
@media (min-width: 576px) {
  h1.my-account-header {
    font-size: 1.4rem;
    margin-top: 2.5rem;
  }
  h2.my-account-section {
    font-size: 1.3rem;
    margin-top: 2.5rem;
  }
}
@media (min-width: 1200px) {
  h1.my-account-header {
    font-size: 1.9rem;
    margin-top: 3.5rem;
  }
  h2.my-account-section {
    font-size: 1.5rem;
    margin-top: 3rem;
  }
}
h2.h5,
h3.h5,
h2.h6 {
  margin-top: 0;
  letter-spacing: inherit;
}

/* ---- Account menu ---------------------------------------------------------
   v16 renders the navbar avatar dropdown (My Account / Log out) with an inline
   display:none and reveals it via client JS after load. Key it off the
   server-rendered session attribute instead so it can never fail to appear. */
body[frappe-session-status="logged-in"] #website-post-login {
  /* flex, not list-item: frappe centers the avatar via .logged-in's flex */
  display: flex !important;
}
body[frappe-session-status="logged-in"] .btn-login-area {
  display: none !important;
}
/* the avatar inside the dropdown is also JS-injected; show a placeholder
   until (or in case) the script doesn't fill it */
#website-post-login .user-image-wrapper:empty::before {
  content: "👤";
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-color);
  font-size: 0.95rem;
}

/* ---- Home landing page ------------------------------------------------------
   The home Web Page is a landing page rather than a card grid: a two-column
   hero, a stats strip, and panels for the latest sermon and what is coming
   up. The panels reuse .card, so the active theme's card look applies. The
   Web Page record sets text-align: Center on the article, so blocks that read
   left declare it. */
#home .home-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary-color);
  background: color-mix(in srgb, var(--primary-color) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--primary-color) 22%, transparent);
  padding: 0.4em 0.9em;
  border-radius: 999px;
}

#home .home-hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: center;
  padding: clamp(1.5rem, 5vw, 3.5rem) 0 clamp(2rem, 5vw, 3.5rem);
}
/* the second column only exists when there is a gathering to put in it */
#home .home-hero:has(.home-aside) {
  grid-template-columns: 1.05fr 0.95fr;
}
#home .home-hero-copy {
  text-align: left;
}
#home .home-title {
  font-size: clamp(2.1rem, 4.6vw, 3.4rem);
  line-height: 1.12;
  margin: 0.7rem 0 0.6rem;
}
#home .home-lead {
  font-size: clamp(1.02rem, 1.6vw, 1.2rem);
  color: var(--text-muted);
  max-width: 46ch;
  margin-bottom: 0;
}
#home .home-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.6rem;
}
#home .home-btn-ghost {
  color: var(--heading-color);
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  font-weight: 600;
}

/* hero side panel: the next gathering, or a welcome note when nothing is scheduled */
#home .home-aside {
  text-align: left;
}
#home .home-aside-label,
#home .home-schedule-date {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--primary-color);
}
#home .home-aside-title {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: inherit;
  color: var(--heading-color);
  letter-spacing: -0.02em;
  margin: 0.35rem 0 0.2rem;
}
#home .home-aside-when {
  font-weight: 600;
  color: var(--text-color);
}
#home .home-aside-text {
  color: var(--text-muted);
  margin: 0.7rem 0 0;
}
#home .home-aside-where {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin-top: 0.7rem;
}
#home .home-aside-link {
  display: inline-block;
  margin-top: 1rem;
  font-weight: 700;
  color: var(--primary-color);
  text-decoration: none;
}
#home .home-aside-link:hover {
  text-decoration: underline;
}

/* stats strip, flex not grid: a theme's card ::before accent bar would
   occupy every auto-fit track and stop the empty ones collapsing */
#home .home-stats {
  display: flex;
  /* .card is itself a column flexbox, so the direction has to be reset */
  flex-direction: row;
  flex-wrap: wrap;
}
#home .home-stats::before {
  flex: 0 0 100%;
}
#home .home-stat {
  flex: 1 1 140px;
  padding: 1.4rem 1rem;
}
#home .home-stat + .home-stat {
  border-left: 1px solid var(--border-color);
}
#home .home-stat-number {
  font-size: clamp(1.7rem, 3.4vw, 2.4rem);
  font-weight: 700;
  color: var(--heading-color);
  letter-spacing: -0.03em;
  line-height: 1.1;
}
#home .home-stat-label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

#home .home-section {
  padding: clamp(2.2rem, 6vw, 4rem) 0 0;
}
#home .home-about-text {
  max-width: 68ch;
  margin: 1rem auto 0;
  text-align: left;
  font-size: 1.05rem;
}
#home .home-split {
  display: grid;
  gap: 1.1rem;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
#home .home-panel {
  text-align: left;
}
#home .home-panel-title {
  font-size: 1.25rem;
  margin: 0.7rem 0 0.2rem;
}
#home .home-panel-meta {
  color: var(--text-muted);
  font-size: 0.92rem;
}
#home .home-panel-text {
  color: var(--text-muted);
  margin: 0.7rem 0 0;
}

#home .home-schedule {
  list-style: none;
  padding: 0;
  margin: 0.9rem 0 0;
}
#home .home-schedule li {
  display: grid;
  grid-template-columns: 7.5rem 1fr auto;
  gap: 0.6rem;
  align-items: baseline;
  padding: 0.6rem 0;
  border-top: 1px solid var(--border-color);
}
#home .home-schedule li:first-child {
  border-top: none;
}
#home .home-schedule-name {
  font-weight: 600;
  color: var(--heading-color);
}
#home .home-schedule-time {
  color: var(--text-muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

/* four stats wrap below this width, so two to a row, with a divider between
   the rows instead of a stray one left of a stat that wrapped */
@media (max-width: 767.98px) {
  #home .home-stat {
    flex-basis: 50%;
  }
  #home .home-stat + .home-stat {
    border-left: 0;
  }
  #home .home-stat:nth-child(even) {
    border-left: 1px solid var(--border-color);
  }
  #home .home-stat:nth-child(n + 3) {
    border-top: 1px solid var(--border-color);
  }
}

@media (max-width: 900px) {
  #home .home-hero:has(.home-aside) {
    grid-template-columns: 1fr;
  }
  #home .home-schedule li {
    grid-template-columns: 6.5rem 1fr;
  }
  #home .home-schedule-time {
    grid-column: 2;
  }
}

/* ---- Portal landing (/portal) --------------------------------------------- */
.portal-home {
  padding: 1rem 0 2rem;
}
.portal-home .lead {
  color: var(--text-muted);
  font-size: 1.1rem;
  max-width: 52ch;
}
.portal-home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr));
  align-items: start;
  gap: 1rem;
  margin-top: 1.5rem;
}
.portal-home-section {
  padding-bottom: 0.5rem;
}
.portal-home-section-title {
  margin: 1rem 1.25rem 0.5rem;
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.portal-home-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0 0.5rem;
  padding: 0.625rem 0.75rem;
  border-radius: var(--border-radius-md, 8px);
  color: var(--heading-color);
  text-decoration: none;
}
.portal-home-link:hover,
.portal-home-link:focus-visible {
  background: var(--subtle-fg, rgba(0, 0, 0, 0.04));
  color: var(--heading-color);
  text-decoration: none;
}
.portal-link-icon {
  flex-shrink: 0;
  stroke: var(--primary-color);
}
.portal-link-text {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}
.portal-card-title {
  font-weight: 600;
}
.portal-link-description {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.4;
}
.portal-card-arrow {
  color: var(--primary-color);
  transition: transform 0.15s ease;
}
.portal-home-link:hover .portal-card-arrow {
  transform: translateX(3px);
}

/* ---- Portal sidebar ---------------------------------------------------------
   frappe's web sidebar, listing the Portal Settings menu on pages that set
   show_sidebar. frappe gives it a col-sm-2 column and hides it below the
   desktop breakpoint. Below that breakpoint it is a row of links that scrolls
   sideways, the one portal menu on a phone (see "Phone menu"); above it, a
   fixed-width column. */
.web-sidebar .sidebar-item a:hover {
  /* frappe's hover is a compiled near-black, unreadable in dark mode */
  color: var(--heading-color);
}
.web-sidebar .sidebar-items > ul + ul {
  border-top: 1px solid var(--border-color);
  margin-top: 0.5rem;
  padding-top: 0.5rem;
}
@media (min-width: 992px) {
  .row > .sidebar-column {
    flex: 0 0 16rem;
    max-width: 16rem;
  }
  .row > .main-column {
    flex: 1 1 0;
    max-width: none;
    min-width: 0;
  }
}
/* The page's own container sits inside the outer one; one gutter is enough.
   A web form also centres its page in 800px with gutters of its own: start it
   at the left, as the www portal pages do, so the content does not jump
   sideways between neighbouring menu items. */
.row > .main-column main.container,
.row[data-doctype="Web Form"] > .main-column .page_content {
  padding-left: 0;
  padding-right: 0;
}
.row[data-doctype="Web Form"] > .main-column .page_content {
  max-width: none;
  margin-left: 0;
  margin-right: 0;
}
/* A web form list drops its card frame, like the www portal pages. Specific
   enough to beat frappe's own rule. */
.row[data-doctype="Web Form"] > .main-column .page_content .web-list-container {
  min-height: 0;
  padding: 0;
  border: 0;
}
.web-list-header .web-list-title,
.web-list-header .web-list-title h1 {
  white-space: normal;
  overflow: visible;
}
/* web_form_lists.js adds the form's introduction and marks a list that cannot
   delete, which has nothing to select */
.web-list-introduction {
  flex: 0 0 100%;
  color: var(--text-muted);
}
.web-list-introduction p:last-child,
.web-list-introduction blockquote:last-child {
  margin-bottom: 0;
}
.web-list-without-delete .web-list-table tr > :first-child {
  display: none;
}
@media (max-width: 575.98px) {
  /* the row number takes room a phone does not have */
  .web-list-table tr > :nth-child(2) {
    display: none;
  }
}
@media (max-width: 991.98px) {
  /* frappe's .container has no padding to absorb the row's negative margins,
     so the page scrolled sideways once the container filled the screen */
  .row:has(> .sidebar-column) {
    margin-left: 0;
    margin-right: 0;
  }
  .row > .sidebar-column,
  .row > .main-column {
    flex: 0 0 100%;
    max-width: 100%;
  }
  .row > .sidebar-column {
    display: block;
  }
  .sidebar-column .web-sidebar {
    position: static;
    padding-top: 1rem;
  }
  .sidebar-column .sidebar-items {
    display: flex;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .sidebar-column .sidebar-items > ul {
    display: flex;
    gap: 0.25rem;
    margin: 0;
  }
  .web-sidebar .sidebar-items > ul + ul {
    border-top: 0;
    border-left: 1px solid var(--border-color);
    margin: 0 0 0 0.25rem;
    padding: 0 0 0 0.25rem;
  }
  .sidebar-column .sidebar-item a {
    margin-top: 0;
    white-space: nowrap;
  }
}
@media (max-width: 575.98px) {
  /* frappe's container has a gutter only on a phone, where the stacked
     columns' own gutters would only push the page further in */
  .row > .sidebar-column,
  .row > .main-column {
    padding-left: 0;
    padding-right: 0;
  }
}

/* ---- Recipient search (prayer-request web form) -----------------------------
   The form's client script builds this list itself; colours come from the
   same tokens as frappe's Link-field dropdown so it follows the theme. */
.recipient-search-results {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 4;
  margin: 0;
  padding: var(--padding-xs);
  list-style: none;
  max-height: 180px;
  overflow-y: auto;
  color: var(--text-color);
  background-color: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-md);
}
.recipient-search-results li {
  padding: var(--padding-sm);
  border-radius: var(--border-radius);
  cursor: pointer;
}
.recipient-search-results li:hover {
  background-color: var(--awesomplete-hover-bg);
}

/* ---- Sermon series cards (sermons template) ------------------------------- */
.series-tag {
  font-size: 0.7em;
  font-weight: 700;
  color: var(--bg-color);
  background: var(--primary-color);
  border-radius: 999px;
  padding: 2px 10px;
  white-space: nowrap;
}
.series-sermon-list li { border-bottom: 1px solid var(--border-color); }
.series-sermon-list li:last-child { border-bottom: none; }
/* buttons that open and close a sermon in a series card, drawn as links */
.series-sermon-link {
  display: block;
  width: 100%;
  padding: 8px 6px;
  border: 0;
  background: none;
  text-align: inherit;
  letter-spacing: inherit;
  color: var(--primary-color);
  font-weight: 600;
  text-decoration: none;
  border-radius: 8px;
  transition: background 0.15s ease;
}
.series-sermon-link:hover {
  background: color-mix(in srgb, var(--primary-color) 8%, transparent);
  color: var(--primary-color);
  text-decoration: none;
}
.series-back {
  display: inline-block;
  margin-bottom: 6px;
  padding: 0;
  border: 0;
  background: none;
  letter-spacing: inherit;
  color: var(--primary-color);
  text-decoration: none;
}

/* ---- Missions map (missions.html) ----------------------------------------- */
.missions-map-card {
  margin-bottom: 2rem;
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  box-shadow: var(--card-shadow);
}
.missions-map {
  height: 420px;
  width: 100%;
  z-index: 1;
}
.missions-map-pin {
  display: flex;
  align-items: center;
  justify-content: center;
}
.missions-map-pin img {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  background: #fff;
}
.missions-map-popup {
  min-width: 140px;
}
.missions-map-popup-title {
  font-weight: 600;
  color: var(--heading-color);
  margin-bottom: 2px;
}
.missions-map-popup-country {
  color: var(--text-muted);
  font-size: 0.85em;
}
.missions-map-notice {
  text-align: center;
  margin-top: 10px;
}
.missions-map-pill {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 999px;
  background: var(--subtle-fg);
  color: var(--text-muted);
  font-size: 0.8em;
  font-weight: 600;
}

/* ---- Reduced motion ---------------------------------------------------------
   The Churchit theme lifts its buttons on hover and the portal card arrow
   slides. The theme's rules are more specific, so these use !important. */
@media (prefers-reduced-motion: reduce) {
  .page_content .btn-primary,
  #home .home-btn-ghost,
  .portal-card-arrow {
    transition: none !important;
  }
  .page_content .btn-primary:hover,
  #home .home-btn-ghost:hover,
  .portal-home-link:hover .portal-card-arrow {
    transform: none !important;
  }
}
