/* Shared interface type. Scripture, quotations, and private-note prose retain
   their existing reading styles in bible.css. */
:root {
  --font-ui: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --type-page: 1.75rem;
  --type-section: 1.25rem;
  --type-episode: 1.0625rem;
  --type-label: .875rem;
  --weight-medium: 500;
  --weight-heading: 600;
}

body[data-bible-page] { font-family: var(--font-ui); }
body[data-bible-page] :is(button, input, textarea, select) { font-family: var(--font-ui); }

/* Primary destinations use the same size, weight, and tracking. */
body[data-bible-page] :is(.social-header h1, .profile-name-row h1, .policy-hero h1),
body.standalone-bible:not(.episode-embedded-panel):not(.episode-mobile-embedded) .desktop-reading-heading h2 {
  font-size: var(--type-page);
  font-weight: var(--weight-heading);
  line-height: 1.2;
  letter-spacing: -.025em;
}

/* Supporting headings are quieter than destination titles. */
body[data-bible-page] :is(.story-collection > h2, .profile-creations-empty h2, .policy-card h2, .prayer-history h2) {
  font-size: var(--type-section);
  font-weight: var(--weight-heading);
  line-height: 1.3;
  letter-spacing: -.015em;
}
body[data-bible-page] :is(.note-header h2, .artifacts-header h2, .chapter-picker-head h2, .profile-edit-heading h2, .note-composer h3, .profile-note-composer h3, .episode-note header h2),
body.episode-embedded-panel .desktop-reading-heading h2,
body.episode-mobile-embedded .desktop-reading-heading h2,
body.videos-page #episode-panel-catalogue > header h2 {
  font-size: 1.25rem;
  font-weight: var(--weight-heading);
  line-height: 1.3;
  letter-spacing: -.015em;
}

/* Labels and controls share a medium weight; close icons keep their own sizing. */
body[data-bible-page] :is(.social-tabs a, .profile-content-tabs button, .routine-tab, .language-toggle, .reading-toggle, .chapter-picker-toggle, .premium-button, .profile-edit-button, .profile-settings-button, .social-primary, .social-secondary, .note-submit, .note-add, .profile-empty-action, .profile-edit-actions button) {
  font-weight: var(--weight-medium);
  letter-spacing: 0;
}
body[data-bible-page] :is(.social-tabs a, .profile-content-tabs button) {
  font-size: var(--type-label);
  line-height: 1.4;
}
/* History stays compact in every language; its accessible name is localized. */
body.pray-page .routine-header { align-items: center; }
body.pray-page .routine-header h1 { margin: 0; }
.routine-history-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 34px;
  height: 34px;
  margin-left: auto;
  padding: 6px;
  border: 1px solid rgba(var(--theme-text-warm-rgb), .2);
  border-radius: 999px;
  color: var(--theme-text-warm);
  background: linear-gradient(135deg, var(--theme-control-gradient-start), var(--theme-raised-surface));
  cursor: default;
}
.routine-history-button svg { width: 19px; height: 19px; }
body[data-bible-page] .bible-nav .nav-item { font-weight: var(--weight-medium); }
body[data-bible-page] :is(.chapter-kicker, .prayer-eyebrow, .eyebrow, .note-entry-ref, .book-toggle, .book-chapter, .chapter-action, .scripture-note-quote cite) {
  font-weight: var(--weight-heading);
}
body[data-bible-page] :is(.premium-button, .language-toggle, .reading-toggle, .chapter-picker-toggle) { line-height: 1.3; }

/* Cards keep their existing widths and placement on each screen size. */
body[data-bible-page] .episode-card .episode-cover h3 {
  font-size: var(--type-episode);
  font-weight: var(--weight-heading);
  line-height: 1.35;
  letter-spacing: -.01em;
}
body.videos-page .genesis-feature > h2 {
  font-size: var(--type-episode);
  font-weight: var(--weight-heading);
  line-height: 1.35;
  letter-spacing: -.01em;
}
body[data-bible-page] .episode-card > p { font-weight: 400; }
body[data-bible-page] .routine-card-title { font-weight: var(--weight-heading); letter-spacing: -.01em; }
body[data-bible-page] :is(.profile-handle, .profile-bio, .profile-stats span, .profile-creations-empty > p, .note-entry-time, .genesis-resume-label) { font-weight: 400; }
body[data-bible-page] .episode-player-copy h2 { font-weight: var(--weight-heading); letter-spacing: -.015em; }

@media (min-width: 680px) {
  :root { --type-page: 2rem; --type-section: 1.5rem; --type-episode: 1.125rem; --type-label: .9375rem; }
  body.videos-page .genesis-feature > h2 { font-size: var(--type-page); line-height: 1.2; }
  body[data-bible-page] .episode-card .episode-cover h3 { min-height: 2.7em; }
  /* The two-column player panel uses a compact version of the same hierarchy. */
  body.videos-page #episode-panel-catalogue .story-collection > h2 { font-size: 1.125rem; }
  body.videos-page #episode-panel-catalogue .episode-card .episode-cover h3 { font-size: 1rem; }
}

/* Align catalogue and community titles at the same header origin. */
.videos-heading.social-header { padding-top: max(22px, env(safe-area-inset-top)); }
@media (min-width: 680px) {
  .videos-heading.social-header { padding-top: 58px; }
}

/* Keep the mobile resume banner connected to its page title. */
@media (max-width: 679px) {
  .videos-heading.social-header { margin-bottom: 10px; }
}

