/*
 * Nacexia — portfolio
 * Visual direction: layout "Cartográfico" (B) + palette and type "Piedra y óxido" (C).
 * All colors live in tokens below; do not hardcode colors in components.
 */

:root {
  --bg: #F7F5F1;
  --band: #EFEBE4;
  --card: #FFFFFF;
  --ink: #2A2622;
  --ink-soft: #3D3834;
  --muted: #6F665E;          /* darker than the old #8A8075 to pass WCAG AA on --bg */
  --accent: #9B583B;
  --accent-hover: #844A31;
  --accent-soft: #F3E8E1;
  --accent-on-dark: #E0A98F;
  --line: #E4E0D9;
  --line-strong: #D2CCC2;
  --on-dark: #F7F5F1;
  --on-dark-muted: #CFC8BF;

  --font-display: "Manrope", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;

  --radius: 6px;
  --radius-lg: 14px;
  --shadow: 0 4px 18px rgba(42, 38, 34, .06);
  --container: 1120px;
  --gutter: 32px;
  --section-y: 112px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; -webkit-text-size-adjust: 100%; }
body { background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 16px; line-height: 1.6; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
ul { list-style: none; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; line-height: 1.12; letter-spacing: -.02em; color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
.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; }
.skip-link { position: absolute; left: 16px; top: -60px; background: var(--ink); color: var(--on-dark); padding: 10px 14px; border-radius: var(--radius); z-index: 200; }
.skip-link:focus { top: 12px; }

.container { max-width: var(--container); margin: 0 auto; padding: 0 var(--gutter); position: relative; }
.section { padding: var(--section-y) 0; }
.section--band { background: var(--band); }
.eyebrow { font-family: var(--font-mono); font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin-bottom: 16px; display: block; }
.section-head { max-width: 680px; margin-bottom: 56px; }
.section-head--center { margin-left: auto; margin-right: auto; text-align: center; }
.section-head h2 { font-size: clamp(1.75rem, 3.4vw, 2.4rem); }
.section-head p { margin-top: 16px; color: var(--muted); font-size: 1.08rem; }

/* ---------- Buttons & links ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: 600 .95rem var(--font-body); padding: 13px 22px; border-radius: var(--radius); border: 1px solid var(--accent); background: var(--accent); color: #fff; text-decoration: none; cursor: pointer; transition: background .2s, transform .2s, border-color .2s; }
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); transform: translateY(-1px); }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn--ghost:hover { background: var(--card); border-color: var(--ink); }
.btn--small { padding: 9px 16px; font-size: .88rem; }
.link-arrow { font-size: .9rem; font-weight: 600; text-decoration: none; border-bottom: 1px solid var(--accent); padding-bottom: 1px; }
.link-arrow:hover { color: var(--accent); }

/* ---------- Header ---------- */
.site-header { position: sticky; top: 0; z-index: 100; background: rgba(239, 235, 228, .92); backdrop-filter: saturate(1.2) blur(8px); border-bottom: 1px solid var(--line-strong); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 72px; gap: 24px; }
.brand { display: flex; align-items: center; text-decoration: none; }
.brand img { height: 40px; width: auto; }
.nav { display: flex; align-items: center; gap: 30px; }
.nav a { text-decoration: none; font-size: .93rem; color: var(--ink-soft); font-weight: 500; }
.nav a:hover { color: var(--accent); }
.nav a.btn, .nav a.btn:hover { color: #fff; }
.nav-toggle { display: none; background: none; border: 1px solid var(--line-strong); border-radius: var(--radius); width: 44px; height: 44px; cursor: pointer; align-items: center; justify-content: center; }
.nav-toggle span, .nav-toggle span::before, .nav-toggle span::after { display: block; width: 18px; height: 2px; background: var(--ink); position: relative; transition: transform .2s; }
.nav-toggle span::before, .nav-toggle span::after { content: ""; position: absolute; left: 0; }
.nav-toggle span::before { top: -6px; }
.nav-toggle span::after { top: 6px; }
.nav-toggle[aria-expanded="true"] span { background: transparent; }
.nav-toggle[aria-expanded="true"] span::before { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span::after { transform: translateY(-6px) rotate(-45deg); }

/* ---------- Hero ---------- */
.hero { background: var(--band); position: relative; overflow: hidden; }
.contours { position: absolute; right: -60px; top: -20px; width: 760px; max-width: 85%; height: auto; aspect-ratio: 640 / 560; pointer-events: none; color: var(--accent); }
.hero-inner { padding: 104px 0 96px; max-width: 700px; position: relative; z-index: 1; }
.hero h1 { font-size: clamp(2.1rem, 5vw, 3.5rem); letter-spacing: -.03em; }
.hero .lead { margin-top: 22px; font-size: 1.15rem; color: var(--muted); max-width: 54ch; }
.hero .ctas { margin-top: 34px; display: flex; gap: 12px; flex-wrap: wrap; }
.hero-proof { margin-top: 48px; display: flex; gap: 32px 72px; flex-wrap: wrap; font-size: .88rem; color: var(--muted); }
.hero-proof strong { display: block; font-family: var(--font-display); font-size: 1.5rem; color: var(--ink); letter-spacing: -.02em; }

/* ---------- Problems ---------- */
.sectors { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.sectors-hint { font-size: .85rem; color: var(--muted); margin-bottom: 32px; }
.chip { font-family: var(--font-mono); font-size: .8rem; border: 1px solid var(--line-strong); border-radius: 999px; padding: 8px 16px; color: var(--ink-soft); background: var(--card); cursor: pointer; transition: background .15s, color .15s, border-color .15s; }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.problem[hidden] { display: none; }
.problem.is-entering { animation: card-in .35s ease-out backwards; }
@keyframes card-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.problems { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.problem { padding: 28px; border-top: 2px solid var(--accent); background: var(--card); border-radius: 0 0 var(--radius-lg) var(--radius-lg); box-shadow: var(--shadow); }
.problem em { display: block; font-style: normal; font-family: var(--font-mono); font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); margin-bottom: 10px; }
.problem p { font-family: var(--font-display); font-weight: 600; font-size: 1.12rem; line-height: 1.4; color: var(--ink); }
.problem span { display: block; margin-top: 10px; font-size: .93rem; color: var(--muted); }
.problems-close { margin-top: 36px; font-size: 1.1rem; color: var(--muted); max-width: 64ch; }
.problems-close strong { color: var(--ink); }

/* ---------- Method tree ---------- */
.tree { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 26px; box-shadow: var(--shadow); }
.card h3 { font-size: 1.22rem; margin: 6px 0 10px; }
.card p { font-size: .95rem; color: var(--muted); margin-bottom: 16px; }
.tag-mono { font-family: var(--font-mono); font-size: .74rem; letter-spacing: .04em; color: var(--accent); }
.base { grid-column: 1 / -1; justify-self: center; width: min(480px, 100%); text-align: center; background: var(--ink); border-color: var(--ink); color: var(--on-dark); }
.base h3 { color: var(--on-dark); }
.base p { color: var(--on-dark-muted); }
.base .tag-mono { color: var(--accent-on-dark); }
.base .fine { font-size: .84rem; margin-top: -6px; }
.base .btn { margin-top: 4px; }
.base-mark { width: 22px; height: 22px; margin: 0 auto 12px; border: 2px solid var(--accent-on-dark); transform: rotate(45deg); }
.rays { grid-column: 1 / -1; height: 72px; color: var(--accent); }
.rays svg { width: 100%; height: 100%; display: block; }
.tree .branch { display: flex; flex-direction: column; }
.tree .branch p { flex: 1; }
.tree .branch .link-arrow { align-self: flex-start; }
.branch-mark { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); margin-bottom: 12px; }
.tree-direct { text-align: center; margin-top: 32px; color: var(--muted); }
.tree-direct strong { color: var(--ink); }

/* ---------- Branch detail ---------- */
.branch-row { display: grid; grid-template-columns: 1fr 1fr; gap: 56px; align-items: center; padding: 56px 0; border-top: 1px solid var(--line); }
.branch-row:first-of-type { border-top: 0; padding-top: 0; }
.branch-row:nth-of-type(even) .branch-media { order: -1; }
.branch-row h3 { font-size: clamp(1.5rem, 2.6vw, 1.9rem); margin-bottom: 14px; }
.branch-row > div > p { color: var(--muted); font-size: 1.04rem; }
.branch-list { margin: 20px 0 26px; display: grid; gap: 10px; }
.branch-list li { position: relative; padding-left: 26px; font-size: .97rem; }
.branch-list li::before { content: ""; position: absolute; left: 0; top: .62em; width: 12px; height: 2px; background: var(--accent); }
.example { background: var(--accent-soft); border-radius: var(--radius); padding: 14px 16px; font-size: .93rem; margin-bottom: 24px; }
.example b { font-family: var(--font-mono); font-size: .74rem; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); display: block; margin-bottom: 4px; font-weight: 500; }
.branch-media { border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow); background: var(--card); }
.branch-media figcaption { font-size: .8rem; color: var(--muted); padding: 10px 14px; border-top: 1px solid var(--line); }
.media-placeholder { aspect-ratio: 4 / 3; display: grid; place-items: center; text-align: center; padding: 32px; background: var(--band); }
.media-placeholder svg { width: 100%; max-width: 360px; height: auto; color: var(--accent); }

/* ---------- Cases ---------- */
.cases { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.case { display: flex; flex-direction: column; }
.case-logo { height: 56px; display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.case-logo img { max-height: 56px; width: auto; }
.case-logo .vapos-mark { height: 44px; width: 64px; object-fit: cover; object-position: top center; border-radius: 4px; }
.case-logo span { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; line-height: 1.2; }
.case-logo small { display: block; font-weight: 500; color: var(--muted); font-size: .82rem; }
.case-figure { font-family: var(--font-display); font-weight: 700; font-size: clamp(2rem, 3.6vw, 2.6rem); color: var(--accent); letter-spacing: -.03em; line-height: 1; }
.case-figure-label { color: var(--muted); font-size: .93rem; margin: 6px 0 20px; }
.case dl { display: grid; gap: 12px; margin-bottom: 22px; }
.case dt { font-family: var(--font-mono); font-size: .74rem; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.case dd { font-size: .95rem; color: var(--ink-soft); }
.case-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding-top: 18px; border-top: 1px solid var(--line); }
.route { font-family: var(--font-mono); font-size: .74rem; color: var(--muted); border: 1px solid var(--line-strong); padding: 5px 10px; border-radius: var(--radius); }
.cases-close { margin-top: 36px; text-align: center; color: var(--muted); font-size: 1.02rem; }
.cases-close .link-arrow { color: var(--ink); white-space: nowrap; }
.case-credit { font-size: .82rem; color: var(--muted); }
.case-media { margin: 0 0 24px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: var(--bg); }
.case-media a { display: block; }
.case-media img { width: 100%; height: 360px; object-fit: contain; object-position: center; transition: transform .3s; }
.case-media a:hover img { transform: scale(1.02); }
.case-media figcaption { font-size: .78rem; color: var(--muted); padding: 8px 12px; border-top: 1px solid var(--line); text-align: right; }

/* ---------- Calculator ---------- */
.calc { display: grid; grid-template-columns: 1.1fr .9fr; gap: 24px; align-items: start; }
.calc fieldset { border: 0; }
.calc legend { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; margin-bottom: 14px; }
.calc .step { font-family: var(--font-mono); font-size: .74rem; color: var(--accent); display: block; margin-bottom: 4px; letter-spacing: .06em; }
.process-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 30px; }
.process-option { position: relative; }
.process-option input { position: absolute; opacity: 0; pointer-events: none; }
.process-option label { display: block; height: 100%; padding: 14px 16px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--bg); cursor: pointer; font-weight: 600; font-size: .93rem; transition: border-color .15s, background .15s; }
.process-option label small { display: block; font-weight: 400; color: var(--muted); font-size: .82rem; margin-top: 2px; }
.process-option input:checked + label { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.process-option input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }
.field { margin-bottom: 20px; }
.field-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 6px; }
.field label { font-size: .93rem; font-weight: 500; }
.field input[type="number"] { width: 92px; padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius); font: 600 .95rem var(--font-mono); text-align: right; background: var(--card); color: var(--ink); }
.field input[type="range"] { width: 100%; accent-color: var(--accent); height: 28px; }
.result { position: sticky; top: 96px; background: var(--ink); color: var(--on-dark); border-color: var(--ink); }
.result .tag-mono { color: var(--accent-on-dark); }
.result .result-main { margin-bottom: 4px; font-family: var(--font-display); font-weight: 700; font-size: clamp(2rem, 4vw, 2.7rem); letter-spacing: -.03em; line-height: 1.1; margin: 8px 0 4px; color: var(--on-dark); }
.result .result-sub { margin-bottom: 0; color: var(--on-dark-muted); font-size: .95rem; }
.result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 24px 0; padding: 20px 0; border-top: 1px solid rgba(247,245,241,.15); border-bottom: 1px solid rgba(247,245,241,.15); }
.result-grid dt { font-size: .8rem; color: var(--on-dark-muted); }
.result-grid dd { font-family: var(--font-display); font-weight: 700; font-size: 1.25rem; color: var(--on-dark); }
.result .btn { width: 100%; }
.result .result-note { margin-bottom: 0; font-size: .8rem; color: var(--on-dark-muted); margin-top: 16px; line-height: 1.5; }

