/* =========================================================
   MARTI ENCINAS — Portfolio design system
   Grid: 12 columns · 120px side margins · 24px gutter
   ========================================================= */

:root {
  --blue: #136CFF;
  --blue-dark: #0A55D6;
  --bg: #FBF9F5;
  --white: #FFFFFF;
  --ink: #000000;
  --sub: #444444;
  --rule: #E6E0D6;
  --ph: #F1ECE4;
  --helvetica: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --margin: 120px;
  --gutter: 24px;

  /* ---------- TYPE SCALE (desktop) ---------- */
  --h1: 48px;      --h1-lh: 56px;     /* page titles */
  --h2: 28px;      --h2-lh: 32px;     /* section titles */
  --h3: 24px;      --h3-lh: 32px;     /* sub-sections */
  --h4: 18px;      --h4-lh: 24px;     /* card titles */
  --h5: 16px;      --h5-lh: 20px;     /* small titles */
  --lead: 22px;    --lead-lh: 30px;   /* intro paragraph */
  --body: 18px;    --body-lh: 26px;   /* running text */
  --small: 16px;   --small-lh: 24px;  /* short text, inputs, buttons */
  --caption: 14px; --caption-lh: 16px;/* back links, small buttons */
  --label: 12px;   --label-lh: 18px;  /* mono labels: dates, breadcrumbs, chips */
  --micro: 11px;   --micro-lh: 14px;  /* mono tags, meta */
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--helvetica);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
main { flex: 1; }

/* ---------- Typography: elements + classes ---------- */
h1, .h1 { font-family: var(--helvetica); font-weight: 700; font-size: var(--h1); line-height: var(--h1-lh); }
h2, .h2 { font-family: var(--helvetica); font-weight: 700; font-size: var(--h2); line-height: var(--h2-lh); }
h3, .h3 { font-family: var(--helvetica); font-weight: 700; font-size: var(--h3); line-height: var(--h3-lh); }
h4, .h4 { font-family: var(--helvetica); font-weight: 700; font-size: var(--h4); line-height: var(--h4-lh); }
h5, .h5 { font-family: var(--helvetica); font-weight: 700; font-size: var(--h5); line-height: var(--h5-lh); }
.lead   { font-weight: 300; font-size: var(--lead);  line-height: var(--lead-lh); }
.body   { font-weight: 300; font-size: var(--body);  line-height: var(--body-lh); }
.small  { font-weight: 300; font-size: var(--small); line-height: var(--small-lh); }
.label  { font-family: var(--mono); font-weight: 300; font-size: var(--label); line-height: var(--label-lh); color: var(--sub); }
.micro  { font-family: var(--mono); font-weight: 300; font-size: var(--micro); line-height: var(--micro-lh); color: var(--sub); }
img { display: block; max-width: 100%; }
ul, ol { list-style: none; }
a { color: inherit; }

/* ---------- Header ---------- */
.header {
  background: var(--white);
  height: 141px;
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 0 var(--margin) 0 123px;
}
.header-left { display: flex; align-items: flex-start; gap: 16px; }
.logo { display: block; width: 128px; margin-top: 44px; }
.logo svg { display: block; width: 100%; height: auto; overflow: visible; }
.nav { display: flex; gap: 16px; margin-top: 53px; }

/* ---------- Line button: nav, category tabs, links ---------- */
.btn {
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  font-family: var(--mono);
  font-weight: 400;
  font-size: var(--small);
  line-height: 1;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  background: transparent;
  border: 0;
  border-top: 1px solid var(--blue);
  border-bottom: 1px solid var(--blue);
  transition: background-color .2s ease, color .2s ease;
}
.btn:hover, .btn:focus-visible, .btn.active { background: var(--blue); color: var(--white); outline: none; }
.btn:active { transform: translateY(1px); }
.nav .btn { width: 110px; justify-content: flex-start; }
.nav .btn + .btn { width: 111px; }

