/* =========================================================
   Outilo — Design System
   Fast, clean, privacy-friendly online tools.
   ========================================================= */

:root {
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --brand-light: #dbeafe;
  --bg: #ffffff;
  --bg-soft: #f6f8fb;
  --bg-card: #ffffff;
  --border: #e6eaf0;
  --text: #0f172a;
  --text-soft: #475569;
  --text-mute: #94a3b8;
  --success: #16a34a;
  --danger: #dc2626;
  --warn: #d97706;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow: 0 4px 16px rgba(15, 23, 42, .08);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, .12);
  --radius: 14px;
  --radius-sm: 9px;
  --maxw: 1120px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "SFMono-Regular", ui-monospace, Menlo, Consolas, "Liberation Mono", monospace;
}

[data-theme="dark"] {
  --brand: #60a5fa;
  --brand-dark: #3b82f6;
  --brand-light: #1e293b;
  --bg: #0b1120;
  --bg-soft: #0f172a;
  --bg-card: #131c30;
  --border: #233048;
  --text: #e8eefb;
  --text-soft: #aebdd4;
  --text-mute: #6b7a93;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 4px 16px rgba(0, 0, 0, .45);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, .55);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

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

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

img { max-width: 100%; display: block; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.container-narrow { max-width: 760px; margin: 0 auto; padding: 0 20px; }

h1, h2, h3, h4 { line-height: 1.25; color: var(--text); font-weight: 750; letter-spacing: -.01em; }
h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin: 0 0 .5rem; }
h2 { font-size: clamp(1.4rem, 2.6vw, 1.9rem); margin: 2.2rem 0 1rem; }
h3 { font-size: 1.18rem; margin: 1.6rem 0 .6rem; }
p { margin: 0 0 1rem; color: var(--text-soft); }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav {
  display: flex; align-items: center; gap: 18px;
  height: 64px; max-width: var(--maxw); margin: 0 auto; padding: 0 20px;
}
.brand {
  display: flex; align-items: center; gap: 9px;
  font-weight: 800; font-size: 1.25rem; color: var(--text);
  letter-spacing: -.02em;
}
.brand:hover { text-decoration: none; }
.brand .logo { width: 30px; height: 30px; }
.brand b { color: var(--brand); }
.nav-links { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.nav-links a {
  color: var(--text-soft); font-weight: 600; font-size: .95rem;
  padding: 8px 12px; border-radius: 8px;
}
.nav-links a:hover { color: var(--text); background: var(--bg-soft); text-decoration: none; }
.icon-btn {
  display: inline-grid; place-items: center;
  width: 40px; height: 40px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg-card);
  color: var(--text-soft); cursor: pointer; transition: .15s;
}
.icon-btn:hover { color: var(--text); border-color: var(--brand); }
.nav-toggle { display: none; }

/* ---------- Hero ---------- */
.hero {
  text-align: center; padding: 64px 0 40px;
  background:
    radial-gradient(900px 380px at 50% -120px, var(--brand-light), transparent 70%);
}
.hero p.lead { font-size: 1.15rem; max-width: 620px; margin: 0 auto 1.6rem; }
.search-box { max-width: 540px; margin: 0 auto; position: relative; }
.search-box input {
  width: 100%; padding: 15px 18px 15px 46px; font-size: 1.05rem;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--bg-card); color: var(--text); box-shadow: var(--shadow);
  transition: .15s;
}
.search-box input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-light); }
.search-box svg { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--text-mute); }

/* ---------- Badges / chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 16px; }
.chip {
  font-size: .82rem; font-weight: 600; color: var(--text-soft);
  background: var(--bg-card); border: 1px solid var(--border);
  padding: 6px 12px; border-radius: 999px;
}
.chip svg { vertical-align: -2px; margin-right: 5px; color: var(--success); }

/* ---------- Tool grid ---------- */
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.section-title a { font-size: .92rem; font-weight: 600; }
.grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  margin: 18px 0 8px;
}
.tool-card {
  display: flex; flex-direction: column; gap: 6px;
  padding: 18px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-card); box-shadow: var(--shadow-sm);
  transition: transform .15s, box-shadow .15s, border-color .15s;
  color: var(--text);
}
.tool-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--brand); text-decoration: none; }
.tool-card .ico {
  width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center;
  background: var(--brand-light); color: var(--brand); margin-bottom: 4px;
}
.tool-card h3 { margin: 0; font-size: 1.05rem; }
.tool-card p { margin: 0; font-size: .9rem; color: var(--text-soft); }
.tool-card .cat-tag { margin-top: auto; font-size: .74rem; color: var(--text-mute); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; padding-top: 8px; }

