/* ==========================================================
   Portafolio Juan Maldonado — estilos compartidos
   Tokens tomados del archivo de Figma
   ========================================================== */

:root {
  color-scheme: light;

  /* Color */
  --gray-800: #434343;
  --gray-700: #5a5a5a;
  --gray-500: #757575;
  --gray-400: #868686;
  --muted: rgba(0, 0, 0, 0.55);
  --line: rgba(0, 0, 0, 0.15);
  --white: #ffffff;
  --bg-top: #f1f2f5;
  --bg-mid: #f5f6f8;
  --bg-end: #fafbfc;

  /* Green Grocer */
  --gg-dark: #1e4416;
  --gg-green: #82b477;
  --gg-cream: #f3f9dd;

  /* Tipografía */
  --font-display: "Cutive", Georgia, "Times New Roman", serif;
  --font-body: "Hind", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --font-inter: "Inter", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --font-roboto: "Roboto", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;

  /* Layout */
  --pad: 160px;          /* margen lateral del texto */
  --section-gap: 160px;  /* espacio entre secciones */
  --header-h: 72px;

  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: inherit; }

html { scroll-padding-top: calc(var(--header-h) + env(safe-area-inset-top, 0px)); }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--gray-800);
  background: linear-gradient(180deg, var(--bg-top) 0%, var(--bg-mid) 28.447%, var(--bg-end) 100%);
  background-color: var(--bg-end);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
p, h1, h2, h3 { margin: 0; font-weight: 400; }
a { color: inherit; }

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

.page { position: relative; overflow-x: clip; }

/* Texto con degradado (Header/H0 y H1 del Figma) */
.gradient-text {
  font-family: var(--font-display);
  line-height: 1.3;
  background-image: linear-gradient(26deg, #434343 28.521%, #878787 72.181%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- Header ---------- */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 20;
  height: calc(var(--header-h) + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) 64px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-image: linear-gradient(180deg, rgba(242, 243, 245, 0.3) 12%, rgba(221, 223, 224, 0) 90%);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--gray-800);
}
.brand img { width: 48px; height: 48px; object-fit: cover; }
.brand-text { display: flex; flex-direction: column; gap: 8px; line-height: 1.1; }
.brand-name { font-weight: 700; font-size: 20px; height: 14px; display: flex; align-items: center; }
.brand-role { font-size: 16px; height: 11px; display: flex; align-items: center; }

