  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

  :root {
    --bg: #0a0e17;
    --surface: #131822;
    --surface2: #1b2129;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.16);
    --text: #e4e6ee;
    --muted: #7d818f;
    --muted-dim: #4a4f62;
    --accent: #4a8ef7;
    --accent2: #3f6fc0;
    --accent-dim: rgba(74, 142, 247, 0.10);
  }

  :root[data-theme="light"] {
    --bg: #f6f7f9;
    --surface: #ffffff;
    --surface2: #eef0f4;
    --border: rgba(10, 14, 23, 0.09);
    --border-strong: rgba(10, 14, 23, 0.18);
    --text: #191d24;
    --muted: #5a5f6d;
    --muted-dim: #9095a1;
    --accent: #3f6fc0;
    --accent2: #2d5296;
    --accent-dim: rgba(63, 111, 192, 0.08);
  }

  body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Noto Sans', sans-serif;
    font-weight: 300;
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    display: flex;
    justify-content: center;
    padding: 4.5rem 1.25rem 4rem;
    transition: background 0.2s, color 0.2s;
  }

  .page { width: 100%; max-width: 1160px; }

  /* ---------- Theme toggle ---------- */
  .theme-toggle {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
    color: var(--muted);
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 8px;
    cursor: pointer;
    transition: color 0.18s, border-color 0.18s, background 0.18s;
    z-index: 50;
  }
  .theme-toggle:hover { color: var(--accent); border-color: var(--border-strong); }
  .theme-toggle-icon { width: 16px; height: 16px; flex-shrink: 0; }
  .theme-toggle .icon-moon { display: none; }
  :root[data-theme="light"] .theme-toggle .icon-sun { display: none; }
  :root[data-theme="light"] .theme-toggle .icon-moon { display: block; }

  /* ---------- Nav offcanvas + back to top (solo mobile) ---------- */
  .nav-toggle { display: none; }
  .nav-offcanvas, .nav-overlay { display: none; }
  .back-to-top { display: none; }

  @media (max-width: 768px) {
    /* En mobile el switch de tema vive dentro del menú, no flotando */
    .theme-toggle { display: none; }

    .nav-toggle {
      position: fixed;
      top: 1.25rem;
      right: 1.25rem;
      display: flex;
      align-items: center;
      justify-content: center;
      line-height: 0;
      color: var(--muted);
      background: var(--surface);
      border: 1px solid var(--border);
      padding: 8px;
      cursor: pointer;
      transition: color 0.18s, border-color 0.18s;
      z-index: 90;
    }
    .nav-toggle:hover { color: var(--accent); border-color: var(--border-strong); }
    .nav-toggle-icon { width: 16px; height: 16px; flex-shrink: 0; }
    .nav-toggle .icon-close { display: none; }
    body.nav-open .nav-toggle .icon-bars { display: none; }
    body.nav-open .nav-toggle .icon-close { display: block; }

    .nav-overlay {
      display: block;
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.5);
      opacity: 0;
      visibility: hidden;
      transition: opacity 0.2s, visibility 0.2s;
      z-index: 70;
    }
    .nav-offcanvas {
      display: flex;
      flex-direction: column;
      position: fixed;
      top: 0;
      right: 0;
      width: 78%;
      max-width: 300px;
      height: 100%;
      background: var(--surface);
      border-left: 1px solid var(--border);
      padding: 4.75rem 1.5rem 2rem;
      transform: translateX(100%);
      transition: transform 0.24s ease;
      z-index: 80;
      overflow-y: auto;
    }
    .nav-offcanvas .nav-label {
      font-family: 'DM Mono', monospace;
      font-size: 11px;
      letter-spacing: 0.14em;
      text-transform: uppercase;
      color: var(--muted-dim);
      margin-bottom: 1.25rem;
    }
    .nav-offcanvas a {
      font-size: 16px;
      color: var(--text);
      text-decoration: none;
      padding: 0.7rem 0;
      border-bottom: 1px solid var(--border);
      transition: color 0.16s;
    }
    .nav-offcanvas a:hover,
    .nav-offcanvas a:focus-visible { color: var(--accent); }

    .nav-theme {
      display: flex;
      align-items: center;
      gap: 10px;
      margin-top: 1.5rem;
      padding: 0.7rem 0;
      background: none;
      border: none;
      color: var(--muted);
      font-family: 'DM Mono', monospace;
      font-size: 11px;
      letter-spacing: 0.14em;
      text-transform: uppercase;
      cursor: pointer;
      transition: color 0.16s;
    }
    .nav-theme:hover,
    .nav-theme:focus-visible { color: var(--accent); }
    .nav-theme .theme-toggle-icon { width: 15px; height: 15px; }
    .nav-theme .icon-moon { display: none; }
    :root[data-theme="light"] .nav-theme .icon-sun { display: none; }
    :root[data-theme="light"] .nav-theme .icon-moon { display: block; }

    body.nav-open { overflow: hidden; }
    body.nav-open .nav-overlay { opacity: 1; visibility: visible; }
    body.nav-open .nav-offcanvas { transform: translateX(0); }

    [id="proceso"], [id="portafolio"],
    [id="como-elegir-agencia-desarrollo-web"], [id="contacto"] { scroll-margin-top: 4rem; }

    .back-to-top {
      position: fixed;
      bottom: 1.1rem;
      right: 1.1rem;
      display: flex;
      align-items: center;
      justify-content: center;
      line-height: 0;
      color: var(--muted);
      background: var(--surface);
      border: 1px solid var(--border);
      padding: 9px;
      cursor: pointer;
      opacity: 0;
      visibility: hidden;
      transform: translateY(6px);
      transition: opacity 0.2s, visibility 0.2s, transform 0.2s, color 0.18s, border-color 0.18s;
      z-index: 55;
    }
    .back-to-top.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }
    .back-to-top:hover { color: var(--accent); border-color: var(--border-strong); }
    .back-to-top-icon { width: 16px; height: 16px; flex-shrink: 0; }
  }

  /* ---------- Hero media ---------- */
  .hero-media {
    /* Sube el bloque para que quede a ~20px del viewport, no a los 4.5rem
       que body reserva para dejar espacio al theme-toggle flotante. */
    margin-top: calc(-4.5rem + 20px);
    margin-bottom: 3rem;
    height: 50vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 1.75rem 1.5rem;
    background: #0a0e17 url('../img/hero-bg.webp') left center / cover no-repeat;
    border-radius: 8px;
    overflow: hidden;
  }

  .hero-media .eyebrow { color: rgba(255, 255, 255, 0.82); }
  .hero-media h1 {
    color: #fff;
    text-shadow: 0 2px 18px rgba(0, 0, 0, 0.45);
  }
  .hero-media h1 .em { color: #dbe9ff; }
  .hero-media .tagline {
    color: rgba(255, 255, 255, 0.82);
    text-shadow: 0 1px 10px rgba(0, 0, 0, 0.4);
    margin-bottom: 0;
    max-width: 46ch;
  }

  @media (max-width: 560px) {
    .hero-media { margin-top: calc(-3rem + 20px); }
  }

  /* ---------- Header ---------- */
  .eyebrow {
    font-family: 'DM Mono', monospace;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 20px;
  }
  .eyebrow .mark { width: 7px; height: 7px; background: var(--accent); flex-shrink: 0; }

  h1 {
    font-family: 'Outfit', sans-serif;
    font-weight: 500;
    font-size: clamp(26px, 4.4vw, 58px);
    line-height: 1.02;
    letter-spacing: -0.02em;
    color: var(--text);
    margin-bottom: 16px;
    white-space: nowrap;
  }
  h1 .em { color: var(--accent); font-weight: 500; }

  @media (max-width: 560px) {
    h1 { white-space: normal; }
  }

  .tagline {
    font-size: 17px;
    color: var(--muted);
    margin-bottom: 3.5rem;
  }

  /* ---------- Section label ---------- */
  .section-label {
    font-family: 'DM Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted-dim);
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 1.5rem;
  }
  .section-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
  }
  .section-label .count { color: var(--muted); }

  /* ---------- Proceso (tarjetas) ---------- */
  .process-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
  }

  .process-card {
    position: relative;
    display: flex;
    flex-direction: column;
    aspect-ratio: 3 / 4;
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: #12151c center / cover no-repeat;
    overflow: hidden;
  }
  /* Placeholder hasta tener las imágenes de fondo por tarjeta */
  .process-card--discovery { background-image: url('../img/process-bg-descubrimiento.webp'); }
  .process-card--design { background-image: url('../img/process-bg-diseno.webp'); }
  .process-card--dev { background-image: url('../img/process-bg-desarrollo.webp'); }
  .process-card--delivery { background-image: url('../img/process-bg-entrega.webp'); }

  .process-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(8, 11, 18, 0.78) 0%, rgba(8, 11, 18, 0.4) 45%, rgba(8, 11, 18, 0.18) 100%);
    pointer-events: none;
  }

  .process-card-body { position: relative; z-index: 1; }
  .process-card-title {
    font-family: 'Outfit', sans-serif;
    font-weight: 500;
    font-size: 19px;
    letter-spacing: -0.01em;
    color: #fff;
    margin-bottom: 8px;
  }
  .process-card-desc {
    font-size: 13.5px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.72);
  }

  .process-card-arrow {
    position: relative;
    z-index: 1;
    margin-top: auto;
    align-self: flex-end;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.85);
  }
  .process-card-arrow svg { width: 18px; height: 18px; }

  @media (max-width: 900px) {
    .process-grid { grid-template-columns: repeat(2, 1fr); }
  }
  @media (max-width: 560px) {
    .process-grid { grid-template-columns: 1fr; }
    .process-card { aspect-ratio: 4 / 3; }
  }

  section.section-block { margin-bottom: 3.5rem; }

  /* ---------- Tarjetas de portafolio ---------- */
  .portfolio-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
  }

  .portfolio-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 1.5rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: border-color 0.18s, background 0.18s;
  }
  .portfolio-card:hover,
  .portfolio-card:focus-within {
    background: var(--surface2);
    border-color: var(--border-strong);
  }

  .pf-tag {
    align-self: flex-start;
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: 'DM Mono', monospace;
    font-size: 10.5px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
  }
  .pf-tag::before {
    content: '';
    width: 5px;
    height: 5px;
    background: var(--accent);
    flex-shrink: 0;
  }

  .pf-title {
    font-family: 'Outfit', sans-serif;
    font-weight: 500;
    font-size: 18px;
    letter-spacing: -0.01em;
    color: var(--text);
    transition: color 0.18s;
  }
  .pf-title a {
    color: inherit;
    text-decoration: none;
    outline: none;
  }
  .pf-title a::after { content: ''; position: absolute; inset: 0; }
  .portfolio-card:hover .pf-title,
  .portfolio-card:focus-within .pf-title { color: var(--accent); }

  .pf-desc {
    font-size: 13.5px;
    color: var(--muted);
    line-height: 1.6;
    flex-grow: 1;
  }

  .pf-url {
    font-family: 'DM Mono', monospace;
    font-size: 11px;
    color: var(--muted-dim);
    letter-spacing: 0.02em;
    margin-top: auto;
  }
  .pf-arrow {
    display: inline-block;
    margin-left: 3px;
    transition: transform 0.18s, color 0.18s;
  }
  .portfolio-card:hover .pf-arrow,
  .portfolio-card:focus-within .pf-arrow {
    color: var(--accent);
    transform: translate(2px, -2px);
  }

  /* ---------- Fila "próximamente" ---------- */
  .table-soon {
    margin-top: 1rem;
    padding: 1.1rem 1.4rem;
    font-size: 13px;
    color: var(--muted-dim);
    border-top: 1px dashed var(--border-strong);
  }

  @media (max-width: 860px) {
    .portfolio-grid { grid-template-columns: repeat(2, 1fr); }
  }
  @media (max-width: 560px) {
    .portfolio-grid { grid-template-columns: 1fr; }
  }

  /* ---------- Footer ---------- */
  footer {
    position: relative;
    margin-top: 3.5rem;
    padding: 4rem 2rem 2rem;
    background: #0a0e17 url('../img/guide-divider.webp') center / cover no-repeat;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
    overflow: hidden;
  }
  footer::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(8, 11, 18, 0.3) 0%, rgba(8, 11, 18, 0.72) 100%);
  }
  footer > * { position: relative; z-index: 1; }

  .footer-brand {
    font-family: 'Outfit', sans-serif;
    font-weight: 500;
    font-size: clamp(34px, 6vw, 64px);
    letter-spacing: -0.02em;
    color: #fff;
    text-decoration: none;
    text-shadow: 0 2px 18px rgba(0, 0, 0, 0.45);
  }
  .footer-brand:hover { color: #dbe9ff; }

  .footer-meta {
    font-family: 'DM Mono', monospace;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.75);
    letter-spacing: 0.04em;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
  }
  .footer-meta a { color: rgba(255, 255, 255, 0.85); text-decoration: none; }
  .footer-meta a:hover { color: #dbe9ff; }

  @media (max-width: 560px) {
    footer { padding: 3rem 1.5rem 1.75rem; gap: 2rem; }
  }

  /* ---------- Contacto ---------- */
  .contact-intro {
    font-size: 14.5px;
    color: var(--muted);
    line-height: 1.6;
    max-width: 480px;
    margin: 0 auto 1.75rem;
  }
  .contact-form { max-width: 480px; margin: 0 auto; }
  .cf-legend {
    font-family: 'DM Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.04em;
    color: var(--muted-dim);
    margin-bottom: 1.1rem;
  }
  .cf-required { color: var(--accent); }
  .cf-row { margin-bottom: 1.1rem; }
  .cf-row label {
    display: block;
    font-family: 'DM Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted-dim);
    margin-bottom: 7px;
  }
  .cf-row input,
  .cf-row textarea {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    font-family: 'Noto Sans', sans-serif;
    font-weight: 300;
    font-size: 14.5px;
    padding: 0.7rem 0.85rem;
    outline: none;
    transition: border-color 0.18s, background 0.18s;
  }
  .cf-row input:focus,
  .cf-row textarea:focus { border-color: var(--accent); background: var(--surface2); }
  .cf-row textarea { resize: vertical; min-height: 110px; line-height: 1.5; }
  /* Honeypot: oculto para personas, presente en el DOM para bots */
  .cf-hp {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
  }
  .cf-submit {
    font-family: 'DM Mono', monospace;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--bg);
    background: var(--accent);
    border: none;
    padding: 0.85rem 1.6rem;
    cursor: pointer;
    transition: background 0.18s, opacity 0.18s;
  }
  .cf-submit:hover { background: var(--accent2); }
  .cf-submit:disabled { opacity: 0.6; cursor: default; }
  .cf-status {
    margin-top: 1rem;
    font-size: 13px;
    color: var(--muted);
  }
  .cf-status-ok { color: var(--accent); }
  .cf-status-error { color: #d9534f; }

  @media (prefers-reduced-motion: reduce) {
    * { transition-duration: 0.01ms !important; }
  }

  @media (max-width: 560px) {
    body { padding: 3rem 1rem; }
    .tagline { font-size: 15.5px; margin-bottom: 2.5rem; }
  }

  /* ---------- Divisor Portafolio → Guía ---------- */
  .guide-divider {
    display: flex;
    align-items: flex-end;
    height: 32vh;
    min-height: 200px;
    margin: 3.5rem 0;
    padding: 1.5rem;
    background: #0a0e17 url('../img/guide-divider.webp') center / cover no-repeat;
    border-radius: 8px;
    overflow: hidden;
  }
  .guide-divider .section-label { color: rgba(255, 255, 255, 0.85); margin-bottom: 0; }
  .guide-divider .section-label::after { background: rgba(255, 255, 255, 0.2); }
  .guide-divider .section-label .count { color: rgba(255, 255, 255, 0.6); }

  /* ---------- Guía evergreen ---------- */
  .guide {
    margin: 0 auto;
    max-width: 720px;
  }
  .guide-head { margin-bottom: 2.25rem; }

  .guide-toc {
    margin-bottom: 2.5rem;
    padding: 1.25rem 1.5rem;
    border: 1px solid var(--border);
    border-radius: 8px;
  }
  .guide-toc-label {
    display: block;
    font-family: 'DM Mono', monospace;
    font-size: 10.5px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted-dim);
    margin-bottom: 0.9rem;
  }
  .guide-toc ol {
    list-style: none;
    margin: 0;
    padding: 0;
    counter-reset: toc;
    columns: 2;
    column-gap: 2rem;
  }
  .guide-toc li { counter-increment: toc; break-inside: avoid; padding: 4px 0; }
  .guide-toc li::before {
    content: counter(toc, decimal-leading-zero);
    font-family: 'DM Mono', monospace;
    font-size: 11px;
    color: var(--accent2);
    margin-right: 10px;
  }
  .guide-toc a {
    font-size: 14px;
    color: var(--muted);
    text-decoration: none;
    transition: color 0.15s;
  }
  .guide-toc a:hover,
  .guide-toc a:focus-visible { color: var(--accent); }

  @media (max-width: 560px) {
    .guide-toc ol { columns: 1; }
  }
  .guide h2 {
    font-family: 'Outfit', sans-serif;
    font-weight: 500;
    font-size: clamp(28px, 5vw, 40px);
    line-height: 1.1;
    letter-spacing: -0.015em;
    color: var(--text);
    margin-bottom: 14px;
  }
  .guide-deck {
    font-size: 17px;
    color: var(--muted);
    line-height: 1.65;
    max-width: 62ch;
  }
  .guide h3 {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 25px;
    line-height: 1.3;
    letter-spacing: -0.01em;
    color: var(--text);
    margin: 2.75rem 0 1rem;
    scroll-margin-top: 5.5rem;
  }
  .guide h4 {
    font-family: 'Outfit', sans-serif;
    font-weight: 400;
    font-style: italic;
    font-size: 18px;
    color: var(--text);
    margin: 1.75rem 0 .6rem;
  }
  .guide p {
    font-size: 15.5px;
    color: var(--muted);
    line-height: 1.75;
    margin-bottom: 1.1rem;
  }
  .guide p strong { color: var(--text); font-weight: 500; }
  .guide ul { margin: 0 0 1.1rem; padding-left: 1.2rem; }
  .guide ul li { color: var(--muted); font-size: 15.5px; line-height: 1.7; padding: 2px 0; }
  .guide ul li strong { color: var(--text); font-weight: 500; }
  .guide a {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-color: rgba(74, 142, 247, .35);
    text-underline-offset: 3px;
    transition: color .15s, text-decoration-color .15s;
  }
  .guide a:hover { color: var(--accent2); text-decoration-color: rgba(63, 111, 192, .5); }

  @media (max-width: 560px) {
    .guide-divider { height: 26vh; margin: 2.5rem 0; }
  }
