/* Filerino runs on a claim-check idea: the link you get back is a ticket
   that redeems a file, and a burn-after-reading file is a ticket that's
   voided the moment it's redeemed. The visual language follows from that —
   kraft ticket stock, a perforated tear between what a file *is* and the
   action that claims it, and grommet holes punched in every card corner.
   Space Mono — the one typeface — carries everything: it's the ticket's
   stamped voice throughout, headline and body alike, so nothing reads as
   an unrelated font swap. */

:root {
  color-scheme: light dark;
  --font-mono: "Space Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --paper: #ede4d0;
  --paper-card: #f6f1e3;
  --ink: #2a2620;
  --ink-muted: #6e6250;
  --line: #c7b98f;
  --accent: #1f3b57;
  --accent-fg: #f6f1e3;
  --danger: #9b2c2c;
  --danger-fg: #f6f1e3;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1a1611;
    --paper-card: #221d16;
    --ink: #eae1cb;
    --ink-muted: #9c917a;
    --line: #4a4030;
    --accent: #7ca6cf;
    --accent-fg: #16222d;
    --danger: #e08a82;
    --danger-fg: #2a1210;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 16px;
  line-height: 1.5;
}

.page {
  max-width: 620px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 3rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-header { margin-bottom: 3rem; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 2.2rem;
  letter-spacing: 0.02em;
  color: var(--ink);
  text-decoration: none;
}
.brand-mark { width: 42px; height: 38px; flex-shrink: 0; }

main { flex: 1; }

h1 {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.4rem;
  letter-spacing: -0.01em;
  margin: 0 0 0.6rem;
}
.subtitle { color: var(--ink-muted); margin-top: 1.5rem; margin-bottom: 0; }

a { color: var(--accent); }

/* --- ticket card: the base unit everything sits in --------------------- */

.file-card {
  position: relative;
  background: var(--paper-card);
  border: 1px solid var(--line);
  padding: 2rem 1.75rem;
  text-align: center;
}
.file-card::before, .file-card::after {
  content: "";
  position: absolute;
  top: -7px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--paper);
  border: 1px solid var(--line);
}
.file-card::before { left: -7px; }
.file-card::after { right: -7px; }

.dropzone {
  position: relative;
  border: 2px dashed var(--line);
  padding: 2.75rem 1rem;
  text-align: center;
  cursor: pointer;
  color: var(--ink-muted);
  transition: border-color 0.15s, background 0.15s;
}
.dropzone::before, .dropzone::after {
  content: "";
  position: absolute;
  top: -7px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--paper);
  border: 1px solid var(--line);
}
.dropzone::before { left: -7px; }
.dropzone::after { right: -7px; }
.dropzone.dragover { border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, transparent); }

.field-row { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem 0.75rem; margin: 1.25rem 0; }
.field-row-stack { flex-direction: column; align-items: stretch; }
.field-row-stack input { width: 100%; }
.field-row label { font-family: var(--font-mono); color: var(--ink-muted); font-size: 0.82rem; }
.checkbox-row { display: inline-flex; align-items: center; gap: 0.5rem; margin-left: 0.5rem; }
.checkbox-row input { width: auto; accent-color: var(--accent); }
.checkbox-row label { color: var(--ink); }

select, input[type="text"], input[type="password"], input[type="email"] {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 0.5rem 0.6rem;
}
select:focus, input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

button, .button {
  font-family: var(--font-mono);
  background: var(--accent);
  color: var(--accent-fg);
  border: none;
  /* padding-top must stay > the clip depth below, or the clipped corner
     cuts into ascenders on the last character of longer labels (verified
     against a screenshot — "Delete now"'s "w" was getting clipped at
     10px/10px). At 12px/8px the text area never enters the clipped
     triangle's y-range at all, so it's safe regardless of label length. */
  padding: 0.75rem 1.4rem;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 0 100%);
}
button:disabled { opacity: 0.5; cursor: not-allowed; }
button:not(:disabled):hover, .button:hover { background: color-mix(in srgb, var(--accent) 85%, black); }

