/* ══ Paste Studio — design tokens ══════════════════════════════════════════
   Dark is the default because this is a media tool and a dark ground makes
   image previews read honestly. Light is a genuine second theme, not an
   afterthought: every colour below is a token, redefined once per theme. */
:root{
  --bg:#0E1020; --bg-2:#151833; --surface:#161A35; --surface-2:#1D2246;
  --line:#262C55; --line-2:#333A6B;
  --ink:#F2F4FF; --body:#B8C0E4; --muted:#8590C0;
  --brand:#7C5CFF; --brand-2:#22D3EE; --brand-ink:#fff;
  --ok:#34D399; --ok-soft:rgba(52,211,153,.14);
  --warn:#FBBF24; --warn-soft:rgba(251,191,36,.14);
  --bad:#FB7185; --bad-soft:rgba(251,113,133,.14);
  --focus:#22D3EE;
  --r:12px; --r-lg:18px; --tap:44px;
  --shadow:0 18px 44px rgba(4,6,20,.5);
  --grad:linear-gradient(135deg,var(--brand),var(--brand-2));
  --maxw:1160px;
}
html[data-theme="light"]{
  --bg:#F6F7FC; --bg-2:#FFFFFF; --surface:#FFFFFF; --surface-2:#F1F3FA;
  --line:#E2E6F2; --line-2:#CFD5E8;
  --ink:#0E1020; --body:#41496B; --muted:#6B7495;
  --brand-ink:#fff; --shadow:0 16px 40px rgba(20,26,60,.10);
}
*,*::before,*::after{box-sizing:border-box}
/* Any class that sets `display` outranks the user-agent's [hidden]{display:none},
   so an element toggled with the hidden attribute stays visible. Every element
   this app shows and hides — the camera button, the ZIP button, the studio, the
   link results, the drawer — is toggled that way, so pin it once here. */
[hidden]{display:none!important}
html{-webkit-text-size-adjust:100%}
body{margin:0;background:var(--bg);color:var(--body);
  font:16px/1.65 Inter,"Segoe UI",system-ui,-apple-system,"Noto Sans Arabic",sans-serif;
  min-height:100dvh;display:flex;flex-direction:column;
  padding-inline:max(0px,env(safe-area-inset-left)) max(0px,env(safe-area-inset-right))}
h1,h2,h3{color:var(--ink);line-height:1.22;margin:0 0 .5em;letter-spacing:-.015em}
h1{font-size:clamp(28px,4.4vw,46px);font-weight:800}
h2{font-size:clamp(20px,2.4vw,27px);font-weight:750}
h3{font-size:18px;font-weight:700}
p{margin:0 0 1em}
a{color:var(--brand-2);text-decoration:none}
a:hover{text-decoration:underline}
img,svg,canvas{max-width:100%}
svg{fill:none;stroke:currentColor;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;
  clip:rect(0 0 0 0);white-space:nowrap;border:0}
.skip{position:absolute;inset-inline-start:-9999px;top:0;z-index:80;background:var(--surface);
  color:var(--ink);padding:12px 18px;border-radius:0 0 var(--r) 0;min-height:var(--tap);
  display:inline-flex;align-items:center}
.skip:focus{inset-inline-start:0}
:where(a,button,input,select,textarea,summary,[tabindex]):focus-visible{
  outline:3px solid var(--focus);outline-offset:2px;border-radius:8px}
.fine{font-size:13px;color:var(--muted)}

/* ── header ── */
.top{display:flex;align-items:center;gap:14px;padding:14px clamp(14px,3vw,28px);
  border-bottom:1px solid var(--line);background:color-mix(in srgb,var(--bg) 88%,transparent);
  position:sticky;top:0;z-index:40;backdrop-filter:blur(10px);
  padding-top:calc(14px + env(safe-area-inset-top))}
.brand{display:inline-flex;align-items:center;gap:10px;color:var(--ink);font-weight:800;font-size:18px}
.brand:hover{text-decoration:none}
.brand b{font-weight:800}.brand i{font-style:normal;color:var(--brand-2)}
.topnav{display:flex;gap:4px;margin-inline-start:auto}
.topnav a{color:var(--body);padding:0 13px;min-height:var(--tap);display:inline-flex;align-items:center;
  border-radius:999px;font-size:14.5px;font-weight:600}