/* ---------- Solid button (.cta) ---------- */
.cta {
  width: 100%;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--helvetica);
  font-weight: 500;
  font-size: var(--small);
  line-height: 1;
  text-decoration: none;
  border: 0;
  border-radius: 0;
  cursor: pointer;
  transition: background-color .2s ease, color .2s ease;
}
.cta:active { transform: translateY(1px); }
.cta:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.cta[disabled] { opacity: .6; cursor: default; }
.cta.primary  { background: var(--blue); color: var(--white); }
.cta.primary:hover  { background: var(--blue-dark); }
.cta.upwork   { background: #14A800; color: var(--white); }
.cta.upwork:hover   { background: #108A00; }
.cta.linkedin { background: #0A66C2; color: var(--white); }
.cta.linkedin:hover { background: #004182; }
.cta.email    { background: var(--ink); color: var(--white); }
.cta.email:hover    { background: #333333; }
.cta.email.copied   { background: var(--blue); }
.ic { width: 18px; height: 18px; flex-shrink: 0; }
.ic-check, .cta.email.copied .ic-copy { display: none; }
.cta.email.copied .ic-check { display: block; }

/* ---------- Motif: >>> + title whose 1px line grows into a box ---------- */
.motif { display: flex; align-items: flex-start; gap: 9px; }
/* >>> : caja de 22x14 con 3 triángulos de 18x10; en hover la caja se llena de azul y los triángulos pasan a blanco */
.arrows {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 14px;
  margin-top: 9.5px; /* centrado en la línea de 33px del .boxline */
  color: var(--blue);
  flex-shrink: 0;
  transition: color .2s ease;
}
.arrows::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--blue);
  opacity: 0;
  transition: opacity .2s ease;
}
.arrows svg { position: relative; display: block; width: 18px; height: 10px; fill: currentColor; }
.boxline {
  position: relative;
  display: inline-block;
  height: 33px;
  font-family: var(--helvetica);
  font-weight: 700;
  font-size: var(--h5);
  line-height: 33px;
  color: var(--ink);
  white-space: nowrap;
  transition: color .15s ease;
}
.boxline::before {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: var(--blue);
  transition: height .3s cubic-bezier(.2, .8, .2, 1);
}
.boxline > span { position: relative; }

.hl { text-decoration: none; color: inherit; outline: none; }
.hl:hover .arrows, .hl:focus-visible .arrows, .is-on .arrows { color: var(--white); }
.hl:hover .arrows::before, .hl:focus-visible .arrows::before, .is-on .arrows::before { opacity: 1; }
.hl:hover .boxline::before, .hl:focus-visible .boxline::before, .is-on .boxline::before { height: 100%; }
.hl:hover .boxline, .hl:focus-visible .boxline { color: var(--white); transition: color .15s ease .12s; }
.is-on .boxline { color: var(--white); }

/* ---------- Section head (About, Case study) ---------- */
.sec-head { display: flex; align-items: baseline; gap: 12px; padding-bottom: 14px; border-bottom: 1px solid var(--blue); }
.sec-head .arrows { margin-top: 0; align-self: center; }
.sec-head h2 { font-size: var(--h2); line-height: 1; }

/* ---------- Breadcrumbs ---------- */
.crumbs { display: flex; flex-wrap: wrap; gap: 8px; font-family: var(--mono); font-weight: 300; font-size: var(--label); line-height: var(--label-lh); color: var(--sub); }
.crumbs a { text-decoration: none; border-bottom: 1px solid transparent; transition: color .2s ease, border-color .2s ease; }
.crumbs a:hover { color: var(--blue); border-color: var(--blue); }

/* ---------- Entry animation ---------- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.stagger > * { animation: fadeUp .5s ease both; }
.stagger > *:nth-child(2) { animation-delay: .08s; }
.stagger > *:nth-child(3) { animation-delay: .16s; }
.stagger > *:nth-child(4) { animation-delay: .24s; }
.stagger > *:nth-child(5) { animation-delay: .32s; }
.stagger > *:nth-child(n+6) { animation-delay: .4s; }
@media (prefers-reduced-motion: reduce) { *, *::before { animation: none !important; transition: none !important; } }

/* =========================================================
   HOME
   ========================================================= */
.home {
  width: 960px;
  margin-left: calc(50% - 478px);
  padding: 57px 0 119px;
  display: grid;
  grid-template-columns: 496px 464px;
  row-gap: 100px;
}
.home-cell { display: flex; align-items: flex-start; }
.home-img { width: 180px; height: 180px; flex-shrink: 0; }
.home-img img { width: 100%; height: 100%; object-fit: contain; }
.home-info { margin-top: 30px; }
.home-text { display: flex; flex-direction: column; align-items: flex-start; }
.home-sub { font-family: var(--mono); font-weight: 300; font-size: var(--micro); line-height: var(--micro-lh); color: var(--sub); margin-top: 4px; white-space: nowrap; }

/* =========================================================
   ABOUT
   ========================================================= */
.about { padding: 72px var(--margin) 120px; display: flex; flex-direction: column; gap: 88px; }
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gutter); }
.intro { align-items: start; }
.photo { grid-column: 1 / span 2; width: 180px; height: 180px; object-fit: cover; }
.intro-body { grid-column: 4 / span 7; }
.bio { font-weight: 300; font-size: var(--body); line-height: var(--body-lh); margin-top: 20px; max-width: 720px; }
.bio strong { font-weight: 700; }
.links { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 32px; }

.entry { display: flex; flex-direction: column; gap: 12px; padding: 28px 0; border-bottom: 1px solid var(--rule); }
.entry-date { font-family: var(--mono); font-weight: 300; font-size: var(--label); line-height: var(--label-lh); color: var(--sub); display: flex; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.dash { margin: 0 8px; }
.now { margin-left: 12px; background: var(--blue); color: var(--white); font-family: var(--mono); font-weight: 400; font-size: var(--micro); line-height: 1; padding: 4px 6px; }
.entry-role h3 { font-size: var(--h5); line-height: var(--h5-lh); }
.entry-co { display: block; font-family: var(--mono); font-weight: 300; font-size: var(--label); line-height: var(--label-lh); color: var(--sub); margin-top: 6px; }
.entry-desc { max-width: 720px; font-weight: 300; font-size: var(--body); line-height: var(--body-lh); }

.stack { row-gap: 88px; }
.stack > section { grid-column: span 6; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 28px; }
.chip { font-family: var(--mono); font-weight: 300; font-size: var(--label); line-height: 1; padding: 9px 12px; white-space: nowrap; border: 1px solid var(--rule); }

/* =========================================================
   CONTACT
   ========================================================= */
.page-contact main { display: flex; align-items: center; justify-content: center; padding: 40px 20px; }
.contact-card { width: 100%; max-width: 420px; }
.contact-title { font-size: var(--h3); line-height: var(--h3-lh); }
.form { display: flex; flex-direction: column; gap: 12px; margin-top: 28px; }
.form input, .form textarea {
  width: 100%;
  font-family: var(--helvetica);
  font-weight: 400;
  font-size: var(--small);
  line-height: 22px;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--rule);
  border-radius: 0;
  padding: 11px 12px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.form textarea { resize: vertical; min-height: 88px; }
.form input::placeholder, .form textarea::placeholder { color: #8F8A82; }
.form input:focus, .form textarea:focus { border-color: var(--blue); box-shadow: inset 0 -1px 0 var(--blue); }
.form input:user-invalid { border-color: #D93025; }
.form .cta { margin-top: 4px; }
.hp { position: absolute; left: -9999px; }
.sent { display: none; margin-top: 28px; padding: 20px; background: var(--white); border-left: 3px solid var(--blue); }
.sent strong { display: block; font-size: var(--h5); margin-bottom: 4px; }
.sent p { font-weight: 300; font-size: var(--small); line-height: var(--small-lh); color: var(--sub); }
.contact-card.is-sent .form { display: none; }
.contact-card.is-sent .sent { display: block; }
.divider { display: flex; align-items: center; gap: 12px; margin: 28px 0 20px; font-family: var(--mono); font-weight: 300; font-size: var(--label); color: var(--sub); }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--rule); }
.direct { display: flex; flex-direction: column; gap: 10px; }

/* =========================================================
   WORK LISTING
   ========================================================= */
.listing, .case { padding: 56px var(--margin) 120px; }
.listing .case-head { margin-top: 0; }
.cats { display: flex; gap: 12px; margin-top: 32px; flex-wrap: wrap; }
.cats .btn { height: 38px; font-size: var(--caption); }

.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: var(--gutter); row-gap: 56px; margin-top: 56px; }
.pcard { display: block; }
.pcard-media { aspect-ratio: 16 / 9; background: var(--white); overflow: hidden; display: flex; align-items: center; justify-content: center; }
.pcard-media img { width: 100%; height: 100%; object-fit: contain; padding: 28px; transition: transform .45s cubic-bezier(.2, .8, .2, 1); }
.pcard:hover .pcard-media img, .pcard:focus-visible .pcard-media img { transform: scale(1.04); }
.ph { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; background: var(--ph); font-family: var(--mono); font-weight: 300; font-size: var(--label); color: #8F8A82; text-align: center; padding: 16px; }
.pcard-body { margin-top: 20px; }
.pcard .boxline { font-size: var(--h4); }
.pcard-text { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; }
.pcard-sum { font-weight: 300; font-size: var(--small); line-height: var(--small-lh); margin-top: 10px; }
.pcard-tags { font-family: var(--mono); font-weight: 300; font-size: var(--micro); line-height: var(--micro-lh); color: var(--sub); margin-top: 12px; }

/* =========================================================
   CASE STUDY
   ========================================================= */
.case-head { margin-top: 32px; max-width: 880px; }
/* Título en caja negra con letra blanca */
.case-title { display: inline-block; background: var(--ink); color: var(--white); padding: 0 10px; letter-spacing: -.5px; }
.case-lead { font-weight: 300; font-size: var(--body); line-height: var(--body-lh); margin-top: 12px; max-width: 720px; }

.gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gutter); margin-top: 48px; }
.gallery figure { background: var(--white); aspect-ratio: 4 / 3; overflow: hidden; }
.gallery figure.full { grid-column: 1 / -1; aspect-ratio: 16 / 9; }
.gallery img { width: 100%; height: 100%; object-fit: contain; padding: 40px; }