/* ---------- Category pills ---------- */
.cat-nav { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 4px; }
.cat-nav a {
  font-size: .9rem; font-weight: 650; padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--bg-card); color: var(--text-soft);
}
.cat-nav a:hover, .cat-nav a.active { background: var(--brand); color: #fff; border-color: var(--brand); text-decoration: none; }

/* ---------- Tool page layout ---------- */
.breadcrumb { font-size: .85rem; color: var(--text-mute); margin: 22px 0 6px; }
.breadcrumb a { color: var(--text-soft); }
.tool-head { margin-bottom: 20px; }
.tool-head .ico-lg {
  width: 56px; height: 56px; border-radius: 14px; display: grid; place-items: center;
  background: var(--brand-light); color: var(--brand); margin-bottom: 14px;
}
.tool-layout { display: grid; grid-template-columns: 1fr; gap: 28px; align-items: start; }

.panel {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow-sm);
}
.panel + .panel { margin-top: 18px; }

label.field-label { display: block; font-weight: 650; font-size: .92rem; margin: 0 0 6px; color: var(--text); }
.muted { color: var(--text-mute); font-size: .88rem; }

textarea, input[type="text"], input[type="number"], input[type="url"], input[type="email"], select {
  width: 100%; font-family: inherit; font-size: 1rem; color: var(--text);
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 14px; transition: .15s;
}
textarea { resize: vertical; min-height: 150px; line-height: 1.5; }
textarea.mono, input.mono { font-family: var(--mono); font-size: .95rem; }
textarea:focus, input:focus, select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-light); }

.row { display: flex; flex-wrap: wrap; gap: 12px; }
.row > * { flex: 1 1 160px; }
.controls { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0; align-items: center; }

.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  font-family: inherit; font-weight: 650; font-size: .96rem; cursor: pointer;
  padding: 11px 18px; border-radius: var(--radius-sm); border: 1px solid transparent;
  background: var(--brand); color: #fff; transition: .15s; text-decoration: none;
}
.btn:hover { background: var(--brand-dark); text-decoration: none; }
.btn.secondary { background: var(--bg-card); color: var(--text); border-color: var(--border); }
.btn.secondary:hover { border-color: var(--brand); color: var(--brand); background: var(--bg-card); }
.btn.ghost { background: transparent; color: var(--text-soft); border-color: transparent; padding: 9px 12px; }
.btn.ghost:hover { background: var(--bg-soft); color: var(--text); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-sm { padding: 7px 12px; font-size: .85rem; }

.output {
  background: var(--bg-soft); border: 1px dashed var(--border); border-radius: var(--radius-sm);
  padding: 14px; min-height: 52px; font-family: var(--mono); font-size: .95rem;
  white-space: pre-wrap; word-break: break-word; color: var(--text);
}
.output:empty::before { content: "Results will appear here."; color: var(--text-mute); font-family: var(--font); }

/* range + checkbox */
input[type="range"] { width: 100%; accent-color: var(--brand); }
.check { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: .92rem; color: var(--text-soft); cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px,1fr)); gap: 12px; }
.stat { background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; text-align: center; }
.stat b { display: block; font-size: 1.5rem; color: var(--brand); }
.stat span { font-size: .8rem; color: var(--text-mute); text-transform: uppercase; letter-spacing: .04em; }

.swatch { height: 56px; border-radius: 8px; border: 1px solid var(--border); cursor: pointer; position: relative; }

/* ---------- Content / SEO prose ---------- */
.prose { margin-top: 8px; }
.prose h2 { font-size: 1.35rem; }
.prose ul { padding-left: 1.2rem; }
.prose li { margin: .35rem 0; color: var(--text-soft); }
.faq details { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 4px 16px; margin: 10px 0; background: var(--bg-card); }
.faq summary { cursor: pointer; font-weight: 650; padding: 12px 0; color: var(--text); }
.faq details[open] summary { color: var(--brand); }

/* ---------- Ads ---------- */
.ad-slot {
  margin: 22px auto; text-align: center; min-height: 90px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.ad-slot .ad-label {
  font-size: .62rem; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-mute); margin-bottom: 4px; line-height: 1;
}
.ad-slot .adsbygoogle { width: 100%; }
.ad-slot.placeholder {
  border: 1px dashed var(--border); border-radius: var(--radius-sm);
  background: var(--bg-soft); padding: 10px;
}
.ad-slot.placeholder .ad-ph {
  color: var(--text-mute); font-size: .8rem;
  letter-spacing: .05em; text-transform: uppercase;
}

