/* ============================================================================
   GeniusLaw, Statement of Facts approval
   SF Pro Display, GeniusLaw blues. Cloned from the CaseCheck report app's
   design system: same custom properties, nav, brand, card, button, state and
   spinner rules, so the two pages read as one product. Unlike that app, this
   page supports light and dark, following prefers-color-scheme.
============================================================================ */

:root {
  --font: "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;

  --brand: #2f6bff;
  --brand-strong: #1d54e8;
  --green: #16a34a;
  --red: #e5484d;

  --r-card: 20px;
  --r-sm: 12px;

  --bg: #ffffff;
  --card: #ffffff;
  --bg-input: #ffffff;
  --text: #0b1220;
  --text-2: #35435c;
  --muted: #6b7890;
  --line: rgba(13, 27, 62, 0.1);
  --line-2: rgba(13, 27, 62, 0.16);
  --chip-bg: #eef3ff;
  --chip-text: #2f6bff;
  --soft-bg: #f7f9fc;
  --green-bg: rgba(22, 163, 74, 0.09);
  --red-bg: rgba(229, 72, 77, 0.08);
  --shadow-sm: 0 1px 2px rgba(13, 27, 62, 0.04);
  --shadow: 0 1px 2px rgba(13, 27, 62, 0.04), 0 14px 34px -28px rgba(13, 27, 62, 0.22);
  --scrim: rgba(8, 13, 26, 0.55);
}

/* Same dark palette as the CaseCheck terms app, applied automatically instead
   of through a toggle: this page has no theme button, it just follows the
   client's OS setting. */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #080d1a;
    --card: #0e1626;
    --bg-input: #111b2e;
    --text: #eaf1fb;
    --text-2: #b6c6e2;
    --muted: #7e90af;
    --line: rgba(150, 180, 225, 0.12);
    --line-2: rgba(150, 180, 225, 0.2);
    --chip-bg: rgba(92, 147, 255, 0.14);
    --chip-text: #9dbeff;
    --soft-bg: rgba(255, 255, 255, 0.04);
    --green-bg: rgba(22, 163, 74, 0.18);
    --red-bg: rgba(229, 72, 77, 0.16);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 24px 50px -28px rgba(0, 0, 0, 0.8);
    --scrim: rgba(0, 0, 0, 0.66);
    --brand: #4d86ff;
  }
}

* { box-sizing: border-box; }
html { height: 100%; }

/* The state sections use display:flex/grid, which would beat the UA's
   [hidden] rule, so force hidden to always win. */
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ----------------------------- nav ------------------------------------- */
.nav { position: sticky; top: 0; z-index: 20; padding: 16px clamp(14px, 3vw, 28px); }
.nav__inner {
  max-width: 1600px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px 12px 10px 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand__word { font-weight: 700; font-size: 17px; letter-spacing: 0.02em; line-height: 1; }
.brand__word b { color: var(--text); }
.brand__word i { color: var(--brand); font-style: normal; }
.brand__word sup { font-size: 8px; color: var(--muted); top: -0.9em; position: relative; }

.chip {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 600; padding: 7px 13px;
  border-radius: 999px; color: var(--chip-text); background: var(--chip-bg); white-space: nowrap;
}

/* ----------------------------- layout ---------------------------------- */
.layout {
  flex: 1;
  width: 100%; max-width: 1600px; margin: 0 auto;
  padding: 10px clamp(14px, 3vw, 28px) 40px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  box-shadow: var(--shadow);
}

.eyebrow {
  font-size: 11.5px; font-weight: 600; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--muted); margin: 0 0 6px;
}

/* ----------------------------- states ---------------------------------- */
.state { padding: 46px 32px; }
.state--center {
  display: flex; flex-direction: column; align-items: center;
  gap: 12px; text-align: center;
}
.state__title { font-size: clamp(21px, 3.4vw, 26px); font-weight: 700; margin: 4px 0 0; letter-spacing: -0.02em; }
.state__text { color: var(--text-2); margin: 0; max-width: 46ch; font-size: 15px; }

.spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid var(--line-2); border-top-color: var(--brand);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ----------------------------- document layout -------------------------- */

/* Two columns on desktop: document left, notes and decision right. The
   sidebar is a fixed band rather than a proportional share, so every pixel
   the window gains goes to the document instead of stretching the notes box. */
.doc {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 400px);
  gap: 28px;
  align-items: start;
}

