/* =============================================================================
   tabmotion — styles.css
   -----------------------------------------------------------------------------
   Visual layer for the tabmotion landing page. Pure CSS, no frameworks.
   The look is intentionally minimal (shadcn-inspired): a near-black canvas,
   white text, and a single purple accent.

   Sections in order:
     1. Design tokens (:root custom properties)
     2. Base / reset
     3. Header (wordmark + tagline)
     4. Controls (search + category chips)
     5. Grid + favicon cards
     6. Code modal
     7. Footer + copy toast

   Tweak the tokens in section 1 to re-theme the entire site.
   ============================================================================= */

/* ---------- 1. Design tokens -------------------------------------------------
   Every color / radius used on the page resolves to one of these variables,
   so the whole theme can be changed from this single block.                    */
:root {
  --bg: #09090b;            /* page background          */
  --bg-soft: #0c0c0f;       /* inputs, modal, tab mock  */
  --card: #0e0e12;          /* favicon cards            */
  --border: #1f1f24;        /* default hairline border  */
  --border-strong: #2a2a31; /* hover / focus border     */
  --fg: #fafafa;            /* primary text             */
  --muted: #8a8a94;         /* secondary text           */
  --muted-2: #5f5f68;       /* tertiary / placeholder   */
  --primary: #800080;       /* brand purple             */
  --primary-soft: #ac59ac;  /* lighter purple accent    */
  --primary-dim: rgba(128, 0, 128, 0.14); /* purple tint for fills/glows */
  --radius: 14px;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ---------- 2. Base / reset ------------------------------------------------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
  overflow-x: hidden;
}

/* Soft purple glow anchored behind the header. Purely decorative. */
body::before {
  content: "";
  position: fixed;
  top: -30%;
  left: 50%;
  width: 900px;
  height: 600px;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(128, 0, 128, 0.30), transparent 60%);
  filter: blur(60px);
  pointer-events: none;
  z-index: 0;
}

