/* ytlens shared stylesheet — single source of truth for design tokens, the
   constant app nav, buttons, forms, and tables. Served from /static/app.css and
   linked by every full page (landing, history, admin, wait). The report renders
   its own self-contained CSS (it also ships as a standalone CLI file) but shares
   the same tokens and nav treatment so the chrome stays uniform. */

/* self-hosted fonts (latin subset, variable weight) — no third-party calls, so
   the strict CSP needs no font/style allowances for Google. */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('/static/fonts/inter.woff2') format('woff2');
}
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url('/static/fonts/space-grotesk.woff2') format('woff2');
}

:root {
  --bg: #F4F3EF;
  --surface: #fff;
  --line: #E7E5DE;
  --ink: #191815;
  --ink2: #5C584F;
  --mute: #6F6A5E;        /* darkened from #968F82 to clear WCAG AA on white for small text */
  --faint: #968F82;       /* decorative only — never the sole carrier of meaning */
  --accent: #1A1916;
  --gold: #C8881F;
  --pos: #2F9E6B;
  --neg: #D6604A;
  --panel: #F0ECE2;
  --disp: "Space Grotesk", system-ui, sans-serif;
  --sans: "Inter", system-ui, sans-serif;
  --r: 14px;
  /* type scale */
  --t-xs: 11px;
  --t-sm: 13px;
  --t-base: 14px;
  --t-lg: 18px;
  --t-xl: 22px;
  --t-hero: 36px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--t-base);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* visible keyboard focus everywhere (custom buttons/links had none) */
:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---- the constant app nav (dark, sticky) — identical across every page ---- */
.appnav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 54px;
  padding: 0 18px;
  background: var(--accent);
  color: #fff;
  font-family: var(--sans);
}
.appnav .an-logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--disp);
  font-weight: 700;
  font-size: 16px;
  color: #fff;
  text-decoration: none;
  letter-spacing: -.02em;
}
.appnav .an-mark { height: 22px; width: auto; display: block; flex: none; }
.appnav .an-name span { color: var(--gold); }
.appnav .an-tag { font-size: 12px; color: var(--faint); font-weight: 500; }
.appnav .an-right { display: flex; align-items: center; gap: 14px; font-size: var(--t-sm); }
.appnav a { color: #CFC9BB; text-decoration: none; font-weight: 500; }
.appnav a:hover, .appnav a.on { color: #fff; }
.appnav a.on { font-weight: 600; }
.appnav .an-cred { font-family: var(--disp); font-weight: 700; color: var(--gold); }
.appnav .an-em { color: #8B857A; font-size: 12px; }

/* ---- buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 10px;
  font-family: var(--sans);
  font-size: var(--t-sm);
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid transparent;
  transition: opacity .15s, border-color .15s, color .15s;
}
.btn:disabled, .btn.is-busy { opacity: .55; cursor: progress; pointer-events: none; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { opacity: .9; }
.btn-outline { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-outline:hover { border-color: var(--ink2); }
.btn-ghost { background: transparent; border-color: rgba(255,255,255,.22); color: #CFC9BB; }
.btn-ghost:hover { border-color: var(--neg); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: var(--t-xs); }

/* ---- forms ---- */
.input {
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-family: var(--sans);
  font-size: var(--t-base);
  color: var(--ink);
  outline: none;
}
.input:focus { border-color: var(--gold); }

/* ---- page shell + headings ---- */
.wrap { max-width: 900px; margin: 32px auto; padding: 0 20px; }
h2 { font-family: var(--disp); font-weight: 700; font-size: var(--t-xl); margin-bottom: 20px; }

/* ---- tables (history, admin) ---- */
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
}
th {
  text-align: left;
  font-size: var(--t-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--mute);
  padding: 10px 14px;
  background: var(--panel);
}
td { padding: 11px 14px; border-top: 1px solid var(--line); font-size: var(--t-sm); vertical-align: middle; }
.num { font-variant-numeric: tabular-nums; color: var(--ink2); }

/* htmx indeterminate state */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: inline; }

/* screen-reader-only (visually hidden but announced) */
.vis-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* wrap a wide table so it scrolls horizontally on small screens instead of
   pushing the whole page wider than the viewport. */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ---- mobile ---- */
@media (max-width: 600px) {
  /* the right-side links don't fit on one line on a phone, so let the bar wrap:
     logo on row one, the nav links wrap onto a second row beneath it. Without
     this the items overflow past the dark header and land on the page bg. */
  .appnav {
    flex-wrap: wrap;
    height: auto;
    min-height: 54px;
    padding: 8px 14px;
    gap: 8px 12px;
  }
  .appnav .an-right {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 8px 14px;
    font-size: var(--t-xs);
  }
  .appnav .an-em { display: none; }   /* email: longest, least-essential nav item */
  .wrap { margin: 22px auto; padding: 0 16px; }
  h2 { font-size: var(--t-lg); }
}

/* ---- site footer: legal banner + obfuscated contact ---- */
.appfoot {
  max-width: 720px;
  margin: 40px auto 0;
  padding: 22px 18px 40px;
  border-top: 1px solid var(--line);
  text-align: center;
}
.appfoot .af-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px 18px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.appfoot .af-brand { font-family: var(--disp); font-weight: 700; color: var(--ink); letter-spacing: -.02em; }
.appfoot .af-contact { font-size: var(--t-sm); color: var(--ink2); }
.appfoot .af-contact .at { color: var(--mute); }
.appfoot .af-legal { font-size: var(--t-xs); color: var(--mute); line-height: 1.5; max-width: 560px; margin: 0 auto 8px; }
.appfoot .af-copy { font-size: var(--t-xs); color: var(--faint); }
