/* =========================================================
   multiplicado.com — design tokens
   ========================================================= */
:root {
  --bg: #F7F8FA;
  --surface: #FFFFFF;
  --ink: #14213D;
  --ink-muted: #57627A;
  --border: #DEE3E8;
  --border-strong: #C7CEDA;

  --cat-mate: #2A6F6F;
  --cat-mate-bg: #EAF2F1;
  --cat-conv: #2E5C94;
  --cat-conv-bg: #EAF0F8;
  --cat-fin: #B4720F;
  --cat-fin-bg: #FBF1E1;
  --cat-web: #7A4E9E;
  --cat-web-bg: #F2EBF7;
  --cat-id: #A23B3B;
  --cat-id-bg: #F7E9E9;
  --cat-util: #4C7A3D;
  --cat-util-bg: #EAF3E5;

  --radius-sm: 5px;
  --radius-md: 8px;

  --font-display: 'Space Grotesk', 'IBM Plex Sans', sans-serif;
  --font-body: 'IBM Plex Sans', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', 'SFMono-Regular', Menlo, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  margin: 0 0 0.4em 0;
  letter-spacing: -0.01em;
}

p { margin: 0 0 1em 0; color: var(--ink-muted); }

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

button { font-family: inherit; cursor: pointer; }

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--cat-conv);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* =========================================================
   Header
   ========================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(247, 248, 250, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 32px;
  height: 64px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--ink);
  background: none;
  border: none;
  padding: 0;
  flex-shrink: 0;
}
.logo strong { font-weight: 700; color: var(--cat-mate); }
.logo svg { color: var(--ink); flex-shrink: 0; }

.main-nav {
  display: flex;
  gap: 4px;
  flex: 1;
}

.nav-link {
  background: none;
  border: none;
  color: var(--ink-muted);
  font-size: 0.9rem;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
}
.nav-link:hover { color: var(--ink); background: var(--surface); }

.header-search { flex-shrink: 0; }
.header-search input {
  width: 220px;
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  background: var(--surface);
  color: var(--ink);
}
.header-search input:focus { border-color: var(--cat-conv); outline: none; }

@media (max-width: 860px) {
  .main-nav { display: none; }
  .header-search input { width: 160px; }
}

/* =========================================================
   Hero
   ========================================================= */
.hero { padding: 64px 0 56px; }

.hero-inner {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 56px;
  align-items: center;
}

.hero-text h1 {
  font-size: clamp(2rem, 4vw, 2.75rem);
  line-height: 1.1;
  margin-bottom: 0.5em;
}

.hero-text p {
  font-size: 1.05rem;
  max-width: 46ch;
  margin-bottom: 1.6em;
}

.hero-search input {
  width: 100%;
  max-width: 440px;
  padding: 14px 16px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-md);
  font-size: 0.98rem;
  background: var(--surface);
  color: var(--ink);
}
.hero-search input:focus { border-color: var(--cat-mate); outline: none; }

.demo-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 22px 22px;
  box-shadow: 0 1px 2px rgba(20, 33, 61, 0.04);
}

.demo-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--ink-muted);
  margin-bottom: 18px;
}

.demo-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cat-mate);
  flex-shrink: 0;
}

.demo-label {
  display: block;
  font-size: 0.8rem;
  color: var(--ink-muted);
  margin-bottom: 6px;
}

.demo-input {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--cat-mate);
  border-radius: var(--radius-sm);
  font-size: 1.1rem;
  font-family: var(--font-mono);
  color: var(--ink);
  margin-bottom: 18px;
  background: var(--cat-mate-bg);
}
.demo-input:focus { outline: none; }

.demo-outputs { display: flex; flex-direction: column; gap: 10px; }
.demo-out-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--ink-muted);
}
.demo-out-row output {
  font-size: 1.02rem;
  color: var(--ink);
  font-weight: 500;
}

@media (max-width: 780px) {
  .hero-inner { grid-template-columns: 1fr; gap: 32px; }
}

/* =========================================================
   Category sections & tool cards
   ========================================================= */
.category-section { padding: 40px 0; }
.category-section:last-of-type { padding-bottom: 72px; }

