/*
 * unil.li — the anonymous shortener.
 *
 * Fonts are served from here rather than Google's CDN on purpose: the page promises the visitor we
 * are not watching them, and a webfont request hands their address to a third party before the page
 * has even painted.
 */

@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('/fonts/space-grotesk-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url('/fonts/jetbrains-mono-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --paper: #F5F2E9;
  --card: #FFFDF7;
  --ink: #14140F;
  --ink-soft: #4A473D;
  --ink-faint: #6E6A5C;
  --ink-ghost: #9A9484;
  --rule: #CFC9B6;
  --rule-soft: #DCD6C4;
  --flame: #FF4A1C;
  --flame-deep: #C93A11;
  --lime: #C9F24D;
  --white: #FFFFFF;

  --sans: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
}

* { box-sizing: border-box; }

/* Every panel below sets its own display, which silently outranks the browser's [hidden] rule —
   without this the bulk pane and the empty stats strip both render on first paint. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--flame-deep); text-decoration: underline; text-underline-offset: 3px; }
a:hover { color: var(--ink); }

input, select, textarea, button { font: inherit; color: inherit; }
input::placeholder, textarea::placeholder { color: var(--ink-ghost); }

:focus-visible { outline: 2px solid var(--flame); outline-offset: 2px; }

@keyframes pop { from { transform: scale(.94); opacity: 0 } to { transform: scale(1); opacity: 1 } }
@keyframes slidein { from { transform: translateY(12px); opacity: 0 } to { transform: translateY(0); opacity: 1 } }

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

.shell { min-height: 100vh; padding: 0 24px 96px; }
.wrap { max-width: 1080px; margin: 0 auto; }

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

.masthead { display: flex; align-items: center; justify-content: space-between; padding: 26px 0 0; gap: 16px; flex-wrap: wrap; }
.brand { display: flex; align-items: baseline; gap: 12px; }
.brand b { font-size: 26px; font-weight: 700; letter-spacing: -0.03em; }
.brand span { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-faint); }

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

.promise {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--ink); border-radius: 999px;
  padding: 8px 14px; font-size: 13px; font-weight: 500; background: var(--lime);
}
.promise i { width: 7px; height: 7px; border-radius: 999px; background: var(--ink); display: block; }

.ghost-btn {
  border: 1px solid var(--ink); background: transparent; border-radius: 999px;
  padding: 8px 16px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.ghost-btn:hover { background: var(--ink); color: var(--paper); }

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

.hero { padding: 72px 0 40px; display: grid; gap: 18px; max-width: 720px; }
.hero h1 { margin: 0; font-size: clamp(38px, 7vw, 64px); line-height: .98; letter-spacing: -0.04em; font-weight: 700; text-wrap: balance; }
.hero p { margin: 0; font-size: 19px; line-height: 1.5; color: var(--ink-soft); max-width: 520px; text-wrap: pretty; }

/* ---- composer ---- */

.composer {
  background: var(--card); border: 1px solid var(--ink); border-radius: 22px;
  box-shadow: 7px 7px 0 var(--ink); padding: 8px 8px 22px;
}

.composer-tabs { display: flex; gap: 6px; padding: 6px; flex-wrap: wrap; }
.composer-tabs .spacer { flex: 1; }

.tab {
  border: 1px solid transparent; background: transparent; border-radius: 999px;
  padding: 10px 18px; font-size: 14px; font-weight: 600; cursor: pointer; color: var(--ink-faint);
}
.tab[aria-selected="true"] { background: var(--ink); color: var(--paper); }
.tab:hover:not([aria-selected="true"]) { color: var(--ink); }

.options-btn {
  border: 1px solid var(--rule); background: transparent; border-radius: 999px;
  padding: 10px 16px; font-size: 13px; font-weight: 600; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
}
.options-btn:hover { border-color: var(--ink); }
.options-btn .sign { font-family: var(--mono); }

.composer-body { padding: 6px 14px 0; display: grid; gap: 12px; }

.url-row { display: flex; gap: 12px; align-items: stretch; flex-wrap: wrap; }

