/* Fonts bundled locally (no remote CDN) — only the subsets used by the 8 UI
   languages are included. Amiri ships per weight; Plus Jakarta Sans is a
   variable font, so one file per subset covers weights 400–700. */

/* Hidden app pages keep their appearance when resumed without animating in the background. */
body.pt-background * { animation-play-state: paused !important; }

/* Privacy / terms links at the foot of the app's pages (fillLegalLinks in i18n.js). */
.legal-links {
  margin: 14px 0 4px;
  text-align: center;
  font-size: 12px;
  color: var(--muted-foreground, #92a39f);
}
.legal-links a { color: inherit; text-decoration: none; margin: 0 4px; }
.legal-links a:hover { color: var(--primary, #3ad4aa); text-decoration: underline; }

/* Amiri — Arabic serif/display (--font-arabic) */
@font-face {
  font-family: "Amiri";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/amiri-400-arabic.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC4, U+10EFC-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1;
}
@font-face {
  font-family: "Amiri";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/amiri-400-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Amiri";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/amiri-700-arabic.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC4, U+10EFC-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1;
}
@font-face {
  font-family: "Amiri";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/amiri-700-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Plus Jakarta Sans — UI display (--font-display); variable, weights 400–700 */
@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/plus-jakarta-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/plus-jakarta-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Shared token mappings (values set per theme below) */
/* Default theme: Midnight Emerald (:root fallback + explicit data-theme) */
:root,
[data-theme="midnight-emerald"] {
  --font-display: "Plus Jakarta Sans", ui-sans-serif, system-ui, sans-serif;
  --font-arabic: "Amiri", "Scheherazade New", serif;
  --radius: 1rem;

  --background: #011612;
  --foreground: #eef7f5;
  --card: #05221f;
  --popover: #05221f;
  --primary: #3ad4aa;
  --primary-foreground: #011612;
  --secondary: #0c2f2d;
  --muted: #132b2a;
  --muted-foreground: #92a39f;
  --accent: #003c37;
  --destructive: #f94144;
  --border: rgba(255, 255, 255, 0.08);
  --input: rgba(255, 255, 255, 0.1);
  --ring: #3ad4aa;
  --gold: #eebc4a;
  --teal: #3ad4aa;

  --gradient-bg:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(58, 212, 170, 0.12), transparent 60%),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(58, 212, 170, 0.08), transparent 50%),
    linear-gradient(to bottom, #001110, #001c17);
  --gradient-card: linear-gradient(145deg, rgba(7, 42, 38, 0.9), rgba(3, 32, 30, 0.85));
  --gradient-next: linear-gradient(135deg, rgba(0, 65, 44, 0.85), rgba(0, 51, 45, 0.7));
  --shadow-glow: 0 0 40px -10px rgba(58, 212, 170, 0.5);
  --shadow-card: 0 10px 40px -15px rgba(0, 0, 0, 0.5);

  --countdown-block-bg: rgba(4, 26, 24, 0.5);
  --countdown-seconds-border: rgba(58, 212, 170, 0.5);
  --progress-track-bg: rgba(4, 26, 24, 0.6);
  --progress-fill: linear-gradient(to right, rgba(58, 212, 170, 0.7), var(--teal));
  --progress-glow: 0 0 10px rgba(58, 212, 170, 0.5);
  --focus-ring-shadow: 0 0 0 2px rgba(58, 212, 170, 0.25);
  --next-item-border: rgba(58, 212, 170, 0.35);
  --next-item-glow:
    0 0 0 1px rgba(58, 212, 170, 0.6),
    0 0 30px -5px rgba(58, 212, 170, 0.4);

  --glass-blur: blur(12px);
  --show-orbs: block;
}

[data-theme="classic"] {
  --font-display: "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-arabic: "Segoe UI", "Tahoma", "Noto Nastaliq Urdu", system-ui, sans-serif;
  --radius: 0.625rem;

  --background: #0f2027;
  --foreground: #eaf2f1;
  --card: rgba(255, 255, 255, 0.06);
  --popover: #18313a;
  --primary: #2dd4a7;
  --primary-foreground: #06231b;
  --secondary: rgba(255, 255, 255, 0.1);
  --muted: rgba(255, 255, 255, 0.06);
  --muted-foreground: #9fb3b0;
  --accent: #2dd4a7;
  --destructive: #ff8080;
  --border: rgba(255, 255, 255, 0.1);
  --input: rgba(0, 0, 0, 0.25);
  --ring: #2dd4a7;
  --gold: #f4c95d;
  --teal: #2dd4a7;

  --gradient-bg: linear-gradient(160deg, #0f2027, #18313a);
  --gradient-card: rgba(255, 255, 255, 0.06);
  --gradient-next: rgba(45, 212, 167, 0.15);
  --shadow-glow: none;
  --shadow-card: none;

  --countdown-block-bg: transparent;
  --countdown-seconds-border: var(--border);
  --progress-track-bg: transparent;
  --progress-fill: linear-gradient(to right, rgba(45, 212, 167, 0.5), var(--teal));
  --progress-glow: none;
  --focus-ring-shadow: none;
  --next-item-border: var(--primary);
  --next-item-glow: 0 0 0 1px var(--primary) inset;

  --glass-blur: none;
  --show-orbs: none;
}

:root,
[data-theme="midnight-emerald"],
[data-theme="classic"] {
  --color-background: var(--background);
  --color-foreground: var(--foreground);
  --color-card: var(--card);
  --color-popover: var(--popover);
  --color-primary: var(--primary);
  --color-secondary: var(--secondary);
  --color-muted: var(--muted);
  --color-accent: var(--accent);
  --color-destructive: var(--destructive);
  --color-border: var(--border);
  --color-input: var(--input);
  --color-ring: var(--ring);
  --color-gold: var(--gold);
  --color-teal: var(--teal);
}

html,
body {
  color-scheme: dark;
  background: var(--gradient-bg);
  background-attachment: fixed;
  color: var(--color-foreground);
  font-family: var(--font-display);
  -webkit-font-smoothing: antialiased;
}

[dir="rtl"] {
  font-family: var(--font-arabic);
}

.glass-card {
  background: var(--gradient-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-card);
  border-radius: var(--radius);
}

.next-card {
  background: var(--gradient-next);
  border: 1px solid var(--next-item-border);
  box-shadow: var(--shadow-glow);
  border-radius: var(--radius);
}

.text-teal { color: var(--teal); }
.text-gold { color: var(--gold); }

.ring-teal {
  box-shadow: var(--next-item-glow);
}

@keyframes pulse-soft {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.animate-pulse-soft {
  animation: pulse-soft 2s ease-in-out infinite;
}

.orb {
  display: var(--show-orbs);
  /* Fixed (not absolute) so the bottom orb's off-edge bleed doesn't inflate the
     popup's scroll height and leave phantom space below the footer. */
  position: fixed;
  border-radius: 9999px;
  filter: blur(48px);
  pointer-events: none;
  z-index: 0;
}

.orb-top {
  top: -40px;
  left: 50%;
  translate: -50% 0;
  width: 200px;
  height: 120px;
  background: rgba(58, 212, 170, 0.15);
}

.orb-bottom {
  bottom: -60px;
  right: -40px;
  width: 160px;
  height: 160px;
  background: rgba(58, 212, 170, 0.1);
}

[data-theme="classic"] .countdown-blocks,
[data-theme="classic"] .progress-track {
  display: none !important;
}

[data-theme="midnight-emerald"] .next-countdown:not(.force-show) {
  display: none !important;
}

/* Respect users who prefer reduced motion. */
@media (prefers-reduced-motion: reduce) {
  .animate-pulse-soft { animation: none; }
  .progress-fill { transition: none; }
}
