/* Modern CSS reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Custom properties with updated modern colors */
:root {
  --primary-color: #2C3E50;
  --secondary-color: #34495E;
  --accent-color: #E67E22;
  --text-color: #2C3E50;
  --background-color: #F5F6F7;
  --container-width: 1200px;
  --spacing-unit: 1rem;
  --transition-speed: 0.3s;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

.mobile-hide {
  display: inline;
}

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

body {
  font-family: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.7;
  color: var(--text-color);
  background-color: var(--background-color);
  padding-top: 110px;
}

/* Modern container */
#container {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 var(--spacing-unit);
}

/* Header and Navigation */
.header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  background: linear-gradient(rgba(44, 62, 80, 0.95), rgba(44, 62, 80, 0.95)), url('../images/navbkgd2.jpg');
  background-size: cover;
  background-position: center;
  box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

#topNav {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0;
  gap: 4rem;
  height: 45px;
  width: 100%;
  max-width: 900px;
  margin: 0;
  transform: none;
  position: static;
}

.nav-container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  backdrop-filter: blur(5px);
}

.nav-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0rem;
  transition: all 0.3s ease;
  height: 60px;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}

/* Scrolled state */
.header.scrolled .nav-content {
    margin-top: -65px;
}

.site-title {
    font-family: 'Cinzel', serif;
    color: white;
    font-size: 2rem;
    text-align: left;
    margin: 0;
    line-height: 1;
    transition: all 0.3s ease;
    text-decoration: none;
    font-weight: 600;
    white-space: nowrap;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}

.site-title:hover {
    color: var(--accent-color);
}

#topNav a {
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.8px;
  position: relative;
  padding: 0.5rem 0;
  transition: color 0.2s ease, transform 0.2s ease;
}

#topNav a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 2px;
  background: var(--accent-color);
  transition: width 0.3s ease;
}

#topNav a:hover {
  transform: translateY(-1px);
  color: var(--accent-color);
}

#topNav a:hover::after {
  width: 100%;
}


/* Search box styling */
.search-container {
    width: 250px;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255,255,255, 0.1);
    border-radius: 8px;
    padding: 0.4rem 0.75rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.search-box:hover {
    background: rgba(255, 255, 255, 0.12);
}

.search-box.loading .search-icon {
  animation: spin 1s linear infinite;
}

.search-input {
    width: 100%;
    padding: 0.35rem 2rem 0.35rem 0.5rem;
    background: transparent;
    border: none;
    color: white;
    outline: none;
    font-size: 0.95rem;
    font-weight: 400;
    letter-spacing: 0.3px;
}

.search-input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.search-icon {
    position: absolute;
    right: 0.75rem;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-icon svg {
    width: 14px;
    height: 14px;
}

.clear-button {
    position: absolute;
    right: 2.25rem;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    padding: 0;
    display: none;
    font-size: 1.1rem;
}

.clear-button:hover {
    color: white;
}

/* Menu toggle button - Hidden by default for desktop */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    z-index: 1004;
    position: relative;
  }

.menu-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: white;
    margin: 4px 0;
    transition: all 0.3s ease;
}

.menu-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: transparent; 
  z-index: 1002;
  opacity: 1; 
  transition: opacity 0.3s ease;
}
.menu-overlay.active {
  display: block;
  opacity: 1;
}

/* Content area styling */
#content {
  max-width: 720px;
  margin: 4rem auto;
  padding: 0 2rem;
}

#supportingText {
  background-color: transparent;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
}

/* Typography */
h1 {
  font-size: 2.75rem;
  color: var(--primary-color);
  margin-bottom: 3rem;
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-align: center;
  position: relative;
  padding-bottom: 1rem;
  letter-spacing: -0.03rem;
}

h1::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 8rem;
  height: 3px;
  background: linear-gradient(to right, transparent, var(--accent-color), transparent);
  border-radius: 9999px;
  opacity: 0.8;
}

