/* ToolBasket — three colours taken from the logo: navy ink, cloud white, logo blue (the one pop colour). */
:root {
  --ink: #0b1640;
  --paper: #f5f8ff;
  --pop: #0a5cff;
  --pop-strong: #0b3cc8;
  --on-pop: #ffffff;
  --logo-bg: #0a5cff;
  --logo-top: #ffffff;
  --logo-under: #a9c7ff;
  --logo-word: #0b3cc8;

  --bg: var(--paper);
  --fg: var(--ink);
  --surface: #ffffff;
  --surface-2: color-mix(in srgb, var(--pop) 5%, var(--bg));
  --muted: color-mix(in srgb, var(--fg) 64%, var(--bg));
  --line: color-mix(in srgb, var(--fg) 11%, var(--bg));
  --line-strong: color-mix(in srgb, var(--fg) 24%, var(--bg));
  --pop-soft: color-mix(in srgb, var(--pop) 10%, var(--bg));
  --ring: 0 0 0 4px color-mix(in srgb, var(--pop) 22%, transparent);
  --shadow: 0 1px 2px rgba(11, 22, 64, .05), 0 12px 32px -16px rgba(11, 22, 64, .22);

  /* aliases used by tool modules */
  --text: var(--fg);
  --text-muted: var(--muted);
  --accent: var(--pop);
  --border: var(--line);
  --border-strong: var(--line-strong);

  --radius: 14px;
  --radius-sm: 10px;
  --display: "Nunito", "Nunito Sans", system-ui, sans-serif;
  --sans: "Nunito Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
  --checker: repeating-conic-gradient(color-mix(in srgb, var(--fg) 6%, var(--surface)) 0 25%, var(--surface) 0 50%) 50% / 16px 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #0a1230; --fg: #e9eeff; --surface: #101b42; --pop: #3d7bff; --pop-strong: #8fb2ff; --logo-word: #ffffff; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 14px 34px -16px rgba(0,0,0,.7); color-scheme: dark; }
}
:root[data-theme="dark"] { --bg: #0a1230; --fg: #e9eeff; --surface: #101b42; --pop: #3d7bff; --pop-strong: #8fb2ff; --logo-word: #ffffff; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 14px 34px -16px rgba(0,0,0,.7); color-scheme: dark; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg); font-family: var(--sans); font-size: 16px; line-height: 1.6;
  -webkit-font-smoothing: antialiased; min-height: 100vh; display: flex; flex-direction: column;
}
main { flex: 1; }
a { color: var(--pop-strong); text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, var(--pop) 40%, transparent); }
a:hover { color: var(--pop); text-decoration-color: currentColor; }
img, canvas, svg, video { max-width: 100%; }
h1, h2, h3, h4 { font-family: var(--display); line-height: 1.15; letter-spacing: -0.01em; margin: 0 0 .5em; font-weight: 800; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 8px; }
::selection { background: color-mix(in srgb, var(--pop) 30%, transparent); }
.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.container-narrow { max-width: 940px; }
.mono { font-family: var(--mono); }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-family: var(--display); font-weight: 800; font-size: .82rem; letter-spacing: .02em; color: var(--pop-strong); background: var(--pop-soft); padding: 5px 12px 5px 8px; border-radius: 999px; }
.eyebrow svg { width: 18px; height: 18px; }