.topnav a:hover{background:var(--surface-2);text-decoration:none;color:var(--ink)}
.topnav a[aria-current]{background:var(--surface-2);color:var(--ink)}
.topact{display:flex;align-items:center;gap:8px}
.iconbtn{min-width:var(--tap);min-height:var(--tap);display:inline-flex;align-items:center;justify-content:center;
  border:1px solid var(--line-2);background:var(--surface);color:var(--body);border-radius:var(--r);cursor:pointer}
.iconbtn:hover{background:var(--surface-2);color:var(--ink)}
.iconbtn svg{width:19px;height:19px}
.langbtn{min-height:var(--tap);min-width:var(--tap);padding:0 14px;display:inline-flex;align-items:center;
  justify-content:center;border:1px solid var(--line-2);border-radius:var(--r);color:var(--body);
  background:var(--surface);font-weight:700;font-size:14px}
.langbtn:hover{text-decoration:none;background:var(--surface-2);color:var(--ink)}
.menu-toggle{display:none;background:var(--brand);border-color:var(--brand);color:var(--brand-ink)}
@media (max-width:900px){ .topnav{display:none} .menu-toggle{display:inline-flex} }

/* ── mobile drawer ── */
.drawer{position:fixed;inset-block:0;inset-inline-end:0;width:min(86vw,320px);z-index:60;
  background:var(--bg-2);border-inline-start:1px solid var(--line);padding:16px;overflow-y:auto;
  transform:translateX(105%);visibility:hidden;
  transition:transform .24s cubic-bezier(.2,.7,.3,1),visibility 0s linear .24s;
  padding-top:calc(16px + env(safe-area-inset-top))}
html[dir="rtl"] .drawer{transform:translateX(-105%)}
.drawer.is-open,html[dir="rtl"] .drawer.is-open,html[dir="ltr"] .drawer.is-open{
  transform:none;visibility:visible;transition-delay:0s;box-shadow:var(--shadow)}
.drawer-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:14px}
.drawer nav{display:flex;flex-direction:column;gap:2px}
.drawer nav a{color:var(--body);padding:0 14px;min-height:var(--tap);display:flex;align-items:center;
  border-radius:var(--r);font-weight:600}
.drawer nav a:hover{background:var(--surface-2);color:var(--ink);text-decoration:none}
.drawer-scrim{position:fixed;inset:0;z-index:50;background:rgba(6,8,22,.62);backdrop-filter:blur(2px)}
body.no-scroll{overflow:hidden}

/* ── layout ── */
main{flex:1;width:100%;max-width:var(--maxw);margin:0 auto;padding:clamp(20px,3vw,40px) clamp(14px,3vw,28px)}
.hero{text-align:center;max-width:760px;margin:0 auto clamp(20px,3vw,34px)}
.eyebrow{display:inline-flex;align-items:center;gap:8px;font-size:12.5px;font-weight:700;
  letter-spacing:.08em;text-transform:uppercase;color:var(--brand-2);
  background:var(--surface);border:1px solid var(--line-2);border-radius:999px;padding:7px 15px;margin:0 0 14px}
.eyebrow .dot{width:7px;height:7px;border-radius:50%;background:var(--ok);flex:none}
.lede{font-size:clamp(15px,1.7vw,18px);color:var(--body);max-width:62ch;margin-inline:auto}

/* ── dropzone ── */
.dropzone{position:relative;border:2px dashed var(--line-2);border-radius:var(--r-lg);
  background:linear-gradient(180deg,var(--surface),var(--bg-2));padding:clamp(26px,5vw,52px) 20px;
  text-align:center;transition:border-color .18s ease,background .18s ease}
.dropzone.is-over{border-color:var(--brand-2);background:var(--surface-2)}
.dz-icon{width:74px;height:74px;margin:0 auto 16px;border-radius:20px;display:grid;place-items:center;
  background:var(--grad);color:#fff}
.dz-icon svg{width:38px;height:38px;stroke-width:2.2}
.dz-keys{color:var(--muted);font-size:14.5px}
kbd{display:inline-block;padding:3px 9px;border-radius:7px;border:1px solid var(--line-2);
  background:var(--surface-2);color:var(--ink);font:600 13px/1 ui-monospace,Menlo,monospace;margin:0 3px}
.dz-or{display:flex;align-items:center;gap:14px;color:var(--muted);font-size:13px;margin:18px auto;max-width:320px}
.dz-or::before,.dz-or::after{content:"";flex:1;height:1px;background:var(--line)}
.dz-actions{display:flex;flex-wrap:wrap;gap:10px;justify-content:center}
.dz-formats{margin:16px 0 0;font-size:13px;color:var(--muted)}

/* ── buttons ── */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:9px;min-height:var(--tap);
  padding:0 20px;border-radius:var(--r);border:1px solid var(--line-2);background:var(--surface);
  color:var(--ink);font:inherit;font-weight:650;font-size:15px;cursor:pointer;transition:transform .12s ease}
