/* ==========================================================================
   Kevin Vergara — personal site
   Mobile-first. No frameworks. System fonts (zero font requests).
   ========================================================================== */

:root {
  --bg: #0d0d0c;
  --bg-raise: #141412;
  --line: #262622;
  --line-strong: #3a3a34;
  --text: #ecebe6;
  --text-soft: #c4c2ba;
  --muted: #9a988f;
  --accent: #e2a947;          /* brass — the colour of a cymbal */
  --accent-ink: #1a1408;
  --teal: #2aa7ad;            /* second colour — the streak in Kevin's hair (6.7:1 on --bg) */
  --teal-deep: #18788a;       /* the hair colour itself; decoration only, not for text */

  --font-sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI Variable", "Segoe UI",
               "Inter", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Menlo, Consolas, monospace;

  --wrap: 72rem;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
  --section-y: clamp(4.5rem, 11vw, 8.5rem);
  --header-h: 4rem;
  --radius: 999px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 1rem);
}
/* Smooth only for in-page clicks (a focused link); arriving at /es/#work jumps instantly. */
html:focus-within { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
code { font-family: var(--font-mono); font-size: .88em; color: var(--text); }
::selection { background: var(--accent); color: var(--accent-ink); }

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

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}
.muted { color: var(--muted); }
[hidden] { display: none !important; }

.skip-link {
  position: absolute; left: 1rem; top: -4rem; z-index: 100;
  padding: .75rem 1rem;
  background: var(--accent); color: var(--accent-ink);
  font-weight: 600; border-radius: 6px;
}
.skip-link:focus { top: 1rem; }

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

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgb(13 13 12 / .82);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s var(--ease);
}
.site-header.is-scrolled { border-bottom-color: var(--line); }
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  min-height: var(--header-h);
  flex-wrap: wrap;
}
.brand { display: inline-flex; align-items: center; gap: .6rem; min-height: 44px; }
.brand-mark { color: var(--accent); }
.brand-name { font-weight: 600; letter-spacing: -.01em; }

