/* =========================================================
   Carlota Suárez — estilos
   Sistema: tipografía del sistema (cero descargas de fuentes),
   tokens de color claro/oscuro, mobile first.
   ========================================================= */

:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --bg: #fbfbfd;
  --bg-alt: #f3f1f2;
  --ph: #e6e1e4;
  --ink: #1d1d1f;
  --muted: #606066;
  --line: rgba(29, 29, 31, 0.14);
  --accent: #8c3f5f;
  --accent-ink: #ffffff;
  --bar: rgba(251, 251, 253, 0.8);
  --max: 1080px;
  --gutter: clamp(16px, 5vw, 48px);
  --bar-h: 64px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0b0b0c;
  --bg-alt: #141416;
  --ph: #202024;
  --ink: #f5f5f7;
  --muted: #a1a1a6;
  --line: rgba(245, 245, 247, 0.16);
  --accent: #e8a9c0;
  --accent-ink: #1d1d1f;
  --bar: rgba(11, 11, 12, 0.72);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--bar-h) + 8px);
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1.0625rem/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p, dl, dd, ol, ul { margin: 0; }
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }

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

.skip {
  position: absolute;
  left: 16px;
  top: -80px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--ink);
  color: var(--bg);
  border-radius: 999px;
  text-decoration: none;
}
.skip:focus { top: 12px; }

.wrap {
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* ---------- Cabecera ---------- */
.bar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bar);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
}

.bar__in {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: var(--bar-h);
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.brand {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.nav {
  display: none;
  gap: 28px;
  font-size: 0.9375rem;
}
.nav a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s;
}
.nav a:hover,
.nav a[aria-current] { color: var(--ink); }

.tools { display: flex; align-items: center; gap: 4px; }

.lang { display: flex; gap: 2px; }
.lang button {
  min-width: 44px;
  min-height: 44px;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--muted);
  transition: background 0.2s, color 0.2s;
}
.lang button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--bg);
}

.icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  color: var(--ink);
}
.icon:hover { background: var(--line); }

/* Móvil: menú desplegable */
@media (max-width: 759px) {
  .nav {
    position: absolute;
    top: var(--bar-h);
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    padding: 8px var(--gutter) 20px;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    font-size: 1.25rem;
    /* Cerrado: plegado hacia arriba; al abrir se despliega hacia abajo */
    display: flex;
    visibility: hidden;
    clip-path: inset(0 0 100% 0);
    transition: clip-path 0.4s cubic-bezier(0.2, 0.7, 0.1, 1), visibility 0s linear 0.4s;
  }
  .nav.is-open {
    visibility: visible;
    clip-path: inset(0 0 -2px 0);
    transition: clip-path 0.45s cubic-bezier(0.2, 0.7, 0.1, 1), visibility 0s;
  }
  .nav a {
    padding: 12px 0;
    color: var(--ink);
    opacity: 0;
    transform: translateY(-14px);
    transition: opacity 0.2s, transform 0.2s;
  }
  .nav.is-open a {
    opacity: 1;
    transform: none;
    transition: opacity 0.35s, transform 0.45s cubic-bezier(0.2, 0.7, 0.1, 1);
  }
  .nav.is-open a:nth-child(1) { transition-delay: 0.05s; }
  .nav.is-open a:nth-child(2) { transition-delay: 0.11s; }
  .nav.is-open a:nth-child(3) { transition-delay: 0.17s; }

  /* El icono del menú da media vuelta al abrir y vuelve al cerrar */
  .menu svg { transition: transform 0.5s cubic-bezier(0.3, 0.7, 0.3, 1); }
  .menu[aria-expanded="true"] svg { transform: rotate(180deg); }
}

@media (min-width: 760px) {
  .nav { display: flex; }
  .menu { display: none; }
}

/* ---------- Hero ---------- */
.hero {
  min-height: calc(100vh - var(--bar-h));
  min-height: calc(100svh - var(--bar-h));
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
  padding: 64px var(--gutter);
}

