/* =========================================================
   Jordi Bascón · portfolio
   Una sola familia (Archivo) en dos anchuras: expandida para
   el nombre y los titulares, normal para el texto.
   Acento: morado nazareno, usado con moderación.
   ========================================================= */

:root {
  --bg: #F4F4F2;
  --surface: #FFFFFF;
  --ink: #1A1A1F;
  --muted: #5D5D68;
  --line: #DCDCE1;
  --accent: #4B2C7F;
  --accent-ink: #FFFFFF;
  --ok: #1F8A4C;
  --code-bg: #1A1A1F;
  --code-ink: #E7E7EC;
  --c-bg: #1A1A1F;
  --c-ink: #F4F4F2;

  --font: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --wrap: 1240px;
  --gut: 20px;
  --r: 4px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #121214;
  --surface: #1B1B1F;
  --ink: #ECECEF;
  --muted: #A2A2AD;
  --line: #2C2C33;
  --accent: #B59CF2;
  --accent-ink: #1A1225;
  --ok: #4CC883;
  --code-bg: #0B0B0D;
  --c-bg: #231B33;
  --c-ink: #ECECEF;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121214;
    --surface: #1B1B1F;
    --ink: #ECECEF;
    --muted: #A2A2AD;
    --line: #2C2C33;
    --accent: #B59CF2;
    --accent-ink: #1A1225;
    --ok: #4CC883;
    --code-bg: #0B0B0D;
    --c-bg: #231B33;
    --c-ink: #ECECEF;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  font-variation-settings: "wdth" 100;
}
h1, h2, h3 { margin: 0; line-height: 1; font-weight: 700; }
p { margin: 0 0 1em; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gut); }
.sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: var(--gut); top: -60px; z-index: 100;
  padding: .5em 1em; background: var(--ink); color: var(--bg); border-radius: var(--r);
}
.skip:focus { top: 10px; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: .7em 1.4em;
  font-weight: 600; text-decoration: none; cursor: pointer;
  border: 1.5px solid var(--ink); border-radius: 999px;
  transition: background-color .15s, color .15s, border-color .15s;
}
.btn--solid { background: var(--ink); color: var(--bg); }
.btn--solid:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn--ghost { background: transparent; }
.btn--ghost:hover { background: var(--ink); color: var(--bg); }
.link { font-weight: 600; text-decoration-thickness: 1.5px; text-underline-offset: .25em; }
.link:hover { color: var(--accent); }

/* ---------- Cabecera ---------- */
.top {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.top__row { display: flex; align-items: center; gap: 24px; min-height: 64px; }
.mark {
  font-weight: 800; font-size: 1.1rem; text-decoration: none; letter-spacing: -.01em;
  font-variation-settings: "wdth" 125;
}
.nav {
  display: none; position: absolute; top: 100%; left: 0; right: 0;
  flex-direction: column; padding: 8px var(--gut) 20px;
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.nav.is-open { display: flex; }
.nav a { padding: 14px 0; border-bottom: 1px solid var(--line); text-decoration: none; font-size: 1.1rem; }
.nav a:hover { color: var(--accent); }
.tools { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.tool {
  min-width: 44px; height: 44px; padding: 0 10px;
  display: grid; place-items: center;
  background: none; border: 0; border-radius: 999px; cursor: pointer;
  font-weight: 600; font-size: .9rem;
}
.tool:hover { background: var(--line); }
.tool svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.i-sun { display: none; }
:root[data-theme="dark"] .i-sun { display: block; }
:root[data-theme="dark"] .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun { display: block; }
  :root:not([data-theme="light"]) .i-moon { display: none; }
}
.bars, .bars::before, .bars::after {
  display: block; width: 20px; height: 1.5px; background: currentColor; position: relative;
  transition: transform .2s, background-color .2s;
}
.bars::before, .bars::after { content: ""; position: absolute; left: 0; }
.bars::before { top: -6px; }
.bars::after { top: 6px; }
.tool--menu[aria-expanded="true"] .bars { background: transparent; }
.tool--menu[aria-expanded="true"] .bars::before { transform: translateY(6px) rotate(45deg); }
.tool--menu[aria-expanded="true"] .bars::after { transform: translateY(-6px) rotate(-45deg); }

/* ---------- Portada ---------- */
.hero { padding: 48px 0 64px; }
.hero__grid { display: grid; gap: 40px; }
.avail { display: inline-flex; align-items: center; gap: 10px; font-size: .95rem; color: var(--muted); margin-bottom: 28px; }
.avail__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 22%, transparent); }
.hero__name {
  font-size: clamp(3.6rem, 15vw, 9.5rem);
  font-weight: 800;
  font-variation-settings: "wdth" 125;
  line-height: .86;
  letter-spacing: -.045em;
}
.hero__role {
  margin: 24px 0 0;
  font-size: clamp(1.5rem, 4vw, 2.2rem); font-weight: 300; font-style: italic;
  font-variation-settings: "wdth" 80; letter-spacing: -.01em;
}
.hero__lead { margin: 20px 0 0; max-width: 34em; color: var(--muted); font-size: 1.12rem; }
.hero__cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 32px; }
.hero__photo { margin: 0; }
.hero__photo img {
  width: 100%; aspect-ratio: 4 / 5; object-fit: cover;
  border-radius: var(--r); background: var(--line);
}
.hero__photo figcaption { margin-top: 10px; font-size: .88rem; color: var(--muted); }