.nav-toggle {
  display: none;
  align-items: center; gap: .6rem;
  min-height: 44px; padding: 0 .25rem;
  background: none; border: 0; cursor: pointer;
  font-family: var(--font-mono); font-size: .8125rem; letter-spacing: .06em; text-transform: uppercase;
}
.nav-toggle-bars { position: relative; display: block; width: 18px; height: 12px; }
.nav-toggle-bars::before,
.nav-toggle-bars::after {
  content: ""; position: absolute; left: 0; width: 100%; height: 1.5px;
  background: currentColor;
  transition: transform .25s var(--ease), top .25s var(--ease);
}
.nav-toggle-bars::before { top: 3px; }
.nav-toggle-bars::after { top: 8px; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::before { top: 5.25px; transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::after { top: 5.25px; transform: rotate(-45deg); }

.site-nav ul { display: flex; flex-wrap: wrap; gap: .25rem 1.5rem; }
.site-nav a {
  display: inline-flex; align-items: center; min-height: 44px;
  font-size: .9375rem; color: var(--text-soft);
  transition: color .2s;
}
.site-nav a:hover, .site-nav a[aria-current="true"] { color: var(--text); }

/* Language switch — always visible, outside the collapsible menu */
.lang-switch {
  display: flex; align-items: center;
  margin-left: auto;
  font-family: var(--font-mono); font-size: .8125rem; letter-spacing: .06em;
}
.lang-switch li + li::before { content: "/"; color: var(--line-strong); padding-inline: .1rem; }
.lang-switch li { display: flex; align-items: center; }
.lang-switch a {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 36px; min-height: 44px; padding-inline: .35rem;
  color: var(--muted);
  transition: color .2s;
}
.lang-switch a:hover { color: var(--text); }
.lang-switch a[aria-current="page"] { color: var(--accent); }
@media (min-width: 48rem) {
  .site-nav { margin-left: auto; }
  .lang-switch { margin-left: 1.5rem; padding-left: 1.25rem; border-left: 1px solid var(--line); min-height: 20px; }
}

/* Mobile: collapse nav only when JS is available */
@media (max-width: 47.99rem) {
  .lang-switch { order: 1; }
  .js .nav-toggle { display: inline-flex; margin-left: .75rem; order: 2; }
  .site-nav { width: 100%; order: 3; }
  .js .site-nav { display: none; padding: .5rem 0 1.25rem; }
  .js .site-nav.is-open { display: block; }
  .js .site-nav ul { flex-direction: column; gap: 0; }
  .js .site-nav a { font-size: 1.375rem; color: var(--text); width: 100%; border-bottom: 1px solid var(--line); min-height: 56px; }
}

/* ---------- Buttons & links ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 1.4rem;
  border-radius: var(--radius);
  font-weight: 600; font-size: .9875rem;
  transition: background-color .2s, color .2s, border-color .2s, transform .2s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: #f0bb5c; }
.btn-ghost { border: 1px solid var(--line-strong); }
.btn-ghost:hover { border-color: var(--text); }

.text-link {
  display: inline-flex; align-items: center; gap: .35rem; min-height: 44px;
  color: var(--text);
  background: linear-gradient(currentColor, currentColor) 0 calc(100% - 10px) / 100% 1px no-repeat;
  transition: color .2s, background-size .3s var(--ease);
}
.text-link:hover { color: var(--accent); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding-top: clamp(3.5rem, 12vw, 8rem);
  padding-bottom: clamp(7rem, 14vw, 10rem);
  overflow: hidden;
}
.eyebrow {
  display: inline-flex; align-items: center; gap: .6rem;
  font-family: var(--font-mono); font-size: .8125rem; letter-spacing: .04em;
  color: var(--muted);
}
.dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 4px rgb(42 167 173 / .18);
}

/* Hero layout: name spans the full width; portrait sits beside the headline on wide screens. */
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "photo" "eyebrow" "title" "body" "status";
  justify-items: start;
}
.hero-grid > .eyebrow { grid-area: eyebrow; }
.hero-grid > .hero-title { grid-area: title; }
.hero-grid > .hero-body { grid-area: body; }
.hero-grid > .hero-status { grid-area: status; justify-self: stretch; }
.hero-portrait {
  grid-area: photo;
  position: relative;
  width: 120px;
  margin: 0 0 1.75rem;
}
.hero-portrait::before {
  content: "";
  position: absolute; inset: 0;
  border: 1px solid var(--teal-deep);
  border-radius: 14px;
  transform: translate(7px, 7px);
}
.hero-portrait img {
  position: relative;
  width: 100%; height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover; object-position: 50% 28%;
  border-radius: 14px;
  background: #cfcdc9;
}
@media (min-width: 56rem) {
  .hero-grid {
    grid-template-columns: minmax(0, 1fr) 340px;
    grid-template-areas:
      "eyebrow eyebrow"
      "title   title"
      "body    photo"
      "status  photo";
    column-gap: clamp(3rem, 6vw, 5.5rem);
  }
  .hero-portrait {
    width: 100%;
    margin: clamp(2rem, 5vw, 3rem) 14px 0 0;
    align-self: start;
  }
  .hero-portrait::before { border-radius: 20px; transform: translate(14px, 14px); }
  .hero-portrait img { border-radius: 20px; }
}
.hero-title { margin-top: 1.25rem; font-weight: 600; }
.hero-name {
  display: block;
  font-size: clamp(3.1rem, 13vw, 8.75rem);
  line-height: .92;
  letter-spacing: -.045em;
}
.hero-role {
  display: block; margin-top: 1rem;
  font-size: clamp(1.15rem, 2.6vw, 1.6rem);
  font-weight: 500; letter-spacing: -.01em;
  color: var(--teal);
}
.hero-body { margin-top: clamp(2rem, 5vw, 3rem); max-width: 40rem; }
.hero-headline {
  font-size: clamp(1.5rem, 3.6vw, 2.25rem);
  line-height: 1.25; letter-spacing: -.02em; font-weight: 500;
  text-wrap: balance;
}
.hero-lead { margin-top: 1.25rem; color: var(--text-soft); max-width: 36rem; }
.hero-actions {
  display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem;
  margin-top: 2rem;
}
.hero-actions .text-link { margin-left: .25rem; }

.hero-status {
  display: grid; gap: 1rem;
  margin-top: clamp(3rem, 7vw, 4.5rem);
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}
.hero-status dt {
  font-family: var(--font-mono); font-size: .75rem; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted);
}
.hero-status dd { font-size: .9375rem; margin-top: .15rem; }
@media (min-width: 40rem) { .hero-status { grid-template-columns: repeat(3, 1fr); } }

