/* =========================================================
   RevTools — Stylesheet
   Design tokens live at the top as CSS custom properties so
   the whole theme can be re-skinned from one place.
   ========================================================= */

:root {
  /* --- Brand palette (dark, default) --- */
  --bg: #0d0d0d;
  --bg-elevated: #1a1a1a;
  --bg-card: rgba(26, 26, 26, 0.6);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #f5f5f7;
  --text-dim: #a3a3ad;
  --text-faint: #6b6b76;
  --accent: #4f8cff;
  --accent-soft: rgba(79, 140, 255, 0.14);
  --accent-strong: #6ea1ff;
  --danger: #ff6b6b;
  --success: #3ddc97;

  /* --- Type --- */
  --font-display: "Space Grotesk", "Inter", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, monospace;

  /* --- Layout --- */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --nav-h: 68px;
  --max-w: 1200px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

[data-theme="light"] {
  --bg: #f6f7fb;
  --bg-elevated: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.75);
  --border: rgba(13, 13, 13, 0.08);
  --border-strong: rgba(13, 13, 13, 0.14);
  --text: #101014;
  --text-dim: #52525b;
  --text-faint: #8a8a94;
  --accent-soft: rgba(79, 140, 255, 0.1);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  transition: background 0.35s var(--ease), color 0.35s var(--ease);
  min-height: 100vh;
}
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; line-height: 1.15; margin: 0 0 0.5em; letter-spacing: -0.01em; }
p { margin: 0 0 1em; color: var(--text-dim); }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
img { max-width: 100%; display: block; }
ul { margin: 0; padding: 0; list-style: none; }
input, select, textarea { font-family: inherit; color: inherit; }
::selection { background: var(--accent); color: #fff; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.container { max-width: var(--max-w); margin: 0 auto; padding: 0 24px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link {
  position: absolute; left: 12px; top: -60px; background: var(--accent); color: #fff;
  padding: 10px 16px; border-radius: var(--radius-sm); z-index: 200; transition: top 0.2s var(--ease);
}
.skip-link:focus { top: 12px; }

/* ---------- Background particles ---------- */
#bg-canvas {
  position: fixed; inset: 0; z-index: -1; width: 100%; height: 100%;
  background: radial-gradient(circle at 20% 0%, rgba(79,140,255,0.10), transparent 55%),
              radial-gradient(circle at 85% 30%, rgba(79,140,255,0.08), transparent 50%),
              var(--bg);
}

/* ---------- Navigation ---------- */
.navbar {
  position: sticky; top: 0; z-index: 100; height: var(--nav-h);
  display: flex; align-items: center;
  background: rgba(13, 13, 13, 0.65);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border-bottom: 1px solid var(--border);
  transition: background 0.35s var(--ease), border-color 0.35s var(--ease);
}
[data-theme="light"] .navbar { background: rgba(246, 247, 251, 0.75); }
.navbar .container { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.logo { display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; }
.logo-mark {
  width: 28px; height: 28px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #8f6bff);
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 0.85rem; font-weight: 800;
  box-shadow: 0 4px 14px rgba(79, 140, 255, 0.35);
}
.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-links a {
  padding: 9px 14px; border-radius: var(--radius-sm); font-size: 0.92rem; color: var(--text-dim);
  transition: color 0.2s var(--ease), background 0.2s var(--ease);
}
.nav-links a:hover, .nav-links a.active { color: var(--text); background: var(--accent-soft); }
.nav-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg-elevated); color: var(--text); display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; transition: transform 0.15s var(--ease), border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.icon-btn:hover { border-color: var(--accent); transform: translateY(-1px); }
.nav-toggle { display: none; }