p {
  margin-bottom: 2rem;
  font-size: 1.15rem;
  color: rgba(44,62,80,0.9);
  max-width: 38em;
  line-height: 1.8;
  letter-spacing: 0.2px;
}

/* Link styles */
/* ">" so only the page's opening paragraph gets the drop cap, not the first <p> of every blockquote/list item */
#supportingText > p:first-of-type::first-letter {
  font-size: 4.2em;
  float: left;
  padding-right: 0.12em;
  line-height: 0.7;
  color: var(--accent-color);
  font-family: 'Cinzel', serif;
  margin-top: 0.1em;
  margin-right: 0.15em;
}

/* Enhanced link styling */
#supportingText a {
  color: var(--accent-color);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: all var(--transition-speed) ease;
  font-weight: 500;
  padding-bottom: 2px;
  background-image: linear-gradient(transparent 95%, var(--accent-color) 95%);
  background-repeat: no-repeat;
  background-size: 0% 100%;
  transition: background-size 0.3s ease;
}

#supportingText a:hover {
  border-bottom-color: var(--accent-color);
  color: var(--primary-color);
  background-size: 100% 100%;
  border-bottom-color: transparent;
}

/* Text emphasis */
strong {
  color: var(--primary-color);
  font-weight: 600;
}

em {
  font-style: italic;
  color: var(--secondary-color);
}


/* Mobile styles */
@media (max-width: 768px) {
    body {
        padding-top: 90px;
    }

    .mobile-hide {
      display: none;
  }

    .nav-container {
        padding: 0;
    }

    .nav-content {
        height: 55px;
        padding: 0.75rem;
        display: flex;
        padding-left: 0.70rem;
        justify-content: space-between;
        align-items: center;
        position: relative;
        gap: 1rem;
    }

    .header.scrolled .nav-content {
        transform: translateY(-100%);
    }

    .header.scrolled .menu-toggle {
      background: var(--primary-color);
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
      position: fixed;
      top: 1rem;
      left: 0.20rem;
      transform: none;
      background: var(--primary-color);
      border-radius: 4px;
      padding: 0.75rem;
      margin: 0;
  }

  #content {
    margin: 3rem auto;
    padding: 0 1.5rem;
}

  h1 {
    font-size: 2.5rem;
    margin-bottom: 2rem;
}

  p {
    font-size: 1.0625rem;
    margin-bottom: 1.75rem;
}
  

    .menu-toggle {
      position: absolute;
      top: 50%;
      left: 0.5rem;
      display: block;
      background: rgba(44,62,80,0.95);
      border-radius: 4px;
      padding: 0.5rem;
      margin-right: 1rem;
      transform: translateY(-50%);
  }

    .menu-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }

    .menu-toggle.active span:nth-child(2) {
        opacity: 0;
    }

    .menu-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(5px, -5px);
    }

    #topNav {
      position: fixed;
      top: 0;
      left: -110%;
      width: 80%;
      max-width: 300px;
      height: 100vh;
      flex-direction: column;
      padding: 5rem 1rem 1rem;
      transition: left 0.3s ease;
      justify-content: flex-start;
      gap: 0;
      z-index: 1003;
      background: linear-gradient(rgba(44, 62, 80, 0.98), rgba(44, 62, 80, 0.98)), url('../images/navbkgd2.jpg');
      background-size: cover;
      background-position: center;
      backdrop-filter: blur(10px);
      padding-top: 6rem;
  }


    #topNav.active {
        left: 0;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }

    #topNav a {
        padding: 1.2rem 1rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        width: 100%;
        display: block;
    }

    .site-title {
        font-size: 1.75rem;
        margin: 0 auto;
        padding-left: 2.5rem;
    }

    .search-input {
      padding: 0.35rem 1.75rem 0.35rem 0.25rem;
      font-size: 0.85rem;
    }

    .search-container {
        width: 160px;
        transition: width 0.3s ease;
    }

    .search-box {
      width: 0.4rem 0.5rem;
    }

    .search-container.expanded {
      width: 100%;
    }

    .search-icon {
      right: 0.5rem;
    }

    .clear-button {
      right: 1.75rem;
    }
    .nav-content.search-active .site-title {
      opacity: 0;
      visibility: hidden;
      position: absolute;
  }

  .nav-content.search-active .search-container {
      width: 100%;
  }

  }