.case-body { margin-top: 96px; display: flex; flex-direction: column; gap: 64px; }
.case-sec { max-width: 720px; }
.case-sec h2 { font-size: var(--h3); line-height: 33px; }
.case-sec p { font-weight: 300; font-size: var(--body); line-height: var(--body-lh); margin-top: 16px; }

.proto { margin-top: 96px; }
.proto-frame { margin-top: 24px; aspect-ratio: 16 / 9; background: var(--white); border: 1px solid var(--rule); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 24px; text-align: center; }
.proto-frame iframe { width: 100%; height: 100%; border: 0; }
.proto-frame p { font-family: var(--mono); font-weight: 300; font-size: var(--label); color: var(--sub); }
.proto-frame .cta { width: auto; padding: 0 24px; }

.case-next { margin-top: 120px; padding-top: 24px; border-top: 1px solid var(--blue); display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; }
.back { font-family: var(--mono); font-weight: 400; font-size: var(--caption); line-height: 33px; text-decoration: none; color: var(--sub); transition: color .2s ease; }
.back:hover { color: var(--blue); }
.next { display: flex; flex-direction: column; align-items: flex-end; }
.next-label { font-family: var(--mono); font-weight: 300; font-size: var(--micro); color: var(--sub); margin-bottom: 6px; }