@media (max-width: 860px) {
  .nav-links { position: fixed; top: var(--nav-h); left: 0; right: 0; flex-direction: column; align-items: stretch;
    background: var(--bg-elevated); border-bottom: 1px solid var(--border); padding: 8px; gap: 2px;
    transform: translateY(-8px); opacity: 0; pointer-events: none; transition: all 0.25s var(--ease); }
  .nav-links.open { transform: translateY(0); opacity: 1; pointer-events: auto; }
  .nav-links a { padding: 12px 14px; }
  .nav-toggle { display: inline-flex; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border-radius: 999px; font-size: 0.95rem; font-weight: 600;
  border: 1px solid transparent; cursor: pointer; transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease), background 0.2s var(--ease), border-color 0.2s var(--ease);
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 8px 22px rgba(79,140,255,0.32); }
.btn-primary:hover { background: var(--accent-strong); transform: translateY(-2px); }
.btn-ghost { background: transparent; border-color: var(--border-strong); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent-strong); transform: translateY(-2px); }
.btn-sm { padding: 8px 14px; font-size: 0.82rem; border-radius: 8px; }
.btn-icon { padding: 8px 12px; }

/* ---------- Hero ---------- */
.hero {
  padding: 128px 0 96px; text-align: center; position: relative; overflow: hidden;
}
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 8px; font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--accent-strong); background: var(--accent-soft); border: 1px solid rgba(79,140,255,0.25);
  padding: 6px 14px; border-radius: 999px; margin-bottom: 24px;
}
.hero h1 {
  font-size: clamp(2.6rem, 7vw, 5rem); margin-bottom: 18px;
  background: linear-gradient(180deg, var(--text) 30%, var(--text-dim));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.hero p.lead { font-size: clamp(1.02rem, 2vw, 1.25rem); max-width: 620px; margin: 0 auto 36px; }
.hero-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.hero-stats { display: flex; gap: 40px; justify-content: center; margin-top: 72px; flex-wrap: wrap; }
.hero-stats div { text-align: center; }
.hero-stats strong { display: block; font-family: var(--font-display); font-size: 1.8rem; color: var(--text); }
.hero-stats span { font-size: 0.8rem; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.06em; }

/* ---------- Sections / Cards ---------- */
section { padding: 72px 0; }
.section-head { text-align: center; max-width: 640px; margin: 0 auto 48px; }
.section-head h2 { font-size: clamp(1.7rem, 4vw, 2.4rem); }

.glass {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
}

.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 20px; }
.feature-card { padding: 28px; transition: transform 0.25s var(--ease), border-color 0.25s var(--ease); }
.feature-card:hover { transform: translateY(-4px); border-color: var(--border-strong); }
.feature-card .f-icon {
  width: 44px; height: 44px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-strong);
  display: flex; align-items: center; justify-content: center; margin-bottom: 16px; font-size: 1.2rem;
}
.feature-card h3 { font-size: 1.05rem; margin-bottom: 6px; }
.feature-card p { font-size: 0.92rem; margin: 0; }

/* ---------- Tools page ---------- */
.tools-layout { display: grid; grid-template-columns: 220px 1fr; gap: 32px; align-items: start; }
@media (max-width: 860px) { .tools-layout { grid-template-columns: 1fr; } }

.tools-toolbar { display: flex; gap: 12px; margin-bottom: 28px; flex-wrap: wrap; align-items: center; }
.search-box { position: relative; flex: 1; min-width: 220px; }
.search-box input {
  width: 100%; padding: 12px 16px 12px 42px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--bg-elevated); color: var(--text); font-size: 0.95rem; transition: border-color 0.2s var(--ease);
}
.search-box input:focus { border-color: var(--accent); }
.search-box svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-faint); }

.category-list { position: sticky; top: calc(var(--nav-h) + 20px); display: flex; flex-direction: column; gap: 4px; }
.category-list button {
  text-align: left; padding: 10px 14px; border-radius: 10px; border: 1px solid transparent; background: transparent;
  color: var(--text-dim); cursor: pointer; font-size: 0.9rem; display: flex; justify-content: space-between; align-items: center;
  transition: all 0.2s var(--ease);
}
.category-list button:hover { background: var(--accent-soft); color: var(--text); }
.category-list button.active { background: var(--accent-soft); border-color: rgba(79,140,255,0.3); color: var(--accent-strong); font-weight: 600; }
.category-list .count { font-size: 0.72rem; background: var(--bg-elevated); border-radius: 999px; padding: 1px 8px; color: var(--text-faint); }

