/* Bundle — "sealed parcel": warm ink, honey accent, the notch as signature. */

:root {
  --bg:        #efe9df;
  --panel:     #fbf8f2;
  --panel-2:   #f4eee4;
  --ink:       #1d1813;
  --muted:     rgba(29, 24, 19, 0.58);
  --line:      rgba(29, 24, 19, 0.13);
  --line-firm: rgba(29, 24, 19, 0.22);
  --accent:    #d9852b;   /* honey */
  --accent-ink:#3a2408;
  --sage:      #5d8a69;   /* "encrypted / done" */
  --danger:    #b4472f;
  --shadow:    0 1px 2px rgba(29,24,19,.06), 0 12px 40px rgba(29,24,19,.10);
  --radius:    18px;
  --notch:     20px;      /* size of the corner notch */
  --maxw:      560px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #14110d;
    --panel:     #1f1a14;
    --panel-2:   #271f17;
    --ink:       #f1e9dc;
    --muted:     rgba(241, 233, 220, 0.60);
    --line:      rgba(241, 233, 220, 0.13);
    --line-firm: rgba(241, 233, 220, 0.24);
    --accent:    #e7993f;
    --accent-ink:#241402;
    --sage:      #82b890;
    --danger:    #e0795f;
    --shadow:    0 1px 2px rgba(0,0,0,.3), 0 18px 50px rgba(0,0,0,.45);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background:
    radial-gradient(120% 80% at 50% -10%, color-mix(in oklab, var(--accent) 10%, transparent), transparent 60%),
    var(--bg);
  color: var(--ink);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}
.font-notch {
  font-family: "Stack Sans Notch", ui-sans-serif, system-ui, sans-serif;
  font-feature-settings: "ss01";
}
.mono { font-family: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace; }

/* ---- shell ---- */
.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(20px, 6vw, 44px) 20px 80px;
}
header.top {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: clamp(20px, 5vw, 34px);
}
.seal {
  width: 38px; height: 38px; flex: none;
  background: var(--accent);
  /* the notch: a clean bite out of the top-right corner */
  clip-path: polygon(0 0, calc(100% - 13px) 0, 100% 13px, 100% 100%, 0 100%);
  border-radius: 11px;
  display: grid; place-items: center;
  box-shadow: var(--shadow);
}
.seal::after {
  content: ""; width: 13px; height: 13px; border-radius: 50%;
  border: 3px solid var(--accent-ink);
}
.wordmark { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; }
.tagline { margin-left: auto; font-size: 13px; color: var(--muted); }

/* ---- card with the notched corner ---- */
.card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(20px, 5vw, 30px);
  clip-path: polygon(
    0 0,
    calc(100% - var(--notch)) 0,
    100% var(--notch),
    100% 100%,
    0 100%
  );
}
.card + .card { margin-top: 18px; }
.card h2 { font-size: 15px; font-weight: 600; margin: 0 0 4px; letter-spacing: -0.01em; }
.card .sub { font-size: 13px; color: var(--muted); margin: 0 0 18px; }

/* ---- segmented control ---- */
.seg {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 4px; margin-bottom: 18px;
}
.seg button {
  border: 0; background: transparent; color: var(--muted);
  font: inherit; font-weight: 600; font-size: 14px;
  padding: 9px; border-radius: 9px; cursor: pointer; transition: .15s;
}
.seg button[aria-selected="true"] {
  background: var(--panel); color: var(--ink);
  box-shadow: 0 1px 2px rgba(29,24,19,.12);
}

/* ---- dropzone ---- */
.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 170px; width: 100%;
  border: 1.5px dashed var(--line-firm); border-radius: 14px;
  padding: 30px 20px; text-align: center; cursor: pointer;
  transition: .15s; background: var(--panel-2);
}
.drop:hover, .drop.over { border-color: var(--accent); background: color-mix(in oklab, var(--accent) 7%, var(--panel-2)); }
.drop .big { font-size: 15px; font-weight: 600; }
.drop .hint { font-size: 13px; color: var(--muted); margin-top: 4px; }
.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;
}