/* ---------- Secciones ---------- */
.sec { padding: 72px 0; border-top: 1px solid var(--line); }
.sec__head { display: grid; gap: 16px; margin-bottom: 40px; }
.sec__head h2, .about h2 {
  font-size: clamp(2.2rem, 6vw, 4rem); font-weight: 800;
  font-variation-settings: "wdth" 112; letter-spacing: -.035em; line-height: .95;
}
.sec__head p { color: var(--muted); max-width: 36em; margin: 0; }

/* ---------- Galería ---------- */
.gallery { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.shot__btn {
  position: relative; display: block; width: 100%; height: 100%;
  padding: 0; border: 0; background: var(--line); cursor: zoom-in; overflow: hidden;
  border-radius: var(--r);
}
.shot__btn img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s cubic-bezier(.2, .7, .2, 1); }
.shot__btn:hover img { transform: scale(1.025); }
.shot__cap {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  padding: 40px 16px 14px; text-align: left; color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, .62));
}
.shot__title { font-weight: 700; font-size: 1.05rem; }
.shot__place { font-size: .85rem; opacity: .85; white-space: nowrap; }
.shot { aspect-ratio: 4 / 5; }
.shot--b, .shot--e, .shot--f { aspect-ratio: 3 / 2; }

/* ---------- Desarrollo ---------- */
.project { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 28px; }
.project--feature { display: grid; gap: 32px; padding: 32px; margin-bottom: 16px; }
.project__status { display: inline-flex; align-items: center; gap: 8px; color: var(--accent); font-weight: 600; font-size: .92rem; margin-bottom: 18px; }
.project__status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.project__name {
  font-size: clamp(2.6rem, 8vw, 4.6rem); font-weight: 900;
  font-variation-settings: "wdth" 125; letter-spacing: -.04em; margin-bottom: 18px;
}
.project__name--sm { font-size: 1.45rem; font-weight: 700; font-variation-settings: "wdth" 100; letter-spacing: -.015em; margin-bottom: 12px; line-height: 1.15; }
.project__desc { color: var(--muted); max-width: 40em; }
.stack { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 20px 0 0; padding: 0; }
.stack li { font-size: .85rem; padding: 4px 11px; border: 1px solid var(--line); border-radius: 999px; }
.projects { display: grid; gap: 16px; }
.project--cta { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.project--cta .project__desc { color: inherit; opacity: .85; }
.project--cta .link:hover { color: inherit; opacity: .8; }
.websa__btn, .gystars__btn {
  display: inline-flex; align-items: center; justify-content: center; margin-top: 18px;
  min-height: 52px; padding: .75em 1.8em; border-radius: 999px;
  background: #2A1450; color: #fff; font-size: 1.05rem; font-weight: 700; text-decoration: none;
  transition: background-color .2s, transform .2s;
}
.websa__btn:hover, .gystars__btn:hover { background: #1A0C33; transform: translateY(-2px); }
.websa__btn:focus-visible { outline-color: #fff; }

/* Maqueta del duelo de KODELO */
.duel { background: var(--code-bg); color: var(--code-ink); border-radius: var(--r); overflow: hidden; font-size: .82rem; align-self: center; }
.duel__bar {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: 10px 14px; border-bottom: 1px solid rgba(255, 255, 255, .1); font-weight: 600;
}
.duel__bar span:last-child { text-align: right; }
.duel__time { font-variant-numeric: tabular-nums; padding: 2px 10px; border-radius: 999px; background: #B59CF2; color: #1A1225; }
.duel__panes { display: grid; grid-template-columns: 1fr; }
.duel pre {
  margin: 0; padding: 16px; overflow-x: auto;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; line-height: 1.55;
}
.duel pre + pre { border-top: 1px solid rgba(255, 255, 255, .1); }
.duel b { color: #C9B5FF; font-weight: 400; }
.duel i { color: #6FDCA0; font-style: normal; }

/* ---------- Videografía ---------- */
.vid-media {
  position: relative; align-self: center; width: 100%; aspect-ratio: 16 / 9;
  border-radius: var(--r); overflow: hidden;
  background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 35%, var(--code-bg)), var(--code-bg) 75%);
}
.vid-badge {
  position: absolute; top: 14px; left: 14px; z-index: 1;
  font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  padding: 5px 10px; border-radius: 999px; background: var(--accent); color: var(--accent-ink);
}
.vid-play {
  position: absolute; inset: 0; margin: auto; width: 68px; height: 68px; border-radius: 50%;
  display: grid; place-items: center; border: 1.5px solid #fff;
  background: rgba(18, 18, 20, .35); transition: background-color .2s, border-color .2s, transform .2s;
}
.vid-play::before {
  content: ""; border-left: 16px solid #fff; border-top: 10px solid transparent;
  border-bottom: 10px solid transparent; margin-left: 5px;
}
.vid-play:hover { background: var(--accent); border-color: var(--accent); transform: scale(1.05); }

/* ---------- Sobre mí ---------- */
.about { display: grid; gap: 40px; }
.about__lead { font-size: clamp(1.35rem, 3vw, 1.75rem); line-height: 1.3; margin: 24px 0 18px; font-weight: 500; letter-spacing: -.01em; max-width: 24em; }
.about__text > p:last-child { color: var(--muted); max-width: 36em; }
.skills { display: grid; gap: 32px; }
.skills h3 { font-size: 1.05rem; padding-bottom: 12px; border-bottom: 1.5px solid var(--ink); }
.skills ul { list-style: none; margin: 0; padding: 0; }
.skills li { padding: 11px 0; border-bottom: 1px solid var(--line); }

/* ---------- Contacto ---------- */
.contact { padding: 88px 0 96px; background: var(--c-bg); color: var(--c-ink); }
.contact__title {
  font-size: clamp(2.4rem, 8vw, 6rem); font-weight: 800;
  font-variation-settings: "wdth" 118; letter-spacing: -.045em; line-height: .92; max-width: 11ch;
}
.contact__text { margin: 24px 0 32px; max-width: 32em; opacity: .75; }
.contact__mail {
  display: inline-block; font-size: clamp(1.25rem, 4.6vw, 2.4rem); font-weight: 500;
  text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: .2em;
  word-break: break-all; letter-spacing: -.01em;
}
.contact__mail:hover { color: #B59CF2; }
.contact__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 32px; }
.contact .btn { border-color: var(--c-ink); }
.contact .btn--solid { background: var(--c-ink); color: var(--c-bg); }
.contact .btn--solid:hover { background: #B59CF2; border-color: #B59CF2; color: #1A1225; }
.contact .btn--ghost:hover { background: var(--c-ink); color: var(--c-bg); }
.contact__toast { min-height: 1.6em; margin: 16px 0 0; font-size: .95rem; }

/* ---------- Pie ---------- */
.foot { padding: 28px 0; font-size: .9rem; color: var(--muted); }
.foot__row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
.foot p { margin: 0; }

/* ---------- Visor ---------- */
.viewer {
  width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: 0;
  border: 0; background: rgba(10, 10, 12, .96); color: #fff;
}
.viewer::backdrop { background: rgba(10, 10, 12, .96); }
.viewer[open] { display: grid; place-items: center; animation: fade .2s ease-out; }
@keyframes fade { from { opacity: 0; } }
.viewer__fig { margin: 0; display: grid; justify-items: center; gap: 14px; padding: 64px 16px 24px; max-height: 100vh; }
.viewer__fig img { max-width: min(92vw, 1400px); max-height: calc(100vh - 150px); object-fit: contain; }
.viewer__fig figcaption { text-align: center; font-size: .95rem; opacity: .85; max-width: 60ch; }
.viewer__fig figcaption strong { display: block; font-size: 1.1rem; opacity: 1; }
.viewer__btn {
  position: fixed; width: 48px; height: 48px; display: grid; place-items: center;
  background: rgba(255, 255, 255, .1); border: 0; border-radius: 50%; cursor: pointer; color: #fff;
}
.viewer__btn:hover { background: rgba(255, 255, 255, .22); }
.viewer__btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.viewer__close { top: 14px; right: 14px; }
.viewer__prev { left: 14px; top: 50%; transform: translateY(-50%); }
.viewer__next { right: 14px; top: 50%; transform: translateY(-50%); }

/* =========================================================
   ≥ 700px
   ========================================================= */
@media (min-width: 700px) {
  :root { --gut: 32px; }
  .gallery { grid-template-columns: repeat(2, 1fr); }
  .shot, .shot--b, .shot--e, .shot--f { aspect-ratio: 1; }
  .projects { grid-template-columns: repeat(2, 1fr); }
  .project--cta { grid-column: 1 / -1; }
  .skills { grid-template-columns: 1fr 1fr; gap: 40px; }
  .duel__panes { grid-template-columns: 1fr 1fr; }
  .duel pre + pre { border-top: 0; border-left: 1px solid rgba(255, 255, 255, .1); }
}

/* =========================================================
   ≥ 1000px
   ========================================================= */
@media (min-width: 1000px) {
  .tool--menu { display: none; }
  .nav {
    display: flex; position: static; flex-direction: row; gap: 28px;
    padding: 0; margin-left: auto; border: 0; background: none;
  }
  .nav a { padding: 4px 0; border: 0; font-size: .98rem; }
  .tools { margin-left: 12px; }

  .hero { padding: 72px 0 104px; }
  .hero__grid { grid-template-columns: 1fr 400px; gap: 80px; align-items: end; }

  .sec { padding: 112px 0; }
  .sec__head { grid-template-columns: 1fr 1fr; align-items: end; gap: 48px; margin-bottom: 56px; }

  /* Mosaico de 12 columnas: cada foto con su formato */
  .gallery { grid-template-columns: repeat(12, 1fr); grid-auto-rows: 210px; gap: 14px; }
  .shot, .shot--b, .shot--e, .shot--f { aspect-ratio: auto; }
  .shot--a { grid-column: 1 / 6;  grid-row: 1 / 4; }
  .shot--b { grid-column: 6 / 13; grid-row: 1 / 3; }
  .shot--c { grid-column: 6 / 9;  grid-row: 3 / 4; }
  .shot--d { grid-column: 9 / 13; grid-row: 3 / 5; }
  .shot--e { grid-column: 1 / 9;  grid-row: 4 / 6; }
  .shot--f { grid-column: 9 / 13; grid-row: 5 / 6; }

  .project--feature { grid-template-columns: 5fr 6fr; gap: 56px; padding: 48px; }
  .projects { grid-template-columns: 1fr 1fr 1fr; }
  .project--cta { grid-column: auto; }

  .about { grid-template-columns: 1fr 1fr; gap: 80px; }
  .contact { padding: 128px 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
