/* ===========================================================
   Tool Repo — main stylesheet
   Identity: a digital workbench. Tools are drawers on a
   pegboard, tagged like workshop labels. Ink on paper, one
   signal color (amber) reserved for "favorite" and focus.
   =========================================================== */

@font-face {
  font-family: "Lato";
  src: url("../fonts/Lato-Regular.woff2") format("woff2");
  font-weight: 400;
}
@font-face {
  font-family: "Lato";
  src: url("../fonts/Lato-Bold.woff2") format("woff2");
  font-weight: 700;
}
@font-face {
  font-family: "Lato";
  src: url("../fonts/Lato-Black.woff2") format("woff2");
  font-weight: 900;
}

:root {
  --paper: #FAFAF7;
  --paper-dim: #F1EFE8;
  --ink: #16181D;
  --ink-soft: #4A4F58;
  --line: #DAD5C7;
  --steel: #2F5D8C;
  --steel-dark: #234869;
  --amber: #E8A93A;
  --amber-dark: #C68A1F;
  --green: #3F8F5F;
  --red: #C24444;
  --radius: 10px;
  --font-display: "Space Grotesk", "Lato", sans-serif;
  --font-body: "Inter", "Lato", sans-serif;
  --font-mono: "JetBrains Mono", "Nunito", monospace;
  --shadow-card: 0 1px 2px rgba(22,24,29,0.06), 0 6px 16px rgba(22,24,29,0.05);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; }
a, button, select, label, input[type="checkbox"], [role="button"] { cursor: default; }
:focus-visible {
  outline: 2px solid var(--steel);
  outline-offset: 2px;
}

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.site-header .container {
  display: flex;
  align-items: center;
  gap: 20px;
  height: 68px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
  flex-shrink: 0;
}
.brand img { height: 28px; width: auto; }
.brand .tag {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--amber-dark);
  background: rgba(232,169,58,0.15);
  border: 1px solid var(--amber);
  border-radius: 4px;
  padding: 2px 6px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.header-search {
  flex: 1;
  max-width: 420px;
  position: relative;
}
.header-search input {
  width: 100%;
  padding: 9px 14px 9px 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper-dim);
  font-size: 0.9rem;
  color: var(--ink);
}
.header-search input:focus { outline: none; border-color: var(--steel); background: var(--paper); }
.header-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--ink-soft);
  pointer-events: none;
}
.header-search-icon svg { display: block; width: 100%; height: 100%; }
.mobile-search-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: none;
  color: var(--ink-soft);
  flex-shrink: 0;
}
.mobile-search-btn svg { width: 17px; height: 17px; }
.mobile-search-btn:hover { background: var(--paper-dim); color: var(--ink); }