/* Nombre y foto forman un bloque: la foto ocupa la altura de las dos líneas */
.hero__name {
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  column-gap: 0.14em;
  text-align: left;
}
.hero__name .line { grid-column: 1; }
.hero__photo {
  grid-column: 2;
  grid-row: 1 / span 2;
  width: 1.7em;
  height: 1.7em;
  max-width: none;
  border-radius: 50%;
  object-fit: cover;
  animation: pop 0.9s 0.2s cubic-bezier(0.2, 0.7, 0.1, 1) both;
}
/* Al tocar el nombre: las letras botan una tras otra y la foto da una vuelta */
.hero__name { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.hero__name.is-ready .line { overflow: visible; }
.hero__name .ch { display: inline-block; }
.hero__name.is-playing .ch {
  animation: hop 0.6s cubic-bezier(0.3, 0.7, 0.4, 1) calc(var(--i) * 45ms) both;
}
.hero__name.is-playing .hero__photo {
  animation: spin 0.9s cubic-bezier(0.5, 0, 0.3, 1) 0.15s both;
}
/* Cambio de idioma: cada palabra se mantiene junta y sus letras botan */
.hop-w { display: inline-block; white-space: nowrap; }
.hop-ch { display: inline-block; animation: hop 0.6s cubic-bezier(0.3, 0.7, 0.4, 1) both; }

/* Cambio de modo claro/oscuro: fundido lento */
.theme-fade::view-transition-old(root),
.theme-fade::view-transition-new(root) {
  animation-duration: 0.9s;
  animation-timing-function: ease-in-out;
}
.theme-fading,
.theme-fading *,
.theme-fading *::before,
.theme-fading *::after {
  transition: background-color 0.9s ease, color 0.9s ease, border-color 0.9s ease,
    box-shadow 0.9s ease, fill 0.9s ease, stroke 0.9s ease !important;
}

@keyframes hop {
  0% { transform: none; }
  35% { transform: translateY(-0.2em); }
  65% { transform: translateY(0.03em); }
  100% { transform: none; }
}
@keyframes spin {
  0% { transform: rotate(0); }
  70% { transform: rotate(380deg); }
  100% { transform: rotate(360deg); }
}
@keyframes pop { from { opacity: 0; transform: scale(0.85); } to { opacity: 1; transform: none; } }

.hero__name {
  margin: 12px 0 0;
  font-size: clamp(3.5rem, 15vw, 9.5rem);
  font-weight: 650;
  line-height: 0.95;
  letter-spacing: -0.045em;
}

.line {
  display: block;
  overflow: hidden;
  padding: 0.1em 0.04em 0.12em;
  margin: -0.1em 0 -0.12em;
}
.line > span {
  display: block;
  animation: rise 0.9s cubic-bezier(0.2, 0.7, 0.1, 1) both;
}
.line:nth-child(2) > span { animation-delay: 0.1s; }

.hero__lead {
  max-width: 34ch;
  margin-top: 28px;
  font-size: clamp(1.1875rem, 2.6vw, 1.5rem);
  line-height: 1.4;
  animation: fade 0.7s 0.45s both;
}

.hero__cta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 36px;
  animation: fade 0.7s 0.6s both;
}

@keyframes rise { from { transform: translateY(105%); } to { transform: none; } }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 26px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 500;
  text-decoration: none;
  transition: filter 0.2s, background 0.2s;
}
.btn:hover { filter: brightness(1.08); }

.btn--ghost {
  background: transparent;
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line);
}
.btn--ghost:hover { background: var(--line); filter: none; }

/* ---------- Secciones ---------- */
.sec {
  padding-block: clamp(72px, 12vw, 150px);
  content-visibility: auto;
  contain-intrinsic-size: auto 700px;
}
.sec--alt { background: var(--bg-alt); }

h2 {
  margin-bottom: clamp(28px, 5vw, 48px);
  font-size: clamp(2.25rem, 6vw, 4.5rem);
  font-weight: 650;
  line-height: 1.05;
  letter-spacing: -0.035em;
}

