/* sfs-public-web -- customer download page.
   Dependency-free, self-contained, no web fonts, no external resources.
   Plum accent (#6b3fa0) matches the Juvaro SFS brand. Mobile-first. */

:root {
  --plum: #6b3fa0;
  --plum-dark: #59328a;
  /* --accent is the page's CTA/focus colour -- the FIXED Juvaro plum. It is an internal styling
     variable only: nothing ever overrides it (the per-tenant accent was removed platform-wide,
     2026-07-30 -- one palette; tenant identity on this page = logo + name). Every accent-coloured
     surface below reads var(--accent); hover follows via a brightness filter. */
  --accent: var(--plum);
  --ink: #1f2430;
  --muted: #5b6470;
  --line: #e5e7ec;
  --bg: #f5f6f8;
  --card: #ffffff;
}

* { box-sizing: border-box; }

/* The `hidden` attribute must win even when an element also carries a
   `display` rule (e.g. .otp / .brand-logo) -- otherwise the OTP field and
   logo would show before Slice 1 reveals them. */
[hidden] { display: none !important; }

html, body { margin: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  padding: 24px 16px;
}

.page {
  width: 100%;
  max-width: 440px;
  margin: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.brand-logo { max-height: 40px; width: auto; }

.brand-name { font-weight: 600; font-size: 1.05rem; }

.title {
  margin: 0;
  text-align: center;
  font-size: 1.35rem;
  font-weight: 600;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* -- The file list: one row per bundle file (name + size + its own button) -- */
.file-list { list-style: none; margin: 0; padding: 0; }

.file-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  padding: 12px 0;
}

.file-row + .file-row { border-top: 1px solid var(--line); }

.file-info {
  display: flex;
  flex-direction: column;
  min-width: 0;             /* let a long/hostile name shrink + wrap, never overflow */
  flex: 1 1 auto;
}

.file-name { font-weight: 500; word-break: break-word; }

.file-size { font-size: 0.8rem; color: var(--muted); }

/* Higher specificity than .btn so the per-file button is compact + inline,
   independent of source order. */
.file-row .file-btn {
  margin-top: 0;
  width: auto;
  flex: 0 0 auto;
  padding: 8px 14px;
  font-size: 0.9rem;
}

/* A per-row note ("No longer available" / a retry hint) wraps to its own line
   under the row; empty notes take no space. */
.file-note { flex-basis: 100%; font-size: 0.8rem; color: var(--muted); }
.file-note:empty { display: none; }

/* Consumed row: greyed name (the button greys via :disabled). */
.is-done .file-name { color: var(--muted); }

/* Unavailable row: greyed name + a warning-toned note. */
.is-unavailable .file-name { color: var(--muted); }
.is-unavailable .file-note { color: #9a3b3b; }

.expiry {
  margin: 16px 0 0;
  font-size: 0.85rem;
  color: var(--muted);
  text-align: right;
}

.expiry span { color: var(--ink); font-weight: 500; }

.otp {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.otp label { font-size: 0.9rem; color: var(--muted); }

.otp input {
  width: 100%;
  padding: 10px 12px;
  font-size: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.otp input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

.btn {
  margin-top: 20px;
  width: 100%;
  padding: 12px 16px;
  font-size: 1rem;
  font-weight: 600;
  color: #ffffff;
  background: var(--accent);
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

/* Darken on hover with a brightness filter rather than a second colour token (the fixed plum
   darkens to roughly --plum-dark). */
.btn:hover:not(:disabled) { filter: brightness(0.9); }

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn:disabled { background: #b6a8cd; cursor: not-allowed; }

/* The Unlock button lives inside the OTP field (a flex column, gap 6px), so it
   needs less top margin than a standalone .btn. Higher specificity wins. */
.otp .btn { margin-top: 8px; }

.status {
  margin: 12px 0 0;
  min-height: 1.2em;
  text-align: center;
  font-size: 0.9rem;
  color: var(--muted);
}

.footer {
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
}

/* -- Secret reveal (the /s/{token} customer page) -------------------------- */

/* Intro copy above the Reveal button. */
.lead {
  margin: 0 0 4px;
  font-size: 0.95rem;
  color: var(--muted);
}

/* The revealed-secret block: label + read-only display + Copy + the once note.
   A flex column so the pieces stack with even spacing. */
.secret {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.secret label { font-size: 0.9rem; color: var(--muted); }

/* The decrypted plaintext, shown read-only. It is a <pre>, and the secret
   reaches it via textContent ONLY (never innerHTML). pre-wrap keeps intentional
   whitespace; break the word so a long single-line secret (a password / token)
   wraps inside the card and never overflows the page. */
.secret-output {
  margin: 0;
  padding: 12px;
  min-height: 3em;
  max-height: 40vh;
  overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.95rem;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  color: var(--ink);
  background: #f7f4fb;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.secret-output:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* "Viewed only once" -- a warning-toned reminder to copy now. */
.once-notice {
  margin: 4px 0 0;
  font-size: 0.8rem;
  color: #9a3b3b;
}

/* The Copy button: a lighter, outlined companion to the primary Reveal button.
   Placed AFTER the .btn rules so its single-class selectors win on source order
   over .btn / .btn:hover for an element carrying both classes. */
.btn-secondary {
  color: var(--accent);
  background: #ffffff;
  border: 1px solid var(--accent);
}
/* An 8% accent tint over white (the fixed plum). */
.btn-secondary:hover { background: color-mix(in srgb, var(--accent) 8%, #ffffff); }

/* The Copy button sits inside .secret (a flex column, gap 8px), so it needs
   less top margin than a standalone .btn. Higher specificity wins. */
.secret .btn { margin-top: 8px; }
