/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --bg:        #f4f4ef;
  --bg-2:      #e8e8de;
  --panel:     #ffffff;
  --ink:       #16170f;
  --ink-deep:  #202117;
  --ink-soft:  #3a3c2f;
  --ink-mute:  #6c6e5f;
  --accent:    #8bc217;
  --accent-dark: #628c0e;
  --accent-ink:#16170f;
  --eco:       #4f6b4a;
  --line:      #16170f;
  --cream:     #f4f4ef;

  --display: "Poppins", "Segoe UI", sans-serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", "Consolas", monospace;

  --ease-out:  cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in:   cubic-bezier(0.7, 0, 0.84, 0);
  --ease-soft: cubic-bezier(0.25, 0.46, 0.45, 0.94);

  --nav-h: 72px;
}

/* =============================================================
   2. Reset & base
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; tab-size: 2; scroll-behavior: smooth; overflow-x: clip; }
body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
  overscroll-behavior-y: none;
}
img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
p { text-wrap: pretty; }
h1, h2, h3, h4 { text-wrap: balance; line-height: 0.98; letter-spacing: -0.01em; font-family: var(--display); font-weight: 700; text-transform: uppercase; }
ul { list-style: none; padding: 0; }
::selection { background: var(--accent); color: var(--accent-ink); }

:focus-visible {
  outline: 2px solid var(--accent-dark);
  outline-offset: 3px;
}

.skip-link {
  position: fixed; top: -100px; left: 1rem;
  padding: .6rem 1rem; background: var(--ink); color: var(--bg);
  z-index: 9999; font-weight: 600; font-family: var(--mono); font-size: 0.8rem;
}
.skip-link:focus { top: 1rem; }

/* =============================================================
   3. Utilities
   ============================================================= */
.container { max-width: 1440px; margin-inline: auto; padding-inline: 1.25rem; }
@media (min-width: 720px)  { .container { padding-inline: 2rem; } }
@media (min-width: 1280px) { .container { padding-inline: 3rem; } }

.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;
}

.mono { font-family: var(--mono); }

.kicker {
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.kicker::before {
  content: "";
  width: 8px; height: 8px;
  background: var(--accent);
  display: inline-block;
}

.section {
  padding-block: clamp(4rem, 9vw, 8rem);
  border-top: 1px solid var(--line);
}

.section-head {
  display: grid;
  gap: 1rem;
  margin-bottom: clamp(2.5rem, 5vw, 4.5rem);
}
.section-head .kicker {
  margin-bottom: 1.5rem;
}
@media (min-width: 1180px) {
  .section-head { grid-template-columns: 1fr 1fr; align-items: end; }
}
.section-head h2 {
  font-size: clamp(2.2rem, 5.5vw, 4.4rem);
}
@media (min-width: 1180px) {
  /* Column is only ~half the container once split — scale down so long
     headings settle at two lines instead of stretching to four. */
  .section-head h2 { font-size: clamp(2.2rem, 3.4vw, 3.6rem); }
}
.section-head .section-desc {
  font-size: 1.05rem;
  color: var(--ink-soft);
  max-width: 44ch;
}

/* =============================================================
   4. Grid system (brutalist — hairlines via background)
   ============================================================= */
.grid-12 {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}
.grid-12 > * {
  background: var(--bg);
  padding: 1.75rem;
}
@media (max-width: 719px) {
  .grid-12 { grid-template-columns: 1fr; }
}

#servicios .grid-12 .num-block { grid-column: span 12; }
@media (min-width: 720px) {
  #servicios .grid-12 .num-block { grid-column: span 6; }
}

/* =============================================================
   5. Cursor coordinates (signature effect)
   ============================================================= */
.cursor-coord {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink);
  background: var(--bg);
  padding: 3px 7px;
  border: 1px solid var(--ink);
  transform: translate(18px, 18px);
  opacity: 0;
  transition: opacity 0.2s;
  white-space: nowrap;
}
.cursor-coord.is-visible { opacity: 1; }
@media (hover: none), (max-width: 959px) { .cursor-coord { display: none; } }

/* =============================================================
   6. Components
   ============================================================= */

/* Buttons — hard edges, instant hover invert */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.95rem 1.6rem;
  font-family: var(--mono);
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 500;
  border: 1px solid var(--ink);
  border-radius: 0;
  transition: background-color .12s linear, color .12s linear, border-color .12s linear;
}
.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--ink);
}
.btn-ghost:hover { background: var(--ink); color: var(--bg); }

