/* ==========================================================================
   Aad Granth — Browser Cast receiver styles.
   Self-hosted local fonts (.woff2). Theme-aware via CSS variables set on
   <body data-theme="...">.
   ========================================================================== */

@font-face {
  font-family: 'NotoGurmukhi';
  src: url('fonts/NotoSansGurmukhi-Regular.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'NotoGurmukhi';
  src: url('fonts/NotoSansGurmukhi-Bold.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: 'NotoDevanagari';
  src: url('fonts/NotoSansDevanagari-Regular.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'NotoLatin';
  src: url('fonts/NotoSans-Latin-Regular.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'NotoLatin';
  src: url('fonts/NotoSans-Latin-SemiBold.woff2') format('woff2');
  font-weight: 600;
  font-display: swap;
}

:root {
  --bg: #0d1224;
  --fg: #ffffff;
  --muted: rgba(255, 255, 255, 0.62);
  --accent: #f2c14e;
  --card: rgba(255, 255, 255, 0.06);
  --card-border: rgba(255, 255, 255, 0.14);
  --font-scale: 1;
}

body[data-theme='light'] {
  --bg: #faf6ec;
  --fg: #1a1a1a;
  --muted: rgba(0, 0, 0, 0.55);
  --accent: #b8860b;
  --card: rgba(0, 0, 0, 0.04);
  --card-border: rgba(0, 0, 0, 0.12);
}
body[data-theme='sepia'] {
  --bg: #f4ecd8;
  --fg: #3b2f1e;
  --muted: rgba(59, 47, 30, 0.6);
  --accent: #9c6b1f;
  --card: rgba(59, 47, 30, 0.05);
  --card-border: rgba(59, 47, 30, 0.15);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--fg);
  font-family: 'NotoLatin', system-ui, sans-serif;
}

.screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4vh 6vw;
  text-align: center;
}
.hidden { display: none !important; }

.ik-onkar {
  font-family: 'NotoGurmukhi', serif;
  font-size: clamp(48px, 9vw, 120px);
  color: var(--accent);
  line-height: 1;
}

/* --- Pairing screen --- */
.pair-card {
  width: min(440px, 92vw);
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pair-card h1 { font-size: 22px; margin: 8px 0 0; }
.pair-subtitle { color: var(--muted); margin: 0 0 12px; font-size: 15px; }

#pair-form { display: flex; flex-direction: column; text-align: left; }
#pair-form label { font-size: 13px; color: var(--muted); margin: 12px 0 6px; }
#pair-form input {
  font-size: 22px;
  letter-spacing: 4px;
  text-align: center;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: rgba(0, 0, 0, 0.15);
  color: var(--fg);
  font-family: 'NotoLatin', monospace;
}
body[data-theme='light'] #pair-form input,
body[data-theme='sepia'] #pair-form input {
  background: rgba(255, 255, 255, 0.7);
}
#pair-button {
  margin-top: 22px;
  padding: 14px;
  font-size: 17px;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: #1a1200;
  cursor: pointer;
}
#pair-button:disabled { opacity: 0.5; cursor: default; }
.pair-error {
  margin: 14px 0 0;
  color: #ff7a7a;
  font-size: 14px;
  text-align: center;
}

/* --- Idle screen --- */
.idle-content { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.idle-content h2 { font-weight: 600; margin: 0; }
.status-line { color: var(--muted); }

/* --- Verse screen --- */
#verse-screen { justify-content: space-between; padding: 5vh 6vw; }
.verse-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  color: var(--muted);
  font-size: clamp(14px, 2.2vw, 22px);
}
.verse-progress { font-variant-numeric: tabular-nums; }

.verse-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 2.4vh, 28px);
  width: 100%;
}

.line { line-height: 1.5; max-width: 92vw; }
.line-gurmukhi {
  font-family: 'NotoGurmukhi', serif;
  font-weight: 700;
  font-size: calc(clamp(30px, 6.5vw, 92px) * var(--font-scale));
  color: var(--fg);
}
.line-translit-hi { font-family: 'NotoDevanagari', serif; }
.line-translit-en, .line-translit-hi {
  font-family: 'NotoLatin', sans-serif;
  font-size: calc(clamp(18px, 3vw, 40px) * var(--font-scale));
  color: var(--muted);
  font-style: italic;
}
.line-translit-hi { font-family: 'NotoDevanagari', serif; }
.line-translation-pa { font-family: 'NotoGurmukhi', serif; }
.line-translation-hi { font-family: 'NotoDevanagari', serif; }
.line-translation-en, .line-translation-es {
  font-family: 'NotoLatin', sans-serif;
}
.line-translation-pa, .line-translation-hi,
.line-translation-en, .line-translation-es {
  font-size: calc(clamp(18px, 3.2vw, 44px) * var(--font-scale));
  color: color-mix(in srgb, var(--fg) 82%, transparent);
}

.verse-footer { width: 100%; color: var(--muted); font-size: clamp(13px, 2vw, 20px); }

/* alignment applied on body via data-align */
body[data-align='left']  .verse-body,
body[data-align='left']  .line { text-align: left; align-items: flex-start; }
body[data-align='right'] .verse-body,
body[data-align='right'] .line { text-align: right; align-items: flex-end; }
body[data-align='center'] .verse-body { text-align: center; }

/* --- Reconnect overlay --- */
.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  z-index: 10;
}
.overlay-box {
  background: var(--card);
  border: 1px solid var(--card-border);
  padding: 16px 28px;
  border-radius: 12px;
  font-size: 18px;
}