.hero-wave {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: clamp(60px, 9vw, 110px);
  pointer-events: none;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}
.hero-wave svg { width: 100%; height: 100%; }
.wave-bars { stroke: var(--line-strong); stroke-width: 3; stroke-linecap: round; fill: none; vector-effect: non-scaling-stroke; }
.wave-playhead {
  position: absolute; top: 0; bottom: 0; left: 0; width: 2px;
  background: var(--accent);
  opacity: .8;
  transform: translateX(-10px);
  animation: playhead 10s linear infinite;
}
@keyframes playhead {
  from { transform: translateX(-10px); }
  to   { transform: translateX(100vw); }
}

/* ---------- Sections ---------- */
.section { padding-block: var(--section-y); border-top: 1px solid var(--line); }
.section-grid { display: grid; gap: 2rem; }
.section-head { display: flex; align-items: baseline; gap: 1rem; }
.section-index {
  font-family: var(--font-mono); font-size: .8125rem; color: var(--accent);
  letter-spacing: .06em;
}
.section-head h2 {
  font-family: var(--font-mono); font-size: .875rem; font-weight: 500;
  letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
}
.lede {
  font-size: clamp(1.4rem, 3vw, 2rem);
  line-height: 1.3; letter-spacing: -.02em; font-weight: 500;
  max-width: 38rem; text-wrap: balance;
}
.prose p + p { margin-top: 1.1rem; }
.prose .lede + p { margin-top: 1.75rem; }
.prose p:not(.lede):not(.footnote) { color: var(--text-soft); max-width: 40rem; }

@media (min-width: 56rem) {
  .section-grid { grid-template-columns: 14rem 1fr; gap: 3rem; }
  .section-head { flex-direction: column; gap: .4rem; position: sticky; top: calc(var(--header-h) + 2rem); align-self: start; }
}

/* ---------- Timeline ---------- */
.timeline { margin-top: 2.75rem; border-top: 1px solid var(--line); max-width: 40rem; }
.timeline li {
  display: grid; grid-template-columns: 1fr auto; gap: .1rem 1rem;
  padding: 1rem 0; border-bottom: 1px solid var(--line);
}
.t-years { grid-column: 1 / -1; font-family: var(--font-mono); font-size: .8125rem; color: var(--muted); }
.t-role { font-weight: 500; }
.t-org { color: var(--text-soft); text-align: right; }
@media (min-width: 40rem) {
  .timeline li { grid-template-columns: 8.5rem 1fr auto; align-items: baseline; }
  .t-years { grid-column: auto; }
}
.footnote { margin-top: 1.5rem; font-size: .9375rem; color: var(--muted); }

/* ---------- Stack ---------- */
.stack {
  display: grid; gap: 2.25rem;
  margin-top: 2.5rem;
}
.stack-group { padding-top: 1.25rem; border-top: 1px solid var(--line-strong); }
.stack-group h3 { font-size: 1.125rem; font-weight: 600; letter-spacing: -.01em; }
.stack-note { margin-top: .35rem; font-size: .9375rem; color: var(--muted); line-height: 1.5; }
.stack-group ul { margin-top: 1rem; }
.stack-group li {
  font-family: var(--font-mono); font-size: .9375rem;
  padding: .3rem 0; color: var(--text-soft);
}
.stack-group li::before { content: "› "; color: var(--teal); }
@media (min-width: 40rem) { .stack { grid-template-columns: repeat(2, 1fr); gap: 2.75rem 3rem; max-width: 46rem; } }
.practices {
  display: flex; flex-wrap: wrap; gap: .5rem 1.5rem;
  margin-top: 2.5rem;
  font-family: var(--font-mono); font-size: .8125rem; color: var(--muted);
  letter-spacing: .04em;
}
.practices span::before { content: "//"; margin-right: .5rem; color: var(--teal-deep); }

