/* Paleta generada por build.py (single source: PALETTE en build.py). */
:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-2: #eef1f6;
  --text: #161c26;
  --muted: #5b6675;
  --border: #e2e7ee;
  --accent: #2f5bd6;
  --accent-ink: #ffffff;
  --accent-2: #0e9b8a;
  --accent-soft: #e8eefc;
  --accent-2-soft: #e0f5f1;
  --code-bg: #f0f2f7;
  --pro: #0e9b8a;
  --con: #d1495b;
  --shadow: rgba(20,30,50,0.08);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1117;
    --surface: #161b23;
    --surface-2: #1d232e;
    --text: #e6eaf1;
    --muted: #98a3b3;
    --border: #28303c;
    --accent: #6f92ff;
    --accent-ink: #0b1220;
    --accent-2: #2fd0b8;
    --accent-soft: #182338;
    --accent-2-soft: #12241f;
    --code-bg: #1a212b;
    --pro: #2fd0b8;
    --con: #ff7a8a;
    --shadow: rgba(0,0,0,0.4);
  }
}

/* Homelabista — hoja de estilo unica. La paleta (:root) la inyecta build.py. */

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.68 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 22px; }

img, svg, figure { max-width: 100%; }
img { height: auto; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.skip-link {
  position: absolute; left: -999px; top: 0; background: var(--accent);
  color: var(--accent-ink); padding: 10px 16px; border-radius: 0 0 8px 0; z-index: 100;
}
.skip-link:focus { left: 0; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ---------- Header ---------- */
.site-header {
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  position: sticky; top: 0; backdrop-filter: blur(10px); z-index: 20;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 62px; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--text); font-weight: 800; letter-spacing: -0.02em; }
.brand:hover { text-decoration: none; }
.brand-mark { flex: none; border-radius: 6px; }
.brand-name { font-size: 1.2rem; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a {
  color: var(--muted); font-size: 0.95rem; padding: 6px 12px; border-radius: 8px;
}
.nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }

/* ---------- Typography ---------- */
main { padding: 30px 0 64px; }
h1 { font-size: clamp(1.8rem, 4.5vw, 2.5rem); line-height: 1.15; letter-spacing: -0.025em; margin: 0 0 14px; }
h2 { font-size: clamp(1.35rem, 3vw, 1.7rem); line-height: 1.25; letter-spacing: -0.015em; margin: 2.2em 0 0.6em; }
h3 { font-size: 1.2rem; margin: 1.7em 0 0.5em; letter-spacing: -0.01em; }
h4 { font-size: 1.02rem; margin: 1.4em 0 0.4em; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
p { margin: 0 0 1.15em; }
ul, ol { margin: 0 0 1.15em; padding-left: 1.35em; }
li { margin: 0.35em 0; }
li::marker { color: var(--accent); }
strong { font-weight: 700; }
hr { border: none; border-top: 1px solid var(--border); margin: 2.2em 0; }
small { color: var(--muted); }

blockquote {
  margin: 1.5em 0; padding: 0.6em 1.2em;
  border-left: 4px solid var(--accent); background: var(--surface);
  border-radius: 0 10px 10px 0; color: var(--text);
}
blockquote p { margin: 0.3em 0; }

code {
  background: var(--code-bg); padding: 0.12em 0.42em; border-radius: 5px;
  font-size: 0.86em; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
pre {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 15px 17px; overflow-x: auto; margin: 1.5em 0; box-shadow: 0 1px 2px var(--shadow);
}
pre code { background: none; padding: 0; font-size: 0.85em; line-height: 1.55; color: var(--text); }

.meta { color: var(--muted); font-size: 0.92rem; }

/* ---------- Breadcrumbs ---------- */
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 0.86rem; color: var(--muted); margin: 0 0 14px; flex-wrap: wrap; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--accent); }
.crumbs span[aria-hidden] { opacity: 0.6; }

/* ---------- Article column ---------- */
.post, .page { max-width: 72ch; margin: 0 auto; }
.post > h1, .page > h1 { max-width: 20ch; }
.post .meta { margin: 0 0 22px; }

.hero-img {
  margin: 6px 0 26px; border-radius: 16px; overflow: hidden;
  border: 1px solid var(--border); box-shadow: 0 10px 30px -12px var(--shadow); line-height: 0;
}
.hero-img img { width: 100%; display: block; aspect-ratio: 40 / 21; object-fit: cover; }

/* Figures (photos) */
figure.fig { margin: 1.8em 0; }
figure.fig img { width: 100%; border-radius: 12px; border: 1px solid var(--border); display: block; }
figcaption { font-size: 0.85rem; color: var(--muted); margin-top: 8px; line-height: 1.5; }
figcaption .credit { display: inline; }
figcaption .credit a { color: var(--muted); text-decoration: underline; }

/* Own SVG diagrams */
figure.diagram {
  margin: 1.9em 0; padding: 20px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 14px; text-align: center;
  box-shadow: 0 1px 2px var(--shadow);
}
figure.diagram svg { width: 100%; height: auto; max-width: 640px; }
figure.diagram figcaption { text-align: center; }

/* ---------- Disclosure ---------- */
.disclosure {
  display: block; background: var(--accent-2-soft); border: 1px solid var(--border);
  border-left: 4px solid var(--accent-2); border-radius: 10px;
  padding: 13px 16px; margin: 0 0 24px; font-size: 0.93rem; color: var(--text);
}

/* ---------- Affiliate inline links ---------- */
a.aff { color: var(--accent-2); font-weight: 600; border-bottom: 1px dotted var(--accent-2); }
a.aff:hover { border-bottom-style: solid; text-decoration: none; }

/* ---------- Table of contents ---------- */
.toc {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px 20px 16px 18px; margin: 0 0 28px;
}
.toc-title { margin: 0 0 8px; font-weight: 700; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.toc ol { margin: 0; padding-left: 1.2em; }
.toc li { margin: 0.28em 0; }
.toc a { color: var(--text); }
.toc a:hover { color: var(--accent); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; margin: 1.7em 0; border: 1px solid var(--border); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; min-width: 460px; }
thead th { background: var(--surface-2); text-align: left; }
th, td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:nth-child(even) { background: color-mix(in srgb, var(--surface-2) 45%, transparent); }

/* ---------- Product box ---------- */
.product {
  display: block; background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 22px; margin: 1.9em 0; box-shadow: 0 8px 24px -16px var(--shadow);
}
.product-top { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.product-name { margin: 0; font-size: 1.22rem; }
.product-badge {
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  background: var(--accent-soft); color: var(--accent); padding: 3px 9px; border-radius: 999px;
}
.product-for { margin: 0 0 14px; color: var(--text); }
.pf-label { color: var(--muted); font-weight: 600; }
.product-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 22px; margin-bottom: 18px; }
.product-cols ul { margin: 0; padding-left: 1.2em; font-size: 0.95rem; }
.pc-h { margin: 0 0 4px; font-weight: 700; font-size: 0.9rem; }
.pros .pc-h { color: var(--pro); }
.cons .pc-h { color: var(--con); }
.pros li::marker { color: var(--pro); }
.cons li::marker { color: var(--con); }
.btn-cta {
  display: inline-block; background: var(--accent); color: var(--accent-ink);
  font-weight: 700; padding: 12px 22px; border-radius: 10px; text-align: center;
}
.btn-cta:hover { filter: brightness(1.07); text-decoration: none; }
.product-note { margin: 10px 0 0; font-size: 0.8rem; color: var(--muted); }

/* ---------- FAQ ---------- */
.faq { margin-top: 2.4em; }
.faq-item {
  border: 1px solid var(--border); border-radius: 10px; margin: 10px 0;
  background: var(--surface); overflow: hidden;
}
.faq-item summary {
  cursor: pointer; padding: 14px 18px; font-weight: 600; list-style: none;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; color: var(--accent); font-size: 1.3rem; line-height: 1; flex: none; }
.faq-item[open] summary::after { content: "\2013"; }
.faq-a { padding: 0 18px 14px; color: var(--text); }
.faq-a p { margin: 0; }

/* ---------- Home: hero ---------- */
.hero { padding: 34px 0 8px; max-width: 780px; }
.hero-kicker { color: var(--accent-2); font-weight: 700; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.08em; margin: 0 0 12px; }
.hero h1 { font-size: clamp(2rem, 5.5vw, 3rem); }
.hero-lead { font-size: 1.15rem; color: var(--muted); max-width: 640px; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 22px; }
.btn {
  display: inline-block; background: var(--accent); color: var(--accent-ink);
  font-weight: 700; padding: 12px 24px; border-radius: 10px;
}
.btn:hover { filter: brightness(1.07); text-decoration: none; }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--surface-2); filter: none; }

