@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/Inter-Regular.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('fonts/Inter-Medium.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/Inter-SemiBold.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/Inter-Bold.woff2') format('woff2');
}

:root {
  --bg: #fbfbfd;
  --fg: #1d1d1f;
  --muted: #6e6e73;
  --line: #d2d2d7;
  --card-soft: #f0eeea;
  --card-dark: #161618;
  --on-dark: #f5f5f7;
  --on-dark-muted: #a1a1a6;
  --accent: #ff4d2e;
  --accent-hover: #ff5e42;
  --link: #ff4d2e;
  --input-bg: #ffffff;
  --input-border: #d2d2d7;
  --input-focus: #ff4d2e;
  --nav-bg: rgba(251, 251, 253, 0.72);
  --nav-border: rgba(0, 0, 0, 0.06);
  --radius-lg: 18px;
  --max: 1280px;
  --pad: 22px;
  --nav-h: 64px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0a0a;
    --fg: #f5f5f7;
    --muted: #a1a1a6;
    --line: #2a2a2c;
    --card-soft: #18181b;
    --card-dark: #1e1e22;
    --on-dark: #f5f5f7;
    --on-dark-muted: #a1a1a6;
    --input-bg: #18181b;
    --input-border: #2a2a2c;
    --nav-bg: rgba(10, 10, 10, 0.72);
    --nav-border: rgba(255, 255, 255, 0.08);
  }
}

:root[data-theme="dark"] {
  --bg: #0a0a0a;
  --fg: #f5f5f7;
  --muted: #a1a1a6;
  --line: #2a2a2c;
  --card-soft: #18181b;
  --card-dark: #1e1e22;
  --on-dark: #f5f5f7;
  --on-dark-muted: #a1a1a6;
  --input-bg: #18181b;
  --input-border: #2a2a2c;
  --nav-bg: rgba(10, 10, 10, 0.72);
  --nav-border: rgba(255, 255, 255, 0.08);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 16px);
}

/* Anchor targets respetan altura del nav sticky */
[id="apps"], [id="diseno"], [id="web"], [id="estudio"], [id="contacto"], [id="main"] {
  scroll-margin-top: calc(var(--nav-h) + 16px);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.47;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  letter-spacing: -0.003em;
}

a { color: inherit; text-decoration: none; }

:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- SKIP LINK ---------- */
.skip-link {
  position: absolute;
  left: 12px;
  top: -100px;
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  z-index: 1000;
  transition: top 0.2s ease;
}
.skip-link:focus { top: 12px; }

/* ---------- NAV ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  background: var(--nav-bg);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--nav-border);
}

.nav-inner {
  max-width: 1024px;
  margin: 0 auto;
  padding: 0 22px;
  height: 100%;
  display: flex;
  align-items: center;
}

.logo { display: inline-flex; align-items: center; color: var(--fg); }
.logo svg { height: 40px; width: auto; display: block; }
.logo-dot { transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); transform-origin: 3450px 816.667px; }
.logo:hover .logo-dot { transform: scale(1.2); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
  margin-left: auto;
}

.nav-links a {
  font-size: 12px;
  font-weight: 400;
  color: var(--fg);
  opacity: 0.82;
  transition: opacity 0.2s ease;
  white-space: nowrap;
}

.nav-links a:hover { opacity: 1; }

/* ---------- HAMBURGUESA ---------- */
.nav-toggle {
  display: none;
  margin-left: auto;
  width: 40px;
  height: 40px;
  background: transparent;
  border: 0;
  cursor: pointer;
  padding: 10px;
  flex-direction: column;
  justify-content: space-between;
  align-items: stretch;
  border-radius: 6px;
}
.nav-toggle-bar {
  display: block;
  height: 2px;
  background: var(--fg);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.2s ease;
  transform-origin: center;
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

/* ---------- HERO (asimétrico) ---------- */
.hero {
  max-width: var(--max);
  margin: 0 auto;
  padding: 56px var(--pad) 32px;
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 56px;
  align-items: center;
}
.hero-text {
  text-align: left;
}

.meta {
  font-family: 'JetBrains Mono', 'SF Mono', ui-monospace, 'Cascadia Mono', Menlo, Consolas, monospace;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 22px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.meta .dot { color: var(--accent); }
.meta-num {
  background: var(--accent);
  color: #fff;
  padding: 2px 7px 3px;
  border-radius: 4px;
  letter-spacing: 0;
  font-weight: 600;
  font-size: 11px;
}
.meta-on-dark { color: var(--on-dark-muted); }

.hero-title {
  font-size: clamp(36px, 5vw, 72px);
  font-weight: 600;
  line-height: 1.02;
  letter-spacing: -0.028em;
  color: var(--fg);
  margin-bottom: 22px;
  text-wrap: balance;
}

.hero-sub {
  font-size: clamp(15px, 1.15vw, 18px);
  font-weight: 400;
  color: var(--muted);
  max-width: 440px;
  margin: 0 0 26px;
  line-height: 1.5;
  text-wrap: pretty;
}

.hero-links {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
}

.hero-figure {
  position: relative;
  aspect-ratio: 4 / 5;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--card-soft);
}
.hero-figure picture { display: block; height: 100%; }
.hero-figure img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

@media (max-width: 800px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 32px;
    padding: 40px var(--pad) 28px;
  }
  .hero-figure { aspect-ratio: 16 / 10; max-height: 360px; }
}

