/* ============================================================
   Quill UI — Components
   Faithful extractions + recreated paper-sticker system.

   FAITHFUL (DOM/computed-style ground truth from the source):
     · Dotted grid backdrop      · Editorial tab nav
     · Data table                · Buttons (pill / ghost / ink)
     · Row list                  · Mono annotation, display headline

   RECREATED (CSS interpretations of the source's image artwork —
   the source ships these as illustrations, not CSS; rebuilt here
   in the exact pixel-sampled palette):
     · Sticker base + tag / note / price-tag / seal / ticket / toast
   ============================================================ */

/* ── Dotted grid backdrop ───────────────────────────────────
   Source draws this with ~135 SVG <line> elements. Recreated as a
   single CSS radial-gradient dot pattern: lighter, zero DOM, and
   crisp on mobile. */
.quill-grid {
  background-color: var(--color-bg-page);
  background-image: radial-gradient(var(--grid-dot) 1.2px, transparent 1.2px);
  background-size: var(--grid-size) var(--grid-size);
  background-position: -1px -1px;
}

/* ── Display headline (Gerstner 32/500, tight) ─────────────── */
.quill-display {
  font-family: var(--font-display);
  font-size: var(--size-display);
  line-height: var(--lh-display);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-tight);
  color: var(--color-text-primary);
  margin: 0;
}

/* ── Mono annotation (IBM Plex Mono 12/700, accent blue) ───── */
.quill-anno {
  font-family: var(--font-mono);
  font-size: var(--size-xs);
  line-height: var(--lh-xs);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-normal);
  color: var(--color-brand-accent);
}

/* ── Buttons ────────────────────────────────────────────────
   Three forms present/implied on the source:
   · ghost  — the "View" button (measured exactly)
   · ink    — solid dark CTA
   · pill   — fully-rounded CTA (measured radius 100px) */
.quill-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-size: var(--size-base);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-tight);
  line-height: 1;
  border: 1px solid transparent;
  border-radius: var(--radius-xl);
  cursor: pointer;
  user-select: none;
  transition: background var(--duration-normal) var(--ease-in-out),
              border-color var(--duration-normal) var(--ease-in-out),
              color var(--duration-normal) var(--ease-in-out),
              transform var(--duration-fast) var(--ease-out);
}
.quill-btn:focus-visible {
  outline: 2px solid var(--color-focus-ring);
  outline-offset: 2px;
}
.quill-btn:active { transform: translateY(1px); }

/* ghost — measured: bg #FFFCF7, 1px #E0E0E0, radius 10px, 0 12px pad, muted text */
.quill-btn--ghost {
  height: 36px;
  padding: 0 var(--space-3);
  background: var(--color-bg-surface);
  border-color: var(--color-border);
  color: var(--color-text-secondary);
}
.quill-btn--ghost:hover {
  background: var(--color-bg-elevated);
  color: var(--color-text-strong);
  border-color: var(--color-border-strong);
}

/* ink — solid dark CTA */
.quill-btn--ink {
  height: 36px;
  padding: 0 var(--space-4);
  background: var(--color-action-bg);
  color: var(--color-action-text);
}
.quill-btn--ink:hover { background: var(--color-action-bg-hover); }

/* pill — fully rounded (measured radius 100px) */
.quill-btn--pill {
  height: 44px;
  padding: 0 22px;
  border-radius: var(--radius-pill);
  background: var(--color-action-bg);
  color: var(--color-action-text);
}
.quill-btn--pill:hover { background: var(--color-action-bg-hover); }

/* pill outline variant (the hero "Got Mail?" outline treatment) */
.quill-btn--pill-outline {
  height: 44px;
  padding: 0 22px;
  border-radius: var(--radius-pill);
  background: transparent;
  border-color: var(--color-border);
  color: var(--color-text-primary);
}
.quill-btn--pill-outline:hover { border-color: var(--color-text-primary); }

.quill-btn:disabled,
.quill-btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── Editorial tab nav (Table / Insight) ────────────────────
   Measured: Gerstner 13/500, tracking -0.39px, lh 20px.
   Active #333, inactive #AAA, "/" separators. No pill, no bg. */
.quill-tabnav {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-size: var(--size-sm);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-tight);
  line-height: var(--lh-sm);
}
.quill-tabnav__tab {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  font: inherit;
  letter-spacing: inherit;
  color: var(--color-text-muted);
  transition: color var(--duration-normal) var(--ease-in-out);
}
.quill-tabnav__tab:hover { color: var(--color-text-secondary); }
.quill-tabnav__tab[aria-selected="true"] { color: var(--color-text-strong); }
.quill-tabnav__tab:focus-visible {
  outline: 2px solid var(--color-focus-ring);
  outline-offset: 3px;
  border-radius: 2px;
}
.quill-tabnav__sep {
  color: var(--color-border-strong);
  user-select: none;
}

