:root {
  --bg: #f6f7fb;
  --card: #ffffff;
  --text: #1f2430;
  --muted: #5b6475;
  --accent: #2f6fed;
  --accent-dark: #1f55c4;
  --border: #dde1ea;
  --good: #0f8a5f;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}
a { color: var(--accent); }
header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
header .logo { font-weight: 800; font-size: 1.2rem; color: var(--accent); text-decoration: none; }
header nav a { color: var(--text); text-decoration: none; font-weight: 600; }
main { max-width: 820px; margin: 0 auto; padding: 24px 16px 60px; }
h1 { font-size: 1.9rem; margin: 8px 0 6px; line-height: 1.25; }
.intro { color: var(--muted); margin-top: 0; }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px;
  margin: 20px 0;
}
.units { display: flex; gap: 8px; margin-bottom: 18px; }
.units button {
  flex: 1; padding: 10px; border: 1px solid var(--border); background: #fff;
  border-radius: 8px; font-size: 1rem; cursor: pointer; color: var(--text);
}
.units button.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
label { display: block; font-weight: 600; font-size: 0.92rem; margin-bottom: 4px; }
.hint { font-weight: 400; color: var(--muted); font-size: 0.82rem; }
input[type="number"], select {
  width: 100%; padding: 10px 12px; font-size: 1rem;
  border: 1px solid var(--border); border-radius: 8px; background: #fff;
}
input[type="number"]:focus, select:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
.check { display: flex; align-items: center; gap: 8px; margin-top: 16px; font-weight: 600; }
.check input { width: 18px; height: 18px; }
.section-title { font-size: 1rem; margin: 22px 0 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.calc-btn {
  width: 100%; margin-top: 22px; padding: 14px; font-size: 1.1rem; font-weight: 700;
  background: var(--accent); color: #fff; border: none; border-radius: 10px; cursor: pointer;
}
.calc-btn:hover { background: var(--accent-dark); }
.error { color: #c0392b; margin-top: 12px; display: none; }
.result { display: none; }
.big { font-size: 2.2rem; font-weight: 800; color: var(--good); margin: 4px 0; }
.rows div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.rows div:last-child { border-bottom: none; }
.rows span:last-child { font-weight: 700; text-align: right; }
article h2 { margin-top: 34px; font-size: 1.4rem; }
article h3 { font-size: 1.08rem; margin-bottom: 4px; }
.formula { background: #eef3ff; border-radius: 8px; padding: 12px 14px; font-family: Consolas, monospace; font-size: .95rem; }
.tools { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; margin-top: 20px; }
.tool {
  display: block; background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 18px; text-decoration: none; color: var(--text); transition: border-color .15s, transform .15s;
}
.tool:hover { border-color: var(--accent); transform: translateY(-2px); }
.tool .icon { font-size: 1.8rem; }
.tool h2 { font-size: 1.1rem; margin: 6px 0 4px; color: var(--accent); }
.tool p { margin: 0; color: var(--muted); font-size: .93rem; }
.related { margin-top: 36px; }
.related a { display: inline-block; margin: 4px 10px 4px 0; }
footer { text-align: center; color: var(--muted); font-size: .88rem; padding: 24px; border-top: 1px solid var(--border); background: var(--card); }
footer a { color: var(--muted); margin: 0 8px; }
header .logo { display: inline-flex; align-items: center; gap: 10px; color: var(--text); letter-spacing: -0.02em; font-size: 1.3rem; }
.logo-mark { display: block; width: 40px; height: 40px; flex-shrink: 0; }
.logo-text { white-space: nowrap; line-height: 1; }
.lt-light { color: var(--accent-dark); font-weight: 700; }

/* ---------- Premium polish (keeps the original blue and white theme) ---------- */
@font-face { font-family: "Bricolage"; src: url("fonts/bricolage-grotesque-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Bricolage"; src: url("fonts/bricolage-grotesque-latin-800-normal.woff2") format("woff2"); font-weight: 800; font-display: swap; }
@font-face { font-family: "Public Sans"; src: url("fonts/public-sans-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Public Sans"; src: url("fonts/public-sans-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Public Sans"; src: url("fonts/public-sans-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }

body { font-family: "Public Sans", -apple-system, "Segoe UI", Roboto, Arial, sans-serif; font-size: 17px; background: #f5f7fc; }
h1, h2, h3, header .logo, .big { font-family: "Bricolage", "Segoe UI", system-ui, sans-serif; letter-spacing: -0.02em; }

header { padding: 0; position: sticky; top: 0; z-index: 10; background: rgba(255,255,255,.92); backdrop-filter: saturate(1.4) blur(8px); }
header > * { }
header .logo { font-size: 1.35rem; font-weight: 800; }
header nav a { font-size: .95rem; color: #3a4357; }
header nav a:hover { color: var(--accent); }
header { padding: 14px max(20px, calc((100% - 1080px) / 2)); }

a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid #9dbcff; outline-offset: 2px; }

/* Home hero: soft blue band behind the headline */
.hero {
  margin: 0 -16px; padding: 56px 20px 48px; border-radius: 0 0 28px 28px;
  background: radial-gradient(55% 90% at 50% 0%, #e2ebff 0%, rgba(245,247,252,0) 100%);
}
.hero h1 { font-size: clamp(2.2rem, 5vw, 3.3rem); font-weight: 800; margin-bottom: 12px; }
.hero .intro { font-size: 1.12rem; }
.search { position: relative; max-width: 520px; margin: 26px auto 0; }
.search svg { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; color: var(--muted); }
.search input {
  width: 100%; padding: 16px 18px 16px 48px; font: inherit; font-size: 1.05rem;
  border: 1px solid var(--border); border-radius: 14px; background: #fff;
  box-shadow: 0 10px 30px -14px rgba(31,85,196,.35);
}
.search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(47,111,237,.18); }

/* Tool cards */
.cat h2.cat-title { font-weight: 800; }
.tool { border-radius: 16px; padding: 20px; box-shadow: 0 1px 2px rgba(20,30,60,.04); }
.tool:hover { border-color: #b9ccf8; box-shadow: 0 14px 30px -18px rgba(31,85,196,.45); }
.tool .icon {
  width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center;
  background: #eaf0ff; font-size: 1.5rem;
}
.tool h2 { font-family: "Public Sans", sans-serif; letter-spacing: 0; font-weight: 700; margin-top: 12px; }
.tool.soon .icon { background: #f0f1f4; }
.no-results { display: none; color: var(--muted); text-align: center; padding: 20px 0; }

/* Calculator pages */
main > h1 { font-size: clamp(2rem, 4.5vw, 2.7rem); font-weight: 800; margin-top: 18px; }
.card { border-radius: 18px; padding: 26px; box-shadow: 0 16px 40px -24px rgba(20,40,90,.35); }
.units { display: inline-flex; background: #eef2fa; padding: 4px; border-radius: 12px; gap: 4px; }
.units button { flex: none; border: 0; background: transparent; padding: 9px 16px; font: inherit; font-weight: 600; font-size: .95rem; color: var(--muted); border-radius: 9px; }
.units button.active { background: #fff; color: var(--accent); border: 0; box-shadow: 0 1px 4px rgba(20,40,90,.15); }
.section-title { text-transform: none; letter-spacing: 0; font-weight: 700; font-size: 1rem; color: var(--text); }
input[type="number"], select { font: inherit; border-radius: 10px; border: 1.5px solid #d6dcea; }
input[type="number"]:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(47,111,237,.15); }
.calc-btn { font: inherit; font-weight: 700; font-size: 1.08rem; border-radius: 12px; box-shadow: 0 10px 22px -12px rgba(47,111,237,.8); }
.result { border: 0; background: linear-gradient(180deg, #ffffff 0%, #f3f9f6 100%); border-left: 5px solid var(--good); }
.big { font-weight: 800; }
.rows div { border-bottom-style: dashed; }
.formula { font-family: inherit; background: #fff; border: 1px solid var(--border); border-left: 4px solid var(--accent); }
.related { padding: 16px 18px; background: #eaf0ff; border-radius: 12px; }

footer { background: #fff; padding: 28px 20px; }

/* ---------- Image and text tools ---------- */
.dropzone {
  display: block; border: 2px dashed #b9ccf8; border-radius: 16px; background: #f7f9ff;
  padding: 36px 20px; text-align: center; cursor: pointer; transition: background .15s, border-color .15s;
}
.dropzone:hover, .dropzone.drag { background: #eaf0ff; border-color: var(--accent); }
.dropzone strong { display: block; font-size: 1.1rem; margin-bottom: 4px; }
.dropzone span { color: var(--muted); font-size: .93rem; }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dropzone .dz-icon { width: 44px; height: 44px; margin: 0 auto 10px; color: var(--accent); }
.file-list { list-style: none; padding: 0; margin: 18px 0 0; }
.file-item { display: flex; align-items: center; gap: 14px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; margin-bottom: 10px; background: #fff; }
.file-item img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; background: #eef2fa; flex: none; }
.file-item .meta { flex: 1; min-width: 0; }
.file-item .meta strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-item .meta span { color: var(--muted); font-size: .9rem; }
.file-item .saved { color: var(--good); font-weight: 700; }
.btn {
  display: inline-block; padding: 10px 16px; border-radius: 10px; font: inherit; font-weight: 700; font-size: .95rem;
  background: var(--accent); color: #fff; border: 0; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--accent-dark); }
.btn.ghost { background: #eef2fa; color: var(--text); }
.btn.ghost:hover { background: #e2e8f6; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.preview { margin-top: 18px; text-align: center; }
.preview img { max-width: 100%; max-height: 360px; border-radius: 12px; border: 1px solid var(--border); background: repeating-conic-gradient(#eef2fa 0 25%, #fff 0 50%) 50% / 20px 20px; }
.hidden { display: none !important; }
input[type="range"] { width: 100%; accent-color: var(--accent); }
.range-row { display: flex; justify-content: space-between; font-weight: 600; }
textarea {
  width: 100%; min-height: 220px; padding: 14px; font: inherit; font-size: 1rem; line-height: 1.55; color: var(--text);
  border: 1.5px solid #d6dcea; border-radius: 12px; resize: vertical; background: #fff;
}
textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(47,111,237,.15); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin-top: 16px; }
.stat { background: #f5f7fc; border-radius: 12px; padding: 14px; }
.stat b { display: block; font-family: "Bricolage", system-ui, sans-serif; font-size: 1.7rem; line-height: 1.1; color: var(--accent); }
.stat span { color: var(--muted); font-size: .9rem; }
.note { color: var(--muted); font-size: .9rem; margin-top: 10px; }
.status { color: var(--good); font-weight: 600; margin-left: 6px; }
input[type="text"], input[type="url"], input[type="email"], input[type="tel"], input[type="password"] {
  width: 100%; padding: 11px 13px; font: inherit; font-size: 1rem; color: var(--text);
  border: 1.5px solid #d6dcea; border-radius: 10px; background: #fff;
}
input[type="text"]:focus, input[type="url"]:focus, input[type="email"]:focus, input[type="tel"]:focus, input[type="password"]:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(47,111,237,.15);
}
input[type="color"] { width: 100%; height: 46px; padding: 4px; border: 1.5px solid #d6dcea; border-radius: 10px; background: #fff; cursor: pointer; }
.qr-layout { display: grid; grid-template-columns: 1fr 300px; gap: 26px; align-items: start; }
@media (max-width: 760px) { .qr-layout { grid-template-columns: 1fr; } }
.qr-box { text-align: center; background: #f5f7fc; border-radius: 16px; padding: 18px; position: sticky; top: 80px; }
.qr-box canvas { width: 100%; max-width: 260px; height: auto; border-radius: 8px; background: #fff; }
.qr-box .btn-row { justify-content: center; }
.field { margin-bottom: 14px; }

/* Media stays within its container without changing its natural proportions. */
img, video, canvas { max-width: 100%; height: auto; }
iframe, embed, object { max-width: 100%; }

/* The menu control is enabled by site.js; navigation stays usable without JS. */
.nav-toggle { display: none; }
header { flex-wrap: wrap; gap: 8px 12px; }
header nav { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.nav-toggle:not([hidden]) {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-width: 44px; min-height: 44px; padding: 8px 12px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--card); color: var(--text); font: inherit; font-weight: 600; cursor: pointer;
}
.nav-toggle svg { width: 20px; height: 20px; }
.nav-toggle:hover, .nav-toggle[aria-expanded="true"] { background: #eaf0ff; border-color: #b9ccf8; }
header.nav-ready nav {
  display: none; position: absolute; right: max(20px, calc((100% - 1080px) / 2)); top: calc(100% + 8px);
  width: 240px; max-width: calc(100vw - 32px); padding: 8px;
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 16px 36px -16px rgba(20,40,90,.3);
}
header.nav-ready nav.is-open { display: block; }
header nav a { display: flex; align-items: center; min-height: 44px; padding: 8px 12px; border-radius: 8px; }
header nav a:hover, header nav a[aria-current="page"] { color: var(--accent-dark); background: #eef3ff; }

/* Editorial pages share the tools' typography and quiet blue accents. */
.brand-link {
  color: var(--accent-dark); background: #eaf0ff; border-radius: 4px;
  padding: 2px 4px; font-weight: 700; white-space: nowrap;
  text-decoration: underline; text-underline-offset: 3px;
}
.brand-link:hover { color: var(--text); background: #dce7ff; }
.page-intro { padding: 28px 0 24px; max-width: 700px; }
.eyebrow { color: var(--accent-dark); font-size: .82rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; margin: 0 0 12px; }
.page-intro h1 { font-size: clamp(2rem, 5vw, 3rem); margin-bottom: 16px; }
.page-intro .intro { font-size: 1.1rem; }
.content-panel { background: var(--card); border: 1px solid var(--border); border-radius: 18px; padding: clamp(20px, 4vw, 32px); margin: 24px 0; }
.content-panel > :first-child { margin-top: 0; }
.content-panel > :last-child { margin-bottom: 0; }
.about-principles { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; border-block: 1px solid var(--border); padding: 24px 0; margin: 28px 0; }
.about-principles h2 { margin-top: 0; }
.about-principles p { margin-bottom: 0; }
.home-copy { margin-top: 48px; padding-top: 8px; border-top: 1px solid var(--border); }
.reading-links { display: flex; flex-wrap: wrap; gap: 10px 24px; padding: 0; list-style: none; }
.reading-links a { display: inline-block; padding: 8px 0; }
.guide-index { padding: 22px 26px; background: #eaf0ff; border-radius: 14px; }
.guide-index h2 { margin: 0 0 12px; font-size: 1.1rem; }
.guide-index ol { margin: 0; padding-left: 22px; }
.guide-index a { display: inline-block; padding: 8px 0; }
.guide { scroll-margin-top: 100px; padding-block: 32px; border-bottom: 1px solid var(--border); }
.guide h2 { margin-top: 0; font-size: clamp(1.5rem, 4vw, 2rem); line-height: 1.25; }
.guide h3 { margin-top: 24px; }
.guide li { margin-block: 10px; }
.guide .eyebrow { margin-bottom: 12px; }
footer > div { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 0; }
footer a { display: inline-flex; align-items: center; min-height: 44px; }

@media (max-width: 760px) {
  main, footer { overflow-wrap: anywhere; }
  header { flex-wrap: wrap; gap: 8px 12px; padding: 10px 16px; }
  header .logo { min-height: 44px; min-width: 44px; }
  .logo-mark { flex-shrink: 0; }
  header.nav-ready nav { position: static; flex-basis: 100%; width: 100%; box-shadow: none; }
  .about-principles { grid-template-columns: 1fr; }
  .page-intro { padding-top: 16px; }

  /* Keep secondary copy readable and prevent input zoom on phones. */
  label, .hint, .tool p, footer, header nav a, .units button, .btn,
  .dropzone span, .file-item .meta span, .stat span, .note, .formula, .badge {
    font-size: 1rem;
  }
  button, input, select, textarea, .btn { min-width: 44px; min-height: 44px; max-width: 100%; }
  input, select, textarea { font-size: 1rem; }
  .btn { display: inline-flex; align-items: center; justify-content: center; white-space: normal; text-align: center; }
  .check { min-height: 44px; cursor: pointer; }
  .check input { flex-shrink: 0; width: 44px; height: 44px; margin: 0; }
  .dropzone { position: relative; }
  .dropzone input { min-width: 0; min-height: 0; }
  .dropzone:focus-within { outline: 3px solid #9dbcff; outline-offset: 2px; }

  .card { padding: 20px 16px; }
  .grid { grid-template-columns: repeat(auto-fit, minmax(min(170px, 100%), 1fr)); }
  .tools { grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr)); }
  .stats { grid-template-columns: repeat(auto-fit, minmax(min(130px, 100%), 1fr)); }
  .grid > *, .qr-layout > *, .stats > * { min-width: 0; }
  .units { display: flex; max-width: 100%; }
  .units button { flex: 1; min-width: 44px; padding: 9px 10px; overflow-wrap: anywhere; }
  .rows div { flex-wrap: wrap; }
  .rows span { min-width: 0; }
  .rows span:last-child { margin-left: auto; }
  .file-item { display: grid; grid-template-columns: 64px minmax(0, 1fr); }
  .file-item > .btn { grid-column: 1 / -1; }
  .qr-layout { grid-template-columns: minmax(0, 1fr); }
  .qr-box { position: static; }
  .related a, footer a, article p a {
    display: inline-flex; align-items: center; min-width: 44px; min-height: 44px; max-width: 100%;
  }
  article p a { display: inline-block; padding-block: 8px; }
}

@media (max-width: 380px) {
  header .logo { gap: 8px; font-size: 1.2rem; }
}