/* ---------- LINK ---------- */
.link {
  color: var(--link);
  font-size: 14px;
  font-weight: 400;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: opacity 0.15s ease;
}

.link:hover { opacity: 0.75; }
.link .chev {
  font-size: 1.1em;
  transition: transform 0.25s cubic-bezier(.2,.7,.3,1);
  display: inline-block;
}
.link:hover .chev { transform: translateX(3px); }

/* ---------- BENTO ---------- */
main { padding: 0 var(--pad); }

.bento {
  max-width: var(--max);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: minmax(220px, auto);
  gap: 14px;
}

.bento-card {
  position: relative;
  background: var(--card-soft);
  color: var(--fg);
  border-radius: var(--radius-lg);
  padding: 28px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.bento-card-dark {
  background: var(--card-dark);
  color: var(--on-dark);
}

.bento-head {
  margin-bottom: 16px;
}

.bento-title {
  font-size: clamp(28px, 2.6vw, 40px);
  font-weight: 600;
  line-height: 1.06;
  letter-spacing: -0.022em;
  margin: 0 0 10px;
  text-wrap: balance;
}

.bento-title-sm {
  font-size: clamp(20px, 1.6vw, 26px);
  font-weight: 600;
  line-height: 1.18;
  letter-spacing: -0.012em;
  margin: 0;
  text-wrap: balance;
}

.bento-sub {
  font-size: 15px;
  color: var(--muted);
  line-height: 1.5;
  margin: 0 0 14px;
  max-width: 380px;
}

.bento-card-dark .bento-sub { color: var(--on-dark-muted); }
.bento-card-dark .link { color: var(--accent); }
.bento-card .link { margin-top: auto; }

/* Apps card: BIG, span 2x2 */
.bento-apps {
  grid-column: span 2;
  grid-row: span 2;
}
.bento-apps .bento-photo {
  margin-top: auto;
  margin-left: -28px;
  margin-right: -28px;
  margin-bottom: -28px;
  padding-top: 8px;
}
.bento-apps .bento-photo picture { display: block; }
.bento-apps .bento-photo img {
  width: 100%;
  height: auto;
  display: block;
  max-height: 360px;
  object-fit: cover;
  object-position: center 35%;
}

/* Diseño card */
.bento-diseno {
  grid-column: span 1;
  grid-row: span 1;
}
.bento-diseno .bento-photo-sm {
  margin-top: 12px;
  margin-bottom: 12px;
}
.bento-photo-sm img {
  width: 100%;
  height: auto;
  max-height: 130px;
  object-fit: cover;
  border-radius: 10px;
  display: block;
}

/* Web card */
.bento-web {
  grid-column: span 1;
  grid-row: span 1;
}
.bento-svg {
  margin-top: 14px;
  margin-bottom: 14px;
  display: flex;
  justify-content: center;
}
.bento-svg svg {
  max-width: 100%;
  max-height: 110px;
  height: auto;
}

/* Stats card: massive number */
.bento-stats {
  grid-column: span 1;
  grid-row: span 1;
  justify-content: center;
}
.bento-big-num {
  font-size: clamp(64px, 7vw, 96px);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 0.95;
  margin: 14px 0 0;
  color: var(--on-dark);
  font-feature-settings: 'tnum';
}
.bento-big-num-suffix {
  color: var(--accent);
}
.bento-big-num-label {
  font-family: 'JetBrains Mono', 'SF Mono', ui-monospace, Menlo, monospace;
  font-size: 12px;
  color: var(--on-dark-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 8px 0 18px;
}
.bento-mini-stats {
  list-style: none;
  padding: 0;
  margin: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.bento-mini-stats li {
  font-size: 13px;
  color: var(--on-dark-muted);
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.bento-mini-stats li span {
  font-weight: 600;
  font-size: 16px;
  color: var(--on-dark);
  min-width: 14px;
}

/* Manifesto card */
.bento-manifesto {
  grid-column: span 1;
  grid-row: span 1;
}
.bento-quote {
  font-size: clamp(18px, 1.5vw, 22px);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.012em;
  margin: 16px 0 22px;
  text-wrap: balance;
  position: relative;
  padding-left: 14px;
  border-left: 2px solid var(--accent);
}

/* Hover (solo cuando ya revealó el card) */
.bento-card.is-visible {
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.35s ease;
}
.bento-card.is-visible:hover {
  transform: translateY(-3px);
}

/* Responsive bento */
@media (max-width: 1080px) {
  .bento { grid-template-columns: repeat(2, 1fr); }
  .bento-apps { grid-column: span 2; grid-row: span 1; min-height: 480px; }
  .bento-diseno, .bento-web,
  .bento-stats, .bento-manifesto {
    grid-column: span 1;
    grid-row: span 1;
  }
}

@media (max-width: 640px) {
  .bento { grid-template-columns: 1fr; gap: 12px; }
  .bento-apps, .bento-diseno, .bento-web,
  .bento-stats, .bento-manifesto {
    grid-column: span 1;
    grid-row: auto;
  }
  .bento-card { padding: 24px; }
  .bento-apps .bento-photo {
    margin-left: -24px;
    margin-right: -24px;
    margin-bottom: -24px;
  }
  .bento-apps { min-height: 0; }
}

/* ---------- CTA SECTION ---------- */
.cta-section {
  text-align: center;
  padding: 80px var(--pad) 72px;
  max-width: var(--max);
  margin: 0 auto;
}

.cta-title {
  font-size: clamp(30px, 3.8vw, 48px);
  font-weight: 600;
  line-height: 1.06;
  letter-spacing: -0.022em;
  margin-bottom: 12px;
  text-wrap: balance;
}

.cta-sub {
  font-size: clamp(15px, 1.15vw, 19px);
  color: var(--muted);
  margin-bottom: 24px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 22px;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  border-radius: 980px;
  border: 0;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
  font-family: inherit;
}

.btn:hover { background: var(--accent-hover); }
.btn:active { transform: scale(0.98); }

/* ---------- FORMULARIO ---------- */
.contact-form {
  max-width: 560px;
  margin: 0 auto;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--fg);
}

.contact-form input,
.contact-form select,
.contact-form textarea {
  width: 100%;
  padding: 12px 14px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 15px;
  color: var(--fg);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.contact-form textarea {
  resize: vertical;
  min-height: 110px;
}

.contact-form input:focus,
.contact-form select:focus,
.contact-form textarea:focus {
  outline: none;
  border-color: var(--input-focus);
  box-shadow: 0 0 0 3px rgba(255, 77, 46, 0.18);
}

.contact-form input::placeholder,
.contact-form textarea::placeholder {
  color: var(--muted);
  opacity: 0.7;
}

.contact-form input:user-invalid,
.contact-form select:user-invalid,
.contact-form textarea:user-invalid {
  border-color: #d93025;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.form-note {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}
.form-note a { color: var(--muted); text-decoration: underline; }
.form-note a:hover { color: var(--fg); }

.form-status {
  font-size: 13px;
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  display: none;
}
.form-status.is-visible { display: block; }
.form-status.is-success {
  background: rgba(48, 164, 108, 0.12);
  color: #1e7a4a;
}
.form-status.is-error {
  background: rgba(217, 48, 37, 0.10);
  color: #b3241b;
}

/* ---------- LEGAL ---------- */
.legal {
  padding: 56px var(--pad) 80px;
}
.legal-inner {
  max-width: 720px;
  margin: 0 auto;
}
.legal-inner h1 {
  font-size: clamp(28px, 3.4vw, 42px);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 8px 0 6px;
}
.legal-inner h2 {
  font-size: 20px;
  font-weight: 600;
  margin: 32px 0 10px;
  letter-spacing: -0.015em;
}
.legal-inner p,
.legal-inner li {
  font-size: 15px;
  color: var(--fg);
  margin-bottom: 10px;
  line-height: 1.6;
}
.legal-inner ul {
  padding-left: 22px;
  margin-bottom: 10px;
}
.legal-inner a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.legal-meta {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 24px;
}
.legal-back { margin-top: 40px; }

/* ---------- FOOTER ---------- */
footer {
  background: var(--bg);
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.footer-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 40px var(--pad) 24px;
}

.footer-cols {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
}

.footer-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 2px;
}

.footer-col a {
  color: var(--muted);
  transition: color 0.15s ease;
}

.footer-col a:hover { color: var(--fg); }

.footer-meta { color: var(--muted); }

.footer-bottom {
  display: flex;
  justify-content: space-between;
  padding-top: 18px;
  font-size: 12px;
}

.footer-bottom a { color: var(--muted); }
.footer-bottom a:hover { color: var(--fg); }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 900px) {
  .nav-links { gap: 18px; }
  .nav-links a { font-size: 12px; }
}

@media (max-width: 720px) {
  .nav-toggle { display: flex; }

  .nav-links {
    position: fixed;
    top: var(--nav-h);
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: 8px 0;
    margin-left: 0;
    transform: translateY(calc(-100% - var(--nav-h)));
    transition: transform 0.28s cubic-bezier(.2,.7,.3,1), visibility 0s linear 0.28s;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.08);
    visibility: hidden;
  }
  .nav-links.is-open {
    transform: translateY(0);
    visibility: visible;
    transition: transform 0.28s cubic-bezier(.2,.7,.3,1), visibility 0s linear 0s;
  }
  .nav-links a {
    width: 100%;
    padding: 14px 22px;
    font-size: 16px;
    opacity: 1;
    border-bottom: 1px solid var(--line);
  }
  .nav-links a:last-child { border-bottom: 0; }

  body.nav-open { overflow: hidden; }
}

@media (max-width: 640px) {
  :root { --pad: 16px; }
  .nav-inner { gap: 18px; }
  .logo svg { height: 34px; }

  .hero { padding: 40px var(--pad) 28px; }
  .hero-links { gap: 22px; }

  .cta-section { padding: 64px var(--pad) 64px; }

  .form-row { grid-template-columns: 1fr; }
  .form-actions { gap: 14px; }

  .footer-cols { grid-template-columns: 1fr 1fr; gap: 28px; }
  .footer-bottom { flex-direction: column; gap: 8px; }
}

/* ---------- SVG HOVER (Web card) ---------- */
.svg-browser, .svg-browser-btn, .svg-browser-card {
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), fill 0.3s ease;
}
.bento-web:hover .svg-browser { transform: translateY(-3px); }
.bento-web:hover .svg-browser-btn { transform: scale(1.06); fill: var(--accent-hover); }
.bento-web:hover .svg-browser-card { transform: translate(3px, -2px); }

/* ---------- SCROLL REVEAL ---------- */
.js-enabled .bento-card,
.js-enabled .hero-figure {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1), transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}
.js-enabled .bento-card.is-visible,
.js-enabled .hero-figure.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- THEME TOGGLE BUTTON ---------- */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--nav-border);
  background: transparent;
  color: var(--fg);
  cursor: pointer;
  padding: 0;
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
  margin-left: 16px;
  order: 99;
  z-index: 101;
}