.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(22,24,29,0.14);
  max-height: 360px;
  overflow-y: auto;
  z-index: 50;
  display: none;
}
.search-results.open { display: block; }
.search-results a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--paper-dim);
}
.search-results a:last-child { border-bottom: none; }
.search-results a:hover, .search-results a.active { background: var(--paper-dim); }
.search-results .sr-name { font-weight: 600; font-size: 0.88rem; }
.search-results .sr-desc { display: block; font-size: 0.76rem; color: var(--ink-soft); font-weight: 400; }
.search-results .sr-tag {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--steel-dark);
  background: rgba(47,93,140,0.08);
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
  flex-shrink: 0;
}
.search-results .sr-empty { padding: 16px 14px; color: var(--ink-soft); font-size: 0.85rem; }
.search-results .sr-viewall { display: block; text-align: center; padding: 10px; font-size: 0.82rem; font-weight: 600; color: var(--steel); }

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}
.icon-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--ink-soft);
  border: 1px solid transparent;
}
.icon-link:hover { background: var(--paper-dim); color: var(--ink); }
.icon-link svg { width: 18px; height: 18px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.88rem;
  border: 1px solid transparent;
  transition: transform 0.08s ease, background 0.15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover { background: var(--steel-dark); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { background: var(--paper-dim); }
.btn-amber { background: var(--amber); color: #2B1E05; }
.btn-amber:hover { background: var(--amber-dark); }
.btn-block { width: 100%; }
.btn-google {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(22,24,29,0.06);
}
.btn-google:hover { background: var(--paper-dim); }
.google-icon { display: inline-flex; width: 18px; height: 18px; flex-shrink: 0; }
.google-icon svg { display: block; width: 100%; height: 100%; }

.user-chip {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 6px 6px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 0.82rem;
}
.user-chip .avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--steel); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 0.75rem; font-weight: 700;
}

/* ---------- Hero ---------- */
.hero {
  padding: 64px 0 40px;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(600px 220px at 85% -20%, rgba(47,93,140,0.10), transparent),
    var(--paper);
}
.hero .eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--steel-dark);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}
.hero .eyebrow::before {
  content: "";
  width: 8px; height: 8px;
  background: var(--amber);
  border-radius: 2px;
  display: inline-block;
}
.hero h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2rem, 4.2vw, 3.1rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin: 0 0 16px;
  max-width: 18ch;
}
.hero h1 em {
  font-style: normal;
  color: var(--steel);
}
.hero p.lede {
  font-size: 1.05rem;
  color: var(--ink-soft);
  max-width: 52ch;
  margin: 0 0 28px;
}
.hero-stats {
  display: flex;
  gap: 36px;
  flex-wrap: wrap;
}
.hero-stats .stat b {
  display: block;
  font-family: var(--font-display);
  font-size: 1.6rem;
}
.hero-stats .stat span {
  font-size: 0.8rem;
  color: var(--ink-soft);
}

/* ---------- Category pegboard ---------- */
.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 56px 0 20px;
  gap: 16px;
  flex-wrap: wrap;
}
.section-heading h2 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  margin: 0;
}
.section-heading .count {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
}
.category-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 18px 16px 16px;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
  overflow: hidden;
}
.category-card::before {
  /* die-cut tab, like a drawer label */
  content: attr(data-code);
  position: absolute;
  top: 0; right: 0;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--ink-soft);
  background: var(--paper-dim);
  border-left: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-bottom-left-radius: 8px;
  padding: 3px 8px;
}
.category-card:hover {
  border-color: var(--steel);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}
.category-card .cat-icon {
  width: 34px; height: 34px;
  color: var(--steel);
  margin-bottom: 14px;
}
.category-card h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  margin: 0 0 4px;
}
.category-card p {
  font-size: 0.82rem;
  color: var(--ink-soft);
  margin: 0 0 10px;
}
.category-card .cat-count {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--steel-dark);
}

/* ---------- Tool grid & cards ---------- */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}
.tool-card {
  position: relative;
  border: 1px solid var(--line);
  border-left: 3px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 16px 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.tool-card:hover { border-left-color: var(--steel); box-shadow: var(--shadow-card); }
.tool-card .tool-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.tool-card .tool-tag {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.tool-card h4 {
  font-family: var(--font-display);
  font-size: 0.98rem;
  margin: 8px 0 4px;
}
.tool-card p {
  font-size: 0.82rem;
  color: var(--ink-soft);
  margin: 0;
}
.fav-btn {
  background: none;
  border: none;
  padding: 2px;
  color: var(--line);
  flex-shrink: 0;
}
.fav-btn svg { width: 19px; height: 19px; }
.fav-btn.is-fav { color: var(--amber); }
.fav-btn:hover { color: var(--amber-dark); }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--ink-soft);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}
.empty-state svg { width: 40px; height: 40px; margin-bottom: 12px; color: var(--line); }

