/* Benoxy — style.css
   Mobile-first, no dependencies. Shared by the app and the content pages. */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

:root {
  --c-bg:      #f8fafc;
  --c-surface: #ffffff;
  --c-border:  #e2e8f0;
  --c-text:    #0f172a;
  --c-muted:   #526176;
  --c-accent:  #2563EB;
  --c-accent2: #1d4ed8;
  --c-cyan:    #22D3EE;
  --c-green:   #15803d;
  --c-danger:  #b91c1c;
  --c-warn-bg: #fff7ed;
  --c-warn:    #9a3412;
  --r:         12px;
  --shadow:    0 1px 3px rgb(0 0 0/.08), 0 6px 24px rgb(0 0 0/.05);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --c-bg: #0f172a; --c-surface: #1e293b; --c-border: #334155; --c-text: #f1f5f9; --c-muted: #a3b1c6;
    --c-accent: #60a5fa; --c-accent2: #93c5fd; --c-green: #4ade80; --c-danger: #f87171;
    --c-warn-bg: #3b2410; --c-warn: #fdba74;
    color-scheme: dark;
  }
}
[data-theme="dark"] {
  --c-bg: #0f172a; --c-surface: #1e293b; --c-border: #334155; --c-text: #f1f5f9; --c-muted: #a3b1c6;
  --c-accent: #60a5fa; --c-accent2: #93c5fd; --c-green: #4ade80; --c-danger: #f87171;
  --c-warn-bg: #3b2410; --c-warn: #fdba74;
  color-scheme: dark;
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--c-bg);
  color: var(--c-text);
  min-height: 100svh;
  display: flex;
  justify-content: center;
  line-height: 1.5;
}

a { color: var(--c-accent); }
:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 2px; }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link { position: absolute; left: -9999px; top: 8px; z-index: 200; background: var(--c-accent); color: #fff; padding: 8px 12px; border-radius: 6px; }
.skip-link:focus { left: 8px; }

/* ── App shell ─────────────────────────────────────────────────── */
.app {
  width: 100%;
  max-width: 480px;
  min-height: 100svh;
  background: var(--c-surface);
  display: flex;
  flex-direction: column;
}
@media (min-width: 500px) {
  .app { border-inline: 1px solid var(--c-border); box-shadow: var(--shadow); }
}
.app.page-shell { max-width: 760px; }

/* ── Header ────────────────────────────────────────────────────── */
.site-header { padding: 14px 20px; border-bottom: 1px solid var(--c-border); flex-shrink: 0; }
.header-top { display: flex; align-items: center; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; margin-right: auto; }
.logo { font-size: 1.3rem; font-weight: 750; letter-spacing: -.04em; color: var(--c-text); }
.top-nav { display: flex; gap: 14px; font-size: .85rem; }
.top-nav a { color: var(--c-muted); text-decoration: none; }
.top-nav a:hover { color: var(--c-accent); }

/* ── Screens ───────────────────────────────────────────────────── */
main { flex: 1; display: flex; flex-direction: column; }
.screen {
  display: none;
  flex-direction: column;
  align-items: center;
  flex: 1;
  padding: 24px 20px 32px;
  gap: 16px;
}
.screen.active { display: flex; }

.spinner {
  width: 36px; height: 36px; border: 3px solid var(--c-border); border-top-color: var(--c-accent);
  border-radius: 50%; animation: spin .7s linear infinite; flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .spinner, .pulse-dot { animation: none; }
  * { transition: none !important; }
}

/* ── Typography ────────────────────────────────────────────────── */
.tagline { font-size: 1.2rem; font-weight: 700; text-align: center; color: var(--c-text); line-height: 1.35; }
.lead { font-size: .95rem; color: var(--c-muted); text-align: center; }
.h2, h2 { font-size: 1.2rem; font-weight: 700; color: var(--c-text); }
.screen .h2 { text-align: center; }
.screen p { font-size: .9rem; color: var(--c-muted); text-align: center; line-height: 1.6; }
.muted { color: var(--c-muted); font-size: .875rem; }
.small { font-size: .8rem !important; }
.centered { text-align: center !important; }
.emoji { font-size: 2.5rem; }

/* ── QR code ───────────────────────────────────────────────────── */
.qr-card {
  background: #fff; border: 1px solid var(--c-border); border-radius: var(--r);
  padding: 14px; box-shadow: var(--shadow); flex-shrink: 0; color: #0f172a; position: relative;
}
.qr-card canvas, .qr-card img { display: block; max-width: 100%; height: auto; }
.qr-card .qr-logo {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 32px; height: 32px; padding: 4px; box-sizing: content-box;
  background: #fff; border-radius: 6px; pointer-events: none;
}

.status-pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 16px;
  border: 1px solid var(--c-border); border-radius: 999px; font-size: .82rem;
  color: var(--c-muted); background: var(--c-bg); text-align: center;
}
.pulse-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c-accent); animation: pulse 1.6s ease-in-out infinite; flex-shrink: 0; }
.green-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c-green); flex-shrink: 0; }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .3; transform: scale(.65); } }