/* Small mobile styles */
@media (max-width: 480px) {
    body {
        padding-top: 80px;
    }

    .site-title {
        font-size: 1.4rem;
    }

    .search-container {
        width: 160px;
    }

    #supportingText {
        padding: 1rem;
    }

    #content {
      margin: 2rem auto;
      padding: 0 1.25rem;
  }

    h1 {
        font-size: 2rem;
        margin-bottom: 1.75rem;
    }
    
    .search-container {
      width: 140px;
    }

    p {
      font-size: 1rem;
      margin-bottom: 1.5rem;
  }
}

/* Utility classes */
.strong {
    font-weight: 700;
}

.emphasis {
    font-style: italic;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

#supportingText {
  animation: fadeIn 0.8s ease-out;
}

/* ============================================================
   Additions for the FW/1 app (not in the original mock)
   ============================================================ */

/* ---- Two-column layout when a controller sets rc.sidebar ---- */
#content.has-sidebar {
  max-width: 1040px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 3rem;
  align-items: start;
}

#sideNav img:first-child {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
  margin-bottom: 1rem;
}

#sideNav ul {
  list-style: none;
}

#sideNav li {
  padding: 0.35rem 0;
  border-bottom: 1px solid rgba(44, 62, 80, 0.1);
}

#sideNav a {
  color: var(--primary-color);
  text-decoration: none;
}

#sideNav a:hover {
  color: var(--accent-color);
}

#sideNav p {
  font-size: 1rem;
  margin-bottom: 1rem;
}

@media (max-width: 900px) {
  /* Stack the sidebar under the content on narrow screens */
  #content.has-sidebar {
    display: block;
    max-width: 720px;
  }

  #sideNav {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(44, 62, 80, 0.15);
  }

  #sideNav img:first-child {
    display: none;
  }
}

/* ---- Page options (Facebook / email / print) from displayPageOptions() ---- */
#_docOptions {
  text-align: right;
  margin-bottom: 1rem;
}

#_docOptions a,
#supportingText #_docOptions a {
  background-image: none;
  padding: 0;
}

/* ---- Related content boxes (sermon/article views) ---- */
.relatedContent {
  float: right;
  width: 238px;
  margin: 0.5rem 0 1rem 1.5rem;
  border: 1px solid rgba(44, 62, 80, 0.15);
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
}

.relatedContent ul {
  list-style: none;
  padding: 0.5rem 0.75rem;
}

.relatedContent li {
  padding: 0.25rem 0;
  font-size: 0.95rem;
}

.relatedContent li.rcmt7,
.relatedContent li.seriesmt7 {
  display: none;
}

.relatedContentHeader {
  text-align: center;
  font-size: 1.05rem;
  color: #FFFFCC;
  background: #84171A;
  padding: 0.5rem;
}

@media (max-width: 600px) {
  .relatedContent {
    float: none;
    width: auto;
    margin: 1rem 0;
  }
}

/* ---- Newsletter / subscription pages ---- */
.newsletter {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
  margin-bottom: 2rem;
}

.newsletter img {
  flex: 0 0 auto;
}

.newsletter-forms {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
}

.newsletter-form {
  flex: 1 1 240px;
  padding: 1.25rem;
  background: #fff;
  border: 1px solid rgba(44, 62, 80, 0.15);
  border-radius: 8px;
}

.newsletter-form p,
.subscriptions p {
  font-size: 1rem;
  margin-bottom: 1rem;
}

.subscriptions input[type="email"],
.subscriptions input[type="text"],
.newsletter-form input[type="email"],
.newsletter-form select {
  width: 100%;
  max-width: 320px;
  padding: 0.4rem 0.5rem;
  font-size: 1rem;
}

