/* OPRA Subscriber Agreement page (opra_agreement.html).
   Loads after style.css and content.css, scoped to the opra- prefix so it never leaks.
   Shared components used as-is and NOT restyled here: .btn/.btn-primary/
   .btn-ghost/.btn-sm, .auth-submit (+ its .is-loading spinner), .auth-field,
   .auth-status-msg, .subnav, .callout-note, .tier-badge, .eyebrow, .hero-bg,
   .hero-ctas, .reveal. Where this file touches a shared class it does so only
   through an opra- prefixed parent selector, per the design-system hard rules. */

/* ===== Hero ===== */
.opra-hero { padding: 72px 0 8px; text-align: center; position: relative; z-index: 1; }
.opra-hero h1 {
  font-family: var(--font-display); font-weight: var(--fw-display);
  font-size: var(--fs-h1-page); letter-spacing: var(--ls-tight-xl);
  margin: var(--sp-4) 0 var(--sp-3); text-wrap: balance;
}
.opra-hero-sub {
  color: var(--text-muted); max-width: 640px; margin: 0 auto;
  font-size: var(--fs-lead); line-height: 1.5;
}

/* ===== Join-flow stepper ===== */
.opra-steps {
  list-style: none; margin: var(--sp-7) auto 0; padding: 0;
  display: flex; align-items: center; justify-content: center;
  flex-wrap: wrap; gap: var(--sp-3);
}
.opra-step { display: flex; align-items: center; gap: var(--sp-3); text-align: left; }
.opra-step-mark {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-elevated); border: 1px solid var(--border);
  color: var(--text-faint);
  font-family: var(--font-mono); font-size: var(--fs-label);
  transition: background var(--dur-2) ease, color var(--dur-2) ease, border-color var(--dur-2) ease;
}
.opra-step-mark .icon { width: 15px; height: 15px; }
.opra-step.is-done .opra-step-mark { background: var(--data-dim); border-color: transparent; color: var(--data); }
.opra-step.is-current .opra-step-mark {
  background: linear-gradient(135deg, var(--voice), var(--voice-light));
  border-color: transparent; color: var(--text-on-accent); font-weight: var(--fw-strong);
  box-shadow: var(--shadow-glow-voice);
}
.opra-step-text { display: flex; flex-direction: column; line-height: 1.25; }
.opra-step-name { font-size: var(--fs-body-sm); font-weight: var(--fw-emphasis); color: var(--text-faint); }
.opra-step.is-done .opra-step-name,
.opra-step.is-current .opra-step-name { color: var(--text); }
.opra-step-meta {
  font-family: var(--font-mono); font-size: var(--fs-2xs);
  letter-spacing: var(--ls-wide); text-transform: uppercase; color: var(--text-faint);
}
.opra-step.is-current .opra-step-meta { color: var(--voice); }
.opra-step-line { list-style: none; width: 40px; height: 1px; background: var(--border-strong); flex-shrink: 0; }
@media (max-width: 640px) {
  .opra-steps { flex-direction: column; align-items: flex-start; max-width: 260px; }
  .opra-step-line { width: 1px; height: 20px; margin-left: 15px; }
}

/* ===== Full-width state cards (loading / error / exempt / signed) ===== */
.opra-state { padding-block: var(--sp-8); }
.opra-state-card {
  max-width: 560px; margin: 0 auto; text-align: center;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: var(--sp-7) var(--sp-6);
  box-shadow: var(--shadow-card);
}
.opra-state-card h2 {
  font-family: var(--font-display); font-weight: var(--fw-display);
  font-size: var(--fs-h3); letter-spacing: var(--ls-tight-lg); margin: var(--sp-4) 0 var(--sp-3);
}
.opra-state-card p { color: var(--text-muted); font-size: var(--fs-sm); line-height: 1.65; margin: 0; }
.opra-state-card .hero-ctas { margin-top: var(--sp-5); justify-content: center; }
.opra-state-card .tier-badge { margin-top: var(--sp-4); }
.opra-state-icon {
  width: 52px; height: 52px; border-radius: var(--radius-lg); margin: 0 auto;
  display: flex; align-items: center; justify-content: center;
}
.opra-state-icon .icon { width: 26px; height: 26px; }
.opra-state-icon.is-ok { background: var(--data-dim); color: var(--data); }
.opra-state-icon.is-fail { background: var(--data-down-dim); color: var(--data-down); }
.opra-state-icon.is-elite { background: var(--voice-dim); color: var(--ecosystem-elite); }