/* ---------- 404 ---------- */
.notfound { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 20px; padding: 80px var(--margin); }
.notfound p { font-weight: 300; font-size: var(--body); line-height: var(--body-lh); }
.notfound .cta { width: auto; padding: 0 24px; }

/* =========================================================
   TABLET
   ========================================================= */
@media (max-width: 1024px) {
  :root {
    --margin: 30px;
    --h1: 36px;   --h1-lh: 44px;
    --h2: 24px;   --h2-lh: 28px;
    --h3: 20px;   --h3-lh: 28px;
    --lead: 18px; --lead-lh: 26px;
    --body: 16px; --body-lh: 24px;
  }
  .header { height: auto; padding: 24px 30px; align-items: center; }
  .logo { width: 115px; margin-top: 0; }
  .nav { margin-top: 0; }
  .nav .btn, .nav .btn + .btn { width: 118px; padding: 0; justify-content: center; }

  .home { width: auto; margin-left: 0; padding: 40px 30px 60px; grid-template-columns: 1fr; row-gap: 40px; }
  .home-img { width: 140px; height: 140px; }
  .home-info { margin-top: 20px; }

  .about { padding: 48px 30px 80px; gap: 64px; }
  .photo { grid-column: 1 / -1; width: 140px; height: 140px; }
  .intro-body { grid-column: 1 / -1; margin-top: 24px; }
  .entry { padding: 24px 0; }
  .stack { row-gap: 64px; }
  .stack > section { grid-column: 1 / -1; }

  .page-contact main { align-items: stretch; padding: 40px 30px 32px; }
  .contact-card { display: flex; flex-direction: column; }
  .reach { margin-top: auto; padding-top: 32px; }

  .listing, .case { padding: 40px 30px 80px; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 48px; margin-top: 40px; }
  .case-body, .proto { margin-top: 72px; }
}

