/* ToolNest design system
   Light + dark themes via [data-theme] on <html>. No build step needed. */

:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f0f2f9;
  --text: #12142b;
  --muted: #5b6078;
  --border: #e4e7f2;
  --primary: #4f46e5;
  --primary-600: #4338ca;
  --primary-soft: #eef0ff;
  --accent: #f59e0b;
  --success: #059669;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(18, 20, 43, .05), 0 10px 28px rgba(18, 20, 43, .07);
  --shadow-hover: 0 2px 4px rgba(18, 20, 43, .06), 0 16px 36px rgba(79, 70, 229, .16);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --maxw: 1120px;
}

:root[data-theme="dark"] {
  --bg: #0d0f1f;
  --surface: #15182e;
  --surface-2: #1c2040;
  --text: #eceefb;
  --muted: #9aa0c3;
  --border: #272c52;
  --primary: #8b86ff;
  --primary-600: #a29eff;
  --primary-soft: #232650;
  --accent: #fbbf24;
  --success: #34d399;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 28px rgba(0, 0, 0, .35);
  --shadow-hover: 0 2px 4px rgba(0, 0, 0, .4), 0 16px 36px rgba(139, 134, 255, .22);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
img, svg { max-width: 100%; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.02em; }
h1 { font-size: clamp(1.9rem, 4vw, 2.8rem); font-weight: 800; }
h2 { font-size: clamp(1.25rem, 2.4vw, 1.6rem); font-weight: 700; }
h3 { font-size: 1.05rem; font-weight: 650; }
p { margin: 0 0 1em; }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; border-radius: 6px; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--border);
}
.site-header .container { position: relative; display: flex; align-items: center; gap: 12px; height: 66px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-weight: 800; font-size: 1.25rem; letter-spacing: -.03em; }
.brand svg { width: 34px; height: 34px; flex: none; }
.brand b { color: var(--primary); font-weight: 800; }
.icon { width: 1.25em; height: 1.25em; flex: none; display: block; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0;
  border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); cursor: pointer; font-size: 1.05rem; font-family: inherit;
}
.icon-btn:hover { background: var(--surface-2); }
#theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] #theme-toggle .i-sun { display: block; }
:root[data-theme="dark"] #theme-toggle .i-moon { display: none; }

