@font-face { font-family: "Big Shoulders Display"; src: url("assets/fonts/big-shoulders-display-800.woff2") format("woff2"); font-weight: 800; font-display: swap; }
@font-face { font-family: "Public Sans"; src: url("assets/fonts/public-sans-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Public Sans"; src: url("assets/fonts/public-sans-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }

:root {
  --bg: #0F0E0D;
  --surface: #1B1917;
  --line: #3A3631;
  --text: #F5EFE8;
  --muted: #C4B9AC;
  --accent: #FF5A24;
  --radius: 18px;
  --display: "Big Shoulders Display", "Arial Narrow", system-ui, sans-serif;
  --body: "Public Sans", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 4.5rem; color-scheme: dark; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 1.125rem/1.6 var(--body); }
img { max-width: 100%; display: block; }
a, button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.wrap { width: min(1120px, 100% - 2rem); margin-inline: auto; }
.skip { position: absolute; left: 1rem; top: -4rem; background: var(--accent); color: #111; padding: .75rem 1rem; z-index: 10; font-weight: 600; }
.skip:focus { top: 1rem; }

.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 1rem; padding: .6rem max(1rem, calc((100% - 1120px) / 2)); background: rgba(15, 14, 13, .96); border-bottom: 1px solid var(--line); }
.brand img { height: 36px; width: auto; }
.top-nav { margin-left: auto; display: flex; gap: .25rem; }
.top-nav a { color: var(--text); text-decoration: none; font-weight: 600; padding: .7rem .9rem; min-height: 44px; display: inline-flex; align-items: center; border-radius: 10px; }
.top-nav a:hover { background: var(--surface); }
.lang { position: relative; isolation: isolate; display: flex; gap: 2px; padding: 3px; background: var(--surface); border-radius: 12px; }
.lang button { position: relative; z-index: 1; font: 600 .95rem var(--body); min-width: 44px; min-height: 44px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); transition: color .15s; }
.lang button:hover { color: var(--text); }
.lang button[aria-pressed="true"] { background: transparent; color: #111; }
.lang .ind { background: var(--accent); border-radius: 9px; z-index: 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: .65rem 1.4rem; font: 600 1.05rem var(--body); color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; text-decoration: none; transition: transform .15s, background .15s; }
.btn:hover { transform: translateY(-2px); background: #26231F; }
.btn:active { transform: translateY(0); }
.btn-accent { background: var(--accent); color: #111; border-color: var(--accent); }
.btn-accent:hover { background: #FF7342; }

h1, h2, h3 { font-family: var(--display); font-weight: 800; line-height: .98; margin: 0; text-transform: uppercase; }
.hero { min-height: calc(100svh - 62px); display: grid; align-items: center; padding-block: 3rem; }
.hero-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 3rem; align-items: center; }
h1 { min-height: 1.5em; text-transform: none; font-size: clamp(2.4rem, 5vw, 4.4rem); line-height: 1.02; max-width: 20ch; text-wrap: balance; animation: enter .7s cubic-bezier(.2, .7, .2, 1) both; }
.hero .btn { margin-top: 2rem; animation: enter .7s .2s cubic-bezier(.2, .7, .2, 1) both; }
.hero-pic { max-width: 380px; justify-self: center; width: 100%; border-radius: 28px; overflow: hidden; border: 1px solid var(--line); animation: enter .8s .15s cubic-bezier(.2, .7, .2, 1) both; }
.hero-pic img { width: 100%; height: auto; aspect-ratio: 1; }
@keyframes enter { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.projects > .wrap h2, .links h2 { font-size: clamp(1.8rem, 3.6vw, 2.8rem); margin-bottom: 1rem; }
.projects { padding-top: 3rem; }
.repo { min-height: min(92svh, 820px); display: grid; align-items: center; padding-block: 3.5rem; border-top: 1px solid var(--line); }
.repo-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 3rem; align-items: center; }
.repo-info { order: 2; }
.repo .gal { order: 1; }
.repo h3 { font-size: clamp(2.6rem, 6vw, 5rem); color: var(--text); overflow-wrap: anywhere; }
.repo-desc { margin: 1rem 0 1.25rem; color: var(--muted); }
.meta { display: grid; gap: .35rem; margin: 0 0 1.5rem; padding: 0; }
.meta div { display: flex; gap: .5rem; }
.meta dt { color: var(--muted); }
.meta dt::after { content: ":"; }
.meta dd { margin: 0; font-weight: 600; }
.meta div:first-child:not(:has(dt)) dd { color: var(--accent); }
.actions { display: flex; flex-wrap: wrap; gap: .75rem; }

.gal-frame { background: #000; border: 1px solid var(--line); border-radius: var(--radius); aspect-ratio: 16 / 10; display: grid; place-items: center; overflow: hidden; }
.gal-trigger { width: 100%; height: 100%; min-width: 0; min-height: 0; overflow: hidden; padding: 0; border: 0; background: transparent; display: grid; place-items: center; cursor: zoom-in; }
.gal-trigger:focus-visible { outline-offset: -3px; }
.gal-frame img { width: 100%; height: 100%; object-fit: contain; transition: transform .3s; }
.gal-frame:hover img { transform: scale(1.025); }
.gal-thumbs { position: relative; isolation: isolate; display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; align-items: center; }
.gal-thumb { position: relative; min-width: 44px; min-height: 44px; font: 600 1rem var(--body); background: none; color: var(--muted); border: 0; border-radius: 10px; transition: color .15s; }
.gal-thumb::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; transition: border-color .15s; }
.gal-thumb:hover { color: var(--text); }
.gal-thumb:hover::before { border-color: var(--muted); }
.gal-thumb[aria-current="true"] { background: none; color: #111; }
.gal-thumb[aria-current="true"]::before { background: transparent; border-color: transparent; }
.gal-thumbs .ind { background: var(--accent); border-radius: 10px; z-index: 0; }
.gal-pause { width: 44px; height: 44px; min-width: 44px; min-height: 44px; margin-left: auto; padding: 0; display: inline-flex; align-items: center; justify-content: center; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 10px; transition: background .15s, border-color .15s, color .15s; }
.gal-pause:hover { background: #26231F; border-color: var(--muted); }
.gal-pause[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
.gal-empty { border: 1px dashed var(--line); border-radius: var(--radius); padding: 3rem 1.5rem; text-align: center; color: var(--muted); }

.state { width: min(1120px, 100% - 2rem); margin: 2rem auto 4rem; padding: 2rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 2rem; }
.state p { margin: 0; }
.state-error, .state-rate { border-color: var(--accent); }
.stale { width: min(1120px, 100% - 2rem); margin: 1rem auto; color: var(--muted); }

/* Resaltes con resorte: el indicador (.ind) se desliza entre opciones. Las cajas fijas van en ::before (z -1),
   el indicador encima y el texto arriba de todo. */
.ind { position: absolute; left: 0; top: 0; pointer-events: none; will-change: transform, width, height; }

.side { position: fixed; right: 1.25rem; top: 50%; transform: translateY(-50%); z-index: 4; isolation: isolate; display: flex; flex-direction: column; gap: .25rem; align-items: flex-end; }
.side[hidden] { display: none; }
.side a { position: relative; color: var(--muted); text-decoration: none; font-weight: 600; padding: .6rem .8rem; min-height: 44px; display: inline-flex; align-items: center; background: none; transition: color .15s; }
.side a::before { content: ""; position: absolute; inset: 0; z-index: -1; background: #26231F; border-radius: 10px; transition: background .15s; }
.side a:hover { color: var(--text); }
.side a:hover::before { background: #36312C; }
.side a[aria-current="true"] { color: var(--text); }
.side a[aria-current="true"]::before { background: transparent; }
.side .ind { background: #3F3933; border-radius: 10px; border-right: 4px solid var(--accent); box-shadow: inset 0 0 0 1px rgba(255, 90, 36, .35); box-sizing: border-box; z-index: 0; }

.links { padding-block: 4rem; border-top: 1px solid var(--line); }
.link-list { list-style: none; margin: 1.5rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: .75rem; }

@media (max-width: 1260px) { .side { display: none; } }
@media (max-width: 820px) {
  .hero-grid, .repo-grid { grid-template-columns: 1fr; gap: 2rem; }
  .repo-info { order: 0; }
  .repo .gal { order: 1; }
  .hero { min-height: 0; }
  .hero-pic { max-width: 240px; justify-self: start; order: -1; }
  .repo { min-height: 0; }
  .gal-frame.is-portrait { aspect-ratio: var(--gal-ar, 9 / 16); max-height: 75svh; }
}
@media (max-width: 560px) {
  .top { flex-wrap: wrap; row-gap: .25rem; }
  .top-nav { margin-left: 0; order: 3; width: 100%; }
  .lang { margin-left: auto; }
  .actions .btn { width: 100%; }
  .link-list { flex-direction: column; }
  .link-list .btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* Visor ampliado (lightbox) */
.lb[hidden] { display: none; }
.lb { position: fixed; inset: 0; z-index: 50; }
.lb-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .86); opacity: 0; transition: opacity .22s cubic-bezier(.2, .7, .2, 1); }
.lb.is-open .lb-backdrop { opacity: 1; }
.lb-stage { position: absolute; inset: 0; overflow: hidden; touch-action: none; }
.lb-frame { position: absolute; left: 0; top: 0; border-radius: 10px; overflow: hidden; will-change: transform, width, height; }
.lb-frame.can-pan { cursor: grab; border-radius: 2px; }
.lb-frame.is-panning { cursor: grabbing; }
.lb-frame img { width: 100%; height: 100%; object-fit: contain; display: block; user-select: none; -webkit-user-drag: none; }

.lb-close { position: absolute; top: max(1rem, env(safe-area-inset-top)); right: max(1rem, env(safe-area-inset-right)); z-index: 2; width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .2); background: rgba(0, 0, 0, .55); color: #fff; display: grid; place-items: center; opacity: 0; transition: opacity .2s, background .15s, border-color .15s, color .15s; }
.lb.is-open .lb-close { opacity: 1; }
.lb-close:hover { background: rgba(255, 90, 36, .18); border-color: rgba(255, 90, 36, .6); color: var(--accent); }

.lb-bar { position: absolute; left: 50%; bottom: max(1.25rem, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 2; display: flex; align-items: center; gap: .25rem; padding: .25rem; background: rgba(27, 25, 23, .92); border: 1px solid var(--line); border-radius: 14px; opacity: 0; transition: opacity .2s; }
.lb.is-open .lb-bar { opacity: 1; }
.lb-btn { min-width: 44px; min-height: 44px; padding: 0 .65rem; border: 0; border-radius: 10px; background: transparent; color: var(--text); font: 600 .95rem var(--body); display: inline-flex; align-items: center; justify-content: center; transition: background .15s, color .15s; }
.lb-btn:hover:not(:disabled) { background: #2E2A26; }
.lb-btn:disabled { opacity: .4; }
.lb-reset { min-width: 60px; font-variant-numeric: tabular-nums; }