/* Nav */
.nav {
  position: fixed; top: 0; inset-inline: 0; z-index: 100;
  height: var(--nav-h);
  display: flex; align-items: center;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  width: 100%;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem;
}
.nav-logo {
  display: flex;
  align-items: center;
}
.nav-logo img {
  height: 36px;
  width: auto;
  display: block;
}
@media (min-width: 540px) { .nav-logo img { height: 42px; } }
.nav-links {
  display: none;
  gap: 0;
  border: 1px solid var(--line);
}
@media (min-width: 860px) { .nav-links { display: flex; } }
.nav-link {
  padding: 0.6rem 1rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-left: 1px solid var(--line);
  transition: background-color .12s linear, color .12s linear;
}
.nav-link:first-child { border-left: 0; }
.nav-link:hover { background: var(--ink); color: var(--bg); }

.nav-cta { display: none; }
@media (min-width: 860px) { .nav-cta { display: inline-flex; } }

.nav-burger {
  display: inline-flex;
  border: 1px solid var(--line);
  padding: 0.55rem 0.7rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  text-transform: uppercase;
}
@media (min-width: 860px) { .nav-burger { display: none; } }

.nav-mobile {
  position: fixed; inset: var(--nav-h) 0 0 0; z-index: 99;
  background: var(--bg);
  transform: translateY(-101%);
  transition: transform .5s var(--ease-soft);
  overflow-y: auto;
}
.nav-mobile[data-open="true"] { transform: translateY(0); }
.nav-mobile-list { display: grid; }
.nav-mobile-list a {
  padding: 1.4rem 1.25rem;
  border-top: 1px solid var(--line);
  font-family: var(--display);
  font-size: 1.6rem;
  text-transform: uppercase;
}
.nav-mobile-list a:hover { background: var(--ink); color: var(--bg); }
.nav-mobile-foot { padding: 1.5rem 1.25rem; border-top: 1px solid var(--line); }

/* Numbered blocks (services / process) */
.num-block {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.9rem;
  transition: background-color .15s linear, color .15s linear;
}
.num-block .num {
  font-family: var(--mono);
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--accent-dark);
}
.num-block:hover .num { color: currentColor; }
.num-block h3 {
  font-size: 1.5rem;
  text-transform: none;
}
.num-block p {
  font-size: 0.95rem;
  color: var(--ink-soft);
  max-width: 36ch;
}
.num-block:hover { background: var(--ink); color: var(--bg); }
.num-block:hover p { color: rgba(240,239,233,0.75); }

/* Process — horizontal steps */
.process-row {
  display: grid;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  grid-template-columns: 1fr;
}
@media (min-width: 720px) { .process-row { grid-template-columns: repeat(4, 1fr); } }
.process-step {
  background: var(--bg);
  padding: 2rem 1.6rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 220px;
}
.process-step .num {
  font-family: var(--mono);
  font-size: 2.2rem;
  color: var(--accent-dark);
}
.process-step h3 { font-size: 1.15rem; text-transform: none; }
.process-step p { font-size: 0.9rem; color: var(--ink-soft); }

/* Stats */
.stats-row {
  display: grid;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  grid-template-columns: 1fr;
}
@media (min-width: 640px) { .stats-row { grid-template-columns: repeat(3, 1fr); } }
.stat-card {
  background: var(--bg);
  padding: 2.2rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.stat-num {
  font-family: var(--display);
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  color: var(--ink);
  line-height: 1;
}
.stat-num .suffix { color: var(--accent-dark); }
.stat-label {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink-deep);
  letter-spacing: 0.02em;
}

/* Gallery */
.gallery-grid {
  display: grid;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  grid-template-columns: 1fr;
}
@media (min-width: 640px) { .gallery-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .gallery-grid { grid-template-columns: repeat(3, 1fr); } }
.gallery-item {
  position: relative;
  background: var(--bg);
  aspect-ratio: 4 / 3;
  overflow: hidden;
  isolation: isolate;
}
.gallery-item img {
  width: 100%; height: 100%; object-fit: cover;
  object-position: center;
  filter: saturate(1.05) contrast(1.02);
  transform: scale(1.01);
  transition: filter .5s var(--ease-out), transform .7s var(--ease-out);
}
.gallery-item img[src*="planta-3"] { object-position: left center; }
.gallery-item:hover img { filter: saturate(1.15); transform: scale(1.06); }
.gallery-caption {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 0.85rem 1rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  color: var(--bg);
  background: rgba(21,20,15,0.82);
  transform: translateY(100%);
  transition: transform .3s var(--ease-out);
}
.gallery-item:hover .gallery-caption { transform: translateY(0); }