/* =========================================================
   PHONE
   ========================================================= */
@media (max-width: 600px) {
  :root {
    --margin: 20px;
    --h1: 30px;   --h1-lh: 36px;
    --h2: 22px;   --h2-lh: 26px;
  }
  .header { padding: 20px; }
  .logo { width: 94px; }
  .nav { flex-direction: column; gap: 8px; }
  .nav .btn, .nav .btn + .btn { width: 120px; height: 38px; font-size: var(--caption); }

  .home { padding: 24px 20px 40px; row-gap: 24px; }
  .home-img { width: 110px; height: 110px; }
  .home-info { margin-top: 12px; }
  .home-sub { white-space: normal; }

  .about { padding: 32px 20px 64px; gap: 56px; }
  .photo { width: 110px; height: 110px; }
  .links { gap: 8px; }
  .links .btn { height: 38px; font-size: var(--caption); padding: 0 12px; }
  .chip { padding: 8px 10px; }

  .page-contact main { padding: 28px 20px 24px; }
  .form { gap: 10px; margin-top: 20px; }
  .form textarea { min-height: 72px; }
  .divider { margin: 18px 0 14px; }
  .direct { gap: 8px; }
  .cta { height: 46px; }

  .listing, .case { padding: 28px 20px 64px; }
  .cats { flex-wrap: nowrap; overflow-x: auto; margin-right: -20px; padding-right: 20px; scrollbar-width: none; }
  .cats::-webkit-scrollbar { display: none; }
  .cards { grid-template-columns: 1fr; row-gap: 40px; }
  .gallery { grid-template-columns: 1fr; gap: 12px; }
  .gallery figure.full { aspect-ratio: 4 / 3; }
  .gallery img { padding: 24px; }
  .case-next { flex-direction: column; }
  .next { align-items: flex-start; }
}

/* ---------- Behance covers ---------- */
.pcard-media img.cover { object-fit: cover; padding: 0; }
.gallery figure.hero { grid-column: 1 / -1; aspect-ratio: 404 / 316; }
.gallery img.cover { object-fit: cover; padding: 0; }
/* Ancho completo con la proporción propia de la imagen, sin recortes (capturas, renders, láminas) */
.gallery figure.wide { grid-column: 1 / -1; aspect-ratio: auto; }
.gallery figure.wide img { height: auto; object-fit: initial; padding: 0; }