.error {
  color: #B00020;
}

.highlight {
  background: #FFF4D6;
  padding: 0.5rem;
}

.smaller {
  font-size: 0.85em;
}

/* ---- Site search page ---- */
.site-search {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.site-search input[type="search"] {
  flex: 1;
  padding: 0.5rem 0.75rem;
  font-size: 1rem;
}

.site-search button {
  padding: 0.5rem 1.25rem;
  font-size: 1rem;
  cursor: pointer;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  clip: rect(0 0 0 0);
  overflow: hidden;
}

/* ---- Email-this-page dialog ---- */
#emailPageDialog {
  margin: auto;
  width: min(92vw, 420px);
  padding: 1.5rem;
  border: 1px solid rgba(44, 62, 80, 0.2);
  border-radius: 10px;
}

#emailPageDialog::backdrop {
  background: rgba(0, 0, 0, 0.45);
}

#emailPageDialog h2 {
  margin-bottom: 0.5rem;
}

#emailPageDialog p {
  font-size: 1rem;
  margin-bottom: 0.75rem;
}

#emailPageDialog input,
#emailPageDialog textarea {
  width: 100%;
  padding: 0.4rem 0.5rem;
  font-size: 1rem;
}

.email-page-close {
  position: absolute;
  top: 0.5rem;
  right: 0.75rem;
  background: none;
  border: none;
  font-size: 1.75rem;
  cursor: pointer;
}

.email-page-result {
  margin-bottom: 0.75rem;
}

/* ---- Library (views/library/*) ---- */
.library-topics {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.library-topics li {
  background: #fff;
  border: 1px solid rgba(44, 62, 80, 0.15);
  border-radius: 8px;
  overflow: hidden;
}

#supportingText .library-topics a {
  display: block;
  border-bottom: none;
  padding: 0;
}

.library-topic-name {
  display: block;
  padding: 0.75rem 1rem 0;
  font-size: 1.15rem;
  font-weight: 600;
}

.library-topics p {
  padding: 0.25rem 1rem 1rem;
  font-size: 0.95rem;
}

.topic-summary {
  font-style: italic;
  margin: 1rem 0 2rem;
  overflow: hidden;
}

.topic-summary img,
.resource-image {
  float: right;
  max-width: min(45%, 400px);
  height: auto;
  margin: 0.25rem 0 1rem 1.5rem;
  border-radius: 6px;
}

.resource-image img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}

.resource-image figcaption {
  font-size: 0.75rem;
  font-style: italic;
  text-align: center;
}

.type-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.type-filter button {
  padding: 0.35rem 0.9rem;
  font-size: 0.95rem;
  color: var(--primary-color);
  background: #fff;
  border: 1px solid rgba(44, 62, 80, 0.3);
  border-radius: 999px;
  cursor: pointer;
}

.type-filter button[aria-pressed="true"] {
  color: #fff;
  background: var(--primary-color);
  border-color: var(--primary-color);
}

.topic-resources .resource {
  padding: 1.25rem 0;
  border-bottom: 1px solid rgba(44, 62, 80, 0.12);
  overflow: hidden;
}

.topic-resources .resource > img {
  float: right;
  height: 125px;
  width: auto;
  margin: 0.25rem 0 0.5rem 1rem;
  border-radius: 6px;
}

.resource-type {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
}

.resource-desc.truncated {
  position: relative;
  max-height: 7.5em;
  overflow: hidden;
}

/* Fade the last lines of a truncated description */
.resource-desc.truncated::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3em;
  background: linear-gradient(rgba(245, 246, 247, 0), var(--background-color));
}

.toggle-desc {
  margin-top: 0.25rem;
  padding: 0;
  font-size: 0.95rem;
  color: var(--accent-color);
  background: none;
  border: none;
  cursor: pointer;
}

.byline {
  font-size: 1rem;
  margin-bottom: 1.5rem;
}

