:root {
  --bg: #f3efe6;
  --surface: #ffffff;
  --ink: #141210;
  --muted: #4f4a43;
  --line: #cfc6b6;
  --accent: #0a7384;
  --accent-soft: #d8eef2;
  --header: 56px;
  --font: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  font-weight: 400;
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
}
img, svg { display: block; }
a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
a:hover { color: #07525e; }
button, input, textarea { font: inherit; }

.container { width: min(1040px, calc(100% - 36px)); margin: 0 auto; }
.narrow { width: min(720px, calc(100% - 36px)); }

.sr-only, .skip-link { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.skip-link:focus {
  clip: auto; width: auto; height: auto; left: 12px; top: 12px;
  padding: 8px 12px; background: var(--ink); color: #fff; z-index: 80;
}

.site-header {
  position: relative;
  z-index: 30;
  height: var(--header);
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
  letter-spacing: -0.02em;
}
.brand:hover { color: var(--ink); text-decoration: none; }
.brand img { width: 28px; height: 28px; }
.brand-word { font-size: 1.05rem; font-weight: 500; }
.site-nav { display: flex; align-items: center; gap: 22px; }
.site-nav a,
.site-nav .nav-link {
  color: var(--ink);
  text-decoration: none;
  font-weight: 400;
  font-size: 0.98rem;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
.site-nav a:hover,
.site-nav a.is-current,
.site-nav .nav-link:hover,
.site-nav .nav-link.is-current { color: var(--accent); }
.nav-item { position: relative; }
.nav-item .nav-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.nav-item .nav-link .icon { transition: transform 0.15s ease; }
.nav-item.is-open .nav-link .icon { transform: rotate(180deg); }
.nav-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 230px;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  padding: 6px;
  box-shadow: 0 8px 24px rgba(20, 18, 16, 0.08);
}
.nav-menu[hidden] { display: none; }
.nav-menu a {
  display: block;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 0.95rem;
}
.nav-menu a:hover { background: var(--accent-soft); color: var(--accent); text-decoration: none; }
.nav-toggle {
  display: none;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  padding: 7px;
  color: var(--ink);
}

.tool-fold { padding: 20px 0 28px; }
.hero-compact { margin-bottom: 18px; max-width: 720px; }
.hero-compact h1 {
  font-size: clamp(1.75rem, 3.2vw, 2.25rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--ink);
}
.hero-sub {
  margin-top: 6px;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--ink);
}
.hero-desc {
  margin-top: 8px;
  color: var(--muted);
  font-weight: 400;
  max-width: 62ch;
}
.hero-desc strong { color: var(--ink); font-weight: 600; }
.hero-pills {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.hero-pills li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border: 1.5px solid var(--accent);
  color: var(--accent);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 0.88rem;
  font-weight: 600;
}
.hero-pills .icon { color: var(--accent); }

.tool-board {
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 18px;
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label,
.output label {
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ink);
}
.field label span { color: var(--muted); font-weight: 500; }

textarea {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
  resize: vertical;
  font-family: "Source Sans 3", ui-monospace, Consolas, sans-serif;
  font-size: 0.95rem;
  line-height: 1.45;
  outline: none;
}
textarea::placeholder { color: #7a7468; }
textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(10, 115, 132, 0.18); }

.options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}
.option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 6px 11px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
  user-select: none;
}
.option:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: #063943;
  font-weight: 600;
}
.option input { accent-color: var(--accent); }