.steps { width: 100%; padding-left: 1.4rem; font-size: .88rem; color: var(--c-text); display: grid; gap: 6px; }
.steps li::marker { color: var(--c-accent); font-weight: 700; }

/* ── Buttons & inputs ──────────────────────────────────────────── */
.btn-primary, .btn-secondary, .btn-sm {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: 8px; font: 600 .95rem/1.1 inherit; cursor: pointer; text-decoration: none;
  -webkit-tap-highlight-color: transparent; transition: background .15s, transform .1s;
}
.btn-primary { padding: 13px 18px; background: var(--c-accent); color: #fff; border: none; }
[data-theme="dark"] .btn-primary { color: #0f172a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-primary { color: #0f172a; } }
.btn-primary:hover { background: var(--c-accent2); }
.btn-primary:active { transform: scale(.97); }
.btn-primary:disabled { opacity: .55; cursor: default; }
.btn-secondary { padding: 11px 16px; background: transparent; color: var(--c-accent); border: 1.5px solid var(--c-accent); }
.btn-secondary:hover, .btn-sm:hover { background: rgb(37 99 235 / .08); }
.btn-sm { padding: 7px 12px; background: transparent; color: var(--c-accent); border: 1.5px solid var(--c-accent); font-size: .8rem; white-space: nowrap; flex-shrink: 0; }
.btn-ghost { background: none; border: none; color: var(--c-accent); font: inherit; cursor: pointer; padding: 4px 8px; border-radius: 6px; }
.btn-ghost:hover { background: rgb(37 99 235 / .08); }
.btn-xs { font-size: .78rem; font-weight: 600; padding: 5px 10px; border-radius: 6px; white-space: nowrap; flex-shrink: 0; }
.btn-secondary.btn-xs { padding: 5px 12px; font-size: .8rem; }
.icon-btn { background: none; border: none; font-size: 1.1rem; cursor: pointer; padding: 6px 8px; border-radius: 6px; line-height: 1; color: var(--c-text); }
.icon-btn:hover { background: var(--c-border); }

textarea {
  width: 100%; min-height: 84px; padding: 10px 12px; border: 1px solid var(--c-border); border-radius: 8px;
  font: 1rem/1.5 inherit; background: var(--c-surface); color: var(--c-text); resize: vertical;
}
textarea:focus { outline: none; border-color: var(--c-accent); box-shadow: 0 0 0 3px rgb(59 130 246 / .18); }
textarea::placeholder { color: var(--c-muted); }

.share-row, .share-row .btn-secondary { width: 100%; }
.expando { width: 100%; border: 1px solid var(--c-border); border-radius: var(--r); }
.expando summary { padding: 11px 14px; font-size: .85rem; color: var(--c-muted); cursor: pointer; }
.expando-body { padding: 0 14px 14px; display: flex; flex-direction: column; gap: 8px; }
.link-row { display: flex; gap: 8px; align-items: center; width: 100%; }
.mono-input {
  flex: 1; min-width: 0; padding: 7px 10px; border: 1px solid var(--c-border); border-radius: 6px;
  font: .75rem/1.2 ui-monospace, 'Cascadia Code', monospace; background: var(--c-bg); color: var(--c-muted);
}
.hint { font-size: .75rem; color: var(--c-muted); line-height: 1.45; }
.screen .hint { text-align: left; }
.key-hint { text-align: right !important; }
.privacy { font-size: .78rem !important; }

/* ── Session ───────────────────────────────────────────────────── */
.conn-bar { display: flex; align-items: center; justify-content: space-between; width: 100%; gap: 8px; }
.conn-badge { display: flex; align-items: center; gap: 8px; font-size: .9rem; font-weight: 600; color: var(--c-green); }
.conn-badge.offline { color: var(--c-muted); }
.conn-actions { display: flex; gap: 2px; flex-shrink: 0; }
.conn-badge.offline .green-dot { background: var(--c-muted); }

.banner {
  width: 100%; border-radius: var(--r); padding: 12px 14px; background: var(--c-warn-bg);
  border: 1px solid var(--c-border); display: grid; gap: 8px;
}
.banner p { text-align: left !important; color: var(--c-warn) !important; font-size: .88rem; }
.banner .hint { color: var(--c-muted) !important; }
.banner-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.banner.info { background: var(--c-bg); border-left: 4px solid var(--c-accent); }
.banner.info p { color: var(--c-text) !important; }

.card {
  width: 100%; border: 1px solid var(--c-border); border-radius: var(--r); padding: 14px;
  display: flex; flex-direction: column; gap: 10px; background: var(--c-bg);
}
.card-label { font-size: .72rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--c-muted); }

.drop-zone { position: relative; border-radius: 8px; }
.drop-hint {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: .9rem; font-weight: 600; color: var(--c-accent); background: rgb(37 99 235 / .08);
  border: 2px dashed var(--c-accent); border-radius: 8px; pointer-events: none; opacity: 0; transition: opacity .15s;
}
.drop-zone.drop-over .drop-hint { opacity: 1; }
.drop-zone.drop-over textarea { opacity: .35; }

.file-queue { list-style: none; display: grid; gap: 6px; }
.file-badge {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px; background: var(--c-surface);
  border: 1px solid var(--c-border); border-radius: 8px; font-size: .82rem;
}
.file-badge-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }

.send-row { display: flex; gap: 8px; align-items: stretch; }
.attach-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 14px;
  font-size: .9rem; font-weight: 600; background: var(--c-surface); color: var(--c-text);
  border: 1.5px solid var(--c-border); border-radius: 8px; cursor: pointer; flex-shrink: 0;
}
.attach-btn:hover { background: var(--c-border); }
.attach-btn:focus-within { outline: 2px solid var(--c-accent); outline-offset: 2px; }
.send-row .btn-primary { flex: 1; }

.activity { width: 100%; display: grid; gap: 8px; }
.activity-hdr { display: flex; align-items: center; justify-content: space-between; }
.activity .muted.small { text-align: left !important; }
.activity-list { list-style: none; display: grid; gap: 8px; }
.act-item {
  display: flex; gap: 10px; align-items: flex-start; justify-content: space-between;
  border: 1px solid var(--c-border); border-radius: 10px; padding: 10px 12px; background: var(--c-surface);
}
.act-in { border-left: 3px solid var(--c-green); }
.act-out { border-left: 3px solid var(--c-accent); }
.act-main { display: flex; gap: 10px; min-width: 0; flex: 1; }
.act-icon { font-size: 1.1rem; line-height: 1.4; }
.act-body { min-width: 0; flex: 1; display: grid; gap: 4px; }
.act-title { font-size: .9rem; font-weight: 600; color: var(--c-text) !important; text-align: left !important; overflow-wrap: anywhere; }
.act-text { font-weight: 400; white-space: pre-wrap; max-height: 12rem; overflow: auto; }
.act-meta { font-size: .76rem !important; color: var(--c-muted) !important; text-align: left !important; }
[data-status="failed"] .act-meta { color: var(--c-danger) !important; }
[data-status="delivered"] .act-meta, [data-status="received"] .act-meta { color: var(--c-green) !important; }
.act-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