/* ---------- Projects ---------- */
.projects { margin-top: 2.5rem; counter-reset: project; }
.project {
  counter-increment: project;
  position: relative;
  padding: 2rem 0 2.25rem;
  border-top: 1px solid var(--line);
}
.project:last-child { border-bottom: 1px solid var(--line); }
.project::before {
  content: counter(project, decimal-leading-zero);
  display: block; margin-bottom: .75rem;
  font-family: var(--font-mono); font-size: .8125rem; color: var(--accent);
}
.project-meta {
  display: flex; flex-wrap: wrap; gap: .25rem 1rem;
  font-family: var(--font-mono); font-size: .8125rem; color: var(--muted);
}
.project-meta span + span::before { content: "·"; margin-right: 1rem; }
.project h3 {
  margin-top: .5rem;
  font-size: clamp(1.35rem, 2.8vw, 1.75rem);
  line-height: 1.25; letter-spacing: -.02em; font-weight: 600;
}
.project-purpose { margin-top: .75rem; color: var(--text-soft); max-width: 40rem; }
.project-points { margin-top: 1rem; max-width: 40rem; }
.project-points li {
  position: relative; padding-left: 1.25rem; margin-top: .45rem;
  color: var(--text-soft); font-size: 1rem;
}
.project-points li::before {
  content: ""; position: absolute; left: 0; top: .78em;
  width: .5rem; height: 1px; background: var(--muted);
}
.project-tech {
  margin-top: 1.25rem;
  font-family: var(--font-mono); font-size: .8125rem; color: var(--teal);
  letter-spacing: .02em;
}
.project-note { margin-top: .4rem; font-size: .875rem; color: var(--muted); font-style: italic; }
@media (min-width: 56rem) {
  .project { display: grid; grid-template-columns: 3.5rem 1fr; }
  .project::before { margin: .15rem 0 0; }
}
.more-link { margin-top: 1.5rem; }

/* ---------- Beyond the code ---------- */
.beyond { background: var(--bg-raise); }
.beyond-quote {
  font-size: clamp(2rem, 6vw, 3.75rem);
  line-height: 1.05; letter-spacing: -.035em; font-weight: 600;
  font-style: italic;
}
.beyond-text { margin-top: 1.25rem; max-width: 34rem; color: var(--text-soft); }

.sequencer { margin-top: 2.5rem; max-width: 40rem; }
.seq-grid {
  display: grid; grid-template-columns: 2rem 1fr; gap: .5rem .75rem; align-items: center;
}
.seq-label { font-family: var(--font-mono); font-size: .6875rem; color: var(--muted); letter-spacing: .06em; }
.seq-row { display: grid; grid-template-columns: repeat(16, 1fr); gap: 4px; }
.seq-row > * {
  display: block; width: 100%; aspect-ratio: 1 / 1; max-height: 28px;
  padding: 0; border: 0; border-radius: 3px;
  background: var(--line);
  transition: background-color .08s, transform .08s, box-shadow .15s;
}
.seq-row > :nth-child(4n + 1) { background: var(--line-strong); }
.seq-row > .on { background: var(--teal); }
.seq-row:not([data-row="hat"]) > .on { background: var(--accent); }
.seq-row > .now { transform: scale(.82); }
.seq-row > .on.now { background: var(--accent); transform: scale(1.05); }
.seq-row > button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.seq-row > button:hover { box-shadow: inset 0 0 0 1px var(--muted); }
.seq-row > button:focus-visible { outline-offset: 2px; border-radius: 3px; }
.seq-row > button:active { transform: scale(.9); }