.other-languages {
  text-align: right;
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

/* ---- Sermon media players (ported from cgg.org/views/library/sermon.cfm) ---- */
.media-section {
  display: flex;
  flex-direction: column;
  gap: 15px;
  width: 100%;
  margin-bottom: 20px;
}

.sermonSectionLabel {
  font-weight: 800;
  font-variant: small-caps;
  font-size: 1.1em;
}

#video-player, #audio-player {
  width: 100%;
  max-width: 600px;
}

#audio-player .jw-flag-floating .jw-wrapper { height: 50px; }
#video-player .jw-flag-floating .jw-wrapper { height: 200px; }
#audio-player .jw-icon-fullscreen { display: none !important; }
#audio-player .jw-icon-settings { display: inline-flex !important; }
#audio-player,
#audio-player .jw-wrapper,
#audio-player .jw-controls { overflow: visible !important; }
.jw-icon-rewind { display: none !important; }
.jw-flag-audio-player .jw-controlbar .jw-icon-tooltip,
.jw-flag-audio-player .jw-controlbar .jw-icon-inline { display: flex; }
.jw-flag-audio-player .jw-controlbar .jw-text-countdown { display: none !important; }
.jwplayer .jw-time-tip { display: block; position: relative; height: 12px; }
.jw-state-idle .jw-controls { background-color: transparent !important; }
.jw-controls-backdrop { background: none !important; }

@media (min-width: 576px) and (max-width: 767px) {
  #video-player, #audio-player { width: 450px; height: auto; }
}

@media (min-width: 1024px) and (max-width: 1199px) {
  #video-player, #audio-player { width: 550px; }
}

@media (min-width: 1400px) {
  #video-player, #audio-player { width: 700px; }
}

@media (max-width: 767px) and (orientation: landscape) {
  #video-player, #audio-player { height: 200px; }
}

@media (max-width: 600px) {
  .topic-summary img,
  .resource-image {
    float: none;
    max-width: 100%;
    margin: 0 0 1rem;
  }
}

/* The reset at the top of this file zeroes blockquote margins; restore the indent (scripture quotes in transcripts) */
blockquote {
  margin: 0 clamp(1rem, 5vw, 2.5rem) 2rem;
}

/* ============================================================
   Berean signup overlay (ported from cgg.org/layouts/default.cfm).
   The cgg-only px type-scale block is omitted: this site's root
   font size is the browser default, so the rem values are correct.
   ============================================================ */

/* ---- Fixed darkening overlay ---- */
#berean-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0);
    z-index: 100001;
    pointer-events: none;
}
#berean-modal-overlay.active {
    pointer-events: auto;
}

/* ---- Fixed form container (anchored to bottom) ---- */
#berean-modal-container {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 100002;
    display: none;
    justify-content: center;
    align-items: flex-end;
    pointer-events: none;
    transform: translateY(100%);
    will-change: transform;
}
#berean-modal-container.ready {
    display: flex;
}

/* ---- The form card ---- */
#subscription-modal {
    position: relative;
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    padding: 2.2em 2em 1.6em;
    background: linear-gradient(to bottom, #fefefe, #f7f7f7);
    border: 1px solid #e0e0e0;
    border-bottom: none;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.25);
    text-align: center;
    color: #333;
    box-sizing: border-box;
    overflow-y: auto;
    max-height: 90vh;
    pointer-events: auto;
}

/* The slidebox already draws the card panel; flatten the injected .berean-box wrapper. */
#subscription-modal .berean-box {
    background: none;
    border: none;
    box-shadow: none;
    border-radius: 0;
    padding: 0;
    margin: 0;
    max-width: none;
    width: 100%;
}

#subscription-modal .berean-box { text-align: left; }
#subscription-modal .berean-head { text-align: center; }