/* ── Data table ─────────────────────────────────────────────
   Measured: warm paper headers #FCF8EF, 1px #E0E0E0 hairlines,
   square cells (radius 0), Gerstner 13/500 -0.39px, 0 8px pad. */
.quill-table-wrap {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-bg-surface);
}
.quill-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-display);
  font-size: var(--size-sm);
  letter-spacing: var(--tracking-tight);
  line-height: var(--lh-sm);
  color: var(--color-text-strong);
}
.quill-table thead th {
  background: var(--color-bg-elevated);
  font-weight: var(--weight-medium);
  text-align: left;
  color: var(--color-text-strong);
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--color-border);
  border-right: 1px solid var(--color-border);
  white-space: nowrap;
}
.quill-table thead th:last-child { border-right: 0; }
.quill-table tbody td {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--color-border);
  border-right: 1px solid var(--color-border);
  color: var(--color-text-secondary);
}
.quill-table tbody td:last-child { border-right: 0; }
.quill-table tbody tr:last-child td { border-bottom: 0; }
.quill-table tbody tr {
  transition: background var(--duration-fast) var(--ease-out);
}
.quill-table tbody tr:hover { background: var(--color-bg-elevated); }
.quill-table .quill-num {
  font-variant-numeric: tabular-nums;
  color: var(--color-text-strong);
}

/* ── Row list (notification / activity items) ───────────────
   Source: Inter 16, ink, gap 36px between groups. */
.quill-row-list {
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
}
.quill-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-2);
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-primary);
  font-size: var(--size-md);
}
.quill-row:last-child { border-bottom: 0; }
.quill-row__count {
  flex-shrink: 0;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-pill);
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  font-family: var(--font-mono);
  font-size: var(--size-xs);
  font-weight: var(--weight-bold);
  color: var(--color-text-secondary);
}
.quill-row__label { flex: 1; letter-spacing: var(--tracking-tight); }
.quill-row__meta {
  color: var(--color-text-muted);
  font-size: var(--size-sm);
}

/* ============================================================
   RECREATED PAPER-STICKER SYSTEM
   The source renders these as illustrations (images + SVG
   filters). Rebuilt here as reusable CSS in the sampled palette.
   Faithful to the aesthetic, not to the source DOM.
   ============================================================ */

/* base sticker — a soft paper card with a gentle drop shadow */
.quill-sticker {
  --sticker-bg: var(--sticker-cream);
  --sticker-fg: var(--sticker-cream-ink);
  position: relative;
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  min-width: 96px;
  padding: var(--space-3) var(--space-4);
  background: var(--sticker-bg);
  color: var(--sticker-fg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-paper);
  font-family: var(--font-display);
  font-size: var(--size-sm);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-tight);
  line-height: var(--lh-sm);
  transition: var(--transition-paper);
}
.quill-sticker:hover {
  transform: translateY(-3px) rotate(var(--tilt, 0deg));
  box-shadow: var(--shadow-lg);
}
.quill-sticker__title { font-weight: var(--weight-semibold); }
.quill-sticker__meta {
  font-family: var(--font-mono);
  font-size: var(--size-xs);
  font-weight: var(--weight-normal);
  letter-spacing: 0;
  opacity: 0.85;
}

/* colour modifiers — map onto the sampled sticker tokens */
.quill-sticker--teal       { --sticker-bg: var(--sticker-teal);       --sticker-fg: var(--sticker-teal-ink); }
.quill-sticker--yellow     { --sticker-bg: var(--sticker-yellow);     --sticker-fg: var(--sticker-yellow-ink); }
.quill-sticker--butter     { --sticker-bg: var(--sticker-butter);     --sticker-fg: var(--sticker-butter-ink); }
.quill-sticker--blue       { --sticker-bg: var(--sticker-blue);       --sticker-fg: var(--sticker-blue-ink); }
.quill-sticker--ocean      { --sticker-bg: var(--sticker-ocean);      --sticker-fg: var(--sticker-ocean-ink); }
.quill-sticker--pink       { --sticker-bg: var(--sticker-pink);       --sticker-fg: var(--sticker-pink-ink); }
.quill-sticker--terracotta { --sticker-bg: var(--sticker-terracotta); --sticker-fg: var(--sticker-terracotta-ink); }
.quill-sticker--lavender   { --sticker-bg: var(--sticker-lavender);   --sticker-fg: var(--sticker-lavender-ink); }
.quill-sticker--sage       { --sticker-bg: var(--sticker-sage);       --sticker-fg: var(--sticker-sage-ink); }
.quill-sticker--brick      { --sticker-bg: var(--sticker-brick);      --sticker-fg: var(--sticker-brick-ink); }
.quill-sticker--forest     { --sticker-bg: var(--sticker-forest);     --sticker-fg: var(--sticker-forest-ink); }
.quill-sticker--cream      { --sticker-bg: var(--sticker-cream);      --sticker-fg: var(--sticker-cream-ink); }
.quill-sticker--paper      { --sticker-bg: var(--sticker-paper);      --sticker-fg: var(--sticker-paper-ink); }

