/*
 * Rendering precision layer
 * Keeps the established visual design while preventing controls and text from
 * being rasterised together with moving/translucent surfaces.
 */

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body,
button,
input,
select,
textarea {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

button,
input,
select,
textarea,
a,
summary {
  -webkit-tap-highlight-color: transparent;
}

svg {
  display: block;
  overflow: visible;
  shape-rendering: geometricPrecision;
}

svg path,
svg line,
svg circle,
svg polyline,
svg rect {
  vector-effect: non-scaling-stroke;
}

img,
.quran-logo-mark,
.salaah-pattern,
.salaah-pattern-light {
  image-rendering: auto;
}

/* Keep animated decoration on its own paint layer, never on a control layer. */
.salaah-pattern,
.salaah-pattern-light,
.next-prayer::before,
.next-prayer::after,
.prayer-row.is-next::before,
.prayer-row.is-next::after,
footer .creator-signature::after {
  pointer-events: none;
}

.salaah-pattern,
.salaah-pattern-light {
  contain: strict;
}

/* The active row used to move by one CSS pixel. On fractional-density mobile
   screens that placed the full card, its text and its border between pixels. */
.prayer-row.is-next,
.settings-launcher:active,
.about-launcher:hover,
.about-launcher:focus-visible,
.about-launcher:active,
.tilawah-gateway:hover,
.tilawah-gateway:focus-visible {
  transform: none;
}

/* Isolate the glass blur behind the timetable. Child text, clocks and borders
   stay on a clean vector/text layer instead of being flattened with the blur. */
.timetable-card {
  position: relative;
  isolation: isolate;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.timetable-card::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: inherit;
  background: var(--card);
  box-shadow: var(--shadow), inset 0 1px rgba(255,255,255,.05);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  pointer-events: none;
}

/* Crisp, consistently sized date navigation. */
.date-navigation {
  grid-template-columns: 34px minmax(0, 1fr) 34px;
  gap: 2px;
}

.date-arrow {
  display: grid;
  width: 34px;
  height: 36px;
  padding: 0;
  place-items: center;
}

.date-arrow-icon {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.date-picker {
  left: 46px;
  width: calc(100% - 92px);
}

.source-shortcut svg,
.about-question-mark,
.about-guide-link svg,
.theme-launcher img,
.settings-brand-mark img {
  flex: 0 0 auto;
}

.source-shortcut::after {
  content: "";
  width: 12px;
  height: 12px;
  margin-left: 1px;
  flex: 0 0 auto;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m9 5 7 7-7 7' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m9 5 7 7-7 7' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  font-size: 0;
}

/* Every prayer clock is now a viewBox-scaled vector. */
.mini-clock {
  display: block;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 0;
  overflow: visible;
}

.mini-clock::before,
.mini-clock::after,
.mini-clock i {
  content: none;
  display: none;
}

.mini-clock-face {
  fill: none;
  stroke: var(--clock-border);
  stroke-width: 1.5;
}

.mini-clock-hand {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mini-clock-hour {
  stroke: var(--cream);
  stroke-width: 1.75;
}

.mini-clock-minute {
  stroke: var(--gold-bright);
  stroke-width: 1.75;
}

.mini-clock-hub {
  fill: var(--gold-bright);
  stroke: none;
}

.mini-clock.is-muted {
  opacity: .28;
}

/* Preference/source icons that were previously built from rotated borders. */
.calculated-source-icon i,
.calculated-source-icon i::after {
  display: none;
}

.calculated-source-mark {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: var(--gold-bright);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.source-option-icon,
.theme-swatch,
.masjid-choice-dot,
.next-status i,
.qaza-quick-toggle i,
.qaza-hub-status::before,
.about-mark,
.about-launcher,
.theme-launcher {
  background-clip: padding-box;
}

/* Qiblah needle and hub remain rotatable, but are drawn as one coherent SVG. */
.qibla-arrow {
  transform-origin: 50% 50%;
}

.qibla-arrow-vector {
  width: 100%;
  height: 100%;
}

.qibla-arrow-head,
.qibla-arrow-shaft,
.qibla-arrow-tail,
.qibla-hub {
  display: none;
}

.qibla-arrow-head-path,
.qibla-arrow-shaft-line {
  fill: none;
  stroke: var(--gold-bright);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.qibla-arrow-tail-line {
  fill: none;
  stroke: color-mix(in srgb, var(--muted) 58%, transparent);
  stroke-width: 2;
  stroke-linecap: round;
}

.qibla-arrow-hub-ring {
  fill: var(--card);
  stroke: var(--gold-bright);
  stroke-width: 3;
}

.qibla-arrow-hub-core {
  fill: var(--gold-bright);
  stroke: none;
}

/* Quran gateway arrow: a vector rather than a typeface-dependent character. */
.tilawah-arrow {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  font-size: 0;
}

.tilawah-arrow svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Keep strokes and corners consistent throughout Preferences and every tool. */
.settings-dialog,
.source-dialog,
.calculation-dialog,
.qibla-dialog,
.qaza-dialog,
.about-dialog,
.theme-chooser,
.masjid-search,
.masjid-option,
.calculation-settings-card,
.qaza-settings-card,
.qibla-settings-card,
.travel-notice,
.personal-tool-card,
.source-option,
.source-option-icon,
.location-box,
.calculation-options,
.qaza-tracker-control,
.qaza-checkin,
.qaza-summary,
.qaza-manual-entry,
.qaza-advanced,
.qaza-prayer-button,
.qaza-total,
.about-guide-link,
.close-settings,
.theme-launcher,
.qaza-open-button,
.qaza-save-button,
.qaza-secondary-button,
.qaza-import-button,
.qaza-toggle-button,
.location-primary-button,
.qibla-start-button,
.empty-state button,
.settings-launcher,
.source-shortcut,
.toast,
.tilawah-gateway,
.next-prayer,
.ramadan-card,
.prayer-row {
  -webkit-backface-visibility: visible;
  backface-visibility: visible;
}

.settings-dialog,
.source-dialog,
.calculation-dialog,
.qibla-dialog,
.qaza-dialog,
.about-dialog {
  outline: 1px solid transparent;
}

.settings-launcher,
.source-shortcut,
.close-settings,
.theme-launcher,
.qaza-open-button,
.qaza-save-button,
.qaza-secondary-button,
.qaza-import-button,
.qaza-toggle-button,
.location-primary-button,
.qibla-start-button,
.about-guide-link,
.source-option,
.theme-option,
.masjid-option,
.qaza-prayer-button,
.qaza-total button,
.empty-state button {
  transform: none;
}

input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--gold-bright);
}

details > summary {
  list-style: none;
}

details > summary::-webkit-details-marker {
  display: none;
}

details > summary::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 6px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m9 5 7 7-7 7' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m9 5 7 7-7 7' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}

details[open] > summary::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m5 9 7 7 7-7' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m5 9 7 7 7-7' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.toast,
.toast.show {
  transform: none;
}

/* Avoid synthetic ultra-fine/fractional weights on the smallest labels. */
.next-label,
.countdown-wrap span,
.legend span,
.theme-label,
.search-label,
.tilawah-kicker,
.source-option-status,
.qaza-hub-status,
.qaza-tracker-control span,
.prayer-name .next-status,
.prayer-name .tomorrow-fajr-status {
  font-weight: 700;
}

@media (min-width: 58rem) {
  .mini-clock {
    width: 42px;
    height: 42px;
  }
}

/* Wallpaper Engine scales the layout by height; use fixed vector sizes at each
   breakpoint so its clocks stay round at every supported canvas. */
.wallpaper-mode .mini-clock {
  width: 48px;
  height: 48px;
}

@media (min-height: 56.25rem) {
  .wallpaper-mode .mini-clock {
    width: 56px;
    height: 56px;
  }
}

@media (min-height: 75rem) {
  .wallpaper-mode .mini-clock {
    width: 64px;
    height: 64px;
  }
}

@media (min-height: 100rem) {
  .wallpaper-mode .mini-clock {
    width: 70px;
    height: 70px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .settings-launcher,
  .source-shortcut,
  .tilawah-gateway,
  .about-launcher,
  .theme-launcher {
    transition: none;
  }
}