/* ---- Card content ---- */
#subscription-modal .berean-logo { max-width: 190px; height: auto; margin: 0 auto 0.6em; display: block; }
#subscription-modal .berean-eyebrow {
    font: 600 0.8rem/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    letter-spacing: .06em; text-transform: uppercase; color: #6b7280; margin: 0 0 .35em;
}
#subscription-modal .berean-head {
    font: 600 1.7rem/1.2 Georgia, serif; color: #004080; margin: 0 0 .5em;
}
#subscription-modal .berean-head::after {
    /* the mock's h1 underline must not leak into the card title */
    display: none;
}
#subscription-modal .berean-sub {
    font: 1rem/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #374151; margin: 0 auto 1em; max-width: 34ch;
}
#subscription-modal .berean-sample {
    font: italic 1rem/1.5 Georgia, serif; color: #004080;
    border-left: 3px solid #cbd5e1; margin: 0 0 1.3em; padding: .2em 0 .2em 1em; text-align: left;
}
#subscription-modal .berean-sample cite {
    display: block; font-style: normal; margin-top: .4em; color: #6b7280;
    font: 0.8rem -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
#subscription-modal .berean-fineprint {
    font: .85rem/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #6b7280; margin: .9em 0 0;
}

/* ---- Form elements ---- */
#berean-email {
    width: 100%; box-sizing: border-box; padding: .85em 1em; font-size: 1rem;
    border: 1px solid #cbd5e1; border-radius: 8px; margin-bottom: .75em;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, .05);
    transition: border-color .15s, box-shadow .15s;
}
#berean-email:focus { outline: none; border-color: #004080; box-shadow: 0 0 0 3px rgba(0, 64, 128, .15); }

#subscribe-button {
    width: 100%; box-sizing: border-box; padding: .9em 1.2em; color: #fff;
    font: 600 1.05rem -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: #004080; border: none; border-radius: 8px; cursor: pointer;
    transition: background-color .18s, transform .05s;
}
#subscribe-button:hover { background: #00305f; }
#subscribe-button:active { transform: translateY(1px); }
#subscribe-button:focus-visible { outline: 3px solid rgba(0, 64, 128, .4); outline-offset: 2px; }

/* ---- In-flight indicator (htmx adds .htmx-request to the form) ---- */
#berean-form .berean-btn-busy { display: none; }
#berean-form.htmx-request .berean-btn-idle { display: none; }
#berean-form.htmx-request .berean-btn-busy { display: inline-block; }
#berean-form.htmx-request #subscribe-button { background: #00305f; cursor: progress; }
#subscribe-button[disabled] { opacity: .9; }
.berean-spinner {
    display: inline-block; width: 15px; height: 15px;
    margin-right: 9px; vertical-align: -2px;
    border: 2px solid rgba(255, 255, 255, .4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: berean-spin .6s linear infinite;
}
@keyframes berean-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
    .berean-spinner { animation-duration: 2s; }
}

#subscription-modal img {
    max-width: 100%;
    height: auto;
    max-height: 30vh;
}

/* ---- Close button (large touch target for mobile) ---- */
#close-modal-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    font-size: 2.4rem;
    line-height: 1;
    cursor: pointer;
    color: #9aa1ab;
    padding: 6px 12px;
    z-index: 10;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition: color 0.2s ease;
}
#close-modal-btn:hover,
#close-modal-btn:active,
#close-modal-btn:focus-visible {
    color: #333;
    outline: none;
}

/* ---- Mobile adjustments ---- */
@media (max-width: 768px) {
    #subscription-modal {
        max-height: 85vh;
        padding: 1.5em 1.2em 1.2em 1.2em;
        max-width: 100%;
        border-radius: 14px 14px 0 0;
    }
    #close-modal-btn {
        font-size: 2.8em;
        top: 4px;
        right: 4px;
        padding: 10px 14px;
    }
}

@media (max-width: 480px) {
    #subscription-modal {
        padding: 1.2em 1em 1em 1em;
    }
    #subscription-modal .berean-head { font-size: 1.45rem; }
}

@media (max-width: 320px) {
    #subscription-modal {
        padding: 0.8em 0.6em 0.8em 0.6em;
    }
}