h3 {
  font-size: 1.375rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.015em;
}

.body { max-width: 62ch; color: var(--muted); }
.body--intro { margin: -16px 0 40px; font-size: 1.1875rem; }

/* Sobre mí */
.statement {
  max-width: 28ch;
  margin-bottom: 28px;
  font-size: clamp(1.625rem, 4vw, 2.75rem);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.025em;
}
.statement:last-child { margin-bottom: 0; }

/* Listas en filas (trayectoria y servicios) */
.rows { list-style: none; padding: 0; border-top: 1px solid var(--line); }
.rows li {
  display: grid;
  gap: 6px 32px;
  padding: 28px 0;
  border-bottom: 1px solid var(--line);
}
.rows p { color: var(--muted); }
.rows .org { color: var(--ink); margin: 2px 0 10px; }

.date { font-variant-numeric: tabular-nums; }
.price { color: var(--accent); font-weight: 600; }
.rows .price { color: var(--accent); }

@media (min-width: 760px) {
  .rows--tl li { grid-template-columns: minmax(140px, 200px) 1fr; }
  .rows--svc li { grid-template-columns: 1.1fr 2fr auto; align-items: baseline; }
}

/* Proyectos */
#proyectos { contain-intrinsic-size: auto 2400px; }
.projects { display: grid; gap: clamp(24px, 4vw, 48px); }

/* Apartado «Trabajos en progreso» */
.wip {
  margin-top: clamp(8px, 2vw, 24px);
  color: var(--accent);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.post__status { display: inline-flex; align-items: center; gap: 8px; }
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.75); }
}

/* Línea separadora entre proyectos: al tocarla, una ola la recorre */
.wave {
  position: relative;
  height: 48px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.wave__svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.wave__path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
}
.post { display: grid; gap: clamp(24px, 4vw, 36px); }
.post__text { min-width: 0; }
.post__year { margin-top: 6px; color: var(--muted); font-size: 0.9375rem; font-variant-numeric: tabular-nums; }
.post h3 { font-size: clamp(1.5rem, 3.4vw, 2.125rem); line-height: 1.15; letter-spacing: -0.025em; }
.post__desc { max-width: 62ch; margin-top: 14px; color: var(--muted); }
.post__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  margin-top: 6px;
  color: var(--accent);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}
.post__link:hover { text-decoration-thickness: 2px; }

.shot {
  position: relative;
  margin: 0;
  max-width: 100%;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  border-radius: 20px;
  background: var(--ph);
}
.shot::before {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 56px;
  height: 56px;
  background: var(--muted);
  opacity: 0.55;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Cpath fill='none' stroke='black' stroke-width='2.4' stroke-linejoin='round' d='M10 9h28a4 4 0 0 1 4 4v22a4 4 0 0 1-4 4H10a4 4 0 0 1-4-4V13a4 4 0 0 1 4-4z'/%3E%3Ccircle cx='17' cy='20' r='3.5'/%3E%3Cpath fill='none' stroke='black' stroke-width='2.4' stroke-linejoin='round' d='M8 36l11-10 8 7 6-5 9 8'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Cpath fill='none' stroke='black' stroke-width='2.4' stroke-linejoin='round' d='M10 9h28a4 4 0 0 1 4 4v22a4 4 0 0 1-4 4H10a4 4 0 0 1-4-4V13a4 4 0 0 1 4-4z'/%3E%3Ccircle cx='17' cy='20' r='3.5'/%3E%3Cpath fill='none' stroke='black' stroke-width='2.4' stroke-linejoin='round' d='M8 36l11-10 8 7 6-5 9 8'/%3E%3C/svg%3E") center / contain no-repeat;
}
.shot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.shot.is-empty img { display: none; }

