/* ==========================================================================
   HUMBE portfolio — Apple-style design system
   - One accent colour, used only for interactive things; the work provides the colour
   - Adaptive light/dark semantic tokens (follows the system)
   - Translucent chrome, size-specific type tracking, springy interruptible motion
   ========================================================================== */

:root {
  color-scheme: dark; /* siempre oscuro */

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* Light */
  --bg: #ffffff;
  --bg-alt: #f5f5f7;
  --surface: #ffffff;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #86868b;
  --sep: rgba(0, 0, 0, 0.12);
  --fill: rgba(0, 0, 0, 0.05);
  --fill-2: rgba(0, 0, 0, 0.08);
  --accent: #0777a8;
  --on-accent: #ffffff;
  --accent-soft: rgba(7, 119, 168, 0.12);
  --nav-bg: rgba(255, 255, 255, 0.72);
  --glow: rgba(7, 119, 168, 0.14);
  --shadow-m: 0 12px 32px -10px rgba(0, 0, 0, 0.22);
  --placeholder: #e8e8ed;

  /* Motion */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);

  /* Shape */
  --r-xl: 28px;
  --r-l: 22px;
  --r-m: 16px;
  --nav-h: 52px;
  --wrap: 1120px;
}

/* Dark is the only theme */
:root {
  --bg: #000000;
  --bg-alt: #0b0b0c;
  --surface: #1c1c1e;
  --text: #f5f5f7;
  --text-2: #a1a1a6;
  --text-3: #6e6e73;
  --sep: rgba(255, 255, 255, 0.14);
  --fill: rgba(255, 255, 255, 0.08);
  --fill-2: rgba(255, 255, 255, 0.12);
  --accent: #4fd8ff;
  --on-accent: #00222d;
  --accent-soft: rgba(79, 216, 255, 0.16);
  --nav-bg: rgba(0, 0, 0, 0.66);
  --glow: rgba(79, 216, 255, 0.15);
  --shadow-m: 0 16px 44px -12px rgba(0, 0, 0, 0.8);
  --placeholder: #1c1c1e;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1.0625rem/1.47 var(--font);
  letter-spacing: -0.005em;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

[hidden] { display: none !important; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
a { color: inherit; }
ul { list-style: none; margin: 0; padding: 0; }
h1, h2, h3, p, dl, dd { margin: 0; }

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

.wrap { width: min(var(--wrap), 100% - 48px); margin-inline: auto; }

.skip {
  position: fixed; left: 16px; top: -60px; z-index: 100;
  background: var(--surface); color: var(--text);
  padding: 10px 16px; border-radius: 12px;
  text-decoration: none; transition: top 200ms var(--ease-out);
}
.skip:focus { top: 12px; box-shadow: var(--shadow-m); }

/* ---------- Navigation: translucent material + scroll edge ---------- */

.nav {
  position: sticky; top: 0; z-index: 50;
  height: var(--nav-h);
  background: var(--nav-bg);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid transparent;
  transition: border-color 200ms ease;
}
.nav.scrolled { border-bottom-color: var(--sep); }

.nav-inner {
  width: min(var(--wrap), 100% - 48px); height: 100%;
  margin-inline: auto;
  display: flex; align-items: center; justify-content: space-between;
}

.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.brand-name { font-size: 1.1875rem; font-weight: 700; letter-spacing: 0.02em; }

.nav-links { display: flex; align-items: center; gap: 28px; font-size: 0.8125rem; letter-spacing: 0.005em; }
.nav-links a { text-decoration: none; color: var(--text-2); transition: color 160ms ease; }
.nav-cta {
  color: var(--on-accent) !important; background: var(--accent);
  padding: 6px 14px; border-radius: 980px; font-weight: 500;
  transition: transform 140ms var(--ease-out), opacity 160ms ease;
}
.nav-cta:active { transform: scale(0.96); }

@media (hover: hover) and (pointer: fine) {
  .nav-links a:not(.nav-cta):hover { color: var(--text); }
  .nav-cta:hover { opacity: 0.88; }
}
@media (max-width: 640px) {
  .nav-links a:not(.nav-cta) { display: none; }
}

/* ---------- Buttons & links ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 26px; border: 0; border-radius: 980px;
  font-size: 1.0625rem; font-weight: 500; letter-spacing: -0.01em;
  text-decoration: none; cursor: pointer;
  transition: transform 140ms var(--ease-out), opacity 160ms ease, background-color 160ms ease;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-secondary { background: var(--fill-2); color: var(--text); }

.link-arrow {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--accent); text-decoration: none; font-size: 1.0625rem; font-weight: 500;
  padding: 10px 4px;
}
.link-arrow::after { content: "›"; font-size: 1.25em; line-height: 1; transition: transform 200ms var(--ease-out); }

@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover { opacity: 0.88; }
  .btn-secondary:hover { background: var(--fill-2); opacity: 0.8; }
  .link-arrow:hover::after { transform: translateX(3px); }
}

.cta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; }

/* ---------- Typography ---------- */

.eyebrow {
  font-size: clamp(1.0625rem, 2vw, 1.4rem); font-weight: 600;
  letter-spacing: -0.01em; color: var(--accent);
}
h1 {
  font-size: clamp(2.75rem, 9.2vw, 6.25rem);
  font-weight: 700; line-height: 1.02; letter-spacing: -0.045em;
  text-wrap: balance;
}
h2 {
  font-size: clamp(2rem, 5.2vw, 3.5rem);
  font-weight: 700; line-height: 1.07; letter-spacing: -0.035em;
  text-wrap: balance;
}
.lede {
  font-size: clamp(1.1875rem, 2.4vw, 1.5rem); line-height: 1.33;
  letter-spacing: -0.015em; color: var(--text-2); max-width: 36em; text-wrap: pretty;
}
.section-sub { color: var(--text-2); font-size: clamp(1.0625rem, 2vw, 1.3125rem); letter-spacing: -0.01em; margin-top: 10px; }
.section-sub:empty { display: none; }

/* ---------- Hero ---------- */

.hero {
  position: relative; overflow: clip;
  padding: clamp(72px, 14vw, 168px) 0 clamp(56px, 9vw, 112px);
  text-align: center;
}
.hero::before {
  content: ""; position: absolute; inset: -20% -10% auto; height: 80%;
  background: radial-gradient(60% 60% at 50% 0%, var(--glow), transparent 70%);
  pointer-events: none;
}
/* Optional photo behind the hero: text switches to the light-on-dark palette so it stays readable. */
.hero-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center; z-index: 0; transform: scale(var(--bg-scale, 1)); }
.hero.has-bg .hero-bg, .hero.has-bg::after { /* soft fade of the bottom edge; --fade is set from the panel */
  -webkit-mask-image: linear-gradient(180deg, #000 calc(100% - var(--fade, 0%)), transparent 100%);
  mask-image: linear-gradient(180deg, #000 calc(100% - var(--fade, 0%)), transparent 100%);
}
.hero.has-bg {
  --text: #f5f5f7; --text-2: rgba(245, 245, 247, 0.84); --accent: #4fd8ff; --on-accent: #00222d; --glow: transparent;
  color: var(--text);
}
.hero.has-bg::before { display: none; }
.hero.has-bg::after {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: rgb(0 0 0 / var(--dim, 0.55));
}
.hero-inner { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 22px; }
.hero .lede { margin-inline: auto; }
.hero .cta-row { justify-content: center; margin-top: 10px; }

/* ---------- Sections ---------- */

.section { padding: clamp(64px, 10vw, 128px) 0; scroll-margin-top: var(--nav-h); }
.section[hidden] { display: none; }
.section.alt { background: var(--bg-alt); }
.section-head { margin-bottom: clamp(28px, 5vw, 56px); }

/* ---------- Media tiles ---------- */

.media {
  position: relative; display: block; overflow: hidden;
  aspect-ratio: 16 / 9; border-radius: var(--r-l);
  background: var(--placeholder);
  isolation: isolate;
}
.media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 400ms ease; }
.media.loaded img { opacity: 1; }
.media.letterbox .media-bg { filter: blur(28px) saturate(1.3); transform: scale(1.3); }
.media.letterbox .media-img { object-fit: contain; }
.media::after { /* hairline edge so artwork never melts into the page */
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(128, 128, 128, 0.18); pointer-events: none;
}

.tile {
  display: block; width: 100%; padding: 0; border: 0; background: none; text-align: left; cursor: pointer;
  transition: transform 200ms var(--ease-out);
}
.tile:active { transform: scale(0.985); }
.tile-frame { position: relative; display: block; }
.tile-frame .media { z-index: 1; }
/* Outer glow: a blurred copy of the artwork itself, so the light always matches the image's colors. */
.tile-glow {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0;
  border-radius: var(--r-l); filter: blur(30px) saturate(1.7); opacity: 0; transform: scale(0.97);
  transition: opacity 420ms ease, transform 520ms var(--ease-out); pointer-events: none;
}
.bento .tile-frame { height: 100%; }
.bento .tile-glow { border-radius: var(--r-xl); }
.tile .media img { transition: opacity 400ms ease, transform 600ms var(--ease-out); }
.tile-caption { padding: 14px 4px 0; }
.tile-title { font-size: 1.0625rem; font-weight: 600; letter-spacing: -0.015em; }
.tile-sub { font-size: 0.875rem; letter-spacing: 0.005em; color: var(--text-2); margin-top: 2px; }

@media (hover: hover) and (pointer: fine) {
  .tile:hover .media:not(.letterbox) .media-img { transform: scale(1.025); }
  .tile:hover .tile-glow, .tile:focus-visible .tile-glow { opacity: var(--glow-o, 0.22); transform: scale(1.05); }
}
@media (prefers-reduced-motion: reduce) { .tile-glow { transition: opacity 200ms ease; transform: scale(1.04); } }

/* Featured bento */
.bento { display: grid; gap: 20px; grid-template-columns: 1fr; }
.bento .tile { position: relative; height: 100%; }
.bento .media { height: 100%; aspect-ratio: 16 / 9; border-radius: var(--r-xl); }
.bento .tile-caption {
  position: absolute; inset: auto 0 0 0; padding: 56px 24px 22px; color: #fff;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.62), rgba(0, 0, 0, 0));
  border-radius: 0 0 var(--r-xl) var(--r-xl); pointer-events: none;
}
.bento .tile-title { font-size: clamp(1.1875rem, 2.4vw, 1.75rem); letter-spacing: -0.02em; }
.bento .tile-sub { color: rgba(255, 255, 255, 0.82); }

@media (min-width: 800px) {
  .bento.n2 { grid-template-columns: 1fr 1fr; }
  .bento.n3 { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; }
  .bento.n3 .tile:first-child { grid-row: span 2; }
  .bento.n3 .tile:not(:first-child) .tile-caption { padding: 40px 18px 16px; }
  .bento.n3 .tile:not(:first-child) .tile-title { font-size: 1.0625rem; }
}

/* Filter: segmented control with a sliding thumb */
.seg-wrap { margin-bottom: 28px; overflow-x: auto; scrollbar-width: none; padding: 4px 2px; margin-inline: -2px; }
.seg-wrap::-webkit-scrollbar { display: none; }
.seg-wrap[hidden] { display: none; }
.seg { position: relative; display: inline-flex; padding: 3px; border-radius: 980px; background: var(--fill); }
.seg-thumb {
  position: absolute; top: 3px; bottom: 3px; left: 0; width: var(--w, 0px);
  transform: translateX(var(--x, 0px)); border-radius: 980px;
  background: var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18), 0 0 0 0.5px rgba(0, 0, 0, 0.04);
  transition: transform 260ms var(--ease-out), width 260ms var(--ease-out);
}
.seg.no-anim .seg-thumb { transition: none; }
.seg-btn {
  position: relative; z-index: 1; white-space: nowrap;
  border: 0; background: none; cursor: pointer;
  padding: 7px 18px; border-radius: 980px;
  font-size: 0.9375rem; font-weight: 500; color: var(--text-2);
  transition: color 160ms ease;
}
.seg-btn[aria-selected="true"] { color: var(--text); }

.grid { display: grid; gap: 36px 20px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
.grid .tile.enter { animation: tile-in 360ms var(--ease-out) both; }
@keyframes tile-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.empty { color: var(--text-2); text-align: center; padding: 48px 0; }

/* ---------- About ---------- */

.about { display: grid; gap: 40px; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 860px) { .about { grid-template-columns: 1.4fr 1fr; gap: 72px; } }
.prose { margin-top: 22px; display: grid; gap: 1em; color: var(--text-2); font-size: clamp(1.0625rem, 2vw, 1.3125rem); line-height: 1.4; letter-spacing: -0.012em; max-width: 34em; }
.prose p:first-child { color: var(--text); }
.about-card { background: var(--surface); border-radius: var(--r-xl); padding: 28px; display: grid; gap: 22px; }
.card-label { font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.02em; color: var(--text-2); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips li { background: var(--fill); padding: 7px 14px; border-radius: 980px; font-size: 0.9375rem; font-weight: 500; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.stats:empty { display: none; }
.stats dt { font-size: clamp(2rem, 4vw, 2.75rem); font-weight: 700; letter-spacing: -0.035em; line-height: 1; order: 1; }
.stats dd { color: var(--text-2); font-size: 0.9375rem; margin-top: 6px; }
.stats > div { display: flex; flex-direction: column; }
.stats > div dt { order: 0; }

/* ---------- Services ---------- */

.cards { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .cards { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1040px) { .cards { grid-template-columns: repeat(4, 1fr); } }
.card { background: var(--bg-alt); border-radius: var(--r-xl); padding: 28px; display: flex; flex-direction: column; gap: 10px; min-height: 200px; }
.card-n { font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.02em; color: var(--accent); }
.card h3 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.025em; line-height: 1.12; }
.card p { color: var(--text-2); font-size: 1rem; line-height: 1.45; }

/* ---------- Contact ---------- */

.contact {
  background: var(--bg-alt); border-radius: var(--r-xl);
  padding: clamp(36px, 7vw, 88px) clamp(24px, 6vw, 72px);
  text-align: center; display: flex; flex-direction: column; align-items: center; gap: 20px;
}
.contact .lede { margin-inline: auto; }
.contact .cta-row { justify-content: center; margin-top: 8px; }
.links { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 22px; }
.links:empty { display: none; }
.btn .copy-ok { display: none; }
.btn.copied .copy-idle { display: none; }
.btn.copied .copy-ok { display: inline; }

/* ---------- Footer ---------- */

.footer { padding: 28px 0 44px; }
.footer p { font-size: 0.75rem; letter-spacing: 0.01em; color: var(--text-2); max-width: 60em; }

/* ---------- Lightbox ---------- */

html.lb-open { overflow: hidden; }
.lb { position: fixed; inset: 0; z-index: 90; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.lb[hidden] { display: none; }
.lb-scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.82); -webkit-backdrop-filter: blur(24px) saturate(160%); backdrop-filter: blur(24px) saturate(160%); }
.lb-stage { position: relative; display: grid; place-items: center; touch-action: pan-x; }
.lb-img {
  display: block; border-radius: 0; background: var(--placeholder);
  clip-path: inset(0 round 14px);
  box-shadow: none; user-select: none; -webkit-user-drag: none;
  will-change: transform;
}
.lb-meta {
  position: relative; display: flex; align-items: flex-end; justify-content: space-between; gap: 24px;
  width: min(var(--lb-w, 960px), 92vw); margin-top: 18px; color: #f5f5f7;
}
.lb-text { min-width: 0; }
.lb-meta h3 { font-size: 1.375rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.lb-sub { color: #a1a1a6; font-size: 0.9375rem; margin-top: 4px; }
.lb-sub:empty { display: none; }
.lb-desc { color: #c7c7cc; font-size: 1rem; margin-top: 8px; max-width: 46em; }
.lb-desc:empty { display: none; }
.lb-meta .btn { flex: none; min-height: 40px; padding: 0 20px; font-size: 0.9375rem; background: rgba(255, 255, 255, 0.16); color: #fff; }
.lb-meta .btn[hidden] { display: none; }
.lb-btn {
  position: absolute; z-index: 2; width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; color: #fff; background: rgba(255, 255, 255, 0.16);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  transition: transform 140ms var(--ease-out), background-color 160ms ease;
}
.lb-btn:active { transform: scale(0.94); }
.lb-btn[hidden] { display: none; }
.lb-close { top: max(16px, env(safe-area-inset-top)); right: 16px; }
.lb-prev, .lb-next { top: 50%; margin-top: -22px; }
.lb-prev { left: 16px; }
.lb-next { right: 16px; }
@media (hover: hover) and (pointer: fine) { .lb-btn:hover { background: rgba(255, 255, 255, 0.26); } }
@media (max-width: 720px) { .lb-prev, .lb-next { display: none; } .lb-meta { flex-direction: column; align-items: flex-start; gap: 14px; } }

/* ---------- Toast ---------- */

.toast {
  position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); z-index: 120;
  transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  background: var(--nav-bg); color: var(--text); padding: 10px 18px; border-radius: 980px;
  font-size: 0.9375rem; font-weight: 500; box-shadow: var(--shadow-m), 0 0 0 1px var(--sep);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  transition: opacity 200ms ease, transform 300ms var(--ease-out);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.noscript { padding: 24px; text-align: center; color: var(--text-2); }

/* ---------- Reveal on scroll (only when JS is running) ---------- */

.js .reveal { opacity: 0; transform: translateY(14px); }
.js .reveal.in {
  opacity: 1; transform: none;
  transition: opacity 700ms var(--ease-out), transform 700ms var(--ease-out);
  transition-delay: calc(min(var(--i, 0), 6) * 55ms);
}

/* ---------- Accessibility preferences ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { transform: none; }
  .js .reveal.in { transition: opacity 250ms ease; transition-delay: 0ms; }
  .tile, .btn, .nav-cta, .lb-btn { transition: none; }
  .tile .media img { transition: opacity 250ms ease; }
  .tile:hover .media .media-img { transform: none; }
  .grid .tile.enter { animation: none; }
  .seg-thumb { transition: none; }
  .link-arrow::after { transition: none; }
}
@media (prefers-reduced-transparency: reduce) {
  .nav { background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .lb-scrim { background: #000; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .toast { background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .lb-btn { background: rgba(60, 60, 60, 0.9); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (prefers-contrast: more) {
  :root { --sep: rgba(128, 128, 128, 0.7); --text-2: color-mix(in srgb, var(--text) 80%, var(--bg)); }
  .media::after { box-shadow: inset 0 0 0 1px var(--sep); }
}