.category-heading { margin-bottom: 24px; padding-left: 14px; border-left: 3px solid; }
.category-heading h2 { font-size: 1.4rem; margin-bottom: 0.2em; }
.category-heading p { margin: 0; font-size: 0.95rem; }

.category-heading.cat-mate { border-color: var(--cat-mate); }
.category-heading.cat-conv { border-color: var(--cat-conv); }
.category-heading.cat-fin { border-color: var(--cat-fin); }
.category-heading.cat-web { border-color: var(--cat-web); }
.category-heading.cat-id { border-color: var(--cat-id); }
.category-heading.cat-util { border-color: var(--cat-util); }

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.tool-card {
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: border-color 0.15s ease, transform 0.1s ease;
}
.tool-card:hover { transform: translateY(-1px); }
.tool-card.cat-mate:hover, .tool-card.cat-mate:focus-visible { border-left-color: var(--cat-mate); }
.tool-card.cat-conv:hover, .tool-card.cat-conv:focus-visible { border-left-color: var(--cat-conv); }
.tool-card.cat-fin:hover, .tool-card.cat-fin:focus-visible { border-left-color: var(--cat-fin); }
.tool-card.cat-web:hover, .tool-card.cat-web:focus-visible { border-left-color: var(--cat-web); }
.tool-card.cat-id:hover, .tool-card.cat-id:focus-visible { border-left-color: var(--cat-id); }
.tool-card.cat-util:hover, .tool-card.cat-util:focus-visible { border-left-color: var(--cat-util); }

.tool-card-icon {
  width: 30px; height: 30px;
  margin-bottom: 8px;
}
.tool-card-icon svg { width: 100%; height: 100%; }
.tool-card.cat-mate .tool-card-icon { color: var(--cat-mate); }
.tool-card.cat-conv .tool-card-icon { color: var(--cat-conv); }
.tool-card.cat-fin .tool-card-icon { color: var(--cat-fin); }
.tool-card.cat-web .tool-card-icon { color: var(--cat-web); }
.tool-card.cat-id .tool-card-icon { color: var(--cat-id); }
.tool-card.cat-util .tool-card-icon { color: var(--cat-util); }

.tool-card h3 {
  font-size: 1rem;
  font-family: var(--font-body);
  font-weight: 600;
  margin: 0;
}
.tool-card p { font-size: 0.87rem; margin: 0; color: var(--ink-muted); }

.no-results {
  text-align: center;
  padding: 48px 0;
  color: var(--ink-muted);
}

/* =========================================================
   Tool views
   ========================================================= */
.tool-view { padding: 40px 0 80px; }

.back-link {
  background: none;
  border: none;
  color: var(--ink-muted);
  font-size: 0.88rem;
  padding: 6px 0;
  margin-bottom: 20px;
}
.back-link:hover { color: var(--ink); }
.back-link::before { content: '← '; }

.tool-head { padding-left: 16px; border-left: 3px solid; margin-bottom: 28px; }
.tool-head.cat-mate { border-color: var(--cat-mate); }
.tool-head.cat-conv { border-color: var(--cat-conv); }
.tool-head.cat-fin { border-color: var(--cat-fin); }
.tool-head.cat-web { border-color: var(--cat-web); }
.tool-head.cat-id { border-color: var(--cat-id); }
.tool-head.cat-util { border-color: var(--cat-util); }
.tool-head h1 { font-size: 1.7rem; }
.tool-head p { max-width: 58ch; margin: 0; }

.tool-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 28px 28px 30px;
  max-width: 720px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
  margin-bottom: 8px;
}
.field-grid-narrow { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); max-width: 420px; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 0.83rem; color: var(--ink-muted); font-weight: 500; }

input[type="text"], input[type="number"], input[type="date"], select, textarea {
  padding: 10px 12px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 0.98rem;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--surface);
  width: 100%;
}
textarea { font-family: var(--font-body); resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--cat-conv); }
.mono { font-family: var(--font-mono); }

.tool-note { font-size: 0.85rem; color: var(--ink-muted); margin-top: 6px; }