/* Logo */
.logo { display: block; height: 34px; width: auto; color: var(--logo-word); }
.brand { display: inline-flex; text-decoration: none; border-radius: 10px; }
.site-footer .logo { --logo-word: #ffffff; height: 30px; }

/* Header */
.site-header { background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: saturate(1.5) blur(12px); -webkit-backdrop-filter: saturate(1.5) blur(12px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50; }
.site-header .container { display: flex; align-items: center; gap: 20px; height: 66px; }
.nav { display: flex; gap: 2px; margin-left: auto; align-items: center; }
.nav a { text-decoration: none; font-family: var(--display); font-weight: 700; font-size: .95rem; padding: 7px 12px; color: var(--muted); border-radius: 10px; }
.nav a:hover { color: var(--pop-strong); background: var(--pop-soft); }
.theme-toggle { border: 1px solid var(--line); background: var(--surface); color: var(--fg); width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; cursor: pointer; margin-left: 6px; }
.theme-toggle:hover { border-color: var(--pop); color: var(--pop); }
.theme-toggle svg { width: 18px; height: 18px; }
@media (max-width: 760px) { .nav a.hide-sm { display: none; } .logo { height: 30px; } }

/* Hero */
.hero { padding: 64px 0 52px; position: relative; overflow: hidden; }
.hero::after { /* the logo's layered diamonds, oversized and faint */
  content: ""; position: absolute; right: -70px; top: 30px; width: 460px; height: 460px; pointer-events: none; opacity: .45;
  background: url("../img/hero-layers.svg") center / contain no-repeat;
}
@media (max-width: 860px) { .hero::after { width: 260px; height: 260px; right: -110px; top: 10px; opacity: .25; } }
.hero-grid { position: relative; z-index: 1; max-width: 760px; }
.hero h1 { font-size: clamp(2.4rem, 5.8vw, 4.2rem); letter-spacing: -0.025em; margin: 18px 0 16px; font-weight: 900; }
.hero h1 em { font-style: normal; color: var(--pop); }
.hero p.lead { color: var(--muted); font-size: 1.15rem; margin: 0 0 26px; max-width: 54ch; }
.search { position: relative; max-width: 620px; }
.search svg { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; color: var(--pop); pointer-events: none; }
.search input {
  width: 100%; height: 58px; border: 1.5px solid var(--line-strong); border-radius: 16px; background: var(--surface);
  padding: 0 56px 0 50px; font: inherit; font-size: 1.05rem; color: var(--fg); box-shadow: var(--shadow);
}
.search input:focus { outline: none; border-color: var(--pop); box-shadow: var(--ring), var(--shadow); }
.search kbd { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-family: var(--mono); font-size: .75rem; border: 1px solid var(--line-strong); padding: 2px 8px; border-radius: 6px; color: var(--muted); background: var(--bg); }
.facts { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 18px; font-size: .92rem; color: var(--muted); font-weight: 600; }
.facts span { display: inline-flex; align-items: center; gap: 7px; }
.facts span::before { content: ""; width: 14px; height: 14px; border-radius: 4px; background: var(--pop) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 10px no-repeat; }

/* Filters */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 8px; }
.chip { border: 1px solid var(--line); background: var(--surface); color: var(--muted); padding: 7px 15px; font-family: var(--display); font-weight: 700; font-size: .9rem; cursor: pointer; border-radius: 999px; }
.chip:hover { color: var(--pop-strong); border-color: color-mix(in srgb, var(--pop) 40%, var(--line)); }
.chip.active { background: var(--pop); border-color: var(--pop); color: var(--on-pop); }

/* Tool index */
.index { padding-bottom: 40px; }
.cat { margin-top: 44px; }
.cat-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.cat-head .num { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--pop-soft); color: var(--pop-strong); font-family: var(--display); font-weight: 900; font-size: .85rem; }
.cat-head h2 { font-size: 1.45rem; margin: 0; }
.cat-head .tb-muted { font-size: .92rem; }
.cat-head .count { margin-left: auto; font-size: .85rem; color: var(--muted); font-weight: 600; white-space: nowrap; }
@media (max-width: 760px) { .cat-head .hide-sm { display: none; } }
.tool-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 900px) { .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .tool-grid { grid-template-columns: 1fr; } }
.tool-link { display: block; padding: 16px 18px 17px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--fg); transition: border-color .15s, box-shadow .15s, transform .15s; }
.tool-link h3 { font-size: 1.02rem; margin: 0 0 4px; display: flex; justify-content: space-between; gap: 8px; font-weight: 800; }
.tool-link h3::after { content: "→"; color: var(--line-strong); transition: transform .15s, color .15s; }
.tool-link p { margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.45; }
.tool-link:hover { color: var(--fg); border-color: color-mix(in srgb, var(--pop) 45%, var(--line)); box-shadow: var(--shadow); transform: translateY(-2px); }
.tool-link:hover h3 { color: var(--pop-strong); }
.tool-link:hover h3::after { color: var(--pop); transform: translateX(3px); }
.tool-link[hidden], .cat[hidden] { display: none; }
.empty { color: var(--muted); padding: 40px 0; text-align: center; }

/* Principles band */
.principles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 56px; }
@media (max-width: 760px) { .principles { grid-template-columns: 1fr; } }
.principles > div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.principles h3 { font-size: 1.08rem; margin-bottom: 6px; display: flex; align-items: center; gap: 10px; }
.principles h3 span { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--pop); color: var(--on-pop); font-size: .8rem; font-weight: 900; }
.principles p { margin: 0; color: var(--muted); font-size: .95rem; }

