/* Outfit — self-hosted (no third-party font requests, consistent with the privacy promise) */
@font-face { font-family: 'Outfit'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/outfit-400.woff2') format('woff2'); }
@font-face { font-family: 'Outfit'; font-style: normal; font-weight: 500; font-display: swap; src: url('../fonts/outfit-500.woff2') format('woff2'); }
@font-face { font-family: 'Outfit'; font-style: normal; font-weight: 600; font-display: swap; src: url('../fonts/outfit-600.woff2') format('woff2'); }
@font-face { font-family: 'Outfit'; font-style: normal; font-weight: 700; font-display: swap; src: url('../fonts/outfit-700.woff2') format('woff2'); }

:root {
  /* Light theme is the default. Identity: warm stone neutrals + a single burnt-orange accent.
     Sharp corners and hairline structure replace the soft, glowy SaaS look. */
  --bg: #faf9f7;
  --bg-soft: #ffffff;
  --card: #ffffff;
  --card-hover: #f4f2ee;
  --border: #e5e1da;
  --border-strong: #d6d1c7;
  --text: #1c1917;
  --muted: #57534e; /* stone-600, WCAG AA on paper */
  --accent: #c2410c;       /* burnt orange */
  --accent-deep: #9a3412;
  --accent-soft: rgba(194, 65, 12, .08);
  --accent2: #0e7a5a;      /* success / added (green, distinct from accent) */
  --danger: #c2362a;       /* error (red, distinct from accent) */
  --warn: #a65a0a;
  --mark: rgba(194, 65, 12, .18);
  --star: #c2410c;
  --on-accent: #ffffff; /* text on accent fills (white on dark burnt orange, AA pass) */
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  --radius: 3px;
  --topbar-h: 58px;
  --sidebar-w: 272px;
  font-size: 16px;
}
[data-theme="dark"] {
  --bg: #1a1815;
  --bg-soft: #221f1b;
  --card: #24211c;
  --card-hover: #2c2823;
  --border: #38332c;
  --border-strong: #4a443b;
  --text: #f3f0ea;
  --muted: #a8a29a;
  --accent: #fb7a45;       /* lighter burnt orange for dark bg */
  --accent-deep: #f97316;
  --accent-soft: rgba(251, 122, 69, .14);
  --accent2: #34d399;
  --danger: #ff7a6b;
  --warn: #fbbf66;
  --mark: rgba(251, 122, 69, .26);
  --star: #fb7a45;
  --on-accent: #1a1512; /* dark text on bright orange in dark mode (AA pass) */
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Outfit', "Segoe UI", system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.hidden { display: none !important; }

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--accent-deep);
  color: var(--on-accent);
  padding: .7rem 1.2rem;
  border-radius: 0 0 8px 0;
  font-weight: 600;
}
.skip-link:focus { left: 0; }

/* ---------- Topbar ---------- */
.topbar {
  height: var(--topbar-h);
  padding: 0 1rem;
  display: flex;
  align-items: center;
  gap: .8rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  z-index: 30;
}
.logo { font-weight: 700; font-size: 1.05rem; display: flex; align-items: center; gap: .5rem; color: var(--text); white-space: nowrap; }
.logo:hover { text-decoration: none; }
.logo svg { color: var(--accent); flex-shrink: 0; }
.header-actions { display: flex; gap: .5rem; margin-left: auto; }
.icon-btn {
  background: var(--bg-soft);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .4rem .7rem;
  font-size: .9rem;
  cursor: pointer;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.icon-btn { transition: border-color .2s, background .2s; }
.icon-btn:hover { border-color: var(--accent); background: var(--card-hover); text-decoration: none; }
.icon-btn:active { transform: scale(.97); }
.menu-btn { display: none; min-width: 44px; }
.lang-btn { gap: .45rem; font-weight: 600; font-size: .82rem; }
.flag { width: 21px; height: 14px; border-radius: 3px; outline: 1px solid var(--border); flex-shrink: 0; }

/* ---------- Topbar category menu ---------- */
.topnav { display: flex; gap: .15rem; margin-left: .8rem; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.topnav a {
  color: var(--muted);
  font-size: .88rem;
  font-weight: 500;
  padding: .35rem .7rem;
  border-radius: var(--radius);
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}
.topnav a:hover { color: var(--accent); background: var(--accent-soft); text-decoration: none; }
@media (max-width: 1120px) { .topnav { display: none; } }

/* ---------- Layout: sidebar + main ---------- */
.layout { display: flex; min-height: calc(100vh - var(--topbar-h)); }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  padding: 1rem .9rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: .6rem;
  scrollbar-width: thin;
}
.search-wrap { padding: 0 .1rem; }
#search-input {
  width: 100%;
  background: var(--bg-soft);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .55rem .9rem;
  font-size: .9rem;
}
#search-input:focus { outline: none; border-color: var(--accent); }