.results-box {
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.result-line {
  font-size: 0.95rem;
  color: var(--ink-muted);
  margin: 0 0 8px 0;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.result-value {
  color: var(--ink);
  font-weight: 600;
  font-size: 1rem;
}

.sub-tool { padding: 18px 0; border-bottom: 1px solid var(--border); }
.sub-tool:last-child { border-bottom: none; padding-bottom: 0; }
.sub-tool:first-child { padding-top: 0; }
.sub-tool h3 { font-size: 0.98rem; font-family: var(--font-body); font-weight: 600; margin-bottom: 12px; }

/* Multiplication table */
.mult-table {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
  margin-top: 12px;
}
.mult-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 10px;
  background: var(--cat-mate-bg);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.92rem;
}
.mult-row span:last-child { font-weight: 600; }

/* Color tool */
.color-layout { display: flex; gap: 24px; align-items: flex-start; flex-wrap: wrap; }
.color-swatch {
  width: 96px; height: 96px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.color-layout .field-grid { flex: 1; min-width: 220px; }

/* Password tool */
.pass-output-row {
  display: flex;
  gap: 10px;
  margin-bottom: 22px;
}
.pass-output {
  flex: 1;
  padding: 14px 16px;
  background: var(--cat-web-bg);
  border: 1.5px solid var(--cat-web);
  border-radius: var(--radius-sm);
  font-size: 1.05rem;
  word-break: break-all;
}
.checkbox-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 24px;
  margin: 14px 0 22px;
  font-size: 0.9rem;
  color: var(--ink-muted);
}
.checkbox-row label { display: flex; align-items: center; gap: 7px; }
input[type="range"] { width: 100%; accent-color: var(--cat-web); margin-top: 6px; }
input[type="checkbox"] { accent-color: var(--cat-web); width: 16px; height: 16px; }

.btn-primary, .btn-secondary {
  border-radius: var(--radius-sm);
  padding: 11px 18px;
  font-size: 0.92rem;
  font-weight: 500;
  border: 1.5px solid transparent;
}
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: #223058; }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--border-strong); }
.btn-secondary:hover { border-color: var(--ink); }

/* Base64 */
.b64-buttons { display: flex; gap: 10px; margin: 4px 0 20px; flex-wrap: wrap; }

/* Text counter */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 12px;
  margin-top: 18px;
}
.stat-box {
  background: var(--cat-web-bg);
  border-radius: var(--radius-sm);
  padding: 14px 12px;
  text-align: center;
}
.stat-value { display: block; font-size: 1.4rem; font-weight: 600; color: var(--cat-web); margin-bottom: 2px; }
.stat-box span { font-size: 0.78rem; color: var(--ink-muted); }

/* Word frequency */
.checkbox-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--ink-muted);
  margin: 4px 0 18px;
}
.freq-list { display: flex; flex-direction: column; gap: 8px; }
.freq-row {
  display: grid;
  grid-template-columns: 100px 1fr 84px;
  align-items: center;
  gap: 12px;
  font-size: 0.87rem;
}
.freq-word {
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.freq-bar-track {
  background: var(--cat-web-bg);
  border-radius: 4px;
  height: 10px;
  overflow: hidden;
}
.freq-bar { background: var(--cat-web); height: 100%; border-radius: 4px; }
.freq-count { color: var(--ink-muted); text-align: right; }

/* Fractions */
.fraction-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.fraction-input, .fraction-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.fraction-input input {
  width: 64px;
  text-align: center;
  padding: 8px 6px;
}
.fraction-bar {
  width: 64px;
  height: 2px;
  background: var(--ink);
}
.fraction-result .fraction-bar { background: var(--cat-mate); }
.fraction-result output {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--cat-mate);
  min-width: 40px;
  text-align: center;
}
.fraction-eq { font-size: 1.3rem; color: var(--ink-muted); }
#fr-op { width: auto; padding: 8px 10px; }

/* Case converter */
.case-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 18px;
}

/* Stopwatch / Timer */
.stopwatch-display {
  font-family: var(--font-mono);
  font-size: 2.6rem;
  font-weight: 600;
  text-align: center;
  color: var(--cat-util);
  background: var(--cat-util-bg);
  border-radius: var(--radius-md);
  padding: 28px 16px;
  margin-bottom: 20px;
  letter-spacing: 0.02em;
}
.stopwatch-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.lap-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 220px;
  overflow-y: auto;
}
.lap-list li {
  display: flex;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.9rem;
}
.lap-list li:first-child { border-top: 1px solid var(--border); }
#tm-inputs { justify-content: center; margin: 0 auto 4px; }

