/* Southern Rut Performance — deck viewer chrome.
   Palette taken from the deck: deep navy ground, orange accent, off-white ink. */
:root {
  --navy-900: #0a1422;
  --navy-800: #0d1b2e;
  --navy-700: #14263c;
  --line: #21344b;
  --orange: #ee6c1f;
  --orange-bright: #f6792b;
  --ink: #e8edf4;
  --muted: #8aa0b8;
  --topbar-h: 60px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--navy-900);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---- top bar ---- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  /* min-height so the iOS safe-area inset adds to the bar instead of
     compressing the brand/controls behind a notch in landscape. */
  min-height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 clamp(12px, 3vw, 28px);
  padding-top: env(safe-area-inset-top, 0);
  background: rgba(10, 20, 34, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  text-decoration: none;
  color: inherit;
  line-height: 1;
  overflow: hidden;
}

.brand-logo {
  font-weight: 800;
  letter-spacing: 0.5px;
  font-size: 18px;
  white-space: nowrap;
}
.brand-logo .sr { color: var(--ink); }
.brand-logo .perf { color: var(--orange); margin-left: 6px; }
.brand-logo.big { font-size: 30px; }

.brand-sub {
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
}

.controls {
  display: flex;
  align-items: center;
  gap: clamp(8px, 2vw, 18px);
}

.page-ind {
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  color: var(--muted);
  white-space: nowrap;
}
.page-ind #pageCurrent { color: var(--ink); font-weight: 700; }
.page-ind .sep { margin: 0 5px; opacity: 0.6; }

.zoom {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.zoom button {
  appearance: none;
  border: 0;
  background: var(--navy-700);
  color: var(--ink);
  font-size: 16px;
  font-weight: 700;
  min-width: 38px;
  padding: 8px 10px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.zoom button + button { border-left: 1px solid var(--line); }
.zoom button:hover { background: var(--line); }
.zoom button:active { background: var(--orange); color: #fff; }
.zoom #zoomReset { font-size: 13px; letter-spacing: 0.5px; }

.dl {
  display: inline-flex;
  align-items: center;
  background: var(--orange);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.3px;
  padding: 9px 16px;
  border-radius: 8px;
  white-space: nowrap;
  transition: background 0.15s ease, transform 0.05s ease;
}
.dl:hover { background: var(--orange-bright); }
.dl:active { transform: translateY(1px); }

/* ---- viewer ---- */
.viewer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(14px, 2.4vw, 28px);
  padding: clamp(16px, 3vw, 36px) clamp(10px, 3vw, 28px) 64px;
  width: 100%;
}

.page {
  position: relative;
  width: 100%;
  max-width: var(--page-max, 1180px);
  background: var(--navy-800);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}
/* Keep layout stable before the canvas paints (16:9 deck pages). */
.page::before {
  content: "";
  display: block;
  padding-top: var(--page-ratio, 56.25%);
}
.page canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.page .page-num {
  position: absolute;
  left: 10px;
  bottom: 8px;
  z-index: 2;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  background: rgba(10, 20, 34, 0.6);
  padding: 2px 8px;
  border-radius: 99px;
  pointer-events: none;
}

/* ---- overlays ---- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--navy-900);
}
.overlay.hidden { display: none; }
.overlay-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  text-align: center;
  padding: 24px;
  color: var(--muted);
}
.spinner {
  width: 38px;
  height: 38px;
  border: 3px solid var(--line);
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .spinner { animation: none; }
}

@media (max-width: 640px) {
  .brand-sub { display: none; }
  .zoom #zoomReset { display: none; }
  .dl { padding: 9px 12px; }
}