.tool-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.btn {
  border: 0;
  border-radius: 8px;
  padding: 8px 16px;
  font-weight: 500;
  cursor: pointer;
}
.btn-primary { background: var(--accent); color: #f7f4ee; }
.btn-primary:hover { background: #085e6c; }
.btn-ghost {
  background: #fff;
  color: var(--ink);
  border: 1.5px solid var(--line);
}
.btn-ghost:hover { border-color: var(--ink); }
.count-pill { margin-left: auto; color: var(--muted); font-size: 0.9rem; font-weight: 600; }

.output { margin-top: 14px; }
.output label { display: block; margin-bottom: 6px; }
.preview {
  margin-top: 10px;
  min-height: 52px;
  padding: 10px 12px;
  border: 1.5px dashed #b7ae9e;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 0.95rem;
}
.preview:empty::before { content: "Preview"; color: #6d675e; }
.preview a { margin-right: 12px; }

.prose { padding: 36px 0 20px; }
.prose h2 {
  font-size: 1.35rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin: 28px 0 10px;
}
.prose h2:first-child { margin-top: 0; }
.prose p { margin-bottom: 12px; color: #3c3833; font-weight: 400; }
.prose .lead { font-size: 1.05rem; }
.prose .updated { color: var(--muted); font-size: 0.88rem; margin-bottom: 14px; }
.prose ol, .prose ul { padding-left: 20px; margin: 8px 0 16px; }
.prose li { margin: 6px 0; color: #3c3833; }
.prose code {
  font-size: 0.88em;
  background: #efeae0;
  padding: 1px 5px;
  border-radius: 4px;
}

.faq { padding: 10px 0 56px; }
.faq h2 {
  font-size: 1.35rem;
  font-weight: 500;
  margin-bottom: 12px;
}
.faq-item h3 { font-size: 1rem; font-weight: 500; }
.faq-item { border-top: 1px solid var(--line); }
.faq-item:last-child { border-bottom: 1px solid var(--line); }
.faq-item button {
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  padding: 14px 0;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-weight: 500;
  cursor: pointer;
  color: var(--ink);
}
.faq-item .faq-body { display: none; padding: 0 0 14px; color: var(--muted); }
.faq-item.is-open .faq-body { display: block; }
.faq-item.is-open button .icon { transform: rotate(180deg); }

.page-hero { padding: 36px 0 12px; }
.page-hero h1 { font-size: 2rem; font-weight: 500; letter-spacing: -0.03em; }
.page-hero p { color: var(--muted); margin-top: 8px; max-width: 60ch; font-weight: 300; }
.blog-grid {
  display: grid;
  gap: 12px;
  padding-bottom: 56px;
}
.blog-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px;
  color: inherit;
  text-decoration: none;
}
.blog-card:hover { border-color: #cfc8b8; text-decoration: none; }
.blog-card .meta { color: var(--muted); font-size: 0.88rem; }
.blog-card h2 { font-size: 1.2rem; font-weight: 500; margin: 8px 0; }
.article { padding: 36px 0 56px; }
.article .meta { color: var(--muted); margin-bottom: 10px; }
.article h1 { font-size: 2rem; font-weight: 500; letter-spacing: -0.03em; margin-bottom: 16px; }
.article h2 { font-size: 1.25rem; font-weight: 500; margin: 26px 0 8px; }
.article p { margin-bottom: 12px; color: #3c3833; }

.site-footer {
  border-top: 1.5px solid var(--line);
  padding: 36px 0 18px;
  background: #fff;
}
.footer-top {
  display: grid;
  grid-template-columns: 1.2fr .9fr 1fr;
  gap: 28px;
  padding-bottom: 24px;
}
.footer-note { color: var(--muted); margin-top: 10px; font-weight: 300; max-width: 28ch; }
.site-footer h2 {
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}
.site-footer ul { list-style: none; }
.site-footer li { margin: 6px 0; }
.site-footer a, .site-footer span { color: var(--ink); text-decoration: none; font-weight: 400; }
.site-footer a:hover { color: var(--accent); text-decoration: underline; }
.site-footer span { color: var(--muted); }
.footer-bottom {
  border-top: 1px solid var(--line);
  padding-top: 14px;
  color: var(--muted);
  font-size: 0.9rem;
}

.toast {
  position: fixed;
  right: 14px;
  bottom: 14px;
  background: var(--ink);
  color: #f7f4ee;
  padding: 8px 12px;
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
  transition: .18s ease;
  z-index: 60;
}
.toast.is-on { opacity: 1; }

.admin-body { background: #f3efe6; }
.admin-shell { min-height: 100vh; display: grid; grid-template-columns: 240px 1fr; }
.admin-side { background: var(--surface); border-right: 1px solid var(--line); padding: 20px 14px; }
.admin-side nav { display: grid; gap: 4px; margin-top: 22px; }
.admin-side a,
.admin-side button.nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 0;
  background: none;
  color: var(--ink);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  border-radius: 8px;
}
.admin-side a.is-active,
.admin-side button.nav-link.is-active,
.admin-side a:hover,
.admin-side button.nav-link:hover { background: var(--accent-soft); color: var(--accent); }
.admin-main { padding: 24px; }
.admin-top { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.admin-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 12px;
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.tools-admin { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tools-admin label {
  display: flex; gap: 8px; border: 1px solid var(--line); border-radius: 8px; padding: 8px;
}
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card {
  width: min(400px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px;
}
.login-card h1 { font-size: 1.4rem; font-weight: 500; margin: 10px 0 6px; }
.login-card p { color: var(--muted); margin-bottom: 16px; }
.alert { background: #f8e8e4; color: #7a2e22; border-radius: 8px; padding: 8px 10px; margin-bottom: 10px; }
input[type="text"],
input[type="email"],
input[type="url"],
input[type="password"],
input[type="color"] {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

@media (max-width: 800px) {
  .grid-2, .footer-top, .admin-shell, .form-grid, .tools-admin { grid-template-columns: 1fr; }
  .site-nav {
    display: none;
    position: absolute;
    top: var(--header);
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    flex-direction: column;
    padding: 10px 18px 14px;
    gap: 10px;
  }
  .site-nav.is-open { display: flex; }
  .nav-toggle { display: inline-flex; }
  .nav-menu {
    position: static;
    right: auto;
    min-width: 0;
    box-shadow: none;
    margin-top: 6px;
  }
  .count-pill { margin-left: 0; }
  textarea { min-height: 120px; }
  .hero-compact { margin-bottom: 14px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