/* Galería (proyecto 1): carrusel con scroll-snap, flechas y puntos */
.gallery {
  position: relative;
  min-width: 0;
  max-width: 100%;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  border-radius: 20px;
  background: var(--ph);
}
.gallery__track {
  display: flex;
  height: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.gallery__track::-webkit-scrollbar { display: none; }
.gallery__track:focus-visible { outline-offset: -4px; border-radius: 20px; }
@media (prefers-reduced-motion: no-preference) {
  .gallery__track { scroll-behavior: smooth; }
}
.gallery__slide {
  position: relative;
  flex: 0 0 100%;
  margin: 0;
  overflow: hidden;
  scroll-snap-align: center;
  scroll-snap-stop: always;
}
/* Fondo desenfocado con la propia foto, para que las verticales no queden con bandas vacías */
.gallery__bg {
  position: absolute;
  inset: -24px;
  width: calc(100% + 48px);
  height: calc(100% + 48px);
  object-fit: cover;
  filter: blur(24px) saturate(1.1);
  opacity: 0.55;
}
.gallery__slide img:not(.gallery__bg),
.gallery__slide video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.gallery__nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-top: -22px;
  border-radius: 999px;
  background: var(--bar);
  color: var(--ink);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
  box-shadow: inset 0 0 0 1px var(--line);
  transition: opacity 0.2s;
}
.gallery__nav--prev { left: 12px; }
.gallery__nav--next { right: 12px; }
.gallery__nav:disabled { opacity: 0; pointer-events: none; }
@media (hover: none) {
  .gallery__nav { display: none; }
}

.gallery__dots {
  position: absolute;
  left: 50%;
  bottom: 12px;
  z-index: 2;
  display: flex;
  gap: 2px;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--bar);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
  transform: translateX(-50%);
}
.gallery__dots button {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
}
.gallery__dots button::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--muted);
  opacity: 0.5;
  transition: opacity 0.2s, transform 0.2s;
}
.gallery__dots button[aria-current="true"]::before {
  background: var(--ink);
  opacity: 1;
  transform: scale(1.25);
}

@media (min-width: 820px) {
  .gallery { aspect-ratio: 16 / 9; }
}

/* Valoración (al final, fuera del menú) */
.sec--rate { padding-block: clamp(48px, 7vw, 88px); }
.rate { display: grid; justify-items: center; text-align: center; }
.rate__title { margin-bottom: 12px; font-size: clamp(1.5rem, 3.4vw, 2.125rem); letter-spacing: -0.025em; }
.rate .body { margin-bottom: 20px; }
.stars { display: flex; gap: 4px; }
.star {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 999px;
  color: var(--muted);
  transition: transform 0.15s;
}
.star svg { fill: transparent; stroke: currentColor; transition: fill 0.15s, stroke 0.15s; }
.star.is-on { color: var(--accent); }
.star.is-on svg { fill: var(--accent); }
.star:hover { transform: scale(1.12); }
.star.is-pop { animation: hop 0.6s cubic-bezier(0.3, 0.7, 0.4, 1); }
.rate__thanks { min-height: 1.6em; margin-top: 12px; color: var(--accent); font-weight: 500; }

/* Contacto */
.mail {
  display: inline-block;
  font-size: clamp(1.5rem, 5.2vw, 3.5rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
  overflow-wrap: anywhere;
}
.hero__cta--left { justify-content: flex-start; animation: none; }

/* ---------- Pie ---------- */
.foot { border-top: 1px solid var(--line); padding-block: 28px; color: var(--muted); font-size: 0.9375rem; }
.foot__in { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 24px; }
.link { min-height: 44px; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Consentimiento de cookies ---------- */
.consent {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 60;
  max-width: 520px;
  padding: 20px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
}
.consent[hidden] { display: none; }
.consent h2 { margin: 0 0 6px; font-size: 1.125rem; letter-spacing: -0.01em; line-height: 1.3; }
.consent p { color: var(--muted); font-size: 0.9375rem; }
.consent__btns { display: flex; gap: 10px; margin-top: 16px; }
.consent__btns .btn { flex: 1; padding: 0 16px; }

@media (min-width: 640px) {
  .consent { right: auto; left: 24px; bottom: 24px; }
}

/* ---------- Accesibilidad: menos movimiento ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