.btn:hover{background:var(--surface-2);text-decoration:none;transform:translateY(-1px)}
.btn svg{width:18px;height:18px}
.btn-primary{background:var(--grad);border-color:transparent;color:#fff}
.btn-primary:hover{filter:brightness(1.07)}
.btn-ghost{background:transparent}
.btn-sm{min-height:38px;padding:0 14px;font-size:13.5px}
.btn[disabled],.btn[aria-busy="true"]{opacity:.55;pointer-events:none}
@media (pointer:coarse),(max-width:900px){ .btn-sm{min-height:var(--tap)} }

/* ── link bar ── */
.linkbar{margin-top:clamp(18px,3vw,28px);background:var(--surface);border:1px solid var(--line);
  border-radius:var(--r-lg);padding:clamp(16px,2.5vw,22px)}
.linkbar>label{display:block;font-weight:650;color:var(--ink);margin-bottom:9px;font-size:14.5px}
.linkrow{display:flex;gap:9px;align-items:center;background:var(--bg-2);border:1px solid var(--line-2);
  border-radius:var(--r);padding:6px 6px 6px 12px}
html[dir="rtl"] .linkrow{padding:6px 12px 6px 6px}
.linkico{width:20px;height:20px;color:var(--muted);flex:none}
.linkrow input{flex:1;min-width:0;border:0;background:transparent;color:var(--ink);font:inherit;
  min-height:var(--tap);outline:none}
.linkout{margin-top:16px}
@media (max-width:560px){
  .linkrow{flex-wrap:wrap}
  .linkrow input{flex:1 1 100%;order:1}
  .linkrow .btn{flex:1 1 100%;order:2}
  .linkico{order:0}
}

/* ── link result ── */
.lk{display:grid;grid-template-columns:200px 1fr;gap:18px;background:var(--bg-2);
  border:1px solid var(--line);border-radius:var(--r);padding:16px}
.lk img{width:100%;border-radius:10px;border:1px solid var(--line);display:block}
.lk-plat{display:inline-flex;align-items:center;gap:7px;font-size:12px;font-weight:750;letter-spacing:.06em;
  text-transform:uppercase;color:var(--brand-2);margin-bottom:6px}
.lk h3{margin:0 0 4px}
.lk-meta{font-size:13.5px;color:var(--muted);margin:0 0 12px}
.lk-note{display:flex;gap:10px;background:var(--warn-soft);border:1px solid var(--warn);
  border-radius:var(--r);padding:12px 14px;margin:14px 0;color:var(--ink);font-size:14px}
.lk-note svg{width:19px;height:19px;flex:none;color:var(--warn)}
.thumbs{display:flex;flex-wrap:wrap;gap:8px;margin:10px 0 0;padding:0;list-style:none}
.thumbs button{min-height:var(--tap);padding:0 13px;border-radius:999px;border:1px solid var(--line-2);
  background:var(--surface);color:var(--body);font:inherit;font-size:13.5px;font-weight:600;cursor:pointer}
.thumbs button:hover{background:var(--surface-2);color:var(--ink)}
.rights{display:flex;gap:10px;align-items:flex-start;margin:14px 0;padding:13px 15px;
  background:var(--surface);border:1px solid var(--line-2);border-radius:var(--r)}
.rights input{margin-top:3px;width:19px;height:19px;flex:none;accent-color:var(--brand)}
.embedbox{display:flex;gap:8px;margin-top:10px}
.embedbox textarea{flex:1;min-height:76px;background:var(--bg);border:1px solid var(--line-2);
  border-radius:var(--r);color:var(--body);padding:10px 12px;font:12.5px/1.6 ui-monospace,Menlo,monospace;resize:vertical}
@media (max-width:640px){ .lk{grid-template-columns:1fr} }

/* ── studio ── */
.studio{margin-top:clamp(20px,3vw,30px)}
.studio-head{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;margin-bottom:14px}
.studio-head h2{margin:0}
.count{font-size:14px;color:var(--muted);font-weight:600}
.studio-head-act{display:flex;gap:8px;flex-wrap:wrap}
.studio-grid{display:grid;grid-template-columns:310px 1fr;gap:18px;align-items:start}
@media (max-width:900px){ .studio-grid{grid-template-columns:1fr} }
.panel{background:var(--surface);border:1px solid var(--line);border-radius:var(--r-lg);padding:16px}
.controls{position:sticky;top:88px}
@media (max-width:900px){ .controls{position:static} }
.field{margin-bottom:13px}
.field label{display:block;font-size:13px;font-weight:650;color:var(--muted);margin-bottom:6px}
.field input,.field select{width:100%;min-height:var(--tap);background:var(--bg-2);color:var(--ink);
  border:1px solid var(--line-2);border-radius:var(--r);padding:0 12px;font:inherit;font-size:15px}
.field input[type=range]{padding:0;min-height:32px;accent-color:var(--brand)}
.field input[type=color]{padding:4px;min-height:var(--tap);cursor:pointer}
.two{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.check{display:flex;gap:10px;align-items:flex-start;font-size:14px;color:var(--body);
  margin-bottom:12px;cursor:pointer;min-height:var(--tap);align-items:center}
.check input{width:19px;height:19px;flex:none;accent-color:var(--brand)}
.rowbtns{display:flex;gap:7px;flex-wrap:wrap;margin:6px 0 12px}
.adv{border-top:1px solid var(--line);padding-top:12px;margin-top:4px}
.adv>summary{cursor:pointer;font-weight:650;color:var(--ink);min-height:var(--tap);display:flex;
  align-items:center;list-style:none}
.adv>summary::-webkit-details-marker{display:none}
.adv>summary::after{content:"";width:8px;height:8px;margin-inline-start:8px;
  border-inline-end:2px solid currentColor;border-block-end:2px solid currentColor;
  transform:rotate(45deg);transition:transform .18s ease}
.adv[open]>summary::after{transform:rotate(-135deg)}

/* ── file cards ── */
.filelist{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:14px}
.fcard{background:var(--bg-2);border:1px solid var(--line);border-radius:var(--r);padding:14px;
  display:grid;grid-template-columns:150px 1fr;gap:14px}
.fcard-prev{position:relative;border-radius:10px;overflow:hidden;background:
  repeating-conic-gradient(var(--surface-2) 0 25%,transparent 0 50%) 0 0/16px 16px;
  border:1px solid var(--line);aspect-ratio:1;display:grid;place-items:center}
.fcard-prev img{width:100%;height:100%;object-fit:contain;display:block}
.fcard-body{min-width:0;display:flex;flex-direction:column;gap:8px}
.fname{font-weight:700;color:var(--ink);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
  unicode-bidi:plaintext;direction:ltr;text-align:start}
.fmeta{display:flex;flex-wrap:wrap;gap:6px;margin:0;padding:0;list-style:none}
.fmeta li{font-size:12px;padding:3px 9px;border-radius:999px;background:var(--surface-2);
  border:1px solid var(--line);color:var(--muted)}
.fmeta li.on{color:var(--ok);border-color:var(--ok)}
.fmeta li.off{color:var(--muted)}
.fsize{display:flex;align-items:center;gap:9px;flex-wrap:wrap;font-size:13.5px}
.fsize b{color:var(--ink)}
.delta{font-weight:750;padding:2px 9px;border-radius:999px;font-size:12.5px}
.delta.good{color:var(--ok);background:var(--ok-soft)}
.delta.bad{color:var(--warn);background:var(--warn-soft)}
.fact{display:flex;gap:8px;flex-wrap:wrap;margin-top:auto}
@media (max-width:560px){ .fcard{grid-template-columns:1fr} .fcard-prev{aspect-ratio:16/10} }
.empty{color:var(--muted);text-align:center;padding:26px 10px;margin:0}

/* ── docs ── */
.doc{max-width:78ch}
.doc.mid{text-align:center;margin-inline:auto}
.doc h2{margin-top:1.7em}
.callout{background:var(--surface);border:1px solid var(--line-2);border-inline-start:4px solid var(--brand);
  border-radius:var(--r);padding:16px 18px;margin:20px 0}
.callout h2{margin-top:0;font-size:19px}
.notes{padding-inline-start:22px;margin:0 0 1em}
.notes li{margin-bottom:.6em}
.tablewrap{overflow-x:auto;border:1px solid var(--line);border-radius:var(--r);margin:18px 0}
.tbl{width:100%;border-collapse:collapse;font-size:14.5px;min-width:520px}
.tbl th,.tbl td{padding:11px 14px;text-align:start;border-bottom:1px solid var(--line)}
.tbl thead th{font-size:11.5px;text-transform:uppercase;letter-spacing:.09em;color:var(--muted);
  background:var(--surface-2);font-weight:750}
.tbl tbody tr:last-child td{border-bottom:0}
.yes{color:var(--ok);font-weight:700}
.no{color:var(--muted)}
.qa{border:1px solid var(--line);border-radius:var(--r);margin-bottom:10px;background:var(--surface)}
.qa>summary{cursor:pointer;padding:0 16px;min-height:var(--tap);display:flex;align-items:center;
  font-weight:650;color:var(--ink);list-style:none}
.qa>summary::-webkit-details-marker{display:none}
.qa>summary::after{content:"";width:8px;height:8px;margin-inline-start:auto;
  border-inline-end:2px solid currentColor;border-block-end:2px solid currentColor;
  transform:rotate(45deg);transition:transform .18s ease}
.qa[open]>summary::after{transform:rotate(-135deg)}
.qa p{padding:0 16px 14px;margin:0}
.chips{display:flex;flex-wrap:wrap;gap:8px;padding:0;margin:14px 0}
.chips span{font-size:13px;padding:7px 14px;border-radius:999px;background:var(--surface);
  border:1px solid var(--line-2);color:var(--body)}

/* ── footer, toast ── */
.foot{border-top:1px solid var(--line);margin-top:auto;background:var(--bg-2);
  padding-bottom:calc(20px + env(safe-area-inset-bottom))}
.foot-in{max-width:var(--maxw);margin:0 auto;padding:24px clamp(14px,3vw,28px);font-size:14px}
.foot-in p{margin:0 0 6px}
.foot-in nav{display:flex;flex-wrap:wrap;gap:8px 18px;margin-top:12px}
.foot-in nav a{color:var(--muted);font-size:13.5px;min-height:var(--tap);display:inline-flex;align-items:center}
.toast{position:fixed;inset-inline:0;bottom:calc(18px + env(safe-area-inset-bottom));margin-inline:auto;
  width:max-content;max-width:min(92vw,460px);background:var(--surface);color:var(--ink);
  border:1px solid var(--line-2);border-radius:999px;padding:12px 20px;box-shadow:var(--shadow);
  z-index:70;opacity:0;transform:translateY(10px);pointer-events:none;transition:opacity .2s,transform .2s;
  font-size:14.5px;text-align:center}
.toast.show{opacity:1;transform:none}
.toast.err{border-color:var(--bad);color:var(--bad)}

@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{transition:none!important;animation:none!important}
  .btn:hover{transform:none!important}
  .drawer{transition:none!important}
}

/* Working state: a thin indeterminate bar and a dimmed preview, so a slow
   encode reads as progress rather than as a frozen page. */
.studio.is-working .filelist{opacity:.55;transition:opacity .15s ease}
.studio.is-working .studio-head::after{
  content:"";position:absolute;inset-inline:0;bottom:-6px;height:3px;border-radius:3px;
  background:linear-gradient(90deg,transparent,var(--brand-2),transparent);
  background-size:40% 100%;background-repeat:no-repeat;animation:ps-bar 1.1s linear infinite}
.studio-head{position:relative}
@keyframes ps-bar{0%{background-position:-40% 0}100%{background-position:140% 0}}
@media (prefers-reduced-motion:reduce){
  .studio.is-working .studio-head::after{animation:none;background-position:0 0;background-size:100% 100%;opacity:.4}
  .studio.is-working .filelist{transition:none}
}

/* Touch targets in the chrome. The wordmark and the short footer links were
   under 44px — the brand because its height came from the logo, the footer
   links because "About" is simply a narrow word. */
.brand{min-height:var(--tap);min-width:var(--tap)}
.foot-in nav a{min-width:44px;justify-content:center;padding-inline:4px}

/* At 320px the wordmark plus three header controls cannot fit — in Arabic the
   language button reads "English", which is wider still. Below 380px the brand
   collapses to its icon; it remains a link home and keeps its accessible name
   through the alt text of the mark. */
@media (max-width:379px){
  .brand span{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
  .top{gap:8px;padding-inline:10px}
  .topact{gap:6px}
  .langbtn{padding:0 10px;font-size:13px}
}

/* The lede is centred under the hero, but inside a document it should sit flush
   with the prose it introduces. */
.doc .lede{margin-inline:0;max-width:none}
.doc.mid .lede{margin-inline:auto}