#nav { flex: 1; }
.nav-cat {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
  margin: 1.1rem .55rem .25rem;
}
#nav .nav-cat:first-child { margin-top: .4rem; }
.nav-list { list-style: none; }
.nav-link {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .42rem .55rem;
  min-height: 38px;
  border-radius: var(--radius);
  color: var(--text);
  font-size: .88rem;
  line-height: 1.3;
}
.nav-link svg { flex-shrink: 0; color: var(--muted); }
.nav-link:hover { background: var(--card-hover); text-decoration: none; }
.nav-link.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; box-shadow: inset 2px 0 0 var(--accent); }
.nav-link.active svg { color: var(--accent); }

.sidebar-foot {
  display: flex;
  gap: 1.2rem;
  padding: .8rem .55rem 0;
  border-top: 1px solid var(--border);
  font-size: .85rem;
}
.sidebar-foot a { color: var(--muted); }
.sidebar-foot a:hover { color: var(--accent); }

.overlay {
  position: fixed;
  inset: var(--topbar-h) 0 0 0;
  background: rgba(0, 0, 0, .45);
  z-index: 20;
}

/* ---------- Main ---------- */
main {
  flex: 1;
  min-width: 0;
  padding: 0 clamp(1rem, 3vw, 2.5rem) 0;
  display: flex;
  flex-direction: column;
}
main:focus { outline: none; }
#home-view, #tool-view { max-width: 1000px; width: 100%; margin: 0 auto; flex: 1; }

/* ---------- Hero: asymmetric split, copy left, live demo right ---------- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, .9fr);
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: center;
  padding: 3rem 0 1.2rem;
  position: relative;
}
/* structural accent rule instead of a soft radial glow (anti AI-glow) */
.hero { border-top: 2px solid var(--text); }
.hero::before {
  content: '';
  position: absolute;
  top: -1px; left: 0;
  width: 72px; height: 2px;
  background: var(--accent);
}
.hero h1 { font-size: clamp(1.8rem, 3.6vw, 2.5rem); line-height: 1.18; letter-spacing: -.018em; text-wrap: balance; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero-sub { margin-top: .9rem; font-size: 1rem; color: var(--muted); max-width: 46ch; }
.hero-cta { margin-top: 1.5rem; }

.hero-demo {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.3rem 1.4rem 1.5rem;
  box-shadow: 0 12px 32px color-mix(in srgb, var(--accent-deep) 9%, transparent);
}
.hero-demo-label { font-size: .82rem; color: var(--muted); font-weight: 500; }
.hero-demo .pw-display { margin-top: .8rem; font-size: .95rem; }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding-top: 2.2rem; }
  .hero-demo { max-width: 480px; }
}

