/* ============ BASE / TEMA ============ */
:root {
  color-scheme: light;
  --cb-bg: 252, 252, 250;
  --cb-fill: 12, 18, 20;
  --cb-highlight: 74, 116, 130;
  --color-bg: rgba(var(--cb-bg), 1);
  --color-fill: rgba(var(--cb-fill), .87);
  --color-fill-light: #4a7482;
  --color-bevel: rgba(var(--cb-fill), .35);

  --font-standard: "Rethink Sans", "SF Pro", system-ui, Helvetica, sans-serif, "Apple Color Emoji";
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  --size-xl: 4.5rem;
  --size-l: 3rem;
  --size-m: 1.5rem;
  --size-s: 1rem;

  --outerPad: min(7.5vw, 124px);
  --centerMargin: calc(50% - 4.3rem);
  --vertGapLarge: 11.5rem;
  --vertGap: 7.5rem;
  --innerPad: 5.25rem;
  --headerPadTop: 5.25rem;

  --linkLineSlide: cubic-bezier(.57, 0, .12, 1);
  --linkLineSpeed: .21s;
  --slideTime: .39s;
  --headerBounce: cubic-bezier(.12, .93, .42, 1.2);
  --enterDrift: 1.2em;
  --enterTiming: .48s;
  --enterBounce: cubic-bezier(.42, 0, .21, 1);
}

* , *:before, *:after { box-sizing: border-box; margin: 0; padding: 0; }
ol, ul { list-style: none; }

html, body { font-size: 16px; }
html { scroll-behavior: smooth; }
body {
  background: var(--color-bg);
  color: var(--color-fill);
  font-family: var(--font-standard);
  font-weight: 400;
  line-height: 1;
  -webkit-font-smoothing: antialiased;
}

h1 {
  font-size: clamp(var(--size-l), 4.76vw, 78px);
  font-weight: 700;
  line-height: 1.2;
  text-wrap: pretty;
}
h2 { font-size: var(--size-l); font-weight: 700; line-height: 1.3; text-wrap: balance; }
p { font-size: var(--size-m); line-height: 1.4; text-wrap: pretty; }
code { font-family: var(--font-mono); font-weight: 400; letter-spacing: -.05em; }

.wrap { margin: 0 auto; max-width: 1650px; padding: 0 var(--outerPad); }
.push { margin-inline-start: var(--centerMargin); }
.pull { width: 75%; max-width: 930px; }

/* ============ ENLACES (subrayado que se desliza) ============ */
a { color: inherit; cursor: pointer; position: relative; text-decoration: none; }
a:not(.noline):before {
  background: currentColor;
  bottom: -2px; content: ""; height: 1px; left: 0;
  position: absolute; transform-origin: center left;
  transition: transform var(--linkLineSpeed) var(--linkLineSlide);
  width: 100%; will-change: transform; z-index: 10;
}
a:not(.noline):hover:before { transform: scaleX(0); transform-origin: center right; }

/* Botón "jelly" (píldora de vidrio, como el header de la referencia) */
.jelly {
  cursor: pointer; display: inline-block; font-size: var(--size-m);
  position: relative; transform: scale(1);
  transition: transform .17s ease; user-select: none;
}
.jelly:before {
  backdrop-filter: saturate(142%) blur(20px);
  background: color-mix(in srgb, var(--color-bg), transparent 39%);
  border-radius: .43em;
  box-shadow: #0000000a 0 3px, #00000014 0 0 0 1px, #0000001f 0 3px 66px,
              inset #ffffff8c 1px 2px, inset #ffffffb3 0 2px 12px;
  content: ""; inset: -.62em -.75em; position: absolute;
  transition: box-shadow .21s ease; z-index: -1;
}
.jelly:active { transform: scale(.984); }

/* ============ HEADER FIJO ============ */
header {
  left: 0; right: 0; top: 0; position: fixed;
  padding-block-start: var(--headerPadTop);
  transition: transform var(--slideTime) var(--headerBounce);
  z-index: 200;
}
.me { font-weight: 700; font-size: var(--size-m); }
.me:before { opacity: 0; transition: opacity var(--slideTime) var(--headerBounce), box-shadow .21s ease; }
body:not(.scrolled) .me { pointer-events: none; }
.scrolled header { transform: translateY(calc(var(--headerPadTop) / -2)); }
.scrolled .me:before { opacity: 1; }