.opra-spinner {
  width: 24px; height: 24px; margin: 0 auto var(--sp-4); display: block;
  border: 2px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: opraSpin 0.8s linear infinite;
}
@keyframes opraSpin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .opra-spinner { animation: none; } }

/* Signed receipt */
.opra-receipt {
  margin: var(--sp-5) 0 0; padding: var(--sp-4) var(--sp-5);
  background: var(--bg-sunken); border: 1px solid var(--border-hair); border-radius: var(--radius-md);
  text-align: left;
}
.opra-receipt-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: var(--sp-4);
  padding: var(--sp-2) 0;
}
.opra-receipt-row + .opra-receipt-row { border-top: 1px solid var(--border-hair); }
.opra-receipt dt { font-size: var(--fs-label); color: var(--text-faint); }
.opra-receipt dd {
  margin: 0; font-family: var(--font-mono); font-size: var(--fs-body-sm);
  letter-spacing: var(--ls-normal); color: var(--text); text-align: right;
}
.opra-receipt-note {
  margin-top: var(--sp-4) !important;
  font-size: var(--fs-xs) !important; color: var(--text-faint) !important;
}

/* ===== Two-column layout: document + form, with the sticky rail ===== */
.opra-recert-note { max-width: var(--container-max); margin-bottom: var(--sp-5); }
.opra-layout { display: grid; grid-template-columns: 1fr; gap: var(--sp-5); align-items: start; }
@media (min-width: 1024px) {
  .opra-layout { grid-template-columns: minmax(0, 1fr) 320px; gap: var(--sp-6); }
}
.opra-main { display: flex; flex-direction: column; gap: var(--sp-5); min-width: 0; }

/* ===== Panel (one per step) ===== */
.opra-panel {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: var(--sp-6);
  /* fieldset resets — these panels are <fieldset> so the lock can use the
     `disabled` attribute, which disables every control inside for free. */
  margin: 0; min-width: 0;
  transition: border-color var(--dur-2) ease, opacity var(--dur-2) ease;
}
@media (max-width: 560px) { .opra-panel { padding: var(--sp-5) var(--sp-4); } }
.opra-panel-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--sp-4); flex-wrap: wrap; margin-bottom: var(--sp-2);
}
.opra-panel-head h2 {
  font-family: var(--font-display); font-weight: var(--fw-display);
  font-size: var(--fs-h3); letter-spacing: var(--ls-tight-lg); margin: var(--sp-1) 0 0;
}
/* style.css scopes .eyebrow-mono to `.section-head .eyebrow-mono`, and these
   panel heads are not .section-head (different layout: title plus a right-hand
   status tag). Re-stated here through an opra- prefixed parent rather than loosening
   the shared rule, which would change every page that uses it. */
.opra-panel-head .eyebrow-mono {
  font-family: var(--font-mono); font-size: var(--fs-label); color: var(--data);
  letter-spacing: var(--ls-wide); text-transform: uppercase;
}
.opra-panel-head .eyebrow-mono--accent { color: var(--accent); }
.opra-panel-head .eyebrow-mono--voice { color: var(--voice); }
.opra-panel-sub {
  color: var(--text-faint); font-size: var(--fs-body-sm); line-height: 1.6;
  margin: 0 0 var(--sp-5); max-width: 640px;
}
.opra-version-tag, .opra-lock-tag {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  font-family: var(--font-mono); font-size: var(--fs-2xs); letter-spacing: var(--ls-wide);
  text-transform: uppercase; padding: 5px 10px; border-radius: var(--radius-pill);
  background: var(--bg-elevated); border: 1px solid var(--border); color: var(--text-faint);
  white-space: nowrap;
}
.opra-lock-tag .icon { width: 12px; height: 12px; }
.opra-version-tag { letter-spacing: var(--ls-normal); }

