:root {
  /* Colors */
  --bg: #faf6f0;
  --card-bg: #ffffff;
  --text: #2f2a24;
  --muted: #6c6459;
  --accent: #7a5c3e;
  --accent-light: #efe3d3;
  --border: #e3d9c8;
  --error: #b3261e;
  --error-bg: #fbeceb;
  --button-text: #fff;

  /* Typography */
  --font-size-heading: 1.75rem;
  --font-size-body: 1rem;
  --font-size-small: 0.85rem;
  --font-size-disclaimer: 0.8rem;
  --font-size-button: 1.05rem;
  --font-size-error: 0.95rem;
  --font-weight-button: 600;
  --text-align-header: center;

  /* Section layout */
  --max-width: 640px;
  --padding-top: 32px;
  --padding-inline: 20px;
  --padding-bottom: 64px;

  /* Internal spacing (gaps between elements) */
  --spacing-header: 28px;
  --spacing-heading: 8px;
  --spacing-lang-toggle: 14px;
  --spacing-counter-top: 6px;
  --spacing-counter-bottom: 16px;
  --spacing-error: 20px;
  --spacing-result: 24px;
  --spacing-disclaimer: 40px;
  /* Gap between the footer's divider line and "Faith Finder by MaryK-X"
     (the first thing inside the footer) — pulled in from 20px so the
     brand line sits closer to the divider above it. */
  --spacing-disclaimer-border: 12px;

  /* Card/control internal padding */
  --input-padding: 14px;
  --button-padding: 14px;
  --error-padding: 14px;
  --result-padding: 24px;

  /* Borders */
  --border-width: 1px;
  --radius: 10px;
  --radius-card: 12px;

  /* Shadow strength — soft and warm, not harsh */
  --shadow: 0 6px 20px rgba(122, 92, 62, 0.12);

  /* Form card */
  --form-card-padding: 28px;
  --textarea-min-height: 150px;

  /* Logo, sized off --font-size-heading (constant across viewports) so it
     stays proportional wherever the heading is used. Bumped up alongside a
     slightly smaller heading so the logo reads as more prominent without
     the wordmark losing its weight. */
  --logo-size: 54px;
}

@media (max-width: 480px) {
  :root {
    --padding-top: 24px;
    --padding-inline: 16px;
    --padding-bottom: 40px;
    --form-card-padding: 20px;
    --result-padding: 20px;
    /* 10px tighter than the 28px desktop value, per the compact-mobile ask. */
    --spacing-header: 18px;
  }
}

/* Embed mode (?embed=1, see index.html) — strips the outer page padding so
   the app sits flush inside a Shopify iframe instead of floating in a big
   margin. Only the container's own outer spacing changes here; a class
   selector always outranks the plain :root rules above (including inside
   the mobile media query), so this applies consistently at every viewport
   width. Everything else — card padding, grid layout, component spacing —
   is untouched and keeps responding to screen size exactly as it already
   does. */
:root.embed-mode {
  --padding-top: 12px;
  --padding-inline: 12px;
  --padding-bottom: 12px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-wrap: break-word;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--padding-top) var(--padding-inline) var(--padding-bottom);
}

header {
  text-align: var(--text-align-header);
  margin-bottom: var(--spacing-header);
}

/* Logo + heading sit side by side as one branded title lockup. The heading
   is the same size on every viewport today, which is why a single
   --logo-size keeps the pairing balanced on both desktop and mobile. */
.brand-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: var(--spacing-heading);
}

.app-logo {
  display: block;
  width: var(--logo-size);
  height: var(--logo-size);
  flex-shrink: 0;
}

h1 {
  margin: 0;
  font-size: var(--font-size-heading);
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--accent);
}

.subtitle {
  color: var(--muted);
  font-size: var(--font-size-body);
  margin: 0;
}

/* Placed after the base .subtitle rule (not inside the earlier
   max-width:480px block) — with equal selector specificity, source order
   decides ties, so a mobile override positioned before the base rule would
   silently lose to it even while the media query matches. Scoped to
   .subtitle specifically, not the shared --font-size-body variable, since
   that variable also sizes the textarea and result text — neither of which
   should shrink here. */
@media (max-width: 480px) {
  .subtitle {
    font-size: 13px;
    line-height: 1.35;
  }
}

.lang-toggle {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: var(--spacing-lang-toggle) 0 0;
}

.lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  font-family: inherit;
  font-size: var(--font-size-small);
  font-weight: 600;
  padding: 6px 14px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.lang-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.lang-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.lang-btn[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--button-text);
}

.lang-btn[aria-pressed="true"]:hover {
  color: var(--button-text);
}

.form-card {
  background: var(--card-bg);
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
  padding: var(--form-card-padding);
}

textarea {
  width: 100%;
  min-height: var(--textarea-min-height);
  padding: var(--input-padding);
  font-size: var(--font-size-body);
  font-family: inherit;
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius);
  resize: vertical;
  background: var(--card-bg);
  color: var(--text);
}

textarea:focus {
  outline: 2px solid var(--accent-light);
  border-color: var(--accent);
}

textarea::placeholder {
  color: var(--muted);
  opacity: 1;
}