.doc__main { padding: clamp(24px, 4vw, 40px); }
.doc__title {
  font-size: clamp(20px, 3.2vw, 25px);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 4px 0 0;
}

/* Pinned beside the document. Capping the height matters: these three cards
   can outgrow a short viewport, and a sticky element taller than the screen
   strands its bottom, Approve included, off-screen. Capped, it stays pinned
   and scrolls inside itself instead. */
.doc__side {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 84px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.doc__meta {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 16px;
  margin: 20px 0 24px;
  font-size: 14px;
}
.doc__meta dt { color: var(--muted); }
.doc__meta dd { margin: 0; }

.sof {
  font-size: 15px;
  line-height: 1.7;
}
.sof p { margin: 0 0 14px; }

/* Quiet by design: it should read as reassurance under the document, not as
   a warning competing with it. */
.disclaimer {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-top: 28px;
  padding: 14px 16px;
  border-radius: var(--r-sm);
  background: var(--soft-bg);
  border: 1px solid var(--line);
}
.disclaimer__icon { flex: none; margin-top: 1px; color: var(--brand); }
.disclaimer__text {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--muted);
}
.disclaimer__text b { color: var(--text-2); font-weight: 600; margin-right: 2px; }

/* ----------------------------- notes ------------------------------------ */
.notes, .decide { padding: 22px clamp(18px, 3vw, 26px); }
/* Third card in a sticky column that is already height-capped, so it runs
   tighter than the two above it. Every pixel it saves is a pixel of Approve
   that stays on screen on a short laptop display. */
.meet { padding: 18px clamp(18px, 3vw, 26px); }

.notes__title { font-size: 16px; font-weight: 700; margin: 0 0 6px; letter-spacing: -0.01em; }
.notes__help {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--muted);
}
.notes__input {
  width: 100%;
  resize: vertical;
  font: inherit;
  font-size: 14px;
  line-height: 1.5;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  background: var(--bg-input);
  color: var(--text);
}

/* ----------------------------- decision ---------------------------------- */
.check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 14px;
  line-height: 1.45;
  margin-bottom: 14px;
}

.decide .btn, .meet .btn { width: 100%; margin-bottom: 8px; }
.meet .btn { margin-top: 14px; margin-bottom: 0; }
.meet .notes__help { margin-bottom: 0; }

/* ------------------------------ dialog ----------------------------------- */
/* The replacement for window.alert. The backdrop is a sibling of the card
   rather than a background on .modal, so the card can fade in over it without
   inheriting its opacity. `hidden` has to be re-asserted here because the
   display:flex below would otherwise beat the browser's [hidden] rule. */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal[hidden] { display: none; }

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: var(--scrim);
}

.modal__card {
  position: relative;
  width: 100%;
  max-width: 420px;
  padding: 30px 30px 26px;
  text-align: center;
  animation: modal-in 0.18s ease-out;
}
.modal__title {
  margin: 0 0 8px;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.modal__text {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--text-2);
}
/* With no heading the sentence carries the whole dialog on its own, so it
   steps up to roughly the presence the title would have had. */
.modal__title[hidden] + .modal__text {
  font-size: 15.5px;
  color: var(--text);
}

.modal__ok { min-width: 140px; }

@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .modal__card { animation: none; }
}

/* ----------------------------- buttons ----------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  font-family: var(--font); font-size: 15px; font-weight: 650;
  padding: 13px 26px; border-radius: 999px; border: 1px solid transparent;
  cursor: pointer; text-decoration: none; transition: all 0.18s ease; margin-top: 18px;
}
.btn--primary { background: var(--brand); color: #fff; }
.btn--primary:hover:not(:disabled) { background: var(--brand-strong); }
.btn--ghost { color: var(--text-2); background: var(--soft-bg); border-color: var(--line); }
.btn--ghost:hover { color: var(--text); border-color: var(--line-2); }
.btn--danger { background: var(--red); color: #fff; }
.btn--danger:hover:not(:disabled) { opacity: 0.9; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Below this the sidebar would be squeezed under its 340px floor, so the
   columns stack: document, then notes, then the decision. Nothing is hidden.
   The height cap has to go with the sticky, or the stacked sidebar keeps a
   scrollbar it no longer needs. */
@media (max-width: 1024px) {
  .doc { grid-template-columns: 1fr; }
  .doc__side {
    position: static;
    max-height: none;
    overflow-y: visible;
  }
}