/* ---------- More ideas ---------- */
.ideas { display: grid; grid-template-columns: 1fr 1fr; gap: 0 48px; border-top: 1px solid var(--line-strong); }
.ideas li { position: relative; padding: 16px 0 16px 30px; border-bottom: 1px solid var(--line-strong); font-size: 1.02rem; color: var(--ink-soft); }
.ideas li::before { content: "?"; position: absolute; left: 0; top: 15px; width: 20px; height: 20px; border-radius: 50%; background: var(--card); border: 1px solid var(--accent); color: var(--accent); font: 600 .72rem/18px var(--font-mono); text-align: center; }
.ideas-cta { margin-top: 40px; display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; padding: 24px 28px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.ideas-cta p { font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; color: var(--ink); }

/* ---------- About ---------- */.about { display: grid; grid-template-columns: .75fr 1.25fr; gap: 56px; align-items: center; }
.about img { border-radius: var(--radius-lg); aspect-ratio: 4 / 5; object-fit: cover; object-position: center top; max-height: 560px; width: 100%; }
.about h2 { font-size: clamp(1.7rem, 3vw, 2.2rem); margin-bottom: 16px; }
.about p { color: var(--muted); margin-bottom: 14px; font-size: 1.04rem; }
.about-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 26px 0; }
.about-facts strong { display: block; font-family: var(--font-display); font-size: 1.5rem; color: var(--ink); letter-spacing: -.02em; }
.about-facts span { font-size: .85rem; color: var(--muted); }
.about-links { display: flex; gap: 22px; flex-wrap: wrap; }