.progress-wrap { height: 6px; background: var(--c-bg); border: 1px solid var(--c-border); border-radius: 999px; overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: var(--c-accent); border-radius: 999px; transition: width .15s ease-out; }
.recv-img { display: block; max-width: 100%; max-height: 260px; border-radius: 8px; object-fit: contain; margin-top: 4px; }

/* ── Error screen ──────────────────────────────────────────────── */
.error-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

/* ── Invite overlay ────────────────────────────────────────────── */
.qr-overlay {
  position: fixed; inset: 0; background: rgb(0 0 0 / .55); display: flex;
  align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.qr-overlay-card {
  background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r);
  padding: 20px; width: 100%; max-width: 320px; display: flex; flex-direction: column; gap: 14px;
  box-shadow: 0 8px 32px rgb(0 0 0 / .18);
}
.qr-overlay-hdr { display: flex; align-items: center; justify-content: space-between; }
.overlay-title { font-size: 1rem; }
.qr-overlay-card .qr-card { align-self: center; }

/* ── Home content (below the tool) ─────────────────────────────── */
.home-content { padding: 28px 20px; border-top: 1px solid var(--c-border); display: grid; gap: 14px; }
.home-content p { font-size: .9rem; color: var(--c-muted); }
.features { display: grid; gap: 14px; }
.features h3 { font-size: .95rem; margin-bottom: 2px; }
body[data-screen="screen-session"] .home-content { display: none; }

/* ── Footer ────────────────────────────────────────────────────── */
.site-footer { margin-top: auto; padding: 20px; border-top: 1px solid var(--c-border); display: grid; gap: 10px; text-align: center; font-size: .8rem; color: var(--c-muted); }
.site-footer nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 16px; }
.site-footer a { color: var(--c-muted); }
.site-footer a:hover { color: var(--c-accent); }
.app-version { font-size: .7rem; opacity: .7; }
.donate-link { font-weight: 600; color: var(--c-accent) !important; }

/* ── Content pages ─────────────────────────────────────────────── */
.page { padding: 28px 22px 40px; display: grid; gap: 14px; }
.page h1 { font-size: 1.7rem; line-height: 1.25; letter-spacing: -.02em; }
.page h2 { margin-top: 18px; font-size: 1.2rem; }
.page h3 { margin-top: 8px; font-size: 1rem; }
.page p, .page li { font-size: .95rem; line-height: 1.65; color: var(--c-text); }
.page ul, .page ol { padding-left: 1.3rem; display: grid; gap: 6px; }
.page .updated { font-size: .8rem; color: var(--c-muted); }
.page .callout { background: var(--c-bg); border: 1px solid var(--c-border); border-left: 4px solid var(--c-accent); border-radius: 8px; padding: 12px 14px; }
.page .cta { justify-self: start; margin-top: 8px; }
.page table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.page th, .page td { border: 1px solid var(--c-border); padding: 8px 10px; text-align: left; vertical-align: top; }
.page th { background: var(--c-bg); }
.table-wrap { overflow-x: auto; }
.page details { border: 1px solid var(--c-border); border-radius: 8px; padding: 10px 14px; }
.page summary { cursor: pointer; font-weight: 600; }
.page details p { margin-top: 8px; }