/* Navigation */
.nav { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.nav-link {
  display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none;
  font: inherit; font-weight: 600; font-size: .95rem; padding: 8px 12px; border-radius: 999px;
  background: none; border: 0; cursor: pointer;
}
.nav-link:hover, .nav-dropdown.is-open .nav-trigger { color: var(--text); background: var(--surface-2); }
.nav-link[aria-current="page"], .nav-trigger.is-current { color: var(--primary); }
.nav-trigger .chev { width: 1em; height: 1em; transition: transform .15s ease; }
.nav-dropdown.is-open .nav-trigger .chev { transform: rotate(180deg); }
.nav-toggle { display: none; }
.nav-toggle .i-close { display: none; }
.nav-toggle[aria-expanded="true"] .i-open { display: none; }
.nav-toggle[aria-expanded="true"] .i-close { display: block; }

/* Tools dropdown (a panel under the header, listing every tool) */
.mega {
  display: none; position: absolute; top: calc(100% + 6px); right: 20px; z-index: 60;
  width: min(780px, calc(100% - 40px)); padding: 18px 20px 20px;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 18px 26px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-hover);
}
.nav-dropdown.is-open .mega { display: grid; animation: mega-in .14s ease-out; }
@keyframes mega-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.mega-group h3 { margin: 0 0 6px; padding: 0 8px; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.mega-group ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.mega-link { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 12px; text-decoration: none; color: var(--text); }
.mega-link:hover, .mega-link:focus-visible { background: var(--primary-soft); }
.mega-link[aria-current="page"] { background: var(--primary-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 35%, transparent); }
.mega-link .mi { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: var(--primary-soft); color: var(--primary); }
.mega-link:hover .mi, .mega-link[aria-current="page"] .mi { background: var(--surface); }
.mega-link .mi .icon { width: 20px; height: 20px; }
.mega-link .mt { display: flex; flex-direction: column; min-width: 0; }
.mega-link .mt strong { font-size: .93rem; }
.mega-link .mt span { color: var(--muted); font-size: .8rem; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Hero */
.hero { padding: 64px 0 36px; text-align: center; position: relative; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: -40% -10% auto -10%; height: 520px; z-index: -1;
  background:
    radial-gradient(520px 260px at 20% 40%, color-mix(in srgb, var(--primary) 20%, transparent), transparent 70%),
    radial-gradient(460px 240px at 80% 30%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%);
}
.eyebrow {
  display: inline-block; padding: 6px 14px; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary);
  font-size: .82rem; font-weight: 700; letter-spacing: .02em; margin-bottom: 18px;
}
.hero h1 span { background: linear-gradient(90deg, var(--primary), #a855f7 60%, var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.lead { max-width: 620px; margin: 14px auto 28px; color: var(--muted); font-size: 1.1rem; }
.search {
  display: flex; align-items: center; gap: 10px; max-width: 580px; margin: 0 auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  padding: 6px 8px 6px 20px; box-shadow: var(--shadow);
}
.search:focus-within { border-color: var(--primary); }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; color: var(--text); padding: 10px 0; outline: none; }
.search input::placeholder { color: var(--muted); }
.search .kbd { font-size: .75rem; color: var(--muted); border: 1px solid var(--border); border-radius: 6px; padding: 2px 8px; }

/* Chips */
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 26px 0 0; }
.chip {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 8px 16px; border-radius: 999px; font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer;
}
.chip:hover { border-color: var(--primary); }
.chip.is-active { background: var(--primary); border-color: var(--primary); color: #fff; }
:root[data-theme="dark"] .chip.is-active { color: #0d0f1f; }

/* Tool grid */
.section { padding: 28px 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 18px; }
.section-head p { margin: 0; color: var(--muted); font-size: .95rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.tool-card {
  position: relative; display: flex; align-items: center; gap: 14px;
  padding: 18px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); text-decoration: none; color: var(--text);
  box-shadow: var(--shadow); transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.tool-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); border-color: var(--primary); }
.tool-icon {
  flex: none; display: grid; place-items: center; width: 50px; height: 50px;
  border-radius: 14px; background: var(--primary-soft); color: var(--primary);
}
.tool-icon .icon { width: 26px; height: 26px; }
.tool-body { display: flex; flex-direction: column; min-width: 0; }
.tool-body strong { font-size: 1rem; }
.tool-body span { color: var(--muted); font-size: .88rem; line-height: 1.4; }
.badge { position: absolute; top: 12px; right: 12px; font-size: .68rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.tool-card.is-soon { opacity: .72; cursor: default; }
.tool-card.is-soon:hover { transform: none; box-shadow: var(--shadow); border-color: var(--border); }
.tool-card[hidden] { display: none; }
.empty { display: none; text-align: center; color: var(--muted); padding: 40px 0; }
.empty.is-visible { display: block; }

/* Features */
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.feature { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.feature .tool-icon { margin-bottom: 14px; }
.feature p { color: var(--muted); margin: 0; font-size: .95rem; }

/* Ads: reserve space so layout never shifts */
.ad-slot {
  display: grid; place-items: center; min-height: 120px; margin: 24px 0;
  border: 1px dashed var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--muted); font-size: .75rem; letter-spacing: .08em; text-transform: uppercase;
}
.ad-slot--tall { min-height: 280px; }

/* Tool page */
.breadcrumbs { padding: 22px 0 6px; font-size: .88rem; color: var(--muted); }
.breadcrumbs a { color: var(--muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--primary); }
.tool-hero { padding: 6px 0 14px; }
.tool-hero p { color: var(--muted); font-size: 1.05rem; max-width: 720px; }
.privacy-pill { display: inline-flex; align-items: center; gap: 8px; font-size: .85rem; font-weight: 600; color: var(--success); background: color-mix(in srgb, var(--success) 12%, transparent); padding: 6px 12px; border-radius: 999px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); margin-bottom: 20px; }
.panel h2 { margin-bottom: 16px; }
.calc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.calc-grid .panel { margin-bottom: 0; }
.field-row { display: flex; flex-wrap: nowrap; align-items: center; gap: 10px; }
.field-row .sep { color: var(--muted); font-weight: 600; white-space: nowrap; font-size: .9rem; }
.input {
  flex: 1 1 0; min-width: 0; width: 100%; font: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px;
}
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 25%, transparent); }
.btn {
  font: inherit; font-weight: 700; cursor: pointer; border: 0; border-radius: var(--radius-sm);
  padding: 12px 20px; background: var(--primary); color: #fff;
  transition: background .15s ease, transform .1s ease;
}
:root[data-theme="dark"] .btn { color: #0d0f1f; }
.btn:hover { background: var(--primary-600); }
.btn:active { transform: scale(.98); }
.result {
  margin-top: 16px; padding: 14px 16px; border-radius: var(--radius-sm);
  background: var(--primary-soft); color: var(--primary);
  font-size: 1.4rem; font-weight: 800; min-height: 54px; display: flex; align-items: center;
}
.result:empty::before { content: "Your result appears here"; font-size: .9rem; font-weight: 500; color: var(--muted); }

/* Prose, FAQ, related */
.prose { color: var(--muted); }
.prose h2, .prose h3 { color: var(--text); }
.faq details { border-bottom: 1px solid var(--border); padding: 14px 0; }
.faq details:last-child { border-bottom: 0; }
.faq summary { cursor: pointer; font-weight: 650; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--primary); font-size: 1.3rem; line-height: 1; }
.faq details[open] summary::after { content: "\2212"; }
.faq details p { margin: 10px 0 0; color: var(--muted); }