.char-counter {
  text-align: right;
  font-size: var(--font-size-small);
  letter-spacing: 0.01em;
  color: var(--muted);
  margin: var(--spacing-counter-top) 0 var(--spacing-counter-bottom);
}

button#submit-btn {
  width: 100%;
  padding: var(--button-padding);
  font-size: var(--font-size-button);
  font-weight: var(--font-weight-button);
  letter-spacing: 0.01em;
  color: var(--button-text);
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: opacity 0.15s ease;
}

button#submit-btn:hover:not(:disabled) {
  opacity: 0.9;
}

button#submit-btn:disabled {
  opacity: 0.85;
  cursor: not-allowed;
}

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 8px;
  vertical-align: -2px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: var(--button-text);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.btn-icon {
  margin-right: 6px;
}

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

@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation: none;
  }
}

.error {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: var(--spacing-error);
  padding: var(--error-padding);
  border-radius: var(--radius);
  border-left: 4px solid var(--error);
  background: var(--error-bg);
  color: var(--error);
  font-size: var(--font-size-error);
}

.result {
  margin-top: var(--spacing-result);
  padding: var(--result-padding);
  background: var(--card-bg);
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
  white-space: pre-wrap;
  font-size: var(--font-size-body);
}

.result p,
.result ul {
  margin: 0 0 14px;
}

.result > *:last-child {
  margin-bottom: 0;
}

.section-heading {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.01em;
  margin: 40px 0 14px;
}

.result > .section-heading:first-child {
  margin-top: 0;
}

.section-heading-prayer {
  margin-top: 56px;
}

.verse-card {
  background: var(--card-bg);
  border: var(--border-width) solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 22px;
}

.verse-card:last-child {
  margin-bottom: 0;
}

.verse-ref {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.01em;
  margin-bottom: 6px;
}

.verse-text {
  font-style: italic;
  color: var(--text);
}

.response-list,
.reading-list {
  list-style: none;
  padding-left: 0;
  margin: 0 0 14px;
}

.response-list li,
.reading-list li {
  position: relative;
  padding-left: 20px;
  margin-bottom: 8px;
}

.response-list li:last-child,
.reading-list li:last-child {
  margin-bottom: 0;
}

.response-list li::before,
.reading-list li::before {
  content: "\2013";
  position: absolute;
  left: 0;
  color: var(--accent);
}

.prayer-panel {
  position: relative;
  background: var(--accent-light);
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius-card);
  padding: 28px;
  margin: 0 0 14px;
  line-height: 1.75;
  overflow: hidden;
}

.prayer-panel::before {
  content: "\201C";
  position: absolute;
  top: 0;
  left: 14px;
  font-size: 2.75rem;
  line-height: 1;
  color: var(--accent);
  opacity: 0.2;
  font-family: Georgia, serif;
}

.prayer-panel p {
  position: relative;
  z-index: 1;
}

.disclaimer {
  margin-top: var(--spacing-disclaimer);
  padding-top: var(--spacing-disclaimer-border);
  border-top: var(--border-width) solid var(--border);
  font-size: var(--font-size-disclaimer);
  line-height: 1.7;
  letter-spacing: 0.01em;
  color: var(--muted);
  text-align: center;
}

.disclaimer p {
  margin: 0;
}

/* Smaller than brand-name/copyright (both 0.72rem/11.52px) so the
   disclaimer reads as lower-priority than the branding around it, on every
   viewport — the mobile media query further down reduces this again for
   small screens specifically. */
.disclaimer-text {
  font-size: 11px;
}

/* Sits first, right below the Search Scripture / result section, above the
   disclaimer text — kept at the same size it always was. */
.disclaimer .brand-name {
  margin-bottom: 14px;
  font-size: 0.72rem;
  line-height: 1.6;
}

/* Sits last, at the very bottom of the footer. Given more top margin than
   brand-name's bottom margin so it reads as its own separate line rather
   than grouped with the disclaimer text right above it. */
.disclaimer .copyright {
  margin-top: 24px;
  font-size: 0.72rem;
  line-height: 1.6;
}

/* Mobile-only: the disclaimer is secondary/legal information and shouldn't
   compete visually with the heading/description/input above it. Targets
   .disclaimer-text specifically (not the shared --font-size-disclaimer
   variable, and not brand-name/copyright, whose sizes are unchanged), and
   placed after the base rules above for correct cascade order. */
@media (max-width: 480px) {
  .disclaimer-text {
    font-size: 9.5px;
    line-height: 1.4;
  }
}

.copy-section {
  margin-top: 40px;
  padding-top: 20px;
  border-top: var(--border-width) solid var(--border);
  text-align: center;
}

.copy-btn {
  display: inline-block;
  background: transparent;
  border: var(--border-width) solid var(--accent);
  border-radius: var(--radius);
  color: var(--accent);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 10px 20px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.copy-btn:hover {
  background: var(--accent-light);
}

.copy-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.copy-section .copy-note {
  margin: 10px 0 0;
  font-size: var(--font-size-disclaimer);
  color: var(--muted);
}

.hidden {
  display: none;
}

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