/* Manifesto / about */
.manifesto {
  display: grid;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  grid-template-columns: 1fr;
}
.manifesto > div {
  background: var(--bg);
  padding: clamp(1.75rem, 4vw, 2.75rem);
}
@media (min-width: 1180px) {
  .manifesto { grid-template-columns: 7fr 5fr; }
  .manifesto > div:last-child { display: flex; flex-direction: column; justify-content: center; }
}
.manifesto h2 {
  font-size: clamp(2.4rem, 6vw, 5rem);
}
.manifesto .lead {
  font-size: 1.1rem;
  color: var(--ink-soft);
  max-width: 48ch;
}
.manifesto .verbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-top: 1.5rem;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--ink-mute);
  text-transform: uppercase;
}

/* Contact */
.contact-grid {
  display: grid;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  grid-template-columns: 1fr;
}
@media (min-width: 1180px) { .contact-grid { grid-template-columns: 5fr 7fr; } }
.contact-info {
  background: var(--bg);
  padding: 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  min-width: 0;
}
.contact-map {
  background: var(--bg);
  min-height: 320px;
  min-width: 0;
}
.contact-map iframe {
  width: 100%;
  height: 100%;
  min-height: 320px;
  border: 0;
  display: block;
}
.contact-info-item { display: flex; flex-direction: column; gap: 0.35rem; }
.contact-info-item .label {
  font-family: var(--mono); font-size: 0.75rem; text-transform: uppercase;
  color: var(--ink-mute); letter-spacing: 0.06em;
}
.contact-info-item .value { font-size: 1.1rem; overflow-wrap: anywhere; }
.contact-info-item a:hover { color: var(--accent-dark); text-decoration: underline; }

/* Footer */
.footer {
  border-top: 1px solid var(--line);
  padding-block: 3rem 1.75rem;
}
.footer-top {
  display: grid;
  gap: 2rem;
  margin-bottom: 2.5rem;
}
@media (min-width: 720px) { .footer-top { grid-template-columns: 1.4fr 1fr 1fr; } }
.footer-brand .nav-logo { margin-bottom: 0.8rem; }
.footer-brand p { color: var(--ink-soft); max-width: 34ch; font-size: 0.92rem; }
.footer-col h4 {
  font-family: var(--mono); font-size: 0.75rem; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--ink-mute); font-weight: 500; margin-bottom: 0.9rem;
}
.footer-col ul { display: flex; flex-direction: column; gap: 0.55rem; }
.footer-col a:hover { color: var(--accent-dark); text-decoration: underline; }
.footer-partner-badge {
  margin-top: 1.4rem;
  display: inline-flex;
  max-width: 140px;
}
.footer-partner-badge img { width: 100%; height: auto; display: block; }
.footer-bottom {
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; gap: 1rem;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--ink-mute);
}
.footer-bottom a:hover { color: var(--accent-dark); text-decoration: underline; }

/* Credential card (authorization / NIMA) */
.credential-grid {
  display: grid;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  grid-template-columns: 1fr;
}
@media (min-width: 1180px) { .credential-grid { grid-template-columns: 7fr 5fr; } }
.credential-info {
  background: var(--bg);
  padding: clamp(1.75rem, 4vw, 2.75rem);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.credential-info p { color: var(--ink-soft); max-width: 52ch; }
.op-row { display: flex; flex-wrap: wrap; gap: 1rem; }
.op-card {
  border: 1px solid var(--line);
  padding: 1.1rem 1.3rem;
  flex: 1 1 240px;
}
.op-card .op-code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-weight: 600;
  font-size: 0.85rem;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 0.2rem 0.55rem;
  margin-bottom: 0.7rem;
}
.op-card .op-title {
  font-size: 0.95rem;
  text-transform: none;
  margin-bottom: 0.4rem;
}
.op-card p { font-size: 0.88rem; color: var(--ink-soft); max-width: none; }

