/* Theme: follows the system unless the visitor picks one with the toggle
   (stored as data-theme on <html>). */
:root {
  --bg: #f3f0e8;
  --surface: #fbfaf6;
  --ink: #1b1a17;
  --muted: #6d695f;
  --line: #d8d3c5;
  --line-strong: #1b1a17;
  --accent: #cf4a0f;
  --accent-ink: #ffffff;
  --ok: #2f6b3a;
  --danger: #a3261b;
  --tile: #e7e2d4;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141311;
    --surface: #1b1a17;
    --ink: #ebe7dc;
    --muted: #9b968a;
    --line: #34312b;
    --line-strong: #ebe7dc;
    --accent: #ee6a2c;
    --accent-ink: #141311;
    --ok: #7fb98a;
    --danger: #e0715f;
    --tile: #26241f;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #141311;
  --surface: #1b1a17;
  --ink: #ebe7dc;
  --muted: #9b968a;
  --line: #34312b;
  --line-strong: #ebe7dc;
  --accent: #ee6a2c;
  --accent-ink: #141311;
  --ok: #7fb98a;
  --danger: #e0715f;
  --tile: #26241f;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

.wrap {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- header ---------- */

.top {
  border-bottom: 1px solid var(--line);
}
.top .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}
.brand {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 18px;
  text-decoration: none;
  letter-spacing: -0.02em;
}
.brand span { color: var(--accent); }
.top nav {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 20px;
}
.top nav a { text-decoration: none; }
.top nav a:hover { color: var(--ink); }

/* ---------- hero ---------- */

.hero { padding: 64px 0 28px; }
.hero h1 {
  font-size: clamp(34px, 6vw, 54px);
  line-height: 1.05;
  letter-spacing: -0.03em;
  font-weight: 600;
  margin: 0 0 16px;
  max-width: 14ch;
}
.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
  margin: 0;
  padding: 0;
  list-style: none;
}
.facts li::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--accent);
  margin-right: 8px;
  vertical-align: middle;
}

/* ---------- drop zone ---------- */

.drop {
  position: relative;
  display: block;
  margin: 28px 0 0;
  border: 1.5px dashed var(--muted);
  background: var(--surface);
  padding: 56px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color .12s, background .12s;
}
.drop:hover,
.drop:focus-within { border-color: var(--ink); }
.drop.over {
  border-style: solid;
  border-color: var(--accent);
  background: var(--tile);
}
.drop input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
}
.drop .glyph {
  width: 44px;
  height: 44px;
  margin: 0 auto 16px;
  color: var(--ink);
}
.drop strong {
  display: block;
  font-size: 19px;
  font-weight: 600;
}
.drop .sub {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
}
.drop .sub u {
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  color: var(--ink);
}

/* ---------- sections ---------- */

.section { margin: 48px 0; }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border-bottom: 1.5px solid var(--line-strong);
  padding-bottom: 8px;
  margin-bottom: 0;
}
.section-head h2 {
  font-size: 13px;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0;
  font-weight: 600;
}
.section-head .count {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
}

/* ---------- rows (queue + history) ---------- */

.rows { list-style: none; margin: 0; padding: 0; }
.row {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.ext {
  width: 44px;
  height: 52px;
  background: var(--tile);
  border: 1px solid var(--line);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 6px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  position: relative;
  overflow: hidden;
  clip-path: polygon(0 0, 70% 0, 100% 22%, 100% 100%, 0 100%);
}
.ext::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 30%;
  height: 22%;
  background: var(--line);
}
.row .name {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.row .meta {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 2px;
}
.row .meta .err { color: var(--danger); }
.row .meta .done { color: var(--ok); }
.row .info { min-width: 0; }
.bar {
  height: 3px;
  background: var(--line);
  margin-top: 10px;
  overflow: hidden;
}
.bar i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width .15s linear;
}
.link-line {
  display: flex;
  margin-top: 10px;
  max-width: 520px;
}
.link-line input {
  flex: 1;
  min-width: 0;
  font-family: var(--mono);
  font-size: 13px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-right: 0;
  background: var(--bg);
  color: var(--ink);
  border-radius: 0;
}
.link-line input:focus { outline: none; border-color: var(--ink); }

.actions { display: flex; gap: 6px; align-items: center; }

/* ---------- buttons ---------- */