/* ---------- Home grid ---------- */
.cat-title { font-size: 1.05rem; font-weight: 700; letter-spacing: -.01em; margin: 2.4rem 0 1rem; display: flex; align-items: center; gap: .55rem; scroll-margin-top: calc(var(--topbar-h) + 12px); }
.cat-title::before { content: ''; width: 9px; height: 9px; background: var(--accent); flex-shrink: 0; }
.cat-title small { color: var(--muted); font-weight: 500; font-size: .72rem; font-family: var(--mono); margin-left: .1rem; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(225px, 1fr)); gap: .85rem; }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  cursor: pointer;
  position: relative;
  transition: border-color .15s ease, background .15s ease, box-shadow .2s ease, transform .1s ease;
}
.card { overflow: hidden; }
.card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); transform: scaleY(0); transform-origin: top; transition: transform .18s ease; }
.card:hover { background: var(--card-hover); border-color: var(--border-strong); }
.card:hover::before { transform: scaleY(1); }
.card:active { transform: translateY(1px); }
.card .icon { color: var(--accent); margin-bottom: .6rem; display: flex; }
.card h3 { font-size: .95rem; margin: 0 1.6rem .25rem 0; }
.card p { font-size: .78rem; color: var(--muted); line-height: 1.45; }
.card .star {
  position: absolute; top: .25rem; right: .25rem;
  background: none; border: none; cursor: pointer;
  font-size: 1.05rem; color: var(--muted);
  min-width: 40px; min-height: 40px;
  display: flex; align-items: center; justify-content: center;
}
.card .star.on { color: var(--star); }
.no-results { color: var(--muted); text-align: center; padding: 3rem 0; }

/* Lead card: first tool of each category spans two columns for grid rhythm */
@media (min-width: 640px) {
  .card-lead { grid-column: span 2; padding: 1.35rem 1.5rem; display: flex; flex-direction: column; justify-content: center; }
  .card-lead h3 { font-size: 1.12rem; }
  .card-lead p { font-size: .85rem; max-width: 52ch; }
  .card-lead .icon svg { width: 26px; height: 26px; }
}

/* Entry motion: staggered card cascade, hero copy then demo (reduced-motion safe) */
@media (prefers-reduced-motion: no-preference) {
  .card { animation: riseIn .5s cubic-bezier(.16, 1, .3, 1) backwards; animation-delay: calc(min(var(--i, 0), 10) * 35ms); }
  .hero-copy { animation: riseIn .55s cubic-bezier(.16, 1, .3, 1) backwards; }
  .hero-demo { animation: riseIn .55s cubic-bezier(.16, 1, .3, 1) backwards; animation-delay: .12s; }
}
@keyframes riseIn { from { opacity: 0; transform: translateY(12px); } }

/* ---------- Tool view ---------- */
#tool-view { padding-top: 1.3rem; }
.tool-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.back-link { font-size: .9rem; display: inline-flex; align-items: center; min-height: 40px; }
section.tool {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  animation: fadeIn .25s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
section.tool h1, section.tool h2 { margin-bottom: .35rem; font-size: 1.35rem; display: flex; align-items: center; gap: .6rem; }
section.tool h1 .tool-icon, section.tool h2 .tool-icon { color: var(--accent); display: flex; }
section.tool h1:focus, section.tool h2:focus { outline: none; }
section.tool .sub { color: var(--muted); font-size: .92rem; margin-bottom: 1.4rem; }

/* ---------- Form elements ---------- */
label { display: block; font-size: .85rem; color: var(--muted); margin: 1rem 0 .35rem; }
label.inline { display: flex; gap: .4rem; align-items: center; margin: 0; min-height: 32px; }
textarea, input[type="text"], input[type="search"], input[type="number"], input[type="date"],
input[type="datetime-local"], input[type="password"], select {
  width: 100%;
  background: var(--bg-soft);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .65rem .9rem;
  font-size: .95rem;
  font-family: inherit;
}
textarea { min-height: 130px; resize: vertical; font-family: Consolas, monospace; font-size: .88rem; }
textarea:focus, input:focus, select:focus { outline: none; border-color: var(--accent); }
input[type="range"] { width: 100%; accent-color: var(--accent); }
input[type="color"] { width: 100%; height: 42px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-soft); cursor: pointer; }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; accent-color: var(--accent); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: var(--on-accent);
  border: none;
  border-radius: var(--radius);
  padding: .6rem 1.3rem;
  min-height: 42px;
  font-size: .92rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 1rem;
  transition: background .2s, transform .15s, box-shadow .2s, border-color .2s;
}
.btn:hover { background: var(--accent-deep); color: var(--on-accent); text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.98); box-shadow: none; }
.btn.secondary { background: var(--bg-soft); border: 1px solid var(--border); color: var(--text); }
.btn.secondary:hover { background: var(--card-hover); border-color: var(--accent); box-shadow: none; }
.btn.small { padding: .35rem .8rem; min-height: 36px; font-size: .82rem; margin-top: .5rem; }
.btn-row { display: flex; gap: .7rem; flex-wrap: wrap; align-items: center; }