/* ---------- Tool runner page ---------- */
.tool-page-head {
  padding: 40px 0 16px;
  border-bottom: 1px solid var(--line);
}
.breadcrumb {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin-bottom: 12px;
}
.breadcrumb a:hover { color: var(--steel); }
.tool-page-head .head-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}
.tool-page-head h1 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  margin: 0 0 6px;
}
.tool-page-head p { color: var(--ink-soft); margin: 0; max-width: 60ch; }

.tool-body { padding: 32px 0 80px; }
.tool-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
}
.field-row { margin-bottom: 16px; }
.field-row label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 6px;
}
.field-row input[type=text],
.field-row input[type=number],
.field-row input[type=password],
.field-row input[type=date],
.field-row input[type=datetime-local],
.field-row select,
.field-row textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 0.92rem;
  background: var(--paper-dim);
  color: var(--ink);
}
.field-row textarea { min-height: 140px; resize: vertical; font-family: var(--font-mono); }
.field-row input:focus, .field-row select:focus, .field-row textarea:focus {
  outline: none; border-color: var(--steel); background: #fff;
}
.field-inline { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.field-inline > * { flex: 1; min-width: 120px; }

/* ---------- Custom select — one consistent pattern, used everywhere ---------- */
.field-row select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 36px;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="8" viewBox="0 0 12 8"><path d="M1 1l5 5 5-5" fill="none" stroke="%234A4F58" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/></svg>');
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 11px 7px;
}
.field-row select:focus {
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="8" viewBox="0 0 12 8"><path d="M1 1l5 5 5-5" fill="none" stroke="%232F5D8C" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/></svg>');
}
.field-row select::-ms-expand { display: none; }

/* ---------- Custom checkbox — one consistent pattern, used everywhere ---------- */
.tr-checkbox,
.tr-checkbox * ,
.tr-checkbox ::before,
.tr-checkbox ::after { box-sizing: border-box; }
.tr-checkbox { user-select: none; margin-bottom: 8px; }
.tr-checkbox label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--ink);
}
.tr-checkbox input[type="checkbox"] { display: none; }
.tr-checkbox .cbx {
  position: relative;
  display: block;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: #fff;
  transition: all 0.15s ease;
}
.tr-checkbox .cbx svg {
  position: absolute;
  top: 2px;
  left: 2px;
  fill: none;
  stroke: #fff;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 17;
  stroke-dashoffset: 17;
  transition: stroke-dashoffset 0.15s ease;
}
.tr-checkbox input:checked + .cbx {
  background-color: #14161A;
  border-color: #14161A;
}
.tr-checkbox input:checked + .cbx svg { stroke-dashoffset: 0; }
.tr-checkbox input:focus-visible + .cbx { outline: 2px solid var(--steel); outline-offset: 2px; }

.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; margin-bottom: 8px; }

.tool-output {
  margin-top: 18px;
  padding: 16px;
  border-radius: 8px;
  background: var(--paper-dim);
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 0.88rem;
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 44px;
}
.tool-output.result-big {
  font-family: var(--font-display);
  font-size: 1.6rem;
  text-align: center;
  padding: 24px;
}
.stat-strip {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  margin-top: 14px;
  font-size: 0.82rem;
  color: var(--ink-soft);
}
.stat-strip b { color: var(--ink); font-family: var(--font-mono); }

.actions-row { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.swatch-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.swatch {
  width: 64px; height: 64px; border-radius: 8px; border: 1px solid var(--line);
  display: flex; align-items: flex-end; justify-content: center; padding-bottom: 4px;
}
.swatch span {
  font-family: var(--font-mono); font-size: 0.6rem; background: rgba(255,255,255,0.85);
  padding: 1px 4px; border-radius: 3px;
}

.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 0.72rem; font-weight: 700; }
.badge-green { background: rgba(63,143,95,0.14); color: var(--green); }
.badge-amber { background: rgba(232,169,58,0.18); color: var(--amber-dark); }
.badge-red { background: rgba(194,68,68,0.14); color: var(--red); }