/* Two-column tool layout: content + sticky sidebar ad (desktop only) */
.tool-layout { display: grid; grid-template-columns: 1fr; gap: 28px; align-items: start; }
.tool-main { min-width: 0; }
.tool-aside { display: none; }
@media (min-width: 1040px) {
  .tool-layout { grid-template-columns: minmax(0, 1fr) 300px; }
  .tool-aside { display: block; }
  .tool-aside .ad-slot { position: sticky; top: 88px; min-height: 600px; margin-top: 0; }
}

/* Dismissible sticky anchor ad — mobile only, policy compliant */
.ad-anchor {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
  background: var(--bg); border-top: 1px solid var(--border);
  box-shadow: 0 -4px 16px rgba(0,0,0,.08); padding: 6px 8px;
}
.ad-anchor .ad-slot { margin: 0 auto; min-height: 60px; }
.ad-anchor .ad-slot.placeholder { min-height: 56px; }
.ad-anchor-close {
  position: absolute; top: -28px; right: 8px; width: 26px; height: 26px;
  border-radius: 50%; border: 1px solid var(--border); background: var(--bg);
  color: var(--text-soft); font-size: 18px; line-height: 1; cursor: pointer;
  display: grid; place-items: center; box-shadow: var(--shadow-sm);
}
@media (min-width: 681px) { .ad-anchor { display: none !important; } }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); background: var(--bg-soft); margin-top: 56px; padding: 40px 0 28px; }
.footer-grid { display: grid; grid-template-columns: 1.5fr repeat(3, 1fr); gap: 28px; }
.footer-grid h4 { font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-mute); margin: 0 0 12px; }
.footer-grid a { display: block; color: var(--text-soft); font-size: .92rem; padding: 4px 0; }
.footer-grid a:hover { color: var(--brand); text-decoration: none; }
.footer-bottom { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; color: var(--text-mute); font-size: .85rem; }

/* ---------- Toast ---------- */
#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--text); color: var(--bg); padding: 11px 20px; border-radius: 999px;
  font-weight: 600; font-size: .9rem; box-shadow: var(--shadow-lg); opacity: 0;
  pointer-events: none; transition: .25s; z-index: 100;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Utility ---------- */
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.mt-2 { margin-top: 1.4rem; }
.hidden { display: none !important; }
.tag-new { font-size: .65rem; background: var(--success); color: #fff; padding: 2px 7px; border-radius: 999px; font-weight: 700; vertical-align: middle; margin-left: 6px; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 680px) {
  .nav-links {
    position: fixed; inset: 64px 0 auto 0; flex-direction: column; align-items: stretch;
    background: var(--bg); border-bottom: 1px solid var(--border); padding: 10px 20px 18px;
    gap: 2px; transform: translateY(-130%); transition: transform .25s; box-shadow: var(--shadow);
  }
  .nav-links.open { transform: translateY(0); }
  .nav-links a { padding: 12px; border-radius: 8px; }
  .nav-toggle { display: inline-grid; }
  .footer-grid { grid-template-columns: 1fr; gap: 18px; }
}

/* ---- Affiliate recommendation box (contextual, clearly labelled) ---- */
.affiliate-box{
  margin:18px 0;padding:16px 18px;border:1px solid var(--border);
  border-left:3px solid var(--brand);border-radius:var(--radius-sm);
  background:var(--brand-light);
}
.affiliate-box .aff-label{
  display:inline-block;font-size:.7rem;font-weight:700;letter-spacing:.04em;
  text-transform:uppercase;color:var(--brand-dark);margin-bottom:6px;
}
.affiliate-box .aff-text{margin:0 0 12px;color:var(--text);font-weight:500;}
.affiliate-box .aff-btn{display:inline-flex;align-items:center;gap:6px;}
.affiliate-box .aff-disc{margin:10px 0 0;font-size:.72rem;color:var(--text-soft);}

/* ---- Newsletter signup (Beehiiv embed) ---- */
.newsletter{border-top:1px solid var(--border);background:var(--brand-light);}
.newsletter .nl-inner{padding:34px 20px;text-align:center;}
.newsletter .nl-h{margin:0 0 6px;font-size:1.35rem;}
.newsletter .nl-sub{margin:0 auto 16px;max-width:46ch;color:var(--text-soft);}
.newsletter .nl-frame{margin:0 auto;max-width:480px;width:100%;height:64px;border-radius:8px;background:transparent;display:block;}