.theme-toggle:hover {
  background-color: var(--card-soft);
  border-color: var(--line);
  transform: scale(1.05);
}

.theme-toggle:active {
  transform: scale(0.95);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
  display: none;
}

/* En modo claro (por defecto o forzado), mostramos la luna (para cambiar a oscuro) y ocultamos el sol */
:root:not([data-theme="dark"]) .theme-toggle .moon-icon {
  display: block;
}
:root:not([data-theme="dark"]) .theme-toggle .sun-icon {
  display: none;
}

/* En modo oscuro (forzado), mostramos el sol (para cambiar a claro) y ocultamos la luna */
:root[data-theme="dark"] .theme-toggle .sun-icon {
  display: block;
}
:root[data-theme="dark"] .theme-toggle .moon-icon {
  display: none;
}

/* Soporte para modo oscuro automático de sistema (cuando no hay override forzado) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .sun-icon {
    display: block;
  }
  :root:not([data-theme="light"]) .theme-toggle .moon-icon {
    display: none;
  }
}

/* En móvil: theme toggle va en posición DOM (orden 0), absorbe el espacio y el hamburger queda a su derecha */
@media (max-width: 720px) {
  .theme-toggle {
    order: 0;
    margin-left: auto;
  }
  .nav-toggle {
    margin-left: 8px;
  }
}

/* ---------- REDUCED MOTION ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