/* ---------- Contact ---------- */
.contact { display: grid; grid-template-columns: .9fr 1.1fr; gap: 56px; align-items: start; }
.contact h2 { font-size: clamp(1.8rem, 3.4vw, 2.5rem); }
.contact-intro p { color: var(--muted); margin-top: 16px; font-size: 1.05rem; }
.contact-steps { margin-top: 28px; display: grid; gap: 14px; counter-reset: s; }
.contact-steps li { counter-increment: s; display: grid; grid-template-columns: 32px 1fr; gap: 10px; font-size: .97rem; }
.contact-steps li::before { content: counter(s, decimal-leading-zero); font-family: var(--font-mono); font-size: .8rem; color: var(--accent); padding-top: 2px; }
.signature { display: flex; align-items: center; gap: 14px; margin-top: 24px; }
.signature img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; }
.signature span { font-size: .9rem; color: var(--muted); }
.signature strong { display: block; color: var(--ink); font-size: .95rem; }
.calc-summary { margin-top: 24px; background: var(--accent-soft); border-radius: var(--radius); padding: 14px 16px; font-size: .9rem; }
.calc-summary[hidden] { display: none; }
.form-wrap { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px; min-height: 640px; box-shadow: var(--shadow); }
.form-wrap iframe { width: 100%; min-height: 720px; border: 0; border-radius: var(--radius); }
.form-fallback { font-size: .9rem; color: var(--muted); padding: 8px; }