/* Locked state: the affirmation panels before the document has been read. */
.opra-panel.opra-locked { opacity: 0.55; border-style: dashed; }
.opra-panel.opra-locked .opra-check { cursor: not-allowed; }
.opra-panel.is-unlocked { opacity: 1; border-style: solid; }
.opra-panel.is-unlocked .opra-lock-tag {
  background: var(--data-dim); border-color: transparent; color: var(--data);
}

/* ===== The agreement document, in its own scroller ===== */
.opra-doc-progress {
  height: 3px; border-radius: var(--radius-pill); background: var(--border);
  overflow: hidden; margin-bottom: var(--sp-3);
}
.opra-doc-progress-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--voice));
  transition: width var(--dur-1) linear;
}
.opra-doc {
  max-height: 460px; overflow-y: auto; overscroll-behavior: contain;
  background: var(--bg-sunken); border: 1px solid var(--border-hair);
  border-radius: var(--radius-md); padding: var(--sp-5);
  /* A fade at the bottom edge that disappears once the end is reached,
     so "there is more below" is visible without a scrollbar hunt. */
  mask-image: linear-gradient(to bottom, currentColor calc(100% - 40px), transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, currentColor calc(100% - 40px), transparent 100%);
}
.opra-doc.is-at-end { mask-image: none; -webkit-mask-image: none; }
@media (max-width: 560px) { .opra-doc { max-height: 380px; padding: var(--sp-4); } }
.opra-doc-notice {
  font-size: var(--fs-body-sm); line-height: 1.7; color: var(--text-muted); margin: 0 0 var(--sp-4);
}
.opra-doc-notice:first-child {
  color: var(--text); font-weight: var(--fw-emphasis);
  background: var(--accent-soft); border-left: 2px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0; padding: var(--sp-4);
}
.opra-doc-heading {
  font-family: var(--font-display); font-weight: var(--fw-strong); font-size: var(--fs-h4);
  letter-spacing: var(--ls-tight); margin: var(--sp-6) 0 var(--sp-4); color: var(--text);
}
.opra-clause { display: flex; gap: var(--sp-4); margin-bottom: var(--sp-5); }
.opra-clause-num {
  width: 26px; height: 26px; flex-shrink: 0; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-elevated); border: 1px solid var(--border);
  font-family: var(--font-mono); font-size: var(--fs-2xs); letter-spacing: var(--ls-normal);
  color: var(--text-faint);
}
.opra-clause-body { min-width: 0; }
.opra-clause-body h4 {
  font-family: var(--font-body); font-weight: var(--fw-strong); font-size: var(--fs-body-sm);
  letter-spacing: var(--ls-tight); color: var(--text); margin: 3px 0 var(--sp-2);
}
.opra-clause-body p {
  font-size: var(--fs-body-sm); line-height: 1.7; color: var(--text-muted); margin: 0 0 var(--sp-3);
}
.opra-clause-body p:last-child { margin-bottom: 0; }
.opra-clause-emphatic {
  color: var(--text-faint) !important; font-size: var(--fs-xs) !important;
  letter-spacing: var(--ls-wide); line-height: 1.75 !important;
}
.opra-doc-end {
  font-family: var(--font-mono); font-size: var(--fs-2xs); letter-spacing: var(--ls-wide);
  text-transform: uppercase; color: var(--text-faint); text-align: center;
  padding-top: var(--sp-5); border-top: 1px dashed var(--border-strong); margin: 0;
}

.opra-doc-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-4); flex-wrap: wrap; margin-top: var(--sp-4);
}
.opra-doc-status {
  display: flex; align-items: center; gap: var(--sp-2); margin: 0;
  font-size: var(--fs-label); color: var(--text-faint);
}
.opra-doc-status-icon {
  width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--border); color: transparent;
  transition: background var(--dur-2) ease, color var(--dur-2) ease;
}
.opra-doc-status-icon .icon { width: 11px; height: 11px; }
.opra-doc-status[data-read="true"] { color: var(--data); }
.opra-doc-status[data-read="true"] .opra-doc-status-icon { background: var(--data-dim); color: var(--data); }
/* Hidden by opra.js once the end is reached — there is nothing left to jump to. */
.opra-doc-jump { flex-shrink: 0; white-space: nowrap; }