/* Tool page */
.breadcrumb { font-size: .88rem; color: var(--muted); margin: 28px 0 14px; font-weight: 600; }
.breadcrumb a { text-decoration: none; color: var(--muted); }
.breadcrumb a:hover { color: var(--pop); }
.tool-head { margin-bottom: 22px; }
.tool-head h1 { font-size: clamp(2rem, 4.4vw, 2.9rem); letter-spacing: -0.02em; margin: 0 0 8px; font-weight: 900; }
.tool-head p { margin: 0; color: var(--muted); font-size: 1.08rem; max-width: 62ch; }
.tool-shell { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 26px; box-shadow: var(--shadow); }
@media (max-width: 600px) { .tool-shell { padding: 16px; border-radius: 14px; } }
.privacy-note { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: .9rem; margin-top: 14px; font-weight: 600; }
.privacy-note::before { content: ""; width: 18px; height: 18px; flex: none; background: url("../img/logo-mark.svg") center / contain no-repeat; }
.tool-info { margin: 48px 0 8px; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 760px) { .tool-info { grid-template-columns: 1fr; } }
.tool-info > section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; }
.tool-info h2 { font-size: 1.12rem; }
.tool-info p, .tool-info li { color: var(--muted); }
.tool-info p { margin: 0; }
.tool-info ol { padding: 0; margin: 0; list-style: none; counter-reset: s; }
.tool-info ol li { margin-bottom: 10px; display: flex; gap: 12px; align-items: baseline; counter-increment: s; }
.tool-info ol li::before { content: counter(s); flex: none; display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; background: var(--pop-soft); color: var(--pop-strong); font-family: var(--display); font-weight: 900; font-size: .8rem; transform: translateY(-1px); }
.related { margin-top: 44px; }
.related .cat-head h2 { font-size: 1.2rem; }

/* Ads — reserved, labelled, never inside tool UI */
.ad { margin: 40px 0; }
.ad-label { display: block; font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; font-weight: 700; }
.ad ins.adsbygoogle { min-height: 100px; }
.ad-placeholder .ad-box { min-height: 100px; border: 1.5px dashed var(--line-strong); display: grid; place-items: center; font-size: .82rem; color: var(--muted); border-radius: var(--radius); }
@media (min-width: 760px) { .ad ins.adsbygoogle, .ad-placeholder .ad-box { min-height: 120px; } }

/* Footer */
.site-footer { background: #0b1640; color: #dfe7ff; padding: 48px 0 40px; margin-top: 72px; font-size: .93rem; }
.site-footer .container { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 28px; }
@media (max-width: 760px) { .site-footer .container { grid-template-columns: 1fr; } }
.site-footer p { color: #9fb0dc; margin: 14px 0 0; max-width: 36ch; }
.site-footer h4 { font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: #7f93c9; margin: 4px 0 12px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: 7px; }
.site-footer a { color: #ffffff; text-decoration: none; }
.site-footer a:hover { color: #a9c7ff; }

/* Content pages */
.prose { max-width: 720px; margin: 48px auto; }
.prose h1 { font-size: clamp(2.1rem, 4.5vw, 3rem); font-weight: 900; margin-top: 16px; }
.prose h2 { font-size: 1.25rem; margin-top: 2em; }
.prose p, .prose li { color: var(--muted); }

/* ===== Tool UI kit (tb-*) ===== */
.tb-visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tb-visually-hidden:focus { position: static !important; width: auto; height: auto; clip: auto; }
.tb-stack { display: flex; flex-direction: column; gap: 16px; }
.tb-stack > * { min-width: 0; }
.tb-row { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; }
.tb-row > .tb-field { flex: 1 1 160px; }
.tb-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 760px) { .tb-grid-2 { grid-template-columns: 1fr; } }
.tb-panel { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; background: var(--surface-2); }
.tb-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.tb-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tb-field > label, .tb-field > .tb-label, .tb-stack > label:not(.tb-dropzone):not(.tb-check), .tb-label { font-size: .86rem; font-weight: 700; font-family: var(--display); color: var(--fg); }
.tb-input, .tb-select, .tb-textarea {
  width: 100%; font: inherit; font-size: .95rem; color: var(--fg); background: var(--surface); border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm); padding: 9px 12px; min-height: 44px; transition: border-color .12s, box-shadow .12s;
}
.tb-select { appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%230a5cff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center; }
.tb-textarea { font-family: var(--mono); font-size: .85rem; line-height: 1.55; resize: vertical; min-height: 160px; }
.tb-input:focus, .tb-select:focus, .tb-textarea:focus { outline: none; border-color: var(--pop); box-shadow: var(--ring); }
.tb-input[readonly], .tb-textarea[readonly] { background: var(--surface-2); }
input[type="color"] { padding: 3px; width: 56px; min-height: 44px; cursor: pointer; border-radius: var(--radius-sm); border: 1.5px solid var(--line-strong); background: var(--surface); }
.tb-range, input[type="range"] { width: 100%; accent-color: var(--pop); }
.tb-check { display: inline-flex; align-items: center; gap: 8px; font-size: .95rem; cursor: pointer; user-select: none; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--pop); width: 18px; height: 18px; margin: 0; }

.tb-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; font-family: var(--display); font-size: .95rem; font-weight: 800;
  padding: 9px 17px; min-height: 42px; border-radius: 12px; border: 1.5px solid var(--line-strong); background: var(--surface);
  color: var(--fg); cursor: pointer; white-space: nowrap; text-decoration: none; transition: background .12s, border-color .12s, box-shadow .12s, transform .06s;
}
.tb-btn:hover { border-color: var(--pop); color: var(--pop-strong); }
.tb-btn:active { transform: translateY(1px); }
.tb-btn-primary { background: var(--pop); border-color: var(--pop); color: var(--on-pop); box-shadow: 0 6px 16px -8px color-mix(in srgb, var(--pop) 70%, transparent); }
.tb-btn-primary:hover { background: var(--pop-strong); border-color: var(--pop-strong); color: var(--on-pop); }
:root[data-theme="dark"] .tb-btn-primary:hover { background: #2f6cf0; border-color: #2f6cf0; }
.tb-btn-ghost { background: transparent; border-color: var(--line); color: var(--muted); }
.tb-btn-ghost:hover { color: var(--pop-strong); background: var(--pop-soft); border-color: transparent; }
.tb-btn[disabled], .tb-btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }

.tb-dropzone, .tb-stack > label.tb-dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center; cursor: pointer;
  padding: 38px 20px; border: 2px dashed color-mix(in srgb, var(--pop) 35%, var(--line)); border-radius: 16px; background: var(--surface-2); color: var(--fg);
  font-family: var(--sans); font-size: 1rem; transition: border-color .15s, background .15s;
}
.tb-dropzone:hover, .tb-dropzone.is-over { border-color: var(--pop); background: var(--pop-soft); }
.tb-dropzone-icon { color: var(--on-pop); background: var(--pop); width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; margin-bottom: 8px; box-shadow: 0 8px 18px -10px var(--pop); }
.tb-dropzone-icon svg { width: 28px; height: 28px; }
.tb-dropzone strong { font-family: var(--display); font-weight: 800; font-size: 1.05rem; }
.tb-dropzone-hint { color: var(--muted); font-size: .88rem; }