/* Identity validator */
.id-result {
  margin: 16px 0;
  padding: 16px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 1.02rem;
  display: none;
}
.id-result.valid { display: block; background: var(--cat-util-bg); color: var(--cat-util); border: 1.5px solid var(--cat-util); }
.id-result.invalid { display: block; background: var(--cat-id-bg); color: var(--cat-id); border: 1.5px solid var(--cat-id); }
.id-result.partial { display: block; background: var(--cat-fin-bg); color: var(--cat-fin); border: 1.5px solid var(--cat-fin); }

/* File input (PDF reader) */
input[type="file"] {
  font-size: 0.85rem;
  color: var(--ink-muted);
  padding: 0;
  border: none;
}
input[type="file"]::file-selector-button {
  margin-right: 12px;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}
input[type="file"]::file-selector-button:hover { border-color: var(--ink); }

/* =========================================================
   Footer
   ========================================================= */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 48px 0 0;
}
.footer-inner {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 48px;
  padding-bottom: 32px;
}
.footer-inner > div:first-child p { font-size: 0.88rem; max-width: 34ch; margin-top: 12px; }
.logo-footer { pointer-events: none; }

.footer-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 24px;
}
.footer-links h4 { font-size: 0.8rem; text-transform: none; color: var(--ink); margin: 0 0 10px; font-family: var(--font-body); font-weight: 600; }
.footer-links button {
  display: block;
  background: none;
  border: none;
  color: var(--ink-muted);
  font-size: 0.85rem;
  padding: 5px 0;
  text-align: left;
  width: 100%;
}
.footer-links button:hover { color: var(--cat-mate); }

.footer-bottom {
  border-top: 1px solid var(--border);
  padding: 16px 0 20px;
}
.footer-bottom p { font-size: 0.78rem; margin: 0; color: var(--ink-muted); }

@media (max-width: 780px) {
  .footer-inner { grid-template-columns: 1fr; }
  .footer-links { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 500px) {
  .header-inner { gap: 12px; }
  .header-search input { width: 120px; }
  .tool-panel { padding: 20px 18px 22px; }
}


/* QA/accessibility refinements */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }
button, input, select, textarea { -webkit-tap-highlight-color: transparent; }
@media (max-width: 860px) {
  .site-header { position: sticky; }
  .header-inner { min-height: 64px; height: auto; padding-top: 8px; padding-bottom: 8px; }
  .header-search { flex: 1; min-width: 0; }
  .header-search input { width: 100%; }
}
@media (max-width: 500px) {
  .container { padding-left: 16px; padding-right: 16px; }
  .hero { padding-top: 40px; }
  .tool-grid { grid-template-columns: 1fr; }
  .result-line { align-items: flex-start; flex-direction: column; gap: 2px; }
}


/* v2.1 static SEO routes */
.tool-card { text-decoration: none; color: inherit; }
.footer-links a { display:block; background:none; border:none; padding:3px 0; color:var(--ink-muted); text-decoration:none; font-size:.84rem; }
.footer-links a:hover { color:var(--ink); }
.nav-link-static { text-decoration:none; display:inline-flex; align-items:center; }
.footer-bottom-inner { display:flex; justify-content:space-between; gap:20px; align-items:center; flex-wrap:wrap; }
.legal-links { display:flex; gap:16px; flex-wrap:wrap; }
.legal-links a { color:var(--ink-muted); text-decoration:none; font-size:.84rem; }
.legal-links a:hover { color:var(--ink); text-decoration:underline; }
.tool-seo-intro { margin-top:12px !important; }
@media (max-width: 640px) { .tool-panel,.static-content{padding:22px 18px}.legal-links{gap:12px} }

/* v2.2 footer + standalone page refinements */
.copyright { margin: 0; font-size: .82rem; color: var(--ink-muted); }
.footer-bottom-inner { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px 24px; }
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
@media (max-width: 640px) { .footer-bottom-inner { align-items:flex-start; flex-direction:column; } .copyright { order: 3; } }