textarea {
  width: 100%; min-height: 150px; resize: vertical;
  background: var(--panel-2); color: var(--ink);
  border: 1px solid var(--line); border-radius: 12px;
  padding: 14px; font: inherit; font-size: 15px;
}
textarea:focus, .drop:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* file picked summary */
.picked {
  display: flex; align-items: center; gap: 12px;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 14px; font-size: 14px;
}
.picked .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picked .sz { color: var(--muted); flex: none; }
.picked .x { margin-left: auto; flex: none; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 18px; }

/* ---- options ---- */
.opts { margin-top: 18px; display: grid; gap: 12px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.row label { font-size: 14px; font-weight: 500; }
.row .desc { font-size: 12px; color: var(--muted); }
select {
  font: inherit; font-size: 14px; padding: 8px 10px;
  border: 1px solid var(--line-firm); border-radius: 10px;
  background: var(--panel); color: var(--ink); cursor: pointer;
}
input[type="number"] {
  width: 84px; font: inherit; padding: 8px 10px;
  border: 1px solid var(--line-firm); border-radius: 10px;
  background: var(--panel); color: var(--ink);
}
/* switch */
.switch { position: relative; width: 44px; height: 26px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch .track { position: absolute; inset: 0; background: var(--line-firm); border-radius: 999px; transition: .18s; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; background: var(--panel); border-radius: 50%; transition: .18s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + .track { background: var(--sage); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- buttons ---- */
.btn {
  width: 100%; border: 0; cursor: pointer; font: inherit; font-weight: 600;
  font-size: 15px; padding: 14px; border-radius: 12px;
  background: var(--accent); color: var(--accent-ink);
  transition: .15s; margin-top: 20px;
}
.btn:hover { filter: brightness(1.04); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: var(--panel-2); color: var(--ink); border: 1px solid var(--line-firm); margin-top: 10px; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---- encrypted note ---- */
.enote {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--sage); margin-top: 14px; font-weight: 500;
}
.enote svg { flex: none; }

/* ---- progress ---- */
.prog { margin-top: 16px; }
.bar { height: 8px; background: var(--panel-2); border-radius: 999px; overflow: hidden; border: 1px solid var(--line); }
.bar > i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.prog .label { font-size: 13px; color: var(--muted); margin-top: 8px; display: flex; justify-content: space-between; }

/* ---- result (QR + link) ---- */
.qr {
  display: grid; place-items: center; padding: 18px; background: #fff;
  border-radius: 14px; border: 1px solid var(--line); width: max-content; margin: 4px auto 18px;
}
.qr img, .qr canvas { display: block; width: 200px; height: 200px; image-rendering: pixelated; }
.linkbox {
  display: flex; gap: 8px; align-items: stretch;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 6px 6px 6px 12px;
}
.linkbox input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--ink); font-size: 13px; }
.linkbox button { flex: none; border: 0; background: var(--accent); color: var(--accent-ink); font-weight: 600; border-radius: 8px; padding: 8px 14px; cursor: pointer; }
.meta-line { font-size: 12.5px; color: var(--muted); margin-top: 14px; text-align: center; }

/* ---- PIN gate ---- */
.gate { max-width: 360px; margin: 12vh auto 0; text-align: center; }
.gate .seal { margin: 0 auto 18px; width: 52px; height: 52px; }
.gate h1 { font-size: 28px; margin: 0 0 6px; letter-spacing: -0.02em; }
.gate p { color: var(--muted); font-size: 14px; margin: 0 0 22px; }
.pin {
  width: 100%; text-align: center; letter-spacing: 6px; font-size: 22px;
  padding: 14px; border: 1px solid var(--line-firm); border-radius: 12px;
  background: var(--panel); color: var(--ink);
}
.pin:focus { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- open page states ---- */
.center { text-align: center; padding: 8px 0; }
.filebig { font-size: 19px; font-weight: 600; margin: 6px 0 2px; word-break: break-word; }
.spinner { width: 26px; height: 26px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }

.err { color: var(--danger); font-size: 14px; font-weight: 500; }
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px;
  font-size: 13px; font-weight: 500; opacity: 0; transition: .2s; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

footer.foot { text-align: center; margin-top: 26px; font-size: 12px; color: var(--muted); }
footer.foot a { color: var(--muted); }
.hidden { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