/* Centered content column; sits above the ambient glow. */
.wrap {
  position: relative;
  z-index: 1;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- 3. Header ------------------------------------------------------- */
header {
  text-align: center;
  padding: 96px 0 40px;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted);
  border: 1px solid var(--border-strong);
  background: var(--bg-soft);
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 28px;
}
.badge .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 10px var(--primary);
}
/* Wordmark — white-to-grey gradient text via background-clip. */
h1 {
  font-size: clamp(48px, 9vw, 84px);
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 1;
  background: linear-gradient(180deg, #fff 30%, #b9b9c4);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
/* The "motion" half of the wordmark gets the purple gradient. */
h1 .accent {
  background: linear-gradient(180deg, var(--primary-soft), var(--primary));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.tagline {
  margin: 22px auto 0;
  max-width: 540px;
  font-size: 17px;
  color: var(--muted);
}

/* ---------- 4. Controls (search + chips) ----------------------------------- */
.controls {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  margin: 44px 0 36px;
}
.search {
  position: relative;
  width: 100%;
  max-width: 420px;
}
.search svg {
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  color: var(--muted-2);
}
.search input {
  width: 100%;
  background: var(--bg-soft);
  border: 1px solid var(--border-strong);
  color: var(--fg);
  font-size: 14.5px;
  font-family: inherit;
  padding: 12px 16px 12px 42px;
  border-radius: 10px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.search input::placeholder { color: var(--muted-2); }
.search input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-dim);
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip {
  font-family: inherit;
  font-size: 13px;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--border-strong);
  padding: 7px 15px;
  border-radius: 999px;
  cursor: pointer;
  transition: all .15s;
}
.chip:hover { color: var(--fg); border-color: #3a3a42; }
.chip.active {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}

/* Color swatches: preset palettes + custom picker. Built by app.js. */
.swatches {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin-top: 2px;
}
.swatch {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid transparent;
  outline: 2px solid transparent;   /* becomes the active ring */
  outline-offset: 2px;
  padding: 0;
  cursor: pointer;
  transition: transform .12s, outline-color .15s;
}
.swatch:hover { transform: scale(1.15); }
.swatch.active { outline-color: var(--fg); }

/* Custom picker swatch: a rainbow disc hiding the native color input. */
.swatch-custom {
  position: relative;
  overflow: hidden;
  background: conic-gradient(#f43f5e, #f59e0b, #22c55e, #06b6d4, #3b82f6, #800080, #f43f5e);
  display: inline-flex;
}
.swatch-custom input[type="color"] {
  position: absolute;
  inset: -6px;
  width: 36px;
  height: 36px;
  border: none;
  padding: 0;
  background: transparent;
  cursor: pointer;
  opacity: 0;   /* the disc shows through; the input just captures clicks */
}

/* ---------- 5. Grid + favicon cards ---------------------------------------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
  padding-bottom: 40px;
}
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;            /* column layout so actions can sink to the bottom */
  flex-direction: column;
  transition: border-color .18s, transform .18s;
}
.card:hover { border-color: var(--border-strong); transform: translateY(-2px); }

/* Faux browser-tab that hosts the live <canvas> favicon preview. */
.tab-mock {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 10px 12px;
  margin-bottom: 16px;
}
.tab-mock canvas {
  width: 22px; height: 22px;
  flex-shrink: 0;
  image-rendering: -webkit-optimize-contrast;
}
.tab-mock .tab-title {
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tab-mock .tab-x {
  margin-left: auto;
  color: var(--muted-2);
  font-size: 14px;
  line-height: 1;
}

.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card h3 { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.cat {
  font-size: 11px;
  color: var(--primary-soft);
  background: var(--primary-dim);
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.card p { font-size: 13px; color: var(--muted); margin-top: 6px; min-height: 36px; }

/* margin-top:auto pushes the buttons to the card's bottom edge, so they line
   up across cards regardless of description length. */
/* Primary button takes the full first row; the two ghost buttons split the
   second row evenly (avoids cramming three buttons into one narrow row). */
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 14px; }
.btn {
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  border-radius: 9px;
  padding: 9px 12px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all .15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}
.btn-primary { flex: 1 1 100%; background: var(--fg); color: #000; }
.btn-primary:hover { background: #d4d4d8; }
.btn-ghost { flex: 1; background: transparent; color: var(--muted); border-color: var(--border-strong); }
.btn-ghost:hover { color: var(--fg); border-color: #3a3a42; }

/* Shown when a search/filter returns nothing. */
.empty { grid-column: 1 / -1; text-align: center; color: var(--muted-2); padding: 60px 0; }

/* Pagination: numbered page buttons + prev/next. Built by app.js. */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
  padding-bottom: 24px;
}
.pagination:empty { display: none; }   /* collapse when only one page */
.page-btn {
  font-family: inherit;
  font-size: 13px;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  cursor: pointer;
  transition: all .15s;
}
.page-btn:hover:not(:disabled) { color: var(--fg); border-color: #3a3a42; }
.page-btn.active {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}
.page-btn:disabled { opacity: .4; cursor: default; }

/* ---------- 6. Code modal -------------------------------------------------- */
.overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, .7);
  backdrop-filter: blur(4px);
  display: none;             /* toggled to flex via .open */
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 50;
}
.overlay.open { display: flex; }
.modal {
  background: var(--bg-soft);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  width: 100%;
  max-width: 680px;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,.6);
}
.modal-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-head canvas { width: 26px; height: 26px; }
.modal-head .mh-text h3 { font-size: 16px; font-weight: 600; }
.modal-head .mh-text span { font-size: 12.5px; color: var(--muted); }
.modal-head .close {
  margin-left: auto;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 8px;
}
.modal-head .close:hover { color: var(--fg); background: var(--border); }

.code-wrap { position: relative; overflow: auto; padding: 20px; }
.code-wrap pre {
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.7;
  color: #d6d6dd;
  white-space: pre;
}
/* Syntax-highlight token colors (classes are applied by app.js). */
.code-wrap .tok-c { color: #6b6b76; }              /* comment */
.code-wrap .tok-k { color: var(--primary-soft); }  /* keyword */
.code-wrap .tok-s { color: #7fd1a8; }              /* string  */
.code-wrap .tok-t { color: #f0a868; }              /* tag     */

.modal-foot {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}
.modal-foot .hint { font-size: 12.5px; color: var(--muted-2); }
.modal-foot .btn-primary { flex: none; min-width: 150px; }

/* ---------- 6b. Tab preview modal ------------------------------------------ */
.preview-modal {
  background: var(--bg-soft);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  width: 100%;
  max-width: 560px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,.6);
}
.preview-body {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Mock browser window */
.browser {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg);
}
.browser-chrome { background: #08080a; padding-top: 11px; }
.dots { display: flex; gap: 7px; padding: 0 14px 11px; }
.dots span { width: 11px; height: 11px; border-radius: 50%; background: #2a2a31; }

.tabs { display: flex; gap: 6px; padding: 0 10px; }
.tab {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 13px;
  border-radius: 9px 9px 0 0;
  font-size: 12.5px;
  color: var(--muted);
  max-width: 220px;
}
/* Active tab "sits" on the page area below it. */
.tab.active {
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-bottom: none;
}
.tab.ghost { color: var(--muted-2); }
.tab canvas { width: 18px; height: 18px; flex-shrink: 0; }
.tab .t-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tab .t-x { color: var(--muted-2); font-size: 14px; line-height: 1; }

.addressbar { padding: 10px 12px; border-top: 1px solid var(--border); }
.addressbar span {
  display: block;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 12px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.viewport {
  height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted-2);
  font-size: 13px;
}

/* Site-name field */
.preview-field { display: flex; flex-direction: column; gap: 7px; }
.preview-field > span { font-size: 12.5px; color: var(--muted); }
.preview-field input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  color: var(--fg);
  font-family: inherit;
  font-size: 14px;
  padding: 11px 14px;
  border-radius: 10px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.preview-field input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-dim);
}

/* ---------- 7. Footer + toast ---------------------------------------------- */
footer {
  text-align: center;
  color: var(--muted-2);
  font-size: 13px;
  padding: 50px 0 60px;
  border-top: 1px solid var(--border);
  margin-top: 20px;
}
footer a { color: var(--muted); text-decoration: none; }
footer a:hover { color: var(--fg); }

/* Transient "Copied ✓" confirmation; .show is toggled by app.js. */
.toast {
  position: fixed;
  bottom: 28px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--primary);
  color: #fff;
  font-size: 13.5px;
  font-weight: 500;
  padding: 11px 20px;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(168,85,247,.4);
  opacity: 0;
  pointer-events: none;
  transition: all .25s ease;
  z-index: 60;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Persistent "Need a custom favicon?" contact card, anchored bottom-right.
   .hidden is toggled by app.js when dismissed. */
.contact {
  position: fixed;
  bottom: 24px; right: 24px;
  max-width: 280px;
  background: var(--bg-soft);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .5);
  z-index: 55;
  transition: opacity .25s ease, transform .25s ease;
}
.contact.hidden {
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
}
.contact-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 4px;
}
.contact-email {
  font-size: 12.5px;
  color: var(--primary-soft);
  text-decoration: none;
  word-break: break-all;
}
.contact-email:hover { color: var(--primary); text-decoration: underline; }
.contact-close {
  position: absolute;
  top: 8px; right: 10px;
  background: transparent;
  border: none;
  color: var(--muted-2);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 6px;
}
.contact-close:hover { color: var(--fg); }

@media (max-width: 520px) {
  .contact { left: 16px; right: 16px; bottom: 16px; max-width: none; }
}
