/* ═══════════════════════════════════════════════════════════
   Crossroads — shared design system
   Load FIRST on every page: <link rel="stylesheet" href="theme.css">
   Page-specific styles live in each page's <style> block.
   ═══════════════════════════════════════════════════════════ */

*, *::before, *::after {
  margin: 0; padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:root {
  /* Surfaces */
  --bg:      #000;
  --bg2:     #1C1C1E;
  --bg3:     #2C2C2E;
  --bg4:     #3A3A3C;
  --sep:     rgba(255,255,255,0.09);

  /* Text — iOS system scale */
  --label:   #fff;
  --label2:  rgba(235,235,245,0.6);
  --label3:  rgba(235,235,245,0.3);

  /* Brand + feature accents */
  --accent:  #4DBFD8;
  --accent2: #3AA8C0;
  --red:     #FF453A;
  --orange:  #FF9F0A;
  --green:   #48C774;
  --blue:    #0A84FF;
  --purple:  #A782FF;
  --gold:    #FFD43B;

  /* Layout */
  --nav-h:    calc(49px + env(safe-area-inset-bottom, 34px));
  --safe-top: env(safe-area-inset-top, 0px);
}

html { background: var(--bg); }
body {
  /* Native system-font stack — never bundles a font file.
     Resolves to SF Pro on Apple devices, Roboto on Android, Segoe UI on Windows.
     Each platform renders its own system font; no font is distributed with the app. */
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--label);
}

/* ── Large-title header (tab pages) ──────────────── */
.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 44px) + 10px) 20px 12px;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}
.top-nav-title {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.8px;
  color: var(--label);
}

/* ── Frosted bar header (pushed pages) ───────────── */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: var(--safe-top) 12px 0;
  height: calc(52px + var(--safe-top));
  background: rgba(18,18,20,0.92);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-bottom: 0.5px solid var(--sep);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.top-bar-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--label);
  flex: 1;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.top-bar-side { width: 72px; display: flex; align-items: center; flex-shrink: 0; }
.top-bar-side.right { justify-content: flex-end; }

/* ── Round buttons ───────────────────────────────── */
.back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--bg2);
  border: 0.5px solid var(--sep);
  color: var(--label2);
  text-decoration: none;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.14s ease;
}
.back-btn:active { background: var(--bg3); }
.back-btn svg {
  width: 18px; height: 18px;
  fill: none; stroke: currentColor;
  stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round;
}

.icon-btn {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--bg2);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.icon-btn svg { width: 16px; height: 16px; fill: var(--label2); }

/* ── Section title ───────────────────────────────── */
.section-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.4px;
  color: var(--label);
  padding: 0 20px;
}

/* ── Pill action buttons ─────────────────────────── */
.pill-row {
  display: flex;
  gap: 8px;
  padding: 0 20px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  min-height: 44px;
  align-items: center;
  scrollbar-width: none;
}
.pill-row::-webkit-scrollbar { display: none; }
.pill-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 50px;
  background: var(--bg2);
  border: 0.5px solid var(--sep);
  color: var(--label);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
  text-decoration: none;
  transition: background 0.12s;
}
.pill-btn:active { background: var(--bg3); }
.pill-icon {
  width: 26px; height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.pill-icon svg { width: 13px; height: 13px; }

/* ── Horizontal card strip ───────────────────────── */
.card-strip {
  display: flex;
  gap: 12px;
  padding: 0 20px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.card-strip::-webkit-scrollbar { display: none; }
.strip-card {
  flex-shrink: 0;
  width: 190px;
  border-radius: 14px;
  overflow: hidden;
  background: var(--bg2);
  border: 0.5px solid var(--sep);
  text-decoration: none;
  display: flex;
  flex-direction: column;
  transition: transform 0.12s;
}
.strip-card:active { transform: scale(0.97); }
.strip-card-img {
  width: 100%;
  height: 115px;
  background: var(--bg3) center/cover no-repeat;
}
.strip-card-body { padding: 10px 12px 13px; flex: 1; }
.strip-card-title { font-size: 14px; font-weight: 600; color: var(--label); line-height: 1.3; }
.strip-card-sub   { font-size: 12px; color: var(--label2); margin-top: 2px; }

/* ── Bottom tab bar ──────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--nav-h);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(18,18,20,0.92);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-top: 0.5px solid var(--sep);
  display: flex;
  align-items: flex-start;
  justify-content: space-around;
  padding-top: 10px;
  z-index: 100;
}
.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  flex: 1;
  color: var(--label3);
  text-decoration: none;
}
.nav-btn.active { color: var(--accent); pointer-events: none; }
.nav-btn:active { color: var(--accent); }
.nav-btn svg  { width: 24px; height: 24px; fill: currentColor; }
.nav-btn span { font-size: 10px; font-weight: 500; letter-spacing: 0.1px; }

/* ── PDF bottom sheet ────────────────────────────── */
.pdf-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.pdf-backdrop.open { opacity: 1; pointer-events: all; }
.pdf-sheet {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 501;
  height: 92dvh;
  background: var(--bg2);
  border-radius: 20px 20px 0 0;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(0.32,0.72,0,1);
}
.pdf-sheet.open { transform: translateY(0); }
.pdf-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 0.5px solid var(--sep);
  flex-shrink: 0;
}
.pdf-sheet-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--label);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-right: 12px;
}
.pdf-sheet-close {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--bg3);
  border: none;
  color: var(--label2);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.pdf-sheet iframe { flex: 1; border: none; width: 100%; background: #fff; }
.pdf-loading {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--label3);
  font-size: 14px;
}
.pdf-spinner {
  width: 28px; height: 28px;
  border: 3px solid var(--bg3);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: pdfSpin 0.7s linear infinite;
}
@keyframes pdfSpin { to { transform: rotate(360deg); } }

/* ── Skeleton shimmer ────────────────────────────── */
@keyframes homeSkel { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