/* ============ MAST / HERO ============ */
.mast {
  margin: 0 auto; max-width: 1920px; overflow: hidden;
  padding-block-start: var(--headerPadTop); position: relative;
}
/* Foto en duotono, fundida con el fondo */
.mast:before {
  background: url(../img/foto_hero.webp) right 24% no-repeat;
  background-size: auto clamp(120%, 60vw, 150%);
  content: ""; inset: 0 0 0 0; position: absolute;
  mix-blend-mode: luminosity; opacity: .93;
  -webkit-mask-image: linear-gradient(90deg, transparent 32%, #000 62%);
  mask-image: linear-gradient(90deg, transparent 32%, #000 62%);
  transform: translateY(var(--plax, 0px));
  transition: opacity .48s ease;
  will-change: transform; z-index: 1;
}
.mast:after {
  background: var(--color-bevel); bottom: 0; content: ""; height: 1px;
  left: var(--outerPad); right: 0;
  position: absolute; z-index: 2;
}
.mast h1 {
  padding: calc(var(--vertGapLarge) - var(--size-l)) 30% var(--vertGapLarge) 0;
  position: relative; z-index: 3;
}
.mast h1 code:after { content: "()"; letter-spacing: -.12em; }

/* ============ MAIN ============ */
main { padding: var(--vertGap) 0; }
main .wrap { display: flex; flex-direction: column; gap: var(--vertGap); }
main .wrap > section p:not(:last-child) { margin-block-end: 1em; }

/* Animación de entrada */
.drift {
  opacity: 0; position: relative;
  transition: left var(--enterTiming) var(--enterBounce), opacity var(--enterTiming) ease;
}
.drift.left { left: var(--enterDrift); }
.drift.right { left: calc(var(--enterDrift) * -1); }
.loaded .drift:not(.onscroll), .loaded .drift.onscroll.shown { opacity: 1; left: 0; }

/* ============ CV / DESCARGA ============ */
.cv-lines { margin-block-end: calc(var(--size-m) * 1.4); }
.cv-download {
  display: flex; flex-wrap: wrap;
  gap: 1.5em 2.5em; padding-block-start: 1.5em;
}
.cv-download .jelly { font-weight: 700; }
.cv-download .arrow { display: inline-block; margin-inline-end: .25em; }

/* ============ FOOTER ============ */
footer { padding-block-end: var(--innerPad); }
footer .wrap {
  align-items: baseline; display: flex;
  padding-block-start: 2em; position: relative;
}
footer .wrap:before {
  background: var(--color-bevel); content: ""; height: 1px;
  left: var(--outerPad); right: var(--outerPad); top: 0;
  position: absolute;
}
footer p { font-size: var(--size-s); flex: 0; white-space: nowrap; }
footer ul { display: flex; flex: 1; gap: 1.5em; justify-content: flex-end; white-space: nowrap; }
footer li { font-size: var(--size-s); }
.hello { display: inline-block; transform: rotate(17deg); transform-origin: 69% 73%; }

/* ============ RESPONSIVE ============ */
@media screen and (width < 1024px) {
  main section.push { margin-inline-start: 0; }
  main section.pull { width: 100%; max-width: none; }
  h2 { text-wrap: pretty; }
}

@media screen and (width < 768px) {
  :root {
    --size-l: 2.1rem; --size-m: 1.25rem;
    --headerPadTop: 3.4rem; --vertGapLarge: 7.5rem; --vertGap: 5.7rem;
  }
  .mast { min-height: 100lvh; }
  .mast .wrap {
    display: flex; flex-direction: column; justify-content: center;
    min-height: calc(100lvh - var(--headerPadTop));
  }
  .mast:before {
    background-position: right -18vw top 10%;
    background-size: auto 105%;
    -webkit-mask-image: linear-gradient(90deg, transparent 5%, #000 55%);
    mask-image: linear-gradient(90deg, transparent 5%, #000 55%);
    opacity: .48;
  }
  .mast h1 { margin-block-start: -1.2em; max-width: 300px; padding: 0; position: relative; }
  .mast h1:after {
    animation: arrowDrift .84s ease-in-out infinite alternate;
    content: "\2193"; font-size: var(--size-m);
    left: 0; position: absolute; top: calc(100% + 1em);
  }
  footer .wrap { flex-direction: column; gap: 1em; }
  footer ul { justify-content: flex-start; }
  footer { padding-block-end: calc(var(--innerPad) / 2); }
}
@keyframes arrowDrift { 0% { transform: translateY(0); } to { transform: translateY(.5em); } }

@media (prefers-reduced-motion: reduce) {
  .drift, .mast h1:after { animation: none; transition: none; opacity: 1; left: 0; }
}