/* ---------- Home: guides grid ---------- */
.guides { margin-top: 52px; }
.guides > h2 { margin-bottom: 20px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 22px; }
.card {
  display: flex; flex-direction: column; background: var(--surface);
  border: 1px solid var(--border); border-radius: 16px; overflow: hidden;
  box-shadow: 0 6px 22px -16px var(--shadow); transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 14px 32px -18px var(--shadow); }
.card-thumb { display: block; line-height: 0; border-bottom: 1px solid var(--border); }
.card-thumb img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; }
.card-body { padding: 18px 20px 20px; display: flex; flex-direction: column; flex: 1; }
.card h2 { margin: 0 0 6px; font-size: 1.2rem; line-height: 1.28; }
.card h2 a { color: var(--text); }
.card h2 a:hover { color: var(--accent); text-decoration: none; }
.card .meta { margin: 0 0 10px; font-size: 0.85rem; }
.card-desc { color: var(--muted); font-size: 0.96rem; margin: 0 0 16px; flex: 1; }
.more { font-weight: 700; color: var(--accent); }
.card:hover .more { text-decoration: underline; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); padding: 42px 0 34px; margin-top: 40px; color: var(--muted); font-size: 0.92rem; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 28px; }
.footer-brand .brand-name { font-weight: 800; font-size: 1.1rem; color: var(--text); }
.footer-brand .tagline { margin: 8px 0; }
.footer-disclosure { font-size: 0.85rem; line-height: 1.6; max-width: 46ch; }
.footer-nav { display: flex; flex-direction: column; gap: 8px; }
.footer-h { margin: 0 0 2px; font-weight: 700; color: var(--text); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; }
.footer-nav a { color: var(--muted); }
.footer-nav a:hover { color: var(--accent); }
.copy { margin: 30px 0 0; font-size: 0.82rem; border-top: 1px solid var(--border); padding-top: 18px; }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  body { font-size: 16px; }
  main { padding: 22px 0 48px; }
  .product-cols { grid-template-columns: 1fr; gap: 4px; }
  .footer-grid { grid-template-columns: 1fr; gap: 22px; }
  .hero { padding-top: 20px; }
  .nav a { padding: 6px 9px; }
}

.footer-amazon { font-size: 0.8rem; line-height: 1.55; max-width: 46ch; color: var(--muted); margin-top: 8px; }