.site-nav {
  display: flex;
  align-items: center;
  gap: 40px;
  height: 40px;
  padding: 0 40px;
  border: 1px solid var(--gray-800);
  border-radius: 40px;
}
.site-nav a {
  color: #000;
  text-decoration: none;
  font-size: 16px;
  line-height: 1.1;
  padding-top: 3px;
}
.site-nav a:hover,
.site-nav a[aria-current="page"] { text-decoration: underline; text-underline-offset: 4px; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 64px;
  border-radius: 16px;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.09;
  text-decoration: none;
  cursor: pointer;
}
.btn img { width: 24px; height: 24px; }
.btn > span { padding-top: 3px; }
.btn-primary { background: var(--gray-800); color: var(--white); border: 1px solid var(--gray-800); }
.btn-primary:hover { background: #2f2f2f; }
.btn-secondary {
  background: var(--white);
  color: var(--gray-800);
  border: 1px solid var(--gray-800);
  padding: 10px 32px;
  line-height: 1.4;
}
.btn-secondary > span { padding-top: 2px; }
.btn-secondary:hover { background: #f4f4f4; }

/* ---------- Footer ---------- */
.site-footer {
  width: 100%;
  min-height: 162px;
  padding: 64px;
  margin-top: var(--section-gap);
  border-top: 1px solid var(--line);
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.site-footer.is-compact { min-height: 152px; }
.footer-title { font-weight: 700; font-size: 24px; line-height: 1.1; color: #000; }
.social { display: flex; align-items: center; gap: 24px; }
.social a { display: block; width: 24px; height: 24px; }
.social img { width: 24px; height: 24px; }

/* ==========================================================
   HOME
   ========================================================== */
.home main {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--section-gap);
  padding-top: 236px;
}

.palm {
  position: absolute;
  z-index: 0;
  top: -227px;
  left: 48%;
  width: 79.4%;
  max-width: none;
  aspect-ratio: 2032 / 1915;
  object-fit: cover;
  opacity: 0.2;
  pointer-events: none;
}

.hero { max-width: 100%; display: flex; flex-direction: column; align-items: flex-start; gap: 16px; padding: 0 40px; }
.hero h1 { font-size: 64px; }
.hero p { width: 440px; max-width: 100%; line-height: 1.4; color: var(--gray-700); }

/* Página 404 */
.is-404 .page { min-height: 100vh; display: flex; flex-direction: column; }
.is-404 main { flex: 1; justify-content: center; padding: calc(var(--header-h) + 64px) 24px 0; }
.not-found { display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; }
.not-found-code { font-size: 14px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.not-found h1 { font-size: 32px; }
.not-found p { line-height: 1.4; color: var(--gray-700); }
.not-found .btn { margin-top: 8px; }

.logos { width: 100%; padding: 0 64px; display: flex; flex-direction: column; align-items: center; gap: 32px; }
.logos-label { color: var(--muted); line-height: 1.1; text-align: center; }
.logos ul {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center;
  gap: 12px 24px;
}
.logos li { height: 84px; padding: 16px; display: flex; align-items: center; }
.logos img { object-fit: contain; mix-blend-mode: darken; }
.logos .logo-approach   { width: 171px; height: 50px; }
.logos .logo-fullsteam  { width: 195.5px; height: 56.9px; margin-bottom: 20px; }
.logos .logo-jellysmack { width: 210px; height: 62px; }
.logos .logo-prophet    { width: 220px; height: 64px; }

.section-title { font-size: 40px; }
.stack-24 { max-width: 100%; display: flex; flex-direction: column; gap: 24px; align-items: flex-start; }
.stack-24 > * { max-width: 100%; }
.body-copy { line-height: 1.4; color: var(--gray-700); }
.body-copy + .body-copy { margin-top: 22px; }

.work { width: 100%; display: flex; align-items: center; }
.work-text { flex: 1 1 50%; min-width: 0; padding: 0 116px; display: flex; justify-content: center; }
.work-text-inner { min-width: 0; max-width: 100%; display: flex; flex-direction: column; gap: 32px; align-items: flex-start; }
.work-text .body-copy { width: 400px; max-width: 100%; }

.work-gg .work-media { flex: 1 1 50%; min-width: 0; height: 823px; overflow: hidden; }
.work-gg .work-media img { width: 100%; height: 100%; object-fit: cover; }

.work-lava .work-media { flex: 0 0 auto; padding: 31px 13px; }
.work-lava .work-media img { width: 604px; height: 717px; object-fit: contain; }

.work-more { justify-content: flex-end; }
.phone-tilt {
  flex: 0 0 auto;
  position: relative;
  width: 599px;
  height: 737px;
  overflow: hidden;
}
.phone-tilt img {
  position: absolute;
  left: calc(50% + 27.42px);
  top: calc(50% + 7.92px);
  width: 734.487px;
  height: 694px;
  max-width: none;
  object-fit: cover;
  transform: translate(-50%, -50%) rotate(-9.78deg);
}

/* ==========================================================
   ABOUT
   ========================================================== */
body.about { background: var(--white); }
.about-intro { background: var(--bg-top); padding: 180px 120px 120px; }
.about-feature { display: flex; align-items: center; justify-content: center; gap: 64px; max-width: 1040px; margin: 0 auto; }
.about-photo { flex: 1 1 0; min-width: 0; aspect-ratio: 576 / 388; border-radius: 16px; object-fit: cover; }
.about-text { width: 400px; flex: 0 0 auto; display: flex; flex-direction: column; gap: 24px; font-family: var(--font-inter); }
.about-text h1 { font-weight: 700; font-size: 36px; line-height: 1.2; letter-spacing: -0.72px; color: #000; }
.about-text p { font-weight: 500; font-size: 18px; line-height: 1.45; letter-spacing: -0.09px; color: var(--muted); }
.about-text p + p { margin-top: 26px; }
.about-text .stack { display: block; }

/* ==========================================================
   CASOS DE ESTUDIO (Lavabugs + Green Grocer)
   ========================================================== */
.case main { display: flex; flex-direction: column; align-items: center; gap: var(--section-gap); }

.container { width: 100%; max-width: 1280px; margin: 0 auto; padding: 0 var(--pad); }

.case-hero { width: 100%; }
.case-hero img { width: 100%; object-fit: cover; }
.case-hero.is-lava img { aspect-ratio: 1921 / 974; }
.case-hero.is-gg img   { aspect-ratio: 1280 / 854; object-position: 50% 29%; }

.case-title { font-family: var(--font-display); font-size: 40px; line-height: 1.3; }
.case-h2 { font-family: var(--font-display); font-size: 32px; line-height: 1.3; }
.case-copy { line-height: 1.1; }
.case-copy + .case-copy { margin-top: 18px; }

.block { width: 100%; display: flex; flex-direction: column; align-items: center; }
.gap-24 { gap: 24px; } .gap-32 { gap: 32px; } .gap-40 { gap: 40px; } .gap-80 { gap: 80px; }
.text-block { display: flex; flex-direction: column; align-items: flex-start; }

.rounded-30 { border-radius: 30px; }

/* Fila de 3 pantallas (Lavabugs) */
.phones { display: flex; flex-wrap: nowrap; justify-content: center; gap: 26px; }
.phone { flex: none; width: 325.6px; height: 700.355px; padding: 10.44px; display: flex; align-items: center; justify-content: center; }
.phone img { width: 287.102px; height: 623.795px; border-radius: 31.32px; object-fit: cover; object-position: top; }

.wide-img { width: 100%; height: auto; object-fit: cover; }
.opinions { width: min(1094px, calc(100% - 2 * 24px)); aspect-ratio: 1094 / 752; object-fit: cover; }
.personas { aspect-ratio: 1291 / 752; }
.journey  { aspect-ratio: 2262 / 926; }

/* Puntos de dolor */
.pain-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; }
.pain-col { display: flex; flex-direction: column; gap: 40px; }
.pain { display: flex; gap: 8px; padding-left: 16px; align-items: flex-start; }
.pain::before {
  content: "";
  flex: 0 0 8px;
  height: 2px;
  margin-top: 8px;
  border-radius: 12px;
  background: var(--gray-400);
}
.pain p { line-height: 1.1; }
.pain strong { font-weight: 700; font-size: 18px; display: block; }

/* Green Grocer */
.gg-frame { width: 100%; aspect-ratio: 1282 / 826; object-fit: cover; object-position: 56% 50%; }

.tokens { display: flex; gap: 32px; justify-content: center; width: min(1122px, calc(100% - 2 * 24px)); }
.tokens img { flex: 1 1 0; min-width: 0; aspect-ratio: 545 / 592; border-radius: 30px; }
.tokens .is-cover   { object-fit: cover; }
.tokens .is-contain { object-fit: contain; background: var(--white); }

.masonry { width: min(1028px, calc(100% - 2 * 24px)); display: flex; gap: 5.93%; }
.masonry-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; }
.masonry-col.c1 { padding-top: 12.06%; }
.masonry-col.c3 { padding-top: 21.11%; }
.masonry-col img {
  width: 100%;
  height: auto;
  aspect-ratio: 302 / 654;
  object-fit: cover;
  border: 2px solid #dce6db;
  border-radius: 20px;
}
.masonry-col.c1 img + img, .masonry-col.c3 img + img { margin-top: 20.2%; }
.masonry-col.c2 img + img { margin-top: 15.56%; }

/* Tarjeta "Components layout" */
.components-card {
  width: min(1118px, calc(100% - 2 * 24px));
  background: var(--white);
  border: 4px solid #f5f5f5;
  border-radius: 62px;
  padding: 80px 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 124px;
}
.components-card .case-h2 { align-self: stretch; }
.components-card .note { color: var(--gray-500); line-height: 1.1; align-self: stretch; }

.demo { position: relative; width: 845px; height: 333px; flex: 0 0 auto; }
.demo > * { position: absolute; }
.demo-x { font-family: var(--font-roboto); font-weight: 500; font-size: 17.631px; color: #b1b1b1; line-height: 21px; }
.demo-card {
  left: 67.22px; top: 0;
  width: 332.782px; height: 332.782px;
  background: var(--white);
  border: 3.87px solid #f3f3f3;
  border-radius: 38.696px;
}
.demo-card > * { position: absolute; }
.demo-lemon { left: 101.47px; top: 3.72px; width: 122.393px; height: 216.843px; overflow: hidden; }
.demo-lemon img { position: absolute; max-width: none; width: 196.76%; height: 111.5%; left: -46.41%; top: -11.5%; }
.demo-name { left: 36.76px; top: 210.62px; font-family: var(--font-roboto); font-weight: 500; font-size: 29.022px; color: #b1b1b1; white-space: nowrap; }
.demo-price { left: 36.76px; top: 247.05px; font-family: var(--font-roboto); white-space: nowrap; }
.demo-price b { font-weight: 700; font-size: 38.696px; color: var(--gg-dark); }
.demo-price span { font-weight: 500; font-size: 29.022px; color: #b1b1b1; }
.demo-add { left: 246.93px; top: 216.55px; width: 61.196px; height: 66.08px; border-radius: 18.058px; background: #82b478; }
.demo-add img { position: absolute; left: 19.06px; top: 21.38px; width: 24.077px; height: 23.322px; }
.demo-hl { left: 51.79px; width: 93.664px; background: rgba(178, 229, 126, 0.5); }
.demo-label { left: 558px; font-weight: 700; font-size: 24px; line-height: 1.1; color: #404040; white-space: nowrap; }

/* Paleta + tipografía */
.style-sheet { display: flex; align-items: center; justify-content: center; gap: 108px; flex-wrap: wrap; }
.palette { display: flex; align-items: center; gap: 50px; }
.swatches { display: flex; flex-direction: column; gap: 27px; }
.swatch { width: 190px; height: 100px; border-radius: 20px; }
.swatch-labels { display: flex; flex-direction: column; gap: 71px; font-family: var(--font-roboto); font-size: 20.27px; line-height: 28px; color: var(--gray-500); }
.type-card {
  position: relative;
  width: 505px; height: 481px;
  flex: 0 0 auto;
  background: var(--white);
  border-radius: 34.237px;
  box-shadow: 5px 9px 20.9px 0 rgba(0, 0, 0, 0.11);
  font-family: var(--font-roboto);
}
.type-card > * { position: absolute; }
.type-aa { left: 80px; top: 41px; font-weight: 700; font-size: 180.148px; line-height: 211px; color: var(--gg-dark); }
.type-chars { left: 80px; top: 249px; width: 360px; font-size: 20.27px; line-height: 28px; color: var(--gray-500); }
.type-pill { left: 314px; top: 371px; width: 134px; height: 42px; border-radius: 12.952px; background: rgba(236, 245, 201, 0.63); }
.type-name { left: 337px; top: 376px; font-weight: 700; font-size: 27.09px; line-height: 32px; color: var(--gg-dark); }

/* ==========================================================
   FORMULARIO DE CONTACTO (ventana emergente)
   ========================================================== */
.contact-dialog {
  width: min(520px, calc(100% - 32px));
  max-height: calc(100% - 32px);
  padding: 48px;
  border: 0;
  border-radius: 16px;
  background: var(--white);
  color: var(--gray-800);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
}
.contact-dialog::backdrop { background: rgba(67, 67, 67, 0.35); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }

.contact-close {
  position: absolute;
  top: 16px; right: 16px;
  width: 40px; height: 40px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--gray-700);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}
.contact-close:hover { background: #f4f4f4; }

.contact-form { display: flex; flex-direction: column; gap: 20px; }
.contact-title { font-size: 40px; }
.contact-intro { line-height: 1.4; color: var(--gray-700); margin-top: -8px; }

.field { display: flex; flex-direction: column; gap: 8px; }
.field span { font-weight: 700; line-height: 1.1; }
.field input,
.field textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-end);
  font: inherit;
  color: var(--gray-800);
}
.field textarea { resize: vertical; min-height: 120px; }
.field input:focus,
.field textarea:focus { outline: none; border-color: var(--gray-800); background: var(--white); }

.contact-status { min-height: 1.4em; line-height: 1.4; color: var(--gray-700); }
.contact-status:empty { display: none; }
.contact-status.is-ok { color: #2e7d32; }
.contact-status.is-error { color: #c62828; }

.contact-submit { align-self: flex-start; font-size: 16px; }
.contact-submit:disabled { opacity: 0.6; cursor: wait; }

@media (max-width: 640px) {
  .contact-dialog { padding: 40px 24px 32px; }
  .contact-title { font-size: 30px; }
  .contact-submit { align-self: stretch; }
}

/* Utilidad: texto solo para lectores de pantalla */
.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;
}

/* ==========================================================
   RESPONSIVE — Tablet (≈800px en Figma)
   ========================================================== */
@media (max-width: 1100px) {
  :root { --pad: 72px; --section-gap: 120px; }

  .work { flex-direction: column; align-items: stretch; gap: 40px; }
  .work-lava { flex-direction: column-reverse; }
  .work-text { padding: 0 72px; justify-content: flex-start; }
  .work-gg .work-media { flex: none; height: 560px; }
  .work-lava .work-media { align-self: center; padding: 0 24px; }
  .work-lava .work-media img { width: 100%; max-width: 604px; height: auto; aspect-ratio: 604 / 717; }
  .work-more { flex-direction: column; }
  .phone-tilt { align-self: center; zoom: 0.85; }

  .about-intro { padding: 160px 72px 96px; }
  .about-feature { flex-direction: column; align-items: stretch; gap: 48px; }
  .about-text { width: auto; }

  .pain-grid { grid-template-columns: 1fr; }
  .phones { flex-wrap: wrap; }

  .components-card { padding: 64px 48px; gap: 80px; }
  .demo { zoom: 0.78; }
  .style-sheet { flex-direction: column; gap: 64px; }
}

/* ==========================================================
   RESPONSIVE — Mobile (≈375px en Figma)
   ========================================================== */
@media (max-width: 640px) {
  :root { --pad: 40px; --section-gap: 88px; }

  .site-header { justify-content: center; padding-left: 16px; padding-right: 16px; }
  .brand { display: none; }
  .site-nav { gap: 28px; padding: 0 28px; }

  .home main { padding-top: 160px; }
  .hero h1 { font-size: 40px; }
  .section-title { font-size: 30px; }
  .logos { padding: 0 24px; }
  .logos li { height: auto; padding: 8px; }
  .logos img { zoom: 0.7; }

  .work-text { padding: 0 40px; }
  .work-gg .work-media { height: 420px; }
  .phone-tilt { zoom: 0.55; }

  .about-intro { padding: 132px 24px 72px; }
  .about-text { padding: 0 16px; }
  .about-text h1 { font-size: 30px; }
  .about-text p { font-size: 16px; }

  .case-title { font-size: 28px; }
  .case-h2 { font-size: 22px; }
  .gap-80 { gap: 48px; }

  .phones { flex-direction: column; align-items: center; gap: 16px; }

  .tokens { flex-direction: column; width: calc(100% - 48px); }

  .masonry { flex-direction: column; gap: 40px; width: 246px; }
  .masonry-col { padding-top: 0 !important; gap: 40px; }
  .masonry-col img + img { margin-top: 0 !important; }
  .masonry-col .hide-mobile { display: none; }

  .components-card { border-radius: 36px; padding: 40px 20px; gap: 48px; }
  .demo { zoom: 0.36; }

  .palette { zoom: 0.8; }
  .type-card { zoom: 0.6; }

  .site-footer { padding: 48px 40px; }
  .footer-title { font-size: 20px; max-width: 120px; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}