/* ===== Affirmation checkboxes ===== */
.opra-check {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  /* Contains the visually-hidden real <input> below, which is absolutely
     positioned. Without this it would resolve against whatever ancestor
     happens to be positioned (style.css makes every <section> relative) and
     land somewhere arbitrary on the page. */
  position: relative;
  padding: var(--sp-4); border-radius: var(--radius-md);
  border: 1px solid var(--border); background: var(--bg-sunken);
  cursor: pointer; margin-bottom: var(--sp-3);
  transition: border-color var(--dur-2) ease, background var(--dur-2) ease;
}
.opra-check:last-of-type { margin-bottom: 0; }
.opra-check:hover { border-color: var(--border-strong); }
/* The real input stays in the accessibility tree and keeps keyboard focus —
   it's visually replaced by .opra-check-box, not removed. */
.opra-check input[type="checkbox"] {
  position: absolute; opacity: 0; width: 18px; height: 18px; margin: 0; cursor: pointer;
}
.opra-check-box {
  width: 20px; height: 20px; flex-shrink: 0; margin-top: 1px;
  border: 1.5px solid var(--border-strong); border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: transparent; background: transparent;
  transition: background var(--dur-1) ease, border-color var(--dur-1) ease, color var(--dur-1) ease;
}
.opra-check-box .icon { width: 13px; height: 13px; stroke-width: 3; }
.opra-check input:checked ~ .opra-check-box {
  background: var(--data); border-color: var(--data); color: var(--text-on-data);
}
.opra-check input:focus-visible ~ .opra-check-box {
  outline: 2px solid var(--voice); outline-offset: 2px;
}
.opra-check:has(input:checked) { border-color: var(--data-dim); background: var(--data-dim); }
.opra-check-text { font-size: var(--fs-body-sm); line-height: 1.65; color: var(--text-muted); }
.opra-check-marker {
  font-family: var(--font-mono); font-size: var(--fs-2xs); color: var(--text-faint);
  margin-right: var(--sp-2); letter-spacing: var(--ls-normal);
}
.opra-check-text a { color: var(--voice); text-decoration: underline; text-decoration-color: var(--voice-dim); }
.opra-check-text a:hover { text-decoration-color: var(--voice); }
.opra-check--terms { margin-top: var(--sp-5); }
.opra-check.is-invalid { border-color: var(--data-down); background: var(--data-down-dim); }

/* ===== Details form ===== */
.opra-field-grid { display: grid; grid-template-columns: 1fr; gap: var(--sp-4); margin-bottom: var(--sp-4); }
@media (min-width: 768px) { .opra-field-grid { grid-template-columns: 1fr 1fr; } }
.opra-field-wide { margin-bottom: var(--sp-4); }
.opra-field-wide:last-of-type { margin-bottom: 0; }
.opra-field-hint { margin: 0; font-size: var(--fs-label); color: var(--text-faint); line-height: 1.5; }
/* style.css's .auth-field only styles `input`; this page is the first to put a
   textarea in one. Scoped to the panel so no other page's .auth-field changes. */