/* ---------- Footer ---------- */
.site-footer { background: var(--ink); color: var(--on-dark-muted); padding: 56px 0 40px; position: relative; overflow: hidden; }
.site-footer .contours { color: var(--accent-on-dark); opacity: .5; top: auto; bottom: -160px; }
.footer-grid { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 40px; position: relative; z-index: 1; }
.footer-brand img { height: 36px; filter: invert(1) brightness(1.6); margin-bottom: 14px; }
.footer-brand p { font-size: .9rem; max-width: 34ch; }
.site-footer h3 { font-family: var(--font-mono); font-size: .74rem; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-on-dark); font-weight: 500; margin-bottom: 14px; }
.site-footer ul { display: grid; gap: 8px; font-size: .92rem; }
.site-footer a { text-decoration: none; color: var(--on-dark); }
.site-footer a:hover { color: var(--accent-on-dark); }
.footer-bottom { margin-top: 44px; padding-top: 22px; border-top: 1px solid rgba(247,245,241,.12); font-size: .82rem; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; position: relative; z-index: 1; }
.footer-bottom button { background: none; border: 0; color: var(--on-dark-muted); text-decoration: underline; cursor: pointer; font: inherit; }

/* ---------- Cookie banner ---------- */
.cookie-banner { position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 150; max-width: 560px; margin-left: auto; background: var(--card); border: 1px solid var(--line-strong); border-radius: var(--radius-lg); box-shadow: 0 10px 40px rgba(42,38,34,.18); padding: 20px; font-size: .9rem; }
.cookie-banner[hidden] { display: none; }
.cookie-banner p { color: var(--ink-soft); margin-bottom: 14px; }
.cookie-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Reveal on scroll (progressive: visible without JS) ---------- */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease-out, transform .6s ease-out; }
.js .reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .js .reveal { opacity: 1; transform: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  :root { --section-y: 80px; --gutter: 24px; }
  .nav-toggle { display: inline-flex; }
  .nav { position: absolute; top: 72px; left: 0; right: 0; flex-direction: column; align-items: stretch; gap: 0; background: var(--band); border-bottom: 1px solid var(--line-strong); padding: 8px var(--gutter) 20px; display: none; }
  .nav.is-open { display: flex; }
  .nav a { padding: 14px 0; border-bottom: 1px solid var(--line); }
  .nav .btn { margin-top: 14px; }
  .problems, .tree, .cases, .ideas { grid-template-columns: 1fr; }
  .rays { display: none; }
  .tree .branch { border-left: 3px solid var(--accent); }
  .branch-row, .calc, .about, .contact { grid-template-columns: 1fr; gap: 32px; }
  .branch-row:nth-of-type(even) .branch-media { order: 0; }
  .result { position: static; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  :root { --gutter: 16px; --section-y: 64px; }
  .hero-inner { padding: 64px 0 56px; }
  .contours { opacity: .6; }
  .process-options { grid-template-columns: 1fr; }
  .about-facts { grid-template-columns: 1fr 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .result-grid { grid-template-columns: 1fr; }
}

/* ---------- Layout test: centered section heads (remove the body class "layout-centered" to revert) ---------- */
.layout-centered .section .section-head { margin-left: auto; margin-right: auto; text-align: center; }
.layout-centered .sectors { justify-content: center; }
.layout-centered .sectors-hint,
.layout-centered .problems-close { text-align: center; margin-left: auto; margin-right: auto; }
.layout-centered .ideas-cta { justify-content: center; text-align: center; flex-direction: column; }
