/* Perryoke Larger Text accessibility layer.
 * Loaded after page-specific styles so the user's device preference wins.
 * Keep branding, icons, and the compact status header at their normal size. */

/* Keep the preference control visible even where older global form rules remove
 * the browser's native checkbox appearance. */
body.polished-app .app-accessibility-toggle input[type="checkbox"] {
  display: inline-block !important;
  flex: 0 0 22px !important;
  width: 22px !important;
  height: 22px !important;
  min-width: 22px !important;
  min-height: 22px !important;
  margin: 0 !important;
  padding: 0 !important;
  appearance: none !important;
  -webkit-appearance: none !important;
  border: 2px solid var(--app-muted) !important;
  border-radius: 5px !important;
  background-color: var(--app-panel-deep) !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  background-size: 16px 16px !important;
  box-shadow: none !important;
  cursor: pointer;
}

body.polished-app .app-accessibility-toggle input[type="checkbox"]:checked {
  border-color: var(--app-accent) !important;
  background-color: var(--app-accent) !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='%2317120f' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round' d='M5 12.5l4.2 4.2L19 7'/%3E%3C/svg%3E") !important;
}

body.polished-app .app-accessibility-toggle input[type="checkbox"]:focus-visible {
  outline: 3px solid var(--theme-focus) !important;
  outline-offset: 3px !important;
}

body.polished-app #app-large-text-description {
  display: block;
  line-height: 1.4;
}

html[data-app-text="large"] body.polished-app {
  font-size: 18px !important;
}

/* Page headings and section labels */
html[data-app-text="large"] body.polished-app .app-content :is(h1, .page-title, .kamikaze-header) {
  font-size: clamp(22px, 5vw, 28px) !important;
  line-height: 1.22 !important;
}

html[data-app-text="large"] body.polished-app .app-content :is(h2, h3, .calendar-title-header, .chat-header-row, .share-instruction, .selection-label) {
  font-size: 18px !important;
  line-height: 1.35 !important;
}

/* Search, browse, favorites, and song-detail rows */
html[data-app-text="large"] body.polished-app :is(
  .row-artist-name,
  .history-title,
  .setlist-song-title,
  .setlist-host-title,
  .chat-user
) {
  font-size: 17px !important;
  line-height: 1.34 !important;
}

html[data-app-text="large"] body.polished-app :is(
  .row-song-title,
  .history-artist,
  .history-detail,
  .setlist-song-artist,
  .setlist-host-artist,
  .song-item,
  .artist-item,
  .detail-song-item,
  .fav-song-item,
  .chat-message
) {
  font-size: 15px !important;
  line-height: 1.48 !important;
}

/* Ordinary reading text inside the working area */
html[data-app-text="large"] body.polished-app .app-content :is(p, li, td) {
  font-size: 16px !important;
  line-height: 1.5 !important;
}

/* Forms, tabs, filters, navigation, and action buttons */
html[data-app-text="large"] body.polished-app :is(
  button,
  input,
  select,
  textarea,
  label,
  .btn,
  .nav-btn,
  .request-btn,
  .browse-tab,
  .fav-tab-btn,
  .sort-chip,
  .filter-select
) {
  font-size: 17px !important;
  line-height: 1.3 !important;
}

/* Enlarged labels must remain inside their controls. Let text buttons grow or
 * wrap instead of retaining a small fixed height from an individual page. */
html[data-app-text="large"] body.polished-app :is(
  button,
  .btn,
  .nav-btn,
  .request-btn,
  .browse-tab,
  .fav-tab-btn,
  .sort-chip,
  .app-nav a,
  .app-extra-nav a
) {
  box-sizing: border-box !important;
  height: auto !important;
  min-height: 44px !important;
  max-width: 100%;
  padding-top: 8px !important;
  padding-bottom: 8px !important;
  white-space: normal !important;
  overflow-wrap: anywhere;
  text-align: center;
}

html[data-app-text="large"] body.polished-app :is(.app-nav a, .app-extra-nav a, .alpha-btn, .chat-action-btn) {
  font-size: 15px !important;
  line-height: 1.25 !important;
}

/* Singing history */
html[data-app-text="large"] body.polished-app :is(.my-history p, .history-freshness, .history-empty) {
  font-size: 16px !important;
  line-height: 1.5 !important;
}