.seq-hint { margin-bottom: 1rem; font-size: .875rem; color: var(--muted); }
.seq-tools { display: inline-flex; gap: .25rem; }
.seq-tool {
  min-height: 44px; padding: 0 .6rem;
  background: none; border: 0; cursor: pointer;
  font-family: var(--font-mono); font-size: .75rem; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted);
  transition: color .2s;
}
.seq-tool:hover { color: var(--text); }

/* Small screens: two lines of 8 per instrument, so each pad is a comfortable tap target. */
@media (max-width: 39.99rem) {
  .seq-grid { gap: .9rem .75rem; }
  .seq-row { grid-template-columns: repeat(8, 1fr); gap: 6px; }
  .seq-row > * { max-height: none; }
}

.seq-caption {
  display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.25rem;
  margin-top: 1.25rem; font-size: .875rem;
}
.seq-play {
  display: inline-flex; align-items: center; gap: .6rem;
  min-height: 44px; padding: 0 1.1rem 0 .9rem;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: transparent; cursor: pointer; font-weight: 600; font-size: .9375rem;
  transition: border-color .2s;
}
.seq-play:hover { border-color: var(--accent); }
.seq-icon {
  width: 0; height: 0;
  border-left: 9px solid var(--accent);
  border-top: 6px solid transparent; border-bottom: 6px solid transparent;
}
.seq-play[data-playing="true"] .seq-icon {
  width: 10px; height: 10px; border: 0; background: var(--accent); border-radius: 1px;
}
.beyond-links-title {
  margin-top: 3rem;
  font-family: var(--font-mono); font-size: .75rem; font-weight: 500;
  letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
}
.beyond .socials.beyond-links { margin-top: 1rem; max-width: 40rem; }
.beyond-links a:hover, .beyond-links a:hover::after { color: var(--teal); }

/* ---------- Contact ---------- */
.contact-email { margin-top: 2rem; }
.contact-email a {
  display: inline-block;
  font-size: clamp(1.35rem, 5.2vw, 3rem);
  font-weight: 600; letter-spacing: -.03em; line-height: 1.2;
  overflow-wrap: anywhere;
  background: linear-gradient(var(--accent), var(--accent)) 0 100% / 0 2px no-repeat;
  padding-bottom: .2rem;
  transition: background-size .35s var(--ease), color .2s;
}
.contact-email a:hover { background-size: 100% 2px; color: var(--accent); }
.socials { margin-top: 2.5rem; border-top: 1px solid var(--line); max-width: 40rem; }
.socials a {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  min-height: 60px; border-bottom: 1px solid var(--line);
  font-weight: 500;
  transition: color .2s, padding .25s var(--ease);
}
.socials a::after { content: "↗"; color: var(--muted); transition: color .2s; }
.social-handle { margin-left: auto; font-family: var(--font-mono); font-size: .875rem; color: var(--muted); }
.socials a:hover { color: var(--accent); padding-left: .35rem; }
.socials a:hover::after { color: var(--accent); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding-block: 2.5rem 3rem; font-size: .9375rem; }
.footer-inner { display: grid; gap: .5rem; }
.footer-links { display: flex; gap: 1.5rem; margin-top: .75rem; }
.footer-links a { display: inline-flex; align-items: center; min-height: 44px; color: var(--text-soft); }
.footer-links a:hover { color: var(--accent); }
@media (min-width: 56rem) {
  .footer-inner { grid-template-columns: 1fr auto auto; align-items: center; gap: 2rem; }
  .footer-links { margin-top: 0; }
}

/* ---------- 404 ---------- */
.notfound { min-height: 70vh; display: grid; align-content: center; padding-block: 6rem; }
.notfound .hero-name { font-size: clamp(4rem, 18vw, 10rem); }
.notfound p { margin-top: 1.25rem; color: var(--text-soft); max-width: 32rem; }
.notfound .btn { margin-top: 2rem; justify-self: start; }

/* ---------- Motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .wave-playhead { display: none; }
}

@media print {
  .site-header, .hero-wave, .sequencer, .skip-link { display: none !important; }
  body { background: #fff; color: #000; }
}