.url-input, .bulk-input {
  flex: 1 1 380px; min-width: 260px;
  border: 1px solid var(--rule); border-radius: 14px; padding: 18px;
  font-size: 16px; background: var(--white); outline: none; width: 100%;
}
.url-input:focus, .bulk-input:focus, .slug-input:focus {
  border-color: var(--flame); box-shadow: 0 0 0 3px rgba(255, 74, 28, .16);
}
.bulk-input { font-family: var(--mono); font-size: 14px; line-height: 1.6; resize: vertical; min-height: 148px; }

.go-btn {
  border: 1px solid var(--ink); background: var(--flame); color: #FFF8F2;
  border-radius: 14px; padding: 0 30px; font-size: 16px; font-weight: 700;
  cursor: pointer; box-shadow: 3px 3px 0 var(--ink); white-space: nowrap;
}
.go-btn:hover { transform: translate(1px, 1px); box-shadow: 2px 2px 0 var(--ink); }
.go-btn:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); }
.go-btn[disabled] { opacity: .6; cursor: progress; transform: none; box-shadow: 3px 3px 0 var(--ink); }

.slug-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

.slug-field {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px dashed var(--rule); border-radius: 12px; padding: 10px 14px; background: transparent;
}
.slug-field .host { font-family: var(--mono); font-size: 13px; color: var(--ink-faint); }
.slug-input { border: none; background: transparent; outline: none; font-family: var(--mono); font-size: 13px; width: 130px; }

.slug-hint { font-size: 13px; color: var(--ink-faint); }

/* The custom ending is an account feature — the field stays visible because it is the best reason
   anyone has to sign up, and says so the moment it is touched. */
.slug-gate {
  display: none; align-items: center; gap: 10px; flex-wrap: wrap;
  border: 1px solid var(--ink); border-radius: 12px; background: var(--lime);
  padding: 10px 14px; font-size: 13px; animation: slidein .18s ease-out;
}
.slug-gate[data-open="true"] { display: flex; }
.slug-gate a { color: var(--ink); font-weight: 600; }

.composer-note { padding: 10px 14px 0; font-size: 13px; color: var(--ink-faint); }

.error {
  margin: 12px 14px 0; border: 1px solid var(--flame-deep); border-radius: 12px;
  background: #FBE7E0; color: var(--flame-deep); padding: 12px 14px; font-size: 14px;
  animation: slidein .18s ease-out;
}

/* ---- stats ---- */

.stats { margin-top: 56px; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }

.stat { border: 1px solid var(--ink); border-radius: 18px; padding: 20px 22px; background: var(--card); }
.stat h3 { margin: 0 0 10px; font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-faint); font-weight: 500; }
.stat b { font-size: 44px; font-weight: 700; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.stat.dark { background: var(--ink); color: var(--paper); }
.stat.dark h3 { color: var(--ink-ghost); }
.stat.lime { background: var(--lime); }

.stat .top-slug { font-family: var(--mono); font-size: 17px; font-weight: 700; word-break: break-all; }
.stat .top-note { font-size: 13px; color: var(--ink-faint); margin-top: 4px; }

.spark { display: flex; align-items: flex-end; gap: 6px; height: 62px; }
.spark span { flex: 1; background: var(--rule); border-radius: 3px; min-height: 4px; }
.spark span.peak { background: var(--ink); }

/* ---- link list ---- */

.list-head { margin-top: 56px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.list-head h2 { margin: 0; font-size: 30px; letter-spacing: -0.03em; }
.list-head h2 small { font-size: 17px; color: var(--ink-faint); font-weight: 500; }

.search {
  border: 1px solid var(--rule); border-radius: 999px; padding: 12px 20px;
  font-size: 14px; background: var(--card); outline: none; min-width: 260px;
}
.search:focus { border-color: var(--ink); }

.links { display: grid; gap: 14px; margin-top: 22px; }

.link-card {
  border: 1px solid var(--ink); border-radius: 18px; background: var(--card);
  padding: 20px 22px; display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap;
  animation: pop .18s ease-out;
}
.link-main { flex: 1 1 320px; min-width: 0; display: grid; gap: 8px; }

.link-slug { font-family: var(--mono); font-size: 19px; font-weight: 700; word-break: break-all; }
.link-dest { font-family: var(--mono); font-size: 13px; color: var(--ink-faint); word-break: break-all; }
.link-title { font-size: 15px; color: var(--ink-soft); }

.badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge {
  font-family: var(--mono); font-size: 10px; letter-spacing: .06em; text-transform: uppercase;
  border: 1px solid var(--rule); border-radius: 999px; padding: 4px 9px; color: var(--ink-faint);
}

.link-side { display: flex; align-items: center; gap: 18px; }
.clicks { text-align: center; }
.clicks b { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.clicks span { display: block; font-family: var(--mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-faint); }

.qr { width: 76px; height: 76px; border: 1px solid var(--rule); border-radius: 10px; padding: 4px; background: var(--white); }
.qr img, .qr canvas { width: 100%; height: 100%; display: block; image-rendering: pixelated; }

.link-actions { display: grid; gap: 8px; }

.act {
  border: 1px solid var(--ink); border-radius: 10px; padding: 9px 18px;
  font-size: 13px; font-weight: 600; cursor: pointer; background: transparent; white-space: nowrap;
}
.act:hover { background: var(--ink); color: var(--paper); }
.act.primary { background: var(--flame); color: #FFF8F2; }
.act.primary:hover { background: var(--flame-deep); }

.empty {
  border: 1px dashed var(--rule); border-radius: 18px; padding: 44px 24px;
  text-align: center; color: var(--ink-faint); font-size: 15px;
}

/* ---- toast ---- */

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: var(--ink); color: var(--paper); border-radius: 999px;
  padding: 12px 22px; font-size: 14px; font-weight: 500; z-index: 40;
  animation: slidein .2s ease-out; max-width: calc(100vw - 48px);
}

.footer { margin-top: 72px; padding-top: 24px; border-top: 1px solid var(--rule-soft); font-size: 13px; color: var(--ink-faint); display: flex; gap: 18px; flex-wrap: wrap; }

@media (max-width: 640px) {
  .shell { padding: 0 16px 72px; }
  .link-card { gap: 14px; }
  .link-side { width: 100%; justify-content: space-between; }
  .link-actions { grid-auto-flow: column; }
}

/* ---- visitor-facing states: 404, expired, password ----
 *
 * The visitor of a short link normally never sees a page from us — they are redirected. These are
 * the three moments they do, so they carry the same paper, ink and flame as the front page rather
 * than the older stylesheet's purple. */

.state { min-height: 100vh; display: grid; place-items: center; padding: 32px 24px; }
.state-card { max-width: 520px; text-align: center; display: grid; gap: 16px; justify-items: center; }
.state-mark { font-family: var(--mono); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-faint); }
.state-card h1 { margin: 0; font-size: clamp(28px, 5vw, 40px); letter-spacing: -0.03em; line-height: 1.05; text-wrap: balance; }
.state-card p { margin: 0; font-size: 17px; line-height: 1.5; color: var(--ink-soft); }
.state-slug { font-family: var(--mono); font-size: 15px; color: var(--ink-faint); word-break: break-all; }
.state-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 6px; }

.state-btn {
  border: 1px solid var(--ink); border-radius: 12px; padding: 12px 26px;
  font-size: 15px; font-weight: 700; cursor: pointer; text-decoration: none;
  background: var(--flame); color: #FFF8F2; box-shadow: 3px 3px 0 var(--ink); display: inline-block;
}
.state-btn:hover { transform: translate(1px, 1px); box-shadow: 2px 2px 0 var(--ink); color: #FFF8F2; }
.state-btn.quiet { background: transparent; color: var(--ink); box-shadow: none; }
.state-btn.quiet:hover { background: var(--ink); color: var(--paper); }

.pw-form { display: grid; gap: 12px; justify-items: center; margin-top: 8px; width: 100%; }
.pw-input {
  border: 1px solid var(--rule); border-radius: 14px; padding: 16px 18px;
  font-size: 16px; background: var(--white); outline: none; width: 280px; max-width: 100%;
  text-align: center; font-family: var(--mono);
}
.pw-input:focus { border-color: var(--flame); box-shadow: 0 0 0 3px rgba(255, 74, 28, .16); }
.pw-wrong { color: var(--flame-deep); font-size: 15px; }

.report { margin-top: 10px; font-size: 13px; color: var(--ink-faint); }
.report button {
  background: none; border: none; padding: 0; color: var(--flame-deep);
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-size: 13px;
}
.report button:hover { color: var(--ink); }
