/* Snapl — design system
   Concept: shortening a link is tagging it, the way a luggage tag condenses
   a destination onto a small stub. Ink-navy ground, brass-amber accent,
   punch-hole + perforation motifs used structurally (not decoratively). */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,700&family=Inter:wght@400;500;600;700&family=IBM+Plex+Mono:wght@500;600&display=swap');

:root {
  --ink: #101922;
  --ink-soft: #17222c;
  --surface: #1c2833;
  --surface-raised: #223140;
  --hairline: #2c3b48;
  --text: #e8edf1;
  --text-dim: #9fb0be;
  --text-faint: #6b7b89;
  --brass: #e8b44b;
  --brass-dim: #b98d33;
  --teal: #5fb3a3;
  --danger: #e8615a;
  --success: #6fcf97;

  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;

  --radius: 4px;
  --hole: 22px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brass); text-decoration: none; }
a:hover { text-decoration: underline; }

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

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  margin: 0 0 0.4em;
  color: var(--text);
}

h1 { font-size: clamp(2.2rem, 4vw, 3.4rem); font-weight: 500; }
h2 { font-size: clamp(1.5rem, 2.6vw, 2rem); }
h3 { font-size: 1.15rem; }

p { color: var(--text-dim); margin: 0 0 1em; }

.mono { font-family: var(--font-mono); letter-spacing: 0.01em; }

/* ---------- layout shell ---------- */

.shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 28px;
}

.topbar {
  border-bottom: 1px solid var(--hairline);
  background: rgba(16, 25, 34, 0.9);
  backdrop-filter: blur(6px);
  position: sticky;
  top: 0;
  z-index: 40;
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text);
}

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2.5px solid var(--brass);
  position: relative;
  flex-shrink: 0;
}
.brand-mark::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: var(--brass);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 26px;
  font-size: 0.94rem;
}
.nav-links a { color: var(--text-dim); }
.nav-links a:hover { color: var(--text); text-decoration: none; }

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--brass);
  color: #1a1305;
}
.btn-primary:hover { background: #f0c264; text-decoration: none; }

.btn-ghost {
  background: transparent;
  border-color: var(--hairline);
  color: var(--text);
}
.btn-ghost:hover { border-color: var(--brass); text-decoration: none; }

.btn-danger {
  background: transparent;
  border-color: var(--danger);
  color: var(--danger);
}
.btn-danger:hover { background: rgba(232, 97, 90, 0.1); text-decoration: none; }

.btn-sm { padding: 8px 14px; font-size: 0.85rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }

/* ---------- form controls ---------- */

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 6px;
}

input, textarea, select {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 12px 14px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.96rem;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--brass);
}
input::placeholder { color: var(--text-faint); }

.field { margin-bottom: 18px; }
.field-row { display: flex; gap: 14px; }
.field-row > .field { flex: 1; }
.field-hint { font-size: 0.78rem; color: var(--text-faint); margin-top: 5px; }
.field-error { font-size: 0.78rem; color: var(--danger); margin-top: 5px; display: none; }

/* ---------- the tag: hero shortener + link cards ---------- */

.tag {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  position: relative;
  padding: 34px 34px 34px 54px;
}

.tag::before {
  content: "";
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  width: var(--hole);
  height: var(--hole);
  border-radius: 50%;
  background: var(--ink);
  border: 1px solid var(--hairline);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.5);
}

.tag-perforation {
  position: absolute;
  left: 42px;
  top: 14px;
  bottom: 14px;
  width: 1px;
  background-image: linear-gradient(var(--hairline) 60%, transparent 0%);
  background-size: 1px 8px;
  background-repeat: repeat-y;
}

.hero {
  padding: 74px 0 56px;
}

.hero-eyebrow {
  color: var(--brass);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  margin-bottom: 18px;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 48px;
  align-items: center;
}

@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; }
  .tag { padding: 28px 24px 28px 44px; }
  .tag::before { display: none; }
  .tag-perforation { display: none; }
}

.result-box {
  margin-top: 18px;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--ink-soft);
  border: 1px dashed var(--brass-dim);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.result-box .result-link {
  font-family: var(--font-mono);
  font-size: 1.02rem;
  color: var(--brass);
}

/* ---------- cards / lists ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  padding: 24px;
}

.link-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 0;
  border-bottom: 1px solid var(--hairline);
}
.link-row:last-child { border-bottom: none; }

.link-code {
  font-family: var(--font-mono);
  color: var(--brass);
  font-size: 1rem;
}

.link-original {
  color: var(--text-faint);
  font-size: 0.85rem;
  max-width: 420px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.pill-active { background: rgba(111, 207, 151, 0.14); color: var(--success); }
.pill-inactive { background: rgba(155, 168, 178, 0.14); color: var(--text-faint); }
.pill-expired { background: rgba(232, 97, 90, 0.14); color: var(--danger); }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
  margin-bottom: 8px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  padding: 20px;
}
.stat-value {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--brass);
  display: block;
}
.stat-label {
  font-size: 0.8rem;
  color: var(--text-faint);
  margin-top: 4px;
}

/* ---------- misc ---------- */

.section { padding: 56px 0; }
.section-tight { padding: 32px 0; }

.divider { border: none; border-top: 1px solid var(--hairline); margin: 32px 0; }

.muted { color: var(--text-faint); font-size: 0.85rem; }

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--surface-raised);
  border: 1px solid var(--hairline);
  border-left: 3px solid var(--brass);
  padding: 14px 18px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  max-width: 340px;
  z-index: 100;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  animation: toast-in 0.2s ease;
}
.toast.error { border-left-color: var(--danger); }
.toast.success { border-left-color: var(--success); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-faint);
}

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 24px;
}
.tab {
  padding: 10px 18px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-faint);
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
.tab.active { color: var(--brass); border-bottom-color: var(--brass); }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 12, 16, 0.72);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 90;
  padding: 20px;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  padding: 28px;
  max-width: 520px;
  width: 100%;
  max-height: 86vh;
  overflow-y: auto;
}

.center-page {
  min-height: calc(100vh - 68px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.auth-card { max-width: 420px; width: 100%; }

table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  font-size: 0.76rem;
  text-transform: none;
  color: var(--text-faint);
  font-weight: 600;
  padding: 10px 12px;
  border-bottom: 1px solid var(--hairline);
}
td {
  padding: 12px;
  border-bottom: 1px solid var(--hairline);
  font-size: 0.9rem;
}

.footer {
  border-top: 1px solid var(--hairline);
  padding: 32px 0;
  color: var(--text-faint);
  font-size: 0.85rem;
}