/* Footer */
.site-footer { margin-top: 56px; border-top: 1px solid var(--border); background: var(--surface); }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 32px; padding: 40px 0 28px; }
.footer-grid p { color: var(--muted); font-size: .92rem; max-width: 340px; }
.footer-grid h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.footer-grid ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.footer-grid a { color: var(--text); text-decoration: none; font-size: .95rem; }
.footer-grid a:hover { color: var(--primary); }
.copyright { border-top: 1px solid var(--border); padding: 18px 0 28px; color: var(--muted); font-size: .85rem; }

@media (max-width: 720px) {
  .hero { padding: 44px 0 24px; }
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
  .search .kbd { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

/* ---- Static pages: About, Contact, Privacy, Terms ---- */
.narrow { max-width: 880px; }
.page-head { padding: 6px 0 18px; }
.page-head .lead { color: var(--muted); font-size: 1.1rem; max-width: 640px; margin: 0; }

.prose { color: var(--muted); padding: 32px; }
.prose h2 { margin: 1.8em 0 .5em; font-size: 1.25rem; }
.prose h2:first-child { margin-top: 0; }
.prose p, .prose li { line-height: 1.75; }
.prose ul { margin: 0 0 1em; padding-left: 1.3em; }
.prose li { margin-bottom: .5em; }
.prose strong { color: var(--text); }
.prose .features { margin: 1em 0 1.4em; }
.prose .feature { background: var(--surface-2); border: 0; padding: 20px; }
.prose .feature h3 { margin-bottom: .3em; color: var(--text); }
.btn--link { display: inline-block; text-decoration: none; }
:root[data-theme="dark"] .btn--link { color: #0d0f1f; }
.btn--link { color: #fff; }

.contact-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.contact-grid .panel { margin-bottom: 0; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-field { margin-bottom: 16px; }
.form-field label { display: block; font-weight: 650; font-size: .92rem; margin-bottom: 6px; }
.form-field .optional { color: var(--muted); font-weight: 500; }
textarea.input { resize: vertical; min-height: 140px; line-height: 1.5; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.alert { border-radius: var(--radius-sm); padding: 14px 16px; margin-bottom: 18px; font-size: .95rem; }
.alert ul { margin: 6px 0 0; padding-left: 1.2em; }
.alert--success { background: color-mix(in srgb, var(--success) 12%, transparent); color: var(--success); font-weight: 600; }
.alert--error { background: color-mix(in srgb, #e11d48 12%, transparent); color: #e11d48; }
:root[data-theme="dark"] .alert--error { color: #fb7185; }
.side-info { color: var(--muted); }
.side-info h2 { color: var(--text); }
.side-info h3 { color: var(--text); margin-top: 1.2em; }
.side-info ul { padding-left: 1.2em; margin: 0 0 1em; }
.side-info li { margin-bottom: .4em; }
.side-info .note { font-size: .88rem; border-top: 1px solid var(--border); padding-top: 14px; margin: 1em 0 0; }

@media (max-width: 820px) {
  .contact-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .form-row { grid-template-columns: 1fr; gap: 0; }
  .prose { padding: 22px; }
}

/* ---- Tool pages: shared widgets ---- */
[hidden] { display: none !important; }
.note { font-size: .88rem; color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; font-size: .9rem; line-height: 1.55; }
select.input { appearance: auto; cursor: pointer; }
textarea.input.mono { white-space: pre; overflow: auto; tab-size: 2; }
.opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.opt label { display: block; font-weight: 650; font-size: .88rem; margin-bottom: 6px; }
.opt .input { width: 100%; flex: none; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 16px 0 0; }
.toolbar .grow { flex: 1; }
.btn--ghost { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn--ghost:hover { background: var(--primary-soft); }
:root[data-theme="dark"] .btn--ghost { color: var(--text); }
:root[data-theme="dark"] .btn--ghost:hover { background: var(--primary-soft); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: .92rem; font-weight: 600; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-top: 18px; }
.stat { background: var(--surface-2); border-radius: var(--radius-sm); padding: 14px 16px; }
.stat b { display: block; font-size: 1.55rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; color: var(--text); overflow-wrap: anywhere; }
.stat span { color: var(--muted); font-size: .82rem; }
.stat--wide { grid-column: span 2; }

.status { display: inline-flex; align-items: center; gap: 8px; font-size: .9rem; font-weight: 650; padding: 6px 12px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.status--ok { background: color-mix(in srgb, var(--success) 14%, transparent); color: var(--success); }
.status--err { background: color-mix(in srgb, #e11d48 12%, transparent); color: #e11d48; }
:root[data-theme="dark"] .status--err { color: #fb7185; }
.error-text { color: #e11d48; font-size: .92rem; margin: 10px 0 0; overflow-wrap: anywhere; }
:root[data-theme="dark"] .error-text { color: #fb7185; }

/* Age calculator */
.age-hero { font-size: clamp(1.5rem, 4vw, 2.3rem); font-weight: 800; letter-spacing: -.02em; line-height: 1.25; color: var(--primary); margin: 22px 0 0; }
.age-sub { color: var(--muted); margin: 4px 0 0; }

/* Word counter */
.limits { display: grid; gap: 10px; }
.limit { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--surface-2); font-size: .92rem; }
.limit b { font-variant-numeric: tabular-nums; }
.limit.is-over b { color: #e11d48; }
:root[data-theme="dark"] .limit.is-over b { color: #fb7185; }
.kw { display: flex; flex-wrap: wrap; gap: 8px; }
.kw span { background: var(--primary-soft); color: var(--primary); padding: 5px 12px; border-radius: 999px; font-size: .88rem; font-weight: 650; }
.kw em { font-style: normal; opacity: .7; margin-left: 4px; }

/* JSON formatter */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.split label { display: block; font-weight: 650; font-size: .9rem; margin-bottom: 6px; }
.split textarea { min-height: 360px; }

/* QR generator */
.qr-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.qr-layout .panel { margin-bottom: 0; }
.qr-side { position: sticky; top: 86px; }
.chips--left { justify-content: flex-start; margin: 0 0 18px; }
.qr-box { display: grid; place-items: center; min-height: 260px; padding: 18px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: repeating-conic-gradient(var(--surface-2) 0% 25%, var(--surface) 0% 50%) 50% / 20px 20px; }
.qr-box canvas { max-width: 100%; height: auto; image-rendering: pixelated; box-shadow: 0 4px 18px rgba(0, 0, 0, .12); }
.qr-box p { margin: 0; color: var(--muted); text-align: center; }
.color-input { width: 100%; height: 46px; padding: 4px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); cursor: pointer; }
.form-field-tight { margin-bottom: 14px; }

@media (max-width: 860px) {
  .split { grid-template-columns: 1fr; }
  .split textarea { min-height: 240px; }
  .qr-layout { grid-template-columns: 1fr; }
  .qr-side { position: static; }
}
@media (max-width: 480px) {
  .stat--wide { grid-column: auto; }
}

/* ---- Image compressor ---- */
input[type="range"] { width: 100%; accent-color: var(--primary); cursor: pointer; margin: 6px 0 2px; }
.dropzone {
  position: relative; display: grid; place-items: center; gap: 4px; text-align: center;
  padding: 48px 20px; border: 2px dashed var(--border); border-radius: var(--radius);
  background: var(--surface); cursor: pointer; margin-bottom: 20px;
  transition: border-color .15s ease, background .15s ease;
}
.dropzone:hover, .dropzone.is-over, .dropzone:focus-within { border-color: var(--primary); background: var(--primary-soft); }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.dz-icon { display: grid; place-items: center; color: var(--primary); margin-bottom: 6px; }
.dz-icon .icon { width: 48px; height: 48px; stroke-width: 1.5; }
.dropzone strong { font-size: 1.2rem; letter-spacing: -.01em; }
.dropzone small { color: var(--muted); font-size: .92rem; }
.dz-btn { margin-top: 12px; pointer-events: none; }

.files { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 12px; }
.file {
  display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 14px; align-items: center;
  padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg);
}
.thumb { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; display: block; background: var(--surface-2); }
.file-name { font-weight: 650; overflow-wrap: anywhere; line-height: 1.35; }
.file-meta { color: var(--muted); font-size: .88rem; margin-top: 2px; overflow-wrap: anywhere; }
.file-meta .arrow { margin: 0 4px; }
.file-meta b { color: var(--text); }
.file-note { font-size: .82rem; color: var(--muted); margin-top: 2px; }
.file.is-working .file-meta { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }
.save {
  display: inline-block; font-weight: 800; font-size: .82rem; padding: 2px 10px; border-radius: 999px; margin-left: 6px;
  background: color-mix(in srgb, var(--success) 14%, transparent); color: var(--success);
}
.save--none { background: var(--surface-2); color: var(--muted); }
.save--up { background: color-mix(in srgb, #e11d48 12%, transparent); color: #e11d48; }
:root[data-theme="dark"] .save--up { color: #fb7185; }
.file-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.btn--sm { padding: 8px 14px; font-size: .9rem; }
.file.is-error { border-color: color-mix(in srgb, #e11d48 45%, var(--border)); }

@media (max-width: 640px) {
  .file { grid-template-columns: 56px minmax(0, 1fr); }
  .thumb { width: 56px; height: 56px; }
  .file-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .dropzone { padding: 36px 16px; }
}

/* Size landing pages: links to sibling pages */
.size-links .chip { text-decoration: none; display: inline-block; margin: 0 6px 8px 0; }
.size-links p { margin: 0; }

/* HEIC converter: placeholder shown until a photo is converted */
.thumb--ph { display: flex; align-items: center; justify-content: center; font-size: .72rem; font-weight: 700; letter-spacing: .04em; color: var(--muted); }

/* Merge PDF: sortable file list and merge bar */
.file.is-sortable[draggable="true"] { cursor: grab; }
.file.is-dragging { opacity: .45; }
.file.drop-before { box-shadow: 0 -3px 0 0 var(--primary); }
.file.drop-after { box-shadow: 0 3px 0 0 var(--primary); }
.btn--icon { min-width: 36px; padding-left: 0; padding-right: 0; font-size: 1rem; line-height: 1; }
.merge-bar { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-top: 20px; }
.merge-bar .opt { flex: 1 1 240px; max-width: 360px; }
.suffix-input { display: flex; align-items: center; gap: 8px; }
.suffix-input .input { flex: 1; min-width: 0; }
.suffix-input span { color: var(--muted); font-weight: 600; }
.done-box { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); }
.done-box h3 { margin: 0; }

/* Burger menu on small screens: the nav becomes a panel under the header */
@media (max-width: 860px) {
  .site-header .container { gap: 10px; }
  .brand { margin-right: auto; }
  .nav-toggle { display: inline-grid; order: 3; }
  #theme-toggle { order: 2; }
  .nav {
    display: none; position: absolute; top: 100%; left: 0; right: 0; margin: 0; z-index: 60;
    flex-direction: column; align-items: stretch; gap: 2px; padding: 10px 14px 16px;
    max-height: calc(100vh - 66px); max-height: calc(100dvh - 66px); overflow-y: auto;
    background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: var(--shadow-hover);
  }
  .nav.is-open { display: flex; }
  .nav-link { justify-content: space-between; width: 100%; padding: 13px 12px; border-radius: 12px; font-size: 1rem; }
  .nav-dropdown { position: static; }
  .mega {
    position: static; width: auto; padding: 4px 0 8px 6px; border: 0; box-shadow: none; background: none; gap: 14px;
    grid-template-columns: 1fr; margin-left: 6px; border-left: 2px solid var(--border);
  }
  .nav-dropdown.is-open .mega { animation: none; }
  .mega-link { padding: 9px 8px; }
  .mega-link .mt span { white-space: normal; }
}

/* Long-form guides and extra page text */
.guide h2 { font-size: 1.4rem; margin: 0 0 .9em; }
.guide section + section { margin-top: 1.6em; padding-top: 1.4em; border-top: 1px solid var(--border, rgba(127,127,127,.2)); }
.guide h3 { font-size: 1.1rem; margin: 0 0 .5em; }
.guide ol { margin: 0 0 1em; padding-left: 1.3em; }
.guide p { margin: 0 0 1em; max-width: 72ch; }
.text-section { margin: 0 0 2.4rem; }
.text-section > h2 { margin: 0 0 .6em; }
.task-list { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); margin: 0; padding: 0; list-style: none; }
.task-list li { padding: 18px 20px; border: 1px solid var(--border, rgba(127,127,127,.2)); border-radius: 14px; background: var(--surface, transparent); }
.task-list h3 { margin: 0 0 .35em; font-size: 1.02rem; }
.task-list p { margin: 0 0 .6em; color: var(--muted); line-height: 1.65; }
.task-list a { font-weight: 600; }
.steps-inline { counter-reset: s; display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); padding: 0; margin: 0; list-style: none; }
.steps-inline li { counter-increment: s; padding: 18px 20px; border: 1px solid var(--border, rgba(127,127,127,.2)); border-radius: 14px; color: var(--muted); line-height: 1.65; }
.steps-inline li::before { content: counter(s); display: inline-grid; place-items: center; width: 28px; height: 28px; margin-bottom: 8px; border-radius: 50%; background: var(--primary); color: #fff; font-weight: 700; font-size: .9rem; }
.steps-inline strong { display: block; color: var(--text); margin-bottom: .25em; }
.lead-text { color: var(--muted); line-height: 1.75; max-width: 75ch; margin: 0 0 1.4rem; }

/* Guides */
.guide-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.guide-card { display: flex; flex-direction: column; gap: 8px; text-decoration: none; color: inherit; padding: 20px; }
.guide-card h2, .guide-card h3 { font-size: 1.08rem; line-height: 1.35; margin: 0; color: var(--text); }
.guide-card p { margin: 0; color: var(--muted); line-height: 1.6; font-size: .95rem; }
.guide-card .chip-label { font-size: .75rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--primary); }
.guide-card .read-more { margin-top: auto; font-weight: 600; color: var(--primary); }
.guide-card:hover h2, .guide-card:hover h3 { color: var(--primary); }
.article .guide h2 { font-size: 1.25rem; }

/* Cookie banner and footer link button */
.cookie-banner { position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 60; max-width: 760px; margin: 0 auto; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 10px 40px rgba(15,18,50,.25); }
.cookie-banner[hidden] { display: none; }
.cookie-inner { display: flex; gap: 16px; align-items: center; justify-content: space-between; padding: 16px 18px; flex-wrap: wrap; }
.cookie-inner p { margin: .25em 0 0; color: var(--muted); font-size: .92rem; line-height: 1.55; max-width: 52ch; }
.cookie-actions { display: flex; gap: 10px; }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-decoration: underline; cursor: pointer; }

/* Admin */
.admin-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.admin-actions { display: flex; gap: 10px; align-items: center; }
.table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th, .admin-table td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.admin-table th { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.admin-row-actions { white-space: nowrap; }
.admin-row-actions a, .admin-row-actions form { display: inline-block; margin-right: 12px; }
.admin-list { margin: 0; padding-left: 1.2em; display: grid; gap: 6px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92rem; line-height: 1.55; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; margin-top: 8px; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 500; }
fieldset.form-field { border: 0; padding: 0; margin-left: 0; margin-right: 0; }
fieldset.form-field legend { padding: 0; font-weight: 600; }
.panel + .panel, form.panel { margin-top: 20px; }
details.note pre { white-space: pre-wrap; background: var(--surface-2); padding: 12px 14px; border-radius: 10px; font-size: .88rem; }
textarea.input.mono.wrap { white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 640px) {
  .admin-table thead { display: none; }
  .admin-table, .admin-table tbody, .admin-table tr, .admin-table td { display: block; width: 100%; }
  .admin-table tr { padding: 12px 0; border-bottom: 1px solid var(--border); }
  .admin-table td { border: 0; padding: 3px 0; }
  .admin-row-actions { margin-top: 6px; }
}

/* 404 page */
.not-found { text-align: center; padding: 56px 0 24px; }
.not-found .nf-code { margin: 0; font-size: clamp(4.5rem, 16vw, 8rem); font-weight: 800; line-height: 1; letter-spacing: -.04em; background: linear-gradient(135deg, var(--primary), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.not-found h1 { margin: .2em 0 .3em; }
.not-found .lead { max-width: 56ch; margin: 0 auto 1.4rem; color: var(--muted); }
.nf-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.guide-card { align-items: flex-start; text-align: left; }

/* Text-only logo: AEC in the same gradient as the home page headline */
.brand { gap: 6px; }
.brand-aec { font-style: normal; font-weight: 800; background: linear-gradient(90deg, var(--primary), #a855f7 60%, var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