.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2.2rem 1.5rem;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--accent); color: var(--text); background: var(--bg-soft); }

.result-box {
  margin-top: 1.2rem;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  font-size: .9rem;
  word-break: break-all;
}
.result-box.mono { font-family: Consolas, monospace; font-size: .85rem; }
.stat { color: var(--accent2); font-weight: 600; }
.err { color: var(--danger); }
.preview-img { max-width: 100%; max-height: 260px; border-radius: var(--radius); margin-top: .8rem; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }
@media (max-width: 640px) { .row2, .row3 { grid-template-columns: 1fr; } }

.counter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(125px, 1fr)); gap: .8rem; margin-top: 1.2rem; }
.counter-card { background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius); padding: .9rem; text-align: center; }
.counter-card .num { font-size: 1.45rem; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.counter-card .lbl { font-size: .75rem; color: var(--muted); }

table.kv { width: 100%; border-collapse: collapse; margin-top: 1rem; font-size: .88rem; }
table.kv td, table.kv th { padding: .5rem .7rem; border: 1px solid var(--border); text-align: left; word-break: break-all; }
table.kv th { color: var(--muted); font-weight: 600; width: 32%; background: var(--bg-soft); }
table.kv td { font-family: Consolas, monospace; font-size: .84rem; font-variant-numeric: tabular-nums; }

mark { background: var(--mark); color: inherit; border-radius: 3px; padding: 0 .1em; }
.diff-line { font-family: Consolas, monospace; font-size: .84rem; white-space: pre-wrap; padding: .1rem .5rem; border-radius: 3px; }
.diff-add { background: rgba(45, 212, 168, .14); color: var(--accent2); }
.diff-del { background: rgba(255, 107, 107, .12); color: var(--danger); }

.pw-display {
  font-family: Consolas, monospace;
  font-size: 1.1rem;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .9rem 1rem;
  margin-top: 1rem;
  word-break: break-all;
  cursor: pointer;
}
.pw-display:hover { border-color: var(--accent2); }
.strength-track { height: 8px; background: var(--bg-soft); border: 1px solid var(--border); border-radius: 999px; margin-top: .8rem; overflow: hidden; }
.strength-bar { height: 100%; width: 0; border-radius: 999px; transition: width .25s, background .25s; }

.swatches { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.swatch {
  display: flex; align-items: center; gap: .45rem;
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .35rem .6rem;
  min-height: 36px;
  font-family: Consolas, monospace; font-size: .82rem; cursor: pointer;
  color: var(--text);
}
.swatch i { width: 18px; height: 18px; border-radius: 4px; display: inline-block; border: 1px solid var(--border); }

#qr-output { margin-top: 1.2rem; display: flex; justify-content: center; background: #fff; border-radius: var(--radius); padding: 1rem; width: fit-content; }

.timer-display { font-size: clamp(3rem, 10vw, 5rem); font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; margin: 1rem 0; }
.timer-mode { text-align: center; color: var(--muted); font-size: .9rem; }
.timer-mode .on { color: var(--accent2); font-weight: 700; }

.md-preview { background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.2rem; margin-top: 1rem; overflow-wrap: break-word; }
.md-preview h1, .md-preview h2, .md-preview h3 { margin: .8rem 0 .4rem; line-height: 1.3; }
.md-preview p, .md-preview ul, .md-preview ol, .md-preview blockquote { margin: .5rem 0; }
.md-preview ul, .md-preview ol { padding-left: 1.4rem; }
.md-preview code { background: var(--card); border: 1px solid var(--border); border-radius: 4px; padding: .05em .35em; font-size: .85em; }
.md-preview pre { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: .8rem; overflow-x: auto; margin: .6rem 0; }
.md-preview pre code { background: none; border: none; padding: 0; }
.md-preview blockquote { border-left: 3px solid var(--accent); padding-left: .8rem; color: var(--muted); }

.ad-slot { margin: 3rem auto 0; text-align: center; }
.ad-slot .ad-inner { border: 1px dashed var(--border); border-radius: var(--radius); padding: 1.4rem; color: var(--muted); font-size: .8rem; }
.support { text-align: center; margin: 2.5rem auto 0; max-width: 600px; }
.support p { color: var(--muted); font-size: .92rem; }

.seo-content { max-width: 760px; margin: 3rem auto 0; color: var(--muted); font-size: .92rem; }
.seo-content h2 { color: var(--text); font-size: 1.1rem; margin: 1.6rem 0 .4rem; text-wrap: balance; }
.seo-content h3 { color: var(--text); font-size: .98rem; margin: 1.3rem 0 .3rem; text-wrap: balance; }

/* Static "all tools" index on tool pages: crawlable internal-link mesh */
.related-tools { max-width: 760px; margin: 3rem auto 0; border-top: 1px solid var(--border); padding-top: 1.6rem; }
.related-tools h2 { font-size: 1.05rem; font-weight: 700; letter-spacing: -.01em; margin-bottom: 1.1rem; }
.related-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1.3rem 1.5rem; }
.related-group h3 { font-size: .7rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-family: var(--mono); margin-bottom: .55rem; font-weight: 600; }
.related-group ul { list-style: none; display: flex; flex-direction: column; gap: .35rem; }
.related-group a { color: var(--text); font-size: .85rem; }
.related-group a:hover { color: var(--accent); }
.related-group [aria-current="page"] { font-size: .85rem; color: var(--accent); font-weight: 600; }

footer {
  border-top: 1px solid var(--border);
  margin-top: 4rem;
  padding: 2rem 0 2.5rem;
  text-align: center;
  color: var(--muted);
  font-size: .85rem;
}
.footer-links { display: flex; gap: 1.4rem; justify-content: center; flex-wrap: wrap; margin-bottom: 1rem; }
.footer-links a { color: var(--text); display: inline-flex; align-items: center; min-height: 32px; }

#toasts { position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: .5rem; z-index: 50; }
.toast {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: .5rem 1.2rem;
  font-size: .88rem;
  box-shadow: 0 6px 24px color-mix(in srgb, var(--accent-deep) 18%, transparent);
  animation: toastIn .2s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Mobile: sidebar becomes a drawer ---------- */
@media (max-width: 900px) {
  .menu-btn { display: inline-flex; }
  .sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    z-index: 25;
    height: calc(100dvh - var(--topbar-h));
    transform: translateX(-105%);
    transition: transform .2s ease;
    box-shadow: 0 0 40px color-mix(in srgb, var(--accent-deep) 22%, transparent);
    width: min(var(--sidebar-w), 86vw);
  }
  .sidebar.open { transform: translateX(0); }
  section.tool { padding: 1.3rem; }
  .logo span { font-size: 1rem; }
}

/* ---------- Accessibility ---------- */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
#search-input:focus-visible, textarea:focus-visible, input:focus-visible, select:focus-visible { outline: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