html[data-app-text="large"] body.polished-app :is(.history-stat span, .history-name, .history-artist-chip, .history-controls label, .history-result-count) {
  font-size: 14px !important;
  line-height: 1.42 !important;
}

html[data-app-text="large"] body.polished-app .history-dates {
  font-size: 13px !important;
  line-height: 1.4 !important;
}

/* My Setlist and host presentation */
html[data-app-text="large"] body.polished-app :is(.setlist-intro, .setlist-host-note, .setlist-empty) {
  font-size: 15px !important;
  line-height: 1.48 !important;
}

html[data-app-text="large"] body.polished-app .setlist-notice {
  font-size: 14px !important;
  line-height: 1.45 !important;
}

html[data-app-text="large"] body.polished-app :is(.setlist-count, .setlist-badge, .setlist-options, .setlist-option, .setlist-option select, .setlist-host-tags) {
  font-size: 13px !important;
  line-height: 1.35 !important;
}

html[data-app-text="large"] body.polished-app .key-select {
  width: 94px !important;
  min-width: 94px !important;
  height: 40px !important;
  min-height: 40px !important;
  font-size: 13px !important;
}

html[data-app-text="large"] body.polished-app .setlist-options {
  flex-wrap: wrap;
  gap: 7px 10px;
}

html[data-app-text="large"] body.polished-app .setlist-option select {
  height: 40px !important;
  min-height: 40px !important;
}

html[data-app-text="large"] body.polished-app :is(.setlist-heading h1, .setlist-host-head h2) {
  font-size: 22px !important;
}

/* Schedule */
html[data-app-text="large"] body.polished-app .calendar-title-header {
  font-size: 18px !important;
}

html[data-app-text="large"] body.polished-app .calendar-sub-header th {
  font-size: 14px !important;
  line-height: 1.3 !important;
}

html[data-app-text="large"] body.polished-app :is(.calendar-table td, .calendar-table td strong, .calendar-table td a) {
  font-size: 15px !important;
  line-height: 1.4 !important;
}

/* Chat and notification inbox */
html[data-app-text="large"] body.polished-app :is(.chat-message, #notificationInbox article) {
  font-size: 16px !important;
  line-height: 1.48 !important;
}

html[data-app-text="large"] body.polished-app :is(.chat-time, .chat-msg-meta, #reactionPeople, #alertsStatus, #alertsPageLabel) {
  font-size: 13px !important;
  line-height: 1.4 !important;
}

html[data-app-text="large"] body.polished-app #notificationInbox article > div {
  font-size: 15px !important;
  line-height: 1.45 !important;
}

html[data-app-text="large"] body.polished-app #notificationInbox article > div:last-child {
  font-size: 13px !important;
}

/* Supporting copy should grow, but remain visually secondary. */
html[data-app-text="large"] body.polished-app :is(
  small,
  .app-help,
  .rules,
  .browse-hero-sub,
  .count-summary,
  .close-match-label,
  .tip-message-box,
  .pwa-tip-box,
  .muted,
  .meta,
  .status
) {
  font-size: 14px !important;
  line-height: 1.48 !important;
}

/* Do not let accessibility text rules distort icon-only controls. */
html[data-app-text="large"] body.polished-app :is(
  .setlist-add-btn,
  .setlist-action,
  .setlist-host-close,
  .chat-menu-trigger,
  .emoji-btn,
  .app-home-link,
  .app-header-home,
  .app-menu-toggle
) {
  font-size: inherit;
  min-height: 0 !important;
  padding: 0 !important;
  white-space: nowrap !important;
  overflow-wrap: normal;
}

html[data-app-text="large"] body.polished-app .setlist-add-btn {
  width: 40px !important;
  height: 40px !important;
}

html[data-app-text="large"] body.polished-app .setlist-action {
  width: 34px !important;
  height: 34px !important;
}

@media (max-width: 600px) {
  html[data-app-text="large"] body.polished-app .app-content :is(p, li, td) {
    font-size: 15px !important;
  }

  html[data-app-text="large"] body.polished-app :is(.row-artist-name, .history-title, .setlist-song-title, .chat-user) {
    font-size: 16px !important;
  }

  html[data-app-text="large"] body.polished-app :is(.row-song-title, .history-artist, .history-detail, .setlist-song-artist, .chat-message) {
    font-size: 15px !important;
  }
}