.link-button {
  background: none;
  border: none;
  padding: 0;
  color: var(--ink-muted);
  font-size: inherit;
  font-weight: 400;
  text-decoration: underline;
  cursor: pointer;
  clip-path: none;
}
.link-button:hover { background: none; color: var(--accent); }

.progress-wrap { margin-top: 1.25rem; }
.progress-label { font-family: var(--font-mono); color: var(--ink-muted); font-size: 0.8rem; margin: 0 0 0.4rem; word-break: break-all; }
.progress-track { height: 5px; background: var(--line); overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: var(--accent); transition: width 0.1s linear; }

.result { margin-top: 1.75rem; animation: ticket-print 0.4s ease-out; }
.link-row { display: flex; gap: 0.5rem; margin-bottom: 0.5rem; }
.link-row input { flex: 1; }
.hint { color: var(--ink-muted); font-size: 0.9rem; margin-top: 1.75rem; margin-bottom: 0.6rem; }
.share-info { color: var(--ink-muted); font-size: 0.85rem; margin: 0.4rem 0 0; }
.qr-button { margin-top: 1rem; }
.qr-wrap:not([hidden]) { display: flex; flex-direction: column; align-items: flex-start; gap: 0.75rem; margin-top: 1rem; }
.qr-canvas { width: 220px; height: 220px; image-rendering: pixelated; border: 2px dashed var(--line); }
.delete-status { color: var(--ink-muted); font-size: 0.9rem; }

.error {
  margin-top: 1rem;
  padding: 0.7rem 1rem;
  border-left: 3px solid var(--danger);
  background: color-mix(in srgb, var(--danger) 10%, var(--paper-card));
  color: var(--danger);
  font-size: 0.9rem;
}

.filename { font-family: var(--font-mono); font-weight: 700; font-size: 1.05rem; word-break: break-all; margin: 0 0 0.3rem; }
.filesize { font-family: var(--font-mono); color: var(--ink-muted); font-size: 0.85rem; margin: 0 0 1.5rem; }
.burn-warning {
  margin-top: 1.1rem;
  padding-top: 0.65rem;
  border-top: 1px dashed var(--danger);
  color: var(--danger);
  font-style: italic;
  font-size: 0.9rem;
}

/* --- ticket stubs: one row per file, torn between manifest and claim --- */

.file-list { display: flex; flex-direction: column; gap: 0.9rem; }
.file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  text-align: left;
  padding: 1.15rem 1.4rem;
}
.file-row .filename, .file-row .filesize { margin: 0; }
.file-row .filesize { margin-top: 0.3rem; }
.file-row > a.button,
.file-row > button {
  border-left: 2px dashed var(--line);
  padding-left: 1.3rem;
  flex-shrink: 0;
}

@keyframes ticket-print {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.file-card:not([hidden]) { animation: ticket-print 0.4s ease-out; }
.file-list:not([hidden]) { animation: ticket-print 0.4s ease-out; }

.site-footer { margin-top: 3rem; font-family: var(--font-mono); color: var(--ink-muted); font-size: 0.75rem; }

@media (max-width: 480px) {
  .file-row { flex-direction: column; align-items: stretch; }
  .file-row > a.button, .file-row > button { border-left: none; border-top: 2px dashed var(--line); padding-left: 0; padding-top: 0.9rem; margin-top: 0.2rem; }
}

/* --- admin: a plain data table, not the ticket-stub metaphor — this is
   an operator's view, not the file-transfer experience the rest of the
   design language is built around. Same tokens/type, denser layout. --- */

.page-wide { max-width: 900px; }

.admin-heading { font-family: var(--font-mono); font-size: 1rem; margin: 2.25rem 0 0.75rem; }
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.admin-table th, .admin-table td {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--line);
}
.admin-table th {
  font-family: var(--font-mono);
  color: var(--ink-muted);
  font-weight: 700;
  font-size: 0.75rem;
}
.admin-bytes { font-family: var(--font-mono); }

.clickable-row { cursor: pointer; }
.clickable-row:hover { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.burn-toggle { accent-color: var(--accent); }

@media (max-width: 700px) {
  .admin-table { display: block; overflow-x: auto; white-space: nowrap; }
}