.btn {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink);
  padding: 8px 14px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 0;
  white-space: nowrap;
  transition: background .1s, color .1s;
}
.btn:hover { background: var(--ink); color: var(--bg); }
.btn.solid { background: var(--ink); color: var(--bg); }
.btn.solid:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.ghost { border-color: transparent; color: var(--muted); padding: 8px 10px; }
.btn.ghost:hover { background: transparent; color: var(--ink); }
.btn.ghost.danger:hover { color: var(--danger); }
.btn.copied { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn:focus-visible, .drop input:focus-visible + * { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn svg { width: 16px; height: 16px; }

.empty {
  color: var(--muted);
  font-size: 14px;
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}

/* ---------- file page ---------- */

.file-card {
  margin: 56px 0 32px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.file-head {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 24px;
  align-items: center;
  padding: 32px;
  border-bottom: 1px solid var(--line);
}
.file-head .ext {
  width: 76px;
  height: 92px;
  font-size: 14px;
  padding-bottom: 12px;
}
.file-head .kind {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--accent);
  font-weight: 600;
}
.file-head h1 {
  margin: 4px 0 0;
  font-size: clamp(20px, 3.4vw, 28px);
  line-height: 1.2;
  letter-spacing: -0.015em;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.facts-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 0;
}
.facts-grid div {
  padding: 18px 32px;
  border-right: 1px solid var(--line);
}
.facts-grid div:last-child { border-right: 0; }
.facts-grid dt {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.facts-grid dd {
  margin: 4px 0 0;
  font-size: 15px;
  font-weight: 500;
}
.file-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 24px 32px 32px;
  border-top: 1px solid var(--line);
}
.file-actions .btn.solid {
  font-size: 16px;
  padding: 14px 26px;
}
.file-actions .btn { padding: 14px 20px; }
.preview {
  border-top: 1px solid var(--line);
  background: var(--tile);
  display: flex;
  justify-content: center;
  padding: 24px;
}
.preview img, .preview video {
  max-width: 100%;
  max-height: 520px;
  display: block;
}
.preview.audio audio { width: 100%; }
.note {
  font-size: 13.5px;
  color: var(--muted);
  max-width: 60ch;
}

/* ---------- footer ---------- */

.foot {
  border-top: 1px solid var(--line);
  margin-top: 80px;
}
.foot .wrap {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 20px;
  padding-bottom: 32px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 20px);
  background: var(--ink);
  color: var(--bg);
  font-size: 14px;
  padding: 10px 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s, transform .15s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- small screens ---------- */

@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .hero { padding-top: 40px; }
  .drop { padding: 40px 16px; }
  .row { grid-template-columns: 36px 1fr; }
  .row .ext { width: 36px; height: 44px; font-size: 9px; }
  .row .actions { grid-column: 2; }
  .file-card { margin-top: 32px; }
  .file-head { padding: 20px; gap: 16px; grid-template-columns: 56px 1fr; }
  .file-head .ext { width: 56px; height: 68px; font-size: 11px; padding-bottom: 8px; }
  .facts-grid { grid-template-columns: 1fr 1fr; }
  .facts-grid div { padding: 14px 20px; border-bottom: 1px solid var(--line); }
  .facts-grid div:nth-child(2n) { border-right: 0; }
  .facts-grid div:nth-last-child(-n+2) { border-bottom: 0; }
  .file-actions { padding: 20px; }
  .file-actions .btn { flex: 1; justify-content: center; }
  .top nav .hide-sm { display: none; }
}

/* ---------- theme toggle ---------- */

.theme-toggle {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  padding: 0;
  border-radius: 0;
}
.theme-toggle:hover { border-color: var(--ink); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .moon { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .moon { display: block; }
}

/* ---------- upload options ---------- */

.options {
  border: 1px solid var(--line);
  border-top: 0;
  background: var(--surface);
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr;
}
.opt {
  padding: 16px 20px;
  border-right: 1px solid var(--line);
  min-width: 0;
}
.opt:last-child { border-right: 0; }
.opt-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 10px;
}
.opt-label output {
  font-size: 13px;
  color: var(--ink);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
}
.opt input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  margin: 4px 0 0;
}
.range-ends {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}
.switch {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
}
.switch input {
  appearance: none;
  -webkit-appearance: none;
  width: 34px;
  height: 18px;
  border: 1.5px solid var(--ink);
  background: transparent;
  position: relative;
  cursor: pointer;
  margin: 0;
  flex: none;
}
.switch input::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 11px;
  height: 11px;
  background: var(--ink);
  transition: transform .12s;
}
.switch input:checked { background: var(--accent); border-color: var(--accent); }
.switch input:checked::after { transform: translateX(16px); background: var(--accent-ink); }
.switch input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.opt .hint { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.text-input {
  width: 100%;
  font-family: var(--mono);
  font-size: 14px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  border-radius: 0;
}
.text-input:focus { outline: none; border-color: var(--ink); }

/* ---------- badges ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border: 1px solid var(--line);
  padding: 1px 6px;
  color: var(--muted);
  vertical-align: middle;
  margin-left: 6px;
}
.badge svg { width: 11px; height: 11px; }
.file-head .badges { margin-top: 8px; }
.file-head .badges .badge:first-child { margin-left: 0; }

/* ---------- unlock form ---------- */

.unlock { flex-direction: column; align-items: stretch; }
.unlock-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}
.unlock-label svg { width: 16px; height: 16px; color: var(--accent); }
.unlock-row { display: flex; max-width: 440px; }
.unlock-row input {
  flex: 1;
  min-width: 0;
  font-family: var(--mono);
  font-size: 15px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-right: 0;
  background: var(--bg);
  color: var(--ink);
  border-radius: 0;
}
.unlock-row input:focus { outline: none; border-color: var(--ink); }
.form-error { color: var(--danger); margin: 0; font-size: 14px; }

@media (max-width: 640px) {
  .options { grid-template-columns: 1fr; }
  .opt { border-right: 0; border-bottom: 1px solid var(--line); }
  .opt:last-child { border-bottom: 0; }
  .unlock-row .btn { flex: none; }
}
