/* GSH Genie — hoja de estilos principal */
:root {
  --bg: #f7f8f6;
  --surface: #ffffff;
  --surface-2: #eef2ec;
  --text: #1c2420;
  --muted: #5b6760;
  --line: #dfe5dd;
  --brand: #2f8f46;
  --brand-dark: #1f6b33;
  --brand-soft: #e3f2e6;
  --accent: #e0a21b;
  --danger: #c0392b;
  --ok: #2f8f46;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(20,40,25,.06);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1411; --surface: #161d18; --surface-2: #1d2620; --text: #e6ece7;
    --muted: #9aa79e; --line: #2a352d; --brand: #4cb865; --brand-dark: #6fd087;
    --brand-soft: #1c3323; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
  }
}
:root[data-theme="dark"] {
  --bg: #0f1411; --surface: #161d18; --surface-2: #1d2620; --text: #e6ece7;
  --muted: #9aa79e; --line: #2a352d; --brand: #4cb865; --brand-dark: #6fd087;
  --brand-soft: #1c3323; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.6; }
img, svg, canvas { max-width: 100%; display: block; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(2rem, 4.5vw, 3.4rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.3rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
.container { width: min(1180px, 100% - 32px); margin-inline: auto; }
.muted { color: var(--muted); }
.eyebrow { text-transform: uppercase; font-size: .78rem; letter-spacing: .12em; font-weight: 700; color: var(--brand); }

/* Logo */
.logo-img { height: 60px; width: auto; display: block; }
.logo-sub { font-size: .72rem; line-height: 1.25; font-weight: 500; color: var(--muted); border-left: 1px solid var(--line); padding-left: 12px; letter-spacing: .02em; }
.footer-brand { display: flex; align-items: center; gap: 14px; }
.footer-brand img { height: 40px; width: auto; }
/* en modo oscuro el texto marrón del logo necesita fondo claro */
:root[data-theme="dark"] .logo-img, :root[data-theme="dark"] .footer-brand img { background: #fbfaf7; border-radius: 10px; padding: 3px 8px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .logo-img, :root:not([data-theme="light"]) .footer-brand img { background: #fbfaf7; border-radius: 10px; padding: 3px 8px; } }
.nav .btn { white-space: nowrap; }
.logo-sub { white-space: nowrap; }
@media (max-width: 1180px) { .logo-sub { display: none; } }
@media (max-width: 520px) { .logo-img { height: 46px; } }

/* Header */
.site-header { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.nav { display: flex; align-items: center; justify-content: space-between; height: 76px; gap: 16px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; color: var(--text); font-size: 1.15rem; }
.logo:hover { text-decoration: none; }
.logo-mark { width: 38px; height: 38px; border-radius: 10px; background: linear-gradient(135deg, var(--brand), var(--brand-dark)); color: #fff; display: grid; place-items: center; font-size: .95rem; font-weight: 800; }
.logo small { display: block; font-weight: 500; font-size: .7rem; color: var(--muted); letter-spacing: .04em; }
.nav-links { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.nav-links a { color: var(--text); padding: 8px 12px; border-radius: 8px; font-size: .95rem; font-weight: 500; }
.nav-links a:hover, .nav-links a.active { background: var(--brand-soft); color: var(--brand-dark); text-decoration: none; }
.nav-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn { background: transparent; border: 1px solid var(--line); color: var(--text); width: 38px; height: 38px; border-radius: 10px; cursor: pointer; display: grid; place-items: center; }
.menu-toggle { display: none; }
@media (max-width: 860px) {
  .menu-toggle { display: grid; }
  .nav-links { display: none; position: absolute; top: 76px; left: 0; right: 0; flex-direction: column; background: var(--surface); border-bottom: 1px solid var(--line); padding: 12px 16px; }
  .nav-links.open { display: flex; }
  .nav .btn-primary { display: none; }
}

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 11px 20px; border-radius: 10px; font-weight: 600; font-size: .95rem; border: 1px solid transparent; cursor: pointer; transition: transform .1s, background .2s; font-family: inherit; }
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-ghost { border-color: var(--line); color: var(--text); background: var(--surface); }

/* Hero */
.hero { position: relative; overflow: hidden; padding: 72px 0 64px; }
.hero-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 48px; align-items: center; }
.hero p.lead { font-size: 1.15rem; color: var(--muted); max-width: 56ch; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }
.hero-visual { aspect-ratio: 1 / .85; border-radius: 22px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); overflow: hidden; position: relative; }
.hero-visual canvas { width: 100%; height: 100%; }
.hero-visual .tag { position: absolute; left: 14px; bottom: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: .78rem; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 40px; }
.stat { border-left: 3px solid var(--brand); padding-left: 12px; }
.stat b { display: block; font-size: 1.6rem; }
.stat span { color: var(--muted); font-size: .88rem; }
@media (max-width: 860px) { .hero-grid { grid-template-columns: 1fr; } .stats { grid-template-columns: repeat(2, 1fr); } .hero { padding-top: 40px; } }

/* Vitrina animada */
.hero-visual { aspect-ratio: auto; display: flex; flex-direction: column; }
.hero-visual canvas { width: 100%; height: auto; aspect-ratio: 4 / 3.1; }
.scene-tabs { display: flex; flex-wrap: wrap; gap: 4px; padding: 10px 10px 8px; border-bottom: 1px solid var(--line); }
.scene-tabs button { border: 1px solid var(--line); background: var(--surface); color: var(--muted); font: inherit; font-size: .78rem; font-weight: 600; padding: 4px 10px; border-radius: 999px; cursor: pointer; }
.scene-tabs button:hover { color: var(--text); border-color: var(--brand); }
.scene-tabs button.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.scene-tabs button small { font-size: .68rem; opacity: .75; margin-left: 2px; }
.scene-caption { padding: 8px 14px 12px; font-size: .82rem; color: var(--muted); border-top: 1px solid var(--line); min-height: 2.6em; }
.scene-caption .credit { font-size: .72rem; opacity: .85; }
.scene-controls { position: relative; display: flex; align-items: center; gap: 6px; padding: 8px 12px 10px; border-top: 1px solid var(--line); }
.scene-controls > button { width: 34px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-size: .8rem; cursor: pointer; display: grid; place-items: center; }
.scene-controls > button:hover { border-color: var(--brand); color: var(--brand); }
.scene-controls > button[data-a="play"] { background: var(--brand); border-color: var(--brand); color: #fff; }
.scene-dots { display: flex; gap: 6px; margin-left: 6px; }
.scene-dots button { width: 9px; height: 9px; padding: 0; border-radius: 50%; border: 0; background: var(--line); cursor: pointer; }
.scene-dots button.on { background: var(--brand); transform: scale(1.25); }
.scene-count { margin-left: auto; font-size: .75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.scene-progress { position: absolute; left: 0; right: 0; top: -1px; height: 3px; background: transparent; }
.scene-progress i { display: block; height: 100%; width: 0; background: var(--brand); }
.scene-caption .credit a { color: inherit; text-decoration: underline; }
.hero-visual canvas { background: #111; }

/* Mapas */
.map-card { padding: 20px; }
.map-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.map-head p { margin: 0; font-size: .9rem; max-width: 70ch; }
.map-controls { display: flex; gap: 10px; flex-wrap: wrap; }
.map-controls label { font-size: .78rem; color: var(--muted); font-weight: 600; display: flex; flex-direction: column; gap: 3px; margin: 0; }
.map-controls select { padding: 6px 8px; font-size: .88rem; min-width: 150px; }
.map-box { position: relative; height: 560px; border-radius: 12px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); }
@media (max-width: 700px) { .map-box { height: 420px; } }
.map-loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: .9rem; }
.wx-legend { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: .8rem; color: var(--muted); flex-wrap: wrap; }
.wx-legend .bar { height: 10px; width: 220px; border-radius: 5px; }
.wx-marker { background: none; border: none; }
.wx-marker div { transform: translate(-50%, -50%); display: inline-block; padding: 2px 6px; border-radius: 8px; font: 600 11px Inter, sans-serif; color: #111; box-shadow: 0 1px 3px rgba(0,0,0,.35); white-space: nowrap; border: 1px solid rgba(0,0,0,.25); }
.leaflet-container { font-family: var(--font); }
.wms-legend-ctl { background: rgba(255,255,255,.93); border-radius: 8px; padding: 6px 8px; box-shadow: 0 1px 6px rgba(0,0,0,.3); max-height: 300px; overflow: auto; color: #111; }
.wms-legend-ctl img { display: block; max-height: 250px; }
.wms-legend-title { display: flex; justify-content: space-between; align-items: center; gap: 8px; font: 600 11px Inter, sans-serif; margin-bottom: 4px; max-width: 220px; }
.wms-legend-title button { border: 0; background: #e5e7eb; border-radius: 4px; width: 20px; height: 18px; cursor: pointer; line-height: 1; }
.wms-legend-ctl.min img { display: none; }

/* Sections */
section { padding: 72px 0; }
.section-alt { background: var(--surface-2); }
.section-head { max-width: 720px; margin-bottom: 36px; }
.grid { display: grid; gap: 20px; }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); }
@media (max-width: 480px) { .grid-2 { grid-template-columns: 1fr; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.card .ico { width: 44px; height: 44px; border-radius: 11px; background: var(--brand-soft); color: var(--brand-dark); display: grid; place-items: center; margin-bottom: 14px; }
.card h3 { margin-bottom: 6px; }
.card p { color: var(--muted); font-size: .95rem; margin: 0; }
.card ul { margin: 10px 0 0; padding-left: 18px; color: var(--muted); font-size: .92rem; }
a.card { color: inherit; display: block; transition: border-color .2s, transform .15s; }
a.card:hover { text-decoration: none; border-color: var(--brand); transform: translateY(-2px); }
.chip { display: inline-block; font-size: .75rem; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-dark); margin: 0 4px 4px 0; }

/* Projects */
.project { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.project .thumb { aspect-ratio: 16/9; background: linear-gradient(135deg, var(--brand-soft), var(--surface-2)); display: grid; place-items: center; color: var(--brand-dark); }
.project .thumb iframe { width: 100%; height: 100%; border: 0; }
.project .thumb video { width: 100%; height: 100%; object-fit: cover; display: block; background: #111; }
.project .thumb { position: relative; overflow: hidden; }
.project .thumb > img { width: 100%; height: 100%; object-fit: cover; display: block; }
.project .thumb.slides > img { position: absolute; inset: 0; opacity: 0; transition: opacity .9s ease; }
.project .thumb.slides > img.on { opacity: 1; }
.project .thumb .slide-cap { position: absolute; left: 8px; bottom: 8px; right: 8px; font-size: .72rem; color: #fff; background: rgba(0,0,0,.55); padding: 3px 8px; border-radius: 6px; z-index: 2; }
.project[hidden] { display: none; }
.proj-filters { display: flex; flex-wrap: wrap; gap: 6px; margin: -12px 0 22px; }
.proj-filters button { border: 1px solid var(--line); background: var(--surface); color: var(--muted); font: inherit; font-size: .85rem; font-weight: 600; padding: 6px 14px; border-radius: 999px; cursor: pointer; }
.proj-filters button.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.policy { margin-top: 20px; }
.policy summary { cursor: pointer; font-size: .95rem; }
.policy p { color: var(--muted); font-size: .92rem; margin-top: 12px; }
.project .body { padding: 20px; }
.project dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; font-size: .85rem; margin: 12px 0 0; }
.project dt { color: var(--muted); }
.project dd { margin: 0; }

/* Contact */
.contact-grid { display: grid; grid-template-columns: 1fr 1.2fr; gap: 32px; }
@media (max-width: 860px) { .contact-grid { grid-template-columns: 1fr; } }
form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { form .row { grid-template-columns: 1fr; } }
label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 4px; }
input, select, textarea { width: 100%; padding: 10px 12px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-size: .95rem; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: transparent; }
.field { margin-bottom: 12px; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding: 40px 0; font-size: .9rem; color: var(--muted); }
.footer-grid { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.footer-grid a { color: var(--muted); }

/* ===== Calculadoras ===== */
.calc-layout { display: grid; grid-template-columns: 260px 1fr; gap: 28px; align-items: start; padding: 40px 0 72px; }
.calc-nav { position: sticky; top: 96px; display: flex; flex-direction: column; gap: 4px; }
.calc-nav .group { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 14px 10px 4px; }
.calc-nav button { text-align: left; background: transparent; border: 0; padding: 9px 12px; border-radius: 9px; color: var(--text); font: inherit; font-size: .93rem; cursor: pointer; }
.calc-nav button:hover { background: var(--surface-2); }
.calc-nav button.active { background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; }
@media (max-width: 900px) {
  .calc-layout { grid-template-columns: 1fr; }
  .calc-nav { position: static; flex-direction: row; overflow-x: auto; padding-bottom: 6px; }
  .calc-nav .group { display: none; }
  .calc-nav button { white-space: nowrap; border: 1px solid var(--line); }
}
.calc-panel { display: none; }
.calc-panel.active { display: block; }
.calc-head { margin-bottom: 20px; }
.calc-head .norm { font-size: .82rem; color: var(--muted); }
.calc-body { display: grid; grid-template-columns: 340px 1fr; gap: 20px; align-items: start; }
@media (max-width: 1080px) { .calc-body { grid-template-columns: 1fr; } }
.inputs .field { display: grid; grid-template-columns: 1fr 120px; align-items: center; gap: 10px; margin-bottom: 8px; }
.inputs .field label { margin: 0; font-weight: 500; font-size: .88rem; }
.inputs .field label i { font-style: normal; color: var(--muted); font-size: .8rem; }
.inputs input, .inputs select { padding: 7px 9px; font-size: .9rem; }
.inputs h4 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 16px 0 8px; }
.results { display: grid; gap: 16px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.kpi { background: var(--surface-2); border-radius: 11px; padding: 12px 14px; }
.kpi span { font-size: .78rem; color: var(--muted); display: block; }
.kpi b { font-size: 1.35rem; font-family: var(--mono); font-weight: 600; }
.kpi b small { font-size: .75rem; color: var(--muted); font-family: var(--font); font-weight: 500; }
.kpi.ok { box-shadow: inset 3px 0 0 var(--ok); }
.kpi.bad { box-shadow: inset 3px 0 0 var(--danger); }
.verdict { padding: 10px 14px; border-radius: 10px; font-weight: 600; font-size: .92rem; }
.verdict.ok { background: var(--brand-soft); color: var(--brand-dark); }
.verdict.bad { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.chart-box { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.chart-box canvas { width: 100%; height: 320px; }
.steps { font-size: .87rem; color: var(--muted); background: var(--surface-2); border-radius: 10px; padding: 12px 16px; font-family: var(--mono); white-space: pre-wrap; overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.tbl th, table.tbl td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: right; }
table.tbl th:first-child, table.tbl td:first-child { text-align: left; }
.disclaimer { font-size: .8rem; color: var(--muted); margin-top: 8px; }