.opra-panel .auth-field textarea {
  width: 100%; font-family: var(--font-body); font-size: var(--fs-sm);
  letter-spacing: var(--ls-normal); line-height: 1.55; resize: vertical; min-height: 96px;
  background: var(--bg-elevated); border: 1px solid var(--border-strong);
  color: var(--text); border-radius: var(--radius-md); padding: var(--sp-3) var(--sp-4);
  transition: border-color var(--dur-1) ease, box-shadow var(--dur-1) ease, background var(--dur-1) ease;
}
.opra-panel .auth-field textarea:focus {
  outline: none; border-color: var(--accent); background: var(--bg-card);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.opra-panel .auth-field textarea::placeholder { color: var(--text-faint); }
.opra-panel .auth-field.is-invalid textarea {
  border-color: var(--data-down); box-shadow: 0 0 0 3px var(--data-down-dim);
}

/* ===== Signature pad ===== */
.opra-signature { display: flex; flex-direction: column; gap: var(--sp-3); }
.opra-signature-pad {
  position: relative; border: 1.5px dashed var(--border-strong); border-radius: var(--radius-md);
  background: var(--bg-sunken); overflow: hidden;
  transition: border-color var(--dur-2) ease, background var(--dur-2) ease;
}
.opra-signature-pad:hover { border-color: var(--accent-dim); }
.opra-signature-pad.is-signed { border-style: solid; border-color: var(--data-dim); background: var(--bg-elevated); }
.opra-signature-pad.is-invalid { border-color: var(--data-down); }
.opra-signature-pad canvas {
  display: block; width: 100%; height: 180px;
  touch-action: none; /* the pad handles pointer events itself; without this a
                         finger drag scrolls the page instead of drawing */
  cursor: crosshair; position: relative; z-index: 1;
}
.opra-signature-placeholder {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  margin: 0; pointer-events: none; z-index: 0;
  font-family: var(--font-mono); font-size: var(--fs-label); letter-spacing: var(--ls-wide);
  text-transform: uppercase; color: var(--text-faint);
}
.opra-signature-baseline {
  position: absolute; left: 10%; right: 10%; bottom: 42px; height: 1px;
  background: var(--border-strong); pointer-events: none; z-index: 0;
}
.opra-signature-actions {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-3); flex-wrap: wrap;
}
.opra-signature-hint { margin: 0; font-size: var(--fs-label); color: var(--text-faint); }
.opra-signature-hint.is-signed { color: var(--data); }
.opra-signature-buttons { display: flex; gap: var(--sp-2); }
.opra-signature-buttons .btn .icon { width: 13px; height: 13px; }
.opra-signature-buttons .btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ===== Sticky completion rail ===== */
.opra-rail { min-width: 0; }
@media (min-width: 1024px) { .opra-rail { position: sticky; top: 110px; } }
.opra-rail-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: var(--sp-5); box-shadow: var(--shadow-card);
}
.opra-rail-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--sp-3); margin-bottom: var(--sp-3);
}
.opra-rail-title { font-size: var(--fs-body-sm); font-weight: var(--fw-strong); color: var(--text); }
.opra-rail-count {
  font-family: var(--font-mono); font-size: var(--fs-2xs); letter-spacing: var(--ls-normal);
  color: var(--text-faint); font-variant-numeric: tabular-nums;
}
.opra-rail-track {
  height: 4px; border-radius: var(--radius-pill); background: var(--border);
  overflow: hidden; margin-bottom: var(--sp-4);
}
.opra-rail-fill {
  height: 100%; width: 0%; border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--accent), var(--voice));
  transition: width var(--dur-2) var(--ease-out);
}
.opra-rail-list { list-style: none; margin: 0 0 var(--sp-5); padding: 0; display: flex; flex-direction: column; gap: var(--sp-2); }
.opra-rail-item { display: flex; align-items: flex-start; gap: var(--sp-2); font-size: var(--fs-label); line-height: 1.45; }
.opra-rail-item a {
  color: var(--text-faint); text-decoration: none;
  transition: color var(--dur-1) ease;
}
.opra-rail-item a:hover { color: var(--text); }
.opra-rail-mark {
  width: 14px; height: 14px; flex-shrink: 0; margin-top: 2px;
  border: 1.5px solid var(--border-strong); border-radius: 50%;
  transition: background var(--dur-2) ease, border-color var(--dur-2) ease;
}
.opra-rail-item.is-done .opra-rail-mark { background: var(--data); border-color: var(--data); }
.opra-rail-item.is-done a { color: var(--text-muted); text-decoration: line-through; text-decoration-color: var(--border-strong); }
.opra-rail-card .auth-submit { margin-top: 0; }
.opra-rail-note { margin: var(--sp-3) 0 0; font-size: var(--fs-2xs); color: var(--text-faint); line-height: 1.55; }
.opra-rail-card .auth-status-msg { margin-top: var(--sp-3); font-size: var(--fs-label); }

@media (prefers-reduced-motion: reduce) {
  .opra-panel, .opra-check, .opra-signature-pad, .opra-step-mark,
  .opra-rail-fill, .opra-doc-progress-fill, .opra-rail-mark, .opra-doc-status-icon {
    transition: none;
  }
}