.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.tool-card {
  padding: 20px; cursor: pointer; transition: transform 0.22s var(--ease), border-color 0.22s var(--ease), box-shadow 0.22s var(--ease);
  display: flex; flex-direction: column; gap: 10px;
}
.tool-card:hover { transform: translateY(-3px); border-color: rgba(79,140,255,0.35); box-shadow: 0 12px 28px rgba(0,0,0,0.28); }
.tool-card .t-icon { width: 38px; height: 38px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-strong); display: flex; align-items: center; justify-content: center; }
.tool-card h3 { font-size: 1rem; margin: 0; }
.tool-card p { font-size: 0.84rem; margin: 0; }
.tool-card .tag { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-faint); }
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-faint); }

/* ---------- Tool detail / workspace ---------- */
.tool-view { padding: 32px; }
.tool-view-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.tool-view-head h2 { margin-bottom: 6px; font-size: 1.5rem; }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: 0.85rem; color: var(--text-dim); margin-bottom: 18px; cursor: pointer; }
.back-link:hover { color: var(--accent-strong); }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 0.82rem; color: var(--text-dim); margin-bottom: 6px; font-weight: 600; }
.field small.hint { display: block; color: var(--text-faint); font-size: 0.75rem; margin-top: 4px; }

textarea, input[type="text"], input[type="number"], input[type="email"], input[type="search"], input[type="date"], input[type="color"], select {
  width: 100%; padding: 11px 14px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg-elevated); color: var(--text); font-size: 0.92rem; transition: border-color 0.2s var(--ease);
}
textarea:focus, input:focus, select:focus { border-color: var(--accent); }
textarea { min-height: 160px; resize: vertical; font-family: var(--font-mono); font-size: 0.85rem; }
.mono { font-family: var(--font-mono); }

.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 140px; }
.check-row { display: flex; align-items: center; gap: 8px; font-size: 0.88rem; color: var(--text-dim); }
.check-row input { width: auto; }

.result-box {
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 12px; padding: 16px;
  font-family: var(--font-mono); font-size: 0.85rem; white-space: pre-wrap; word-break: break-word; max-height: 340px; overflow: auto;
}
.stat-strip { display: flex; gap: 22px; flex-wrap: wrap; margin: 12px 0; }
.stat-strip div { text-align: left; }
.stat-strip strong { display: block; font-size: 1.3rem; font-family: var(--font-display); }
.stat-strip span { font-size: 0.72rem; color: var(--text-faint); text-transform: uppercase; }