.credential-card {
  background: var(--ink);
  color: var(--bg);
  padding: clamp(1.75rem, 4vw, 2.75rem);
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}
.credential-card .cc-label {
  font-family: var(--mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
}
.credential-card .cc-value {
  font-family: var(--mono);
  font-size: clamp(1.1rem, 2.6vw, 1.4rem);
  word-break: break-all;
}
.credential-card .cc-item { display: flex; flex-direction: column; gap: 0.4rem; }

/* LER codes table */
.ler-table { border: 1px solid var(--line); background: var(--line); display: flex; flex-direction: column; gap: 1px; }
.ler-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1px;
  background: var(--line);
}
@media (min-width: 720px) { .ler-row { grid-template-columns: 160px 1fr; } }
.ler-row .ler-code {
  background: var(--bg);
  padding: 1rem 1.2rem;
  font-family: var(--mono);
  font-weight: 600;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
}
.ler-row .ler-desc {
  background: var(--bg);
  padding: 1rem 1.2rem;
  font-size: 0.92rem;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
}
.ler-note {
  margin-top: 1.5rem;
  font-size: 0.92rem;
  color: var(--ink-soft);
  border-left: 2px solid var(--accent);
  padding-left: 1rem;
}

/* =============================================================
   7. Sections
   ============================================================= */

/* Hero */
.hero {
  padding-top: calc(var(--nav-h) + clamp(2.5rem, 8vw, 6rem));
  padding-bottom: clamp(3rem, 8vw, 6rem);
}
.hero-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}
.hero-logo {
  height: 54px;
  width: auto;
  display: block;
}
@media (min-width: 720px) { .hero-logo { height: 70px; } }
@media (min-width: 1180px) { .hero-logo { height: 86px; } }
.hero-grid {
  display: grid;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  grid-template-columns: 1fr;
}
@media (min-width: 1180px) { .hero-grid { grid-template-columns: 7fr 5fr; } }
.hero-copy {
  background: var(--bg);
  padding: clamp(1rem, 4vw, 3rem);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  min-width: 0;
}
.hero-title {
  font-size: clamp(2rem, 7vw, 5.6rem);
  line-height: 0.94;
}
.hero-title em {
  font-style: normal;
  color: var(--accent-dark);
}
.hero-sub {
  background: var(--bg);
  padding: clamp(1rem, 4vw, 3rem);
  display: flex;
  flex-direction: column;
  gap: 2rem;
  justify-content: center;
  min-width: 0;
}
.hero-sub p { font-size: 1.05rem; line-height: 1.65; color: var(--ink-soft); max-width: 40ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.9rem; }

.hero-media {
  margin-top: 1px;
  aspect-ratio: 16 / 8;
  overflow: hidden;
  border: 1px solid var(--line);
  border-top: 0;
}
.hero-media img {
  width: 100%; height: 100%; object-fit: cover;
  filter: saturate(1.05) contrast(1.02);
}

/* =============================================================
   8. Reveal on scroll
   ============================================================= */
[data-reveal] {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity .7s var(--ease-soft), transform .7s var(--ease-soft);
}
[data-reveal].is-revealed { opacity: 1; transform: none; }
@media (scripting: none) {
  [data-reveal] { opacity: 1; transform: none; }
}

/* =============================================================
   9. Responsive extras
   ============================================================= */
@media (min-width: 1180px) {
  /* hero-grid splits into two columns at 1180px — the title needs the
     narrower-column-aware size from that point on, not just from 1280px,
     or long words like "CERTIFICAMOS" overflow into the adjacent box. */
  .hero-title { font-size: clamp(3.2rem, 6.4vw, 6.4rem); }
}
@media (min-width: 1440px) {
  /* .container stops growing past 1440px (max-width), but 6.4vw keeps
     scaling with the raw viewport — past this point the title's box is
     frozen while the font keeps growing, so it overflows again on wide
     monitors (1600/1920/2560px). Pin it to the exact size it reaches
     right at 1440px so it never outgrows its now-fixed-width box. */
  .hero-title { font-size: 5.76rem; }
}

/* =============================================================
   10. Reduced motion — only truly intrusive effects
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .cursor-coord { display: none; }
  /* Do NOT disable: hover invert, reveals, count-up, gallery hover */
}