/* Mobile account actions participate in the header layout instead of floating
   independently of the title. Desktop keeps its existing sidebar actions. */
@media (max-width: 679px) {
  body[data-bible-page] .social-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 16px;
    row-gap: 20px;
    padding-top: max(22px, env(safe-area-inset-top));
  }
  body[data-bible-page] .social-header h1 {
    display: flex;
    align-items: center;
    min-height: 34px;
    margin: 0;
    padding-right: 0;
  }
  body[data-bible-page] .social-header > .premium-button {
    position: static;
    align-self: center;
    justify-self: end;
    height: 34px;
    min-height: 34px;
    margin: 0;
  }
  .social-header > .social-tabs { grid-column: 1 / -1; }
  body.pray-page .routine-header { grid-template-columns: minmax(0, 1fr) auto auto; column-gap: 8px; }
  body.pray-page .routine-header h1 { min-width: 0; }
  .routine-history-button { margin: 0; }
  body.pray-page .routine-header { padding-bottom: 16px; }

  .profile-page {
    --profile-mobile-gutter: clamp(18px, 5vw, 56px);
    --profile-mobile-header-height: calc(max(22px, env(safe-area-inset-top)) + 46px);
  }
  .profile-page .profile-shell {
    padding-top: 0;
    scroll-padding-top: calc(var(--profile-mobile-header-height) + 54px);
  }
  .profile-page .profile-account-tools {
    position: sticky;
    top: 0;
    right: auto;
    left: auto;
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr);
    grid-template-areas: "settings edit premium";
    align-items: center;
    gap: 8px;
    height: auto;
    min-height: 34px;
    margin: 0 calc(-1 * var(--profile-mobile-gutter)) 8px;
    padding: max(22px, env(safe-area-inset-top)) var(--profile-mobile-gutter) 12px;
    background: var(--theme-page-background);
  }
  .profile-page .profile-content-tabs {
    top: var(--profile-mobile-header-height);
    margin-inline: calc(-1 * var(--profile-mobile-gutter));
    padding-inline: var(--profile-mobile-gutter);
    background: var(--theme-page-background);
  }
  .profile-page .profile-account-tools > :is(.premium-button, .profile-settings-button, .profile-edit-button) {
    position: static;
    inset: auto;
    align-self: center;
    width: auto;
    min-width: 0;
    height: 34px;
    min-height: 34px;
    margin: 0;
  }
  .profile-page .profile-account-tools > .premium-button { grid-area: premium; justify-self: end; }
  .profile-page .profile-account-tools > .profile-settings-button { grid-area: settings; }
  .profile-page .profile-account-tools > .profile-edit-button { grid-area: edit; }
}
@media (max-width: 359px) {
  .profile-page { --profile-mobile-header-height: calc(max(22px, env(safe-area-inset-top)) + 88px); }
  .profile-page .profile-account-tools {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "settings . premium" "edit edit .";
  }
  .profile-page .profile-account-tools > .profile-edit-button { justify-self: start; }
  body.pray-page .routine-header > .premium-button { width: 34px; padding: 6px; }
  body.pray-page .routine-header > .premium-button > span { display: none; }
}

/* The row's 12px scroll padding plus this margin separates mobile collections. */
@media (max-width: 679px) {
  .videos-catalogue > .story-collection { margin-bottom: 18px; }
}

/* Scripture selectors use the same quiet mobile pill as Edit Profile. */
@media (max-width: 679px) {
  .profile-page .profile-account-tools .profile-edit-button,
  body.standalone-bible:not(.episode-mobile-embedded):not(.episode-embedded-panel) .reading-header :is(.language-toggle, .reading-picker-toggle) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 34px;
    min-height: 34px;
    padding: 6px 11px;
    border: 1px solid rgba(var(--theme-text-warm-rgb), .2);
    border-radius: 999px;
    color: var(--theme-text-warm);
    background: linear-gradient(135deg, var(--theme-control-gradient-start), var(--theme-raised-surface));
    font-size: .72rem;
    font-weight: 700;
    line-height: 1.3;
    backdrop-filter: none;
  }
  body.standalone-bible:not(.episode-mobile-embedded):not(.episode-embedded-panel) .reading-header :is(.language-toggle, .reading-picker-toggle) svg {
    flex: none;
    width: 19px;
    height: 19px;
  }
}

/* Only the standalone desktop destination is titled Bible. */
.desktop-reading-heading .bible-page-title { display: none; }
@media (min-width: 680px) {
  body.standalone-bible:not(.episode-embedded-panel):not(.episode-mobile-embedded) .desktop-reading-heading :is(.chapter-kicker, .scripture-panel-title) { display: none; }
  body.standalone-bible:not(.episode-embedded-panel):not(.episode-mobile-embedded) .desktop-reading-heading .bible-page-title { display: inline; }
}

/* Align the desktop Bible reader with the other destination headers. */
@media (min-width: 1000px) {
  body.standalone-bible:not(.episode-embedded-panel):not(.episode-mobile-embedded) .reading-header {
    align-items: flex-start;
    padding: 58px clamp(18px, 5vw, 56px) 18px;
  }
  body.standalone-bible:not(.episode-embedded-panel):not(.episode-mobile-embedded) .reading-content {
    padding-inline: clamp(18px, 5vw, 56px);
  }
}

/* The desktop catalogue begins with its banner at the shared title origin. */
@media (min-width: 680px) {
  body.videos-page .videos-heading.social-header { display: none; }
  body.videos-page .videos-catalogue { padding-top: 58px; }
}