.toolbar-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0; }
.swatch { width: 100%; height: 90px; border-radius: 12px; border: 1px solid var(--border); }
.color-info { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px,1fr)); gap: 10px; margin-top: 12px; }
.color-info div { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.color-info span { display: block; font-size: 0.7rem; color: var(--text-faint); text-transform: uppercase; }
.color-info strong { font-family: var(--font-mono); font-size: 0.9rem; cursor: pointer; }

.diff-add { background: rgba(61, 220, 151, 0.16); color: #7bf0bf; }
.diff-del { background: rgba(255, 107, 107, 0.16); color: #ff9c9c; text-decoration: line-through; }

.dropzone {
  border: 1.5px dashed var(--border-strong); border-radius: 14px; padding: 32px; text-align: center; cursor: pointer;
  color: var(--text-dim); transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.preview-img { max-height: 320px; border-radius: 12px; margin: 12px auto; border: 1px solid var(--border); }

.strength-meter { height: 8px; border-radius: 999px; background: var(--bg-elevated); overflow: hidden; margin-top: 8px; }
.strength-meter i { display: block; height: 100%; border-radius: 999px; transition: width 0.3s var(--ease), background 0.3s var(--ease); }

.big-number { font-family: var(--font-display); font-size: 3.2rem; text-align: center; margin: 20px 0; }
.dice-row { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin: 20px 0; }
.die { width: 64px; height: 64px; border-radius: 14px; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 1.6rem; font-weight: 700; box-shadow: 0 8px 20px rgba(79,140,255,0.35); }
.coin { width: 120px; height: 120px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), #8f6bff); margin: 24px auto; display: flex; align-items: center; justify-content: center; color: #fff; font-family: var(--font-display); font-size: 1.1rem; font-weight: 700; box-shadow: 0 12px 28px rgba(79,140,255,0.4); }
.coin.flipping { animation: coinFlip 0.7s var(--ease); }
@keyframes coinFlip { 0% { transform: rotateY(0);} 100% { transform: rotateY(1080deg);} }

/* ---------- Page content (About / Contact) ---------- */
.page-hero { padding: 90px 0 40px; text-align: center; }
.page-hero h1 { font-size: clamp(2.2rem, 5vw, 3rem); }
.about-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px,1fr)); gap: 20px; margin-top: 40px; }
.about-grid .glass { padding: 26px; }

.contact-wrap { max-width: 560px; margin: 0 auto; padding: 36px; }
.form-msg { padding: 12px 14px; border-radius: 10px; font-size: 0.88rem; margin-bottom: 16px; display: none; }
.form-msg.show { display: block; }
.form-msg.success { background: rgba(61,220,151,0.12); color: var(--success); border: 1px solid rgba(61,220,151,0.3); }
.form-msg.error { background: rgba(255,107,107,0.12); color: var(--danger); border: 1px solid rgba(255,107,107,0.3); }
.field-error { color: var(--danger); font-size: 0.76rem; margin-top: 4px; display: none; }
.field-error.show { display: block; }
input.invalid, textarea.invalid { border-color: var(--danger); }

/* ---------- Footer ---------- */
footer { border-top: 1px solid var(--border); padding: 48px 0 28px; margin-top: 40px; }
.footer-grid { display: flex; justify-content: space-between; gap: 32px; flex-wrap: wrap; }
.footer-brand p { max-width: 280px; font-size: 0.85rem; }
.footer-cols { display: flex; gap: 56px; flex-wrap: wrap; }
.footer-col h4 { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); margin-bottom: 14px; }
.footer-col a { display: block; font-size: 0.88rem; color: var(--text-dim); padding: 5px 0; transition: color 0.2s var(--ease); }
.footer-col a:hover { color: var(--accent-strong); }
.footer-bottom { display: flex; justify-content: space-between; align-items: center; margin-top: 36px; padding-top: 24px; border-top: 1px solid var(--border); font-size: 0.78rem; color: var(--text-faint); flex-wrap: wrap; gap: 10px; }

/* ---------- Toasts ---------- */
#toast-region { position: fixed; bottom: 22px; right: 22px; z-index: 300; display: flex; flex-direction: column; gap: 10px; max-width: 320px; }
.toast {
  padding: 13px 16px; border-radius: 12px; background: var(--bg-elevated); border: 1px solid var(--border-strong);
  color: var(--text); font-size: 0.86rem; box-shadow: 0 12px 30px rgba(0,0,0,0.4);
  display: flex; align-items: center; gap: 10px; animation: toastIn 0.3s var(--ease);
}
.toast.success { border-color: rgba(61,220,151,0.4); }
.toast.error { border-color: rgba(255,107,107,0.4); }
.toast.fade-out { animation: toastOut 0.25s var(--ease) forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px);} to { opacity: 1; transform: translateY(0);} }
@keyframes toastOut { to { opacity: 0; transform: translateY(6px); } }

/* ---------- Page transitions ---------- */
.view { animation: viewIn 0.35s var(--ease); }
@keyframes viewIn { from { opacity: 0; transform: translateY(10px);} to { opacity: 1; transform: translateY(0);} }
.hidden { display: none !important; }

/* ---------- Utility ---------- */
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