/* ---------- Auth modal ---------- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(20,22,26,0.5);
  display: none;
  align-items: center; justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: #fff;
  border-radius: 14px;
  width: 100%;
  max-width: 380px;
  padding: 28px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}
.modal-box h2 { font-family: var(--font-display); margin: 0 0 4px; font-size: 1.3rem; }
.modal-box .sub { color: var(--ink-soft); font-size: 0.85rem; margin: 0 0 20px; }
.modal-msg { font-size: 0.82rem; margin-top: 10px; min-height: 18px; }
.modal-msg.error { color: var(--red); }
.modal-msg.success { color: var(--green); }
.modal-close { position: absolute; top: 16px; right: 16px; background: none; border: none; color: var(--ink-soft); }
.modal-box { position: relative; }
.notice-banner {
  font-size: 0.78rem;
  color: var(--ink-soft);
  background: var(--paper-dim);
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 16px;
}

/* ---------- Tool article (SEO content) ---------- */
.tool-article {
  margin-top: 40px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.tool-article h2 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  margin: 32px 0 12px;
}
.tool-article h2:first-child { margin-top: 24px; }
.tool-article p { color: var(--ink-soft); line-height: 1.7; margin: 0 0 14px; }
.tool-article ol, .tool-article ul { color: var(--ink-soft); line-height: 1.7; padding-left: 22px; margin: 0 0 14px; }
.tool-article li { margin-bottom: 6px; }
.tool-article .faq-item { margin-bottom: 18px; }
.tool-article .faq-item h3 { font-family: var(--font-body); font-weight: 700; font-size: 0.98rem; color: var(--ink); margin: 0 0 6px; }
.tool-article .faq-item p { margin: 0; }

/* ---------- Cookie consent ---------- */
.cookie-banner {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 90;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(22,24,29,0.18);
  padding: 18px 20px;
  max-width: 720px;
  margin: 0 auto;
}
.cookie-banner-inner p {
  margin: 0 0 14px;
  font-size: 0.85rem;
  color: var(--ink-soft);
  line-height: 1.6;
}
.cookie-banner-inner p a { color: var(--steel); text-decoration: underline; }
.cookie-banner-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.cookie-pref-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.cookie-pref-row:first-of-type { border-top: none; padding-top: 4px; }
.cookie-pref-text p { margin: 4px 0 0; font-size: 0.8rem; color: var(--ink-soft); }
.cookie-pref-row .tr-checkbox p { margin: 6px 0 0 26px; font-size: 0.8rem; color: var(--ink-soft); }

@media (max-width: 520px) {
  .cookie-banner-actions { justify-content: stretch; }
  .cookie-banner-actions .btn { flex: 1; }
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 40px 0 28px;
  margin-top: 60px;
  color: var(--ink-soft);
  font-size: 0.85rem;
}
.footer-grid { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.footer-grid h4 { font-family: var(--font-display); color: var(--ink); font-size: 0.85rem; margin: 0 0 10px; }
.footer-grid a { display: block; margin-bottom: 6px; }
.footer-grid a:hover { color: var(--steel); }
.footer-categories { column-count: 2; column-gap: 24px; max-width: 320px; }
.footer-categories h4 { column-span: all; }
.footer-bottom { margin-top: 30px; padding-top: 18px; border-top: 1px solid var(--line); font-size: 0.78rem; }

/* ---------- Utility ---------- */
.mt-0 { margin-top: 0; }
.hidden { display: none !important; }

@media (max-width: 720px) {
  .header-search { display: none; }
  .header-search.mobile-open {
    display: block;
    position: absolute;
    top: 68px;
    left: 0;
    right: 0;
    max-width: none;
    padding: 10px 16px 14px;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 10px 24px rgba(22,24,29,0.1);
    z-index: 60;
  }
  .mobile-search-btn { display: inline-flex; }
  .hero-stats { gap: 22px; }
  .tool-page-head .head-row { flex-direction: column; }
}