.tb-preview { display: flex; align-items: center; justify-content: center; padding: 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--checker); min-height: 120px; overflow: auto; }
.tb-preview img, .tb-preview canvas { max-width: 100%; height: auto; display: block; }
.tb-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.tb-list-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.tb-list-item img { width: 48px; height: 48px; object-fit: cover; border-radius: 8px; background: var(--checker); }
.tb-list-item[draggable="true"] { cursor: grab; }
.tb-muted { color: var(--muted); font-size: .92rem; }
.tb-badge { display: inline-flex; align-items: center; gap: 4px; font-family: var(--display); font-size: .78rem; font-weight: 800; padding: 3px 10px; border-radius: 999px; color: var(--pop-strong); background: var(--pop-soft); white-space: nowrap; }
.tb-error { color: var(--fg); background: color-mix(in srgb, #e5484d 10%, var(--surface)); border: 1px solid color-mix(in srgb, #e5484d 35%, transparent); padding: 10px 14px; border-radius: var(--radius-sm); font-size: .93rem; margin: 0; }
.tb-error:empty { display: none; }
.tb-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tb-table th, .tb-table td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; word-break: break-word; }
.tb-table th { font-family: var(--display); font-size: .8rem; font-weight: 800; color: var(--muted); }
.tb-table code, .tb-code { font-family: var(--mono); font-size: .84rem; }
.tb-code { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; margin: 0; overflow: auto; white-space: pre; max-height: 480px; }
mark { background: color-mix(in srgb, var(--pop) 22%, transparent); color: inherit; border-radius: 3px; }
progress, .tb-progress { width: 100%; height: 8px; accent-color: var(--pop); }
meter { width: 100%; height: 10px; }
details { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px; background: var(--surface); }
summary { cursor: pointer; font-family: var(--display); font-weight: 800; }
.tb-prose { line-height: 1.65; overflow-wrap: anywhere; }
.tb-prose table { border-collapse: collapse; } .tb-prose th, .tb-prose td { border: 1px solid var(--line); padding: 6px 10px; }
.tb-prose pre { background: var(--surface-2); padding: 12px; border-radius: var(--radius-sm); overflow: auto; }
.tb-prose code { font-family: var(--mono); font-size: .9em; }
.tool-shell h2, .tool-shell h3 { font-size: 1.05rem; }

.tb-toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 100; max-width: calc(100vw - 40px); }
.tb-toast { background: #0b1640; color: #fff; padding: 11px 16px; border-radius: 12px; font-size: .92rem; font-weight: 600; box-shadow: var(--shadow); transition: opacity .3s, transform .3s; }
.tb-toast-success { background: var(--pop); }
.tb-toast-error { background: #c62f3c; }
.tb-toast.out { opacity: 0; transform: translateY(8px); }