/* tilt helpers — stickers on the source sit at jaunty angles */
.quill-sticker--tilt-l { --tilt: -4deg; transform: rotate(-4deg); }
.quill-sticker--tilt-r { --tilt:  4deg; transform: rotate(4deg); }

/* TAG — a rounded label chip (e.g. "20% OFF") */
.quill-sticker--tag {
  flex-direction: row;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-pill);
  min-width: 0;
  font-weight: var(--weight-bold);
  text-transform: uppercase;
  font-size: var(--size-xs);
  letter-spacing: var(--tracking-wide);
}

/* PRICE-TAG — a chip with a punched hole on the left */
.quill-sticker--price {
  flex-direction: row;
  align-items: center;
  padding-left: var(--space-6);
  border-radius: var(--radius-sm) var(--radius-lg) var(--radius-lg) var(--radius-sm);
  font-weight: var(--weight-bold);
}
.quill-sticker--price::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  transform: translateY(-50%);
  background: var(--color-bg-page);
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--sticker-fg) 35%, transparent);
}

/* NOTE — a sticky note with a folded corner */
.quill-sticker--note {
  min-width: 140px;
  min-height: 96px;
  padding: var(--space-4);
  border-radius: var(--radius-sm);
  justify-content: flex-start;
}
.quill-sticker--note::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  width: 22px;
  height: 22px;
  background: linear-gradient(135deg, transparent 50%, color-mix(in srgb, var(--sticker-fg) 18%, transparent) 50%);
  border-bottom-right-radius: var(--radius-sm);
}

/* SEAL — a circular discount badge ("30% OFF") */
.quill-sticker--seal {
  width: 88px;
  height: 88px;
  min-width: 0;
  padding: 0;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  text-align: center;
  text-transform: uppercase;
  font-size: var(--size-xs);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-wide);
}

/* TICKET — a boarding-pass card with a perforated divider */
.quill-sticker--ticket {
  flex-direction: row;
  align-items: stretch;
  gap: 0;
  min-width: 240px;
  padding: 0;
  overflow: hidden;
  border-radius: var(--radius-lg);
}
.quill-ticket__body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: var(--space-3) var(--space-4);
  flex: 1;
}
.quill-ticket__route {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-size: var(--size-lg);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-tight);
}
.quill-ticket__meta {
  font-family: var(--font-mono);
  font-size: var(--size-xs);
  opacity: 0.85;
  display: flex;
  justify-content: space-between;
}
.quill-ticket__stub {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 var(--space-3);
  border-left: 2px dashed color-mix(in srgb, var(--sticker-fg) 30%, transparent);
  font-family: var(--font-mono);
  font-size: var(--size-xs);
  writing-mode: vertical-rl;
  text-orientation: mixed;
  opacity: 0.9;
}

/* TOAST — a paper notification card */
.quill-sticker--toast {
  flex-direction: row;
  align-items: flex-start;
  gap: var(--space-3);
  min-width: 240px;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  background: var(--color-bg-surface);
  color: var(--color-text-primary);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-md);
  font-family: var(--font-body);
  letter-spacing: normal;
  font-weight: var(--weight-normal);
}
.quill-toast__dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--color-brand-accent);
}
.quill-toast__body { display: flex; flex-direction: column; gap: 2px; }
.quill-toast__title { font-weight: var(--weight-semibold); font-size: var(--size-md); }
.quill-toast__meta { color: var(--color-text-muted); font-size: var(--size-sm); }

/* ── Badge (small status pill) ──────────────────────────── */
.quill-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  font-family: var(--font-display);
  font-size: var(--size-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-tight);
  background: var(--color-bg-elevated);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
}
.quill-badge--accent { background: color-mix(in srgb, var(--color-brand-accent) 12%, transparent); color: var(--color-brand-accent); border-color: transparent; }
.quill-badge--success { background: color-mix(in srgb, var(--color-success) 14%, transparent); color: var(--sticker-teal-ink); border-color: transparent; }
.quill-badge__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ── Card (plain paper container) ───────────────────────── */
.quill-card {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-2xl);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
}
.quill-card__title {
  font-family: var(--font-display);
  font-size: var(--size-lg);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-tight);
  color: var(--color-text-primary);
  margin: 0 0 var(--space-2);
}
.quill-card__body { color: var(--color-text-secondary); font-size: var(--size-md); line-height: var(--lh-md); }

/* ── Code block ─────────────────────────────────────────── */
.quill-code {
  font-family: var(--font-mono);
  font-size: var(--size-sm);
  line-height: 1.6;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  color: var(--color-text-strong);
  overflow-x: auto;
}
