:root {
  --bg: #ffffff;
  --surface: #f6f7f9;
  --text: #1c1f24;
  --muted: #5b6270;
  --border: #e2e5ea;
  --radius: 12px;
  --maxw: 760px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --surface: #1d2026;
    --text: #e8eaee;
    --muted: #a3a9b5;
    --border: #2c3038;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.7 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--brand); }
img { max-width: 100%; height: auto; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }
.wide { max-width: 1040px; }

/* Cabecera */
.site-header { border-bottom: 1px solid var(--border); background: var(--bg); position: sticky; top: 0; z-index: 10; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 60px; flex-wrap: wrap; }
.logo { font-weight: 800; font-size: 1.2rem; color: var(--text); text-decoration: none; display: flex; align-items: center; gap: 8px; }
.logo span { color: var(--brand); }
.site-header nav { display: flex; gap: 18px; font-size: .95rem; }
.site-header nav a { color: var(--muted); text-decoration: none; }
.site-header nav a:hover { color: var(--brand); }

/* Portada */
.hero { padding: 56px 0 32px; text-align: center; }
.hero h1 { font-size: clamp(1.8rem, 5vw, 2.6rem); line-height: 1.2; margin: 0 0 12px; }
.hero p { color: var(--muted); font-size: 1.1rem; margin: 0 auto; max-width: 600px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; padding: 8px 0 32px; }
h2.cat { font-size: 1.15rem; margin: 16px 0 4px; padding-bottom: 6px; border-bottom: 2px solid var(--brand); display: inline-block; }
.home-intro { padding: 8px 16px 48px; color: var(--muted); }
.home-intro h2 { color: var(--text); font-size: 1.3rem; }
.card {
  display: block; padding: 20px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); text-decoration: none; color: var(--text);
  transition: transform .15s, border-color .15s;
}
.card:hover { transform: translateY(-2px); border-color: var(--brand); }
.card .icon { font-size: 1.8rem; }
.card h3 { font-size: 1.1rem; margin: 8px 0 6px; line-height: 1.35; }
.card p { margin: 0; color: var(--muted); font-size: .93rem; line-height: 1.5; }
.tag { display: inline-block; font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--brand); }

/* Artículo */
article { padding: 32px 0 48px; }
article h1 { font-size: clamp(1.6rem, 4.5vw, 2.2rem); line-height: 1.25; margin: 8px 0 8px; }
article .meta { color: var(--muted); font-size: .9rem; margin-bottom: 24px; }
article h2 { font-size: 1.4rem; margin-top: 2em; line-height: 1.3; }
article h3 { font-size: 1.15rem; margin-top: 1.6em; }
article li { margin-bottom: .4em; }
.breadcrumbs { font-size: .85rem; color: var(--muted); padding-top: 20px; }
.breadcrumbs a { color: var(--muted); }

.note {
  border-left: 4px solid var(--brand); background: var(--surface);
  padding: 12px 16px; border-radius: 0 var(--radius) var(--radius) 0; margin: 1.5em 0;
}
table { width: 100%; border-collapse: collapse; margin: 1.2em 0; font-size: .95rem; display: block; overflow-x: auto; }
th, td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; }
th { background: var(--surface); }

/* Herramientas / calculadoras */
.tool {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; margin: 24px 0;
}
.tool .row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.tool label { display: block; font-size: .88rem; font-weight: 600; margin-bottom: 4px; }
.tool input, .tool select {
  width: 100%; padding: 10px 12px; font: inherit; font-size: 1rem;
  border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text);
}
.tool input:focus, .tool select:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.tool button {
  margin-top: 16px; padding: 11px 22px; font: inherit; font-weight: 700; border: 0; border-radius: 8px;
  background: var(--brand); color: #fff; cursor: pointer;
}
.result { margin-top: 18px; padding: 14px 16px; border-radius: 8px; background: var(--bg); border: 1px dashed var(--brand); }
.result:empty { display: none; }
.result strong { font-size: 1.3rem; color: var(--brand); }

.related { border-top: 1px solid var(--border); padding-top: 24px; margin-top: 40px; }
.related ul { padding-left: 1.1em; }

/* Pie */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); padding: 28px 0; font-size: .88rem; color: var(--muted); }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-bottom: 10px; }
.site-footer a { color: var(--muted); }

@media (max-width: 560px) {
  body { font-size: 16px; }
  .site-header nav { gap: 12px; font-size: .88rem; }
  .hero { padding: 36px 0 20px; }
}
