/* javier.studio — v2 */

:root {
  color-scheme: dark;
  --bg: #131210;
  --bg-2: #1b1a17;
  --ink: #f1eee7;
  --ink-2: #b9b5ab;
  --ink-3: #7d7a72;
  --line: #2c2a26;
  --line-2: #3b3833;
  --accent: #ff5a3c;
  --accent-soft: rgba(255, 90, 60, .14);
  --accent-ink: #ffffff;

  --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --max: 1120px;
  --gutter: clamp(20px, 5vw, 64px);
  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 40px;
  --space-5: 64px;
  --space-6: 112px;
  --space-7: 160px;

  --ease: cubic-bezier(.16, .84, .24, 1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
section, .vpanel { scroll-margin-top: 88px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  padding-inline: var(--gutter);
  overflow-x: clip;
}

/* Film grain over everything, very faint */
body::before {
  content: "";
  position: fixed;
  inset: -50%;
  width: 200%;
  height: 200%;
  pointer-events: none;
  z-index: 100;
  opacity: .055;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .9 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 240px 240px;
  mix-blend-mode: screen;
}

::selection { background: var(--accent); color: #141311; }
::-moz-selection { background: var(--accent); color: #141311; }

a { color: inherit; text-decoration: none; }
p { margin: 0; }
h1, h2, h3 { margin: 0; font-weight: 400; }
dl, dd, dt { margin: 0; }
em { font-style: italic; }

/* Reading progress */
.progress {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  width: 100%;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: 0 50%;
  z-index: 30;
  pointer-events: none;
}

/* Header */
.top {
  position: sticky;
  top: 0;
  z-index: 10;
  margin-inline: calc(-1 * var(--gutter));
  padding-inline: var(--gutter);
  padding-block: var(--space-2);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: 0 1px 0 transparent;
  transition: box-shadow .3s ease;
}
.top.scrolled { box-shadow: 0 1px 0 var(--line); }
.top-inner { max-width: var(--max); margin: 0 auto; display: flex; justify-content: space-between; align-items: center; }
.wordmark {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  font-family: var(--serif);
  font-size: 28px;
  line-height: 1;
  letter-spacing: -0.01em;
}
.wordmark .mark { width: 13px; height: 12px; overflow: visible; fill: var(--accent); transform: translateY(1px); }

/* Mark intro: dots appear one by one while the group settles into place */
.top .mark { transform-origin: 50% 58%; animation: mark-settle 1.1s var(--ease) both; }
.top .mark circle { transform-box: fill-box; transform-origin: center; animation: dot-in .5s cubic-bezier(.2, .7, .2, 1) both; }
.top .mark circle:nth-child(1) { animation-delay: .05s; }
.top .mark circle:nth-child(2) { animation-delay: .28s; }
.top .mark circle:nth-child(3) { animation-delay: .5s; }
@keyframes mark-settle { from { transform: translateY(1px) rotate(-240deg); } to { transform: translateY(1px) rotate(0deg); } }
@keyframes dot-in { from { opacity: 0; transform: scale(.2); } to { opacity: 1; transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .top .mark, .top .mark circle { animation: none; } }
.wordmark.small { font-size: 22px; gap: 8px; }
.wordmark.small .mark { width: 11px; height: 10px; fill: var(--ink-3); }

.nav { display: flex; gap: var(--space-3); font-size: 15px; color: var(--ink-2); }
.nav a { position: relative; padding-bottom: 3px; transition: color .15s ease; }
.nav a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: 100% 50%;
  transition: transform .35s var(--ease);
}
.nav a:hover { color: var(--ink); }
.nav a:hover::after, .nav a.is-active::after { transform: scaleX(1); transform-origin: 0 50%; }
.nav a.is-active { color: var(--ink); }

main { max-width: var(--max); margin: 0 auto; }

/* Hero */
.hero {
  position: relative;
  padding-block: var(--space-6) var(--space-7);
  border-top: 0;
}
.hero .kicker {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: var(--space-3);
  display: flex;
  align-items: center;
  gap: 10px;
}
.hero .kicker::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.hero h1 { max-width: 920px; }
.hero .lede { max-width: 44ch; }
.hero h1 {
  font-family: var(--serif);
  font-size: clamp(44px, 8vw, 104px);
  line-height: 1.0;
  letter-spacing: -0.02em;
  text-wrap: balance;
  margin-bottom: var(--space-4);
}
.hero h1 em { color: var(--ink-2); }
.lede {
  font-size: clamp(19px, 2.2vw, 24px);
  line-height: 1.45;
  color: var(--ink);
  max-width: 44ch;
  text-wrap: pretty;
}
.hero .meta {
  margin-top: var(--space-3);
  color: var(--ink-2);
  max-width: 48ch;
}
.hero .button { margin-top: var(--space-4); }

.button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--ink);
  color: var(--bg);
  padding: 14px 20px 14px 22px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 500;
  border: 0;
  cursor: pointer;
  transition: transform .15s ease, background .2s ease, color .2s ease;
}
.button svg { width: 16px; height: 16px; transition: transform .3s var(--ease); }
.button:hover { background: var(--accent); color: var(--accent-ink); transform: translateY(-1px); }
.button:hover svg { transform: translateX(3px); }
.button:active { transform: translateY(0); }

/* Hero intro */
.hero .kicker, .hero h1, .hero .lede, .hero .meta, .hero .button {
  opacity: 0;
  animation: rise .9s var(--ease) both;
}
.hero .kicker { animation-delay: .05s; }
.hero h1 { animation-delay: .15s; }
.hero .lede { animation-delay: .45s; }
.hero .meta { animation-delay: .6s; }
.hero .button { animation-delay: .75s; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .hero .kicker, .hero h1, .hero .lede, .hero .meta, .hero .button { animation: none; opacity: 1; }
}

/* Section rhythm */
section { padding-block: var(--space-5); border-top: 1px solid var(--line); }
.hero + section { border-top: 0; padding-top: 0; }
.eyebrow {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.eyebrow .n { color: var(--accent); font-variant-numeric: tabular-nums; }
.eyebrow::after { content: ""; flex: 1; height: 1px; background: var(--line); margin-left: var(--space-1); }
h2.eyebrow { margin-bottom: var(--space-5); }

/* What I do */
.cols {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-5) var(--space-4);
}
.col { position: relative; padding-top: var(--space-3); border-top: 1px solid var(--line); }
.col::before {
  content: "";
  position: absolute;
  top: -1px; left: 0;
  height: 1px;
  width: 0;
  background: var(--accent);
  transition: width .6s var(--ease);
}
.col.in::before { width: 40px; }
.col:hover::before { width: 100%; }
.glyph { width: 22px; height: 20px; overflow: visible; fill: var(--accent); margin-bottom: var(--space-3); display: block; }
.glyph .ghost { fill: none; stroke: var(--line-2); stroke-width: .3; }

/* Rotating dots: the "active" position travels clockwise (top → bottom-right → bottom-left)
   in sync across the three glyphs. Static fallback (reduced motion) keeps 1, 2, 3 red. */
.glyph { --cycle: 6s; }
.glyph circle {
  stroke-width: .3;
  animation-duration: var(--cycle);
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
}
.glyph circle:nth-child(1) { animation-delay: 0s; }                  /* top */
.glyph circle:nth-child(2) { animation-delay: calc(var(--cycle) / -3); }     /* bottom-left */
.glyph circle:nth-child(3) { animation-delay: calc(var(--cycle) / -3 * 2); } /* bottom-right */
.glyph.g1 circle { animation-name: dot-one; }
.glyph.g2 circle { animation-name: dot-two; }
.glyph.g3 circle { animation-name: dot-three; }

/* one red dot walking around */
@keyframes dot-one {
  0%, 29%   { fill: var(--accent); stroke: var(--accent); }
  36%, 93%  { fill: transparent;   stroke: var(--line-2); }
  100%      { fill: var(--accent); stroke: var(--accent); }
}
/* two red dots: the empty slot walks around */
@keyframes dot-two {
  0%, 29%   { fill: transparent;   stroke: var(--line-2); }
  36%, 93%  { fill: var(--accent); stroke: var(--accent); }
  100%      { fill: transparent;   stroke: var(--line-2); }
}
/* three red dots: one blinks out and the blink walks around */
@keyframes dot-three {
  0%        { fill: var(--accent); stroke: var(--accent); }
  5%, 13%   { fill: transparent;   stroke: var(--line-2); }
  20%, 100% { fill: var(--accent); stroke: var(--accent); }
}
@media (prefers-reduced-motion: reduce) {
  .glyph circle { animation: none; }
}
.col h3 {
  font-family: var(--serif);
  font-size: 30px;
  letter-spacing: -0.01em;
  line-height: 1.1;
  margin-bottom: var(--space-2);
}
.col p { color: var(--ink-2); text-wrap: pretty; }

/* Work: verticals */
.vtabs {
  display: flex;
  gap: var(--space-4);
  border-bottom: 1px solid var(--line);
  margin-bottom: var(--space-5);
  overflow-x: auto;
  scrollbar-width: none;
}
.vtabs::-webkit-scrollbar { display: none; }
.vtabs a {
  position: relative;
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 10px 0 16px;
  font-size: 15px;
  color: var(--ink-3);
  text-decoration: none;
  white-space: nowrap;
  transition: color .3s ease;
}
.vtabs a .n { font-size: 11px; letter-spacing: .1em; font-variant-numeric: tabular-nums; transition: color .3s ease; }
.vtabs a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
  background: var(--accent); transform: scaleX(0); transform-origin: left;
  transition: transform .5s var(--ease);
}
.vtabs a:hover { color: var(--ink-2); }
.vtabs a[aria-selected="true"] { color: var(--ink); }
.vtabs a[aria-selected="true"] .n { color: var(--accent); }
.vtabs a[aria-selected="true"]::after { transform: scaleX(1); }

.vpanel {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: var(--space-3) var(--space-5);
}
.vpanel[hidden] { display: none; }
.vpanel.enter { animation: rise .6s var(--ease) both; }
.vpanel > header { position: sticky; top: 96px; align-self: start; }
.vpanel h3 {
  font-family: var(--serif);
  font-size: clamp(30px, 3.6vw, 44px);
  line-height: 1.05;
  letter-spacing: -0.015em;
}
.tags { margin-top: var(--space-2); display: flex; flex-wrap: wrap; gap: 8px; font-size: 13px; color: var(--ink-2); }
.tags span { padding: 4px 10px; border: 1px solid var(--line-2); border-radius: 999px; line-height: 1.3; }
.vlede { margin-top: var(--space-3); max-width: 36ch; color: var(--ink); text-wrap: pretty; }

.companies { max-width: 62ch; }
.company + .company { margin-top: var(--space-5); padding-top: var(--space-5); border-top: 1px solid var(--line); }
.company h4 {
  font-family: var(--serif);
  font-size: 30px;
  letter-spacing: -0.01em;
  line-height: 1.1;
  margin-bottom: var(--space-2);
}
.company p { color: var(--ink-2); text-wrap: pretty; }
.company p + p { margin-top: var(--space-2); }
.company .outcome {
  color: var(--ink);
  padding-left: var(--space-2);
  border-left: 2px solid var(--accent);
  margin-top: var(--space-3);
}
.figs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-5);
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink-3);
  letter-spacing: .02em;
}
.figs b {
  display: block;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(30px, 3vw, 40px);
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  margin-bottom: 6px;
}
.figs b small { font-size: .5em; color: var(--ink-3); margin-left: 3px; letter-spacing: 0; }

/* How I work */
.principles {
  list-style: none;
  margin: 0; padding: 0;
  counter-reset: p;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4) var(--space-5);
  max-width: 980px;
}
.principles li {
  counter-increment: p;
  position: relative;
  color: var(--ink-2);
  padding-top: var(--space-2);
  border-top: 1px solid var(--line);
  text-wrap: pretty;
}
.principles li::after {
  content: "";
  position: absolute;
  top: -1px; left: 0;
  height: 1px;
  width: 0;
  background: var(--accent);
  transition: width .6s var(--ease);
}
.principles li:hover::after { width: 100%; }
.principles li::before {
  content: counter(p, decimal-leading-zero);
  display: block;
  font-family: var(--serif);
  font-size: 22px;
  color: var(--accent);
  margin-bottom: var(--space-1);
}
.principles strong { color: var(--ink); font-weight: 500; display: block; margin-bottom: 4px; }

/* About */
.about-grid { display: grid; grid-template-columns: minmax(0, 62ch) 340px; gap: var(--space-5); align-items: start; justify-content: space-between; }
.about-body { max-width: 62ch; display: grid; gap: var(--space-2); color: var(--ink-2); font-size: 18px; }
.about-body p:first-child { color: var(--ink); }
.facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3) var(--space-4);
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--line);
  font-size: 15px;
}
.facts dt { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 4px; }
.facts dd { color: var(--ink); }
.portrait { margin: 0; position: relative; isolation: isolate; }
.portrait::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 118%;
  aspect-ratio: 1;
  border: 1px solid var(--line-2);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  z-index: -1;
  transition: transform .5s var(--ease), border-color .3s ease;
}
.portrait:hover::after { transform: translate(-50%, -50%) scale(1.03); border-color: var(--accent); }
.portrait img {
  display: block; width: 100%; height: auto;
  filter: grayscale(1) contrast(1.05);
  transition: filter .6s ease;
}
.portrait:hover img { filter: grayscale(0) contrast(1); }

/* Contact */
.contact { padding-block: var(--space-6); }
.contact h2 {
  font-family: var(--serif);
  font-size: clamp(38px, 6vw, 72px);
  line-height: 1.02;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-3);
  text-wrap: balance;
}
.contact h2 em { color: var(--ink-2); }
.form {
  margin-top: var(--space-4);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  max-width: 720px;
}
.form label { position: relative; display: grid; gap: 6px; font-size: 14px; color: var(--ink-2); }
.form label::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform .4s var(--ease);
}
.form label:focus-within::after { transform: scaleX(1); }
.form label:focus-within > span { color: var(--ink); }
.form .wide { grid-column: 1 / -1; }
#cf-turnstile-box:empty { display: none; }
.form input, .form textarea {
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--ink-3);
  padding: 10px 0;
  border-radius: 0;
  outline: none;
  resize: vertical;
}
.hp { position: absolute; left: -9999px; }
.form-actions { grid-column: 1 / -1; display: flex; align-items: center; gap: var(--space-3); }
.form-status { font-size: 14px; color: var(--ink-2); }
.form-status.ok { color: var(--ink); }
.form-status.err { color: var(--accent); }
.alt { margin-top: var(--space-4); color: var(--ink-2); font-size: 15px; }
.alt a { border-bottom: 1px solid var(--line); transition: border-color .2s ease, color .2s ease; }
.alt a:hover { border-bottom-color: var(--accent); color: var(--ink); }

/* Back to top */
.to-top {
  position: fixed;
  right: clamp(16px, 3vw, 32px);
  bottom: clamp(16px, 3vw, 32px);
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  color: var(--ink-3);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity .3s ease, transform .3s ease, color .15s ease, border-color .15s ease;
  z-index: 9;
}
.to-top svg { width: 18px; height: 18px; }
.to-top.show { opacity: 1; transform: none; pointer-events: auto; }
.to-top:hover { color: var(--ink); border-color: var(--ink-3); }
@media (prefers-reduced-motion: reduce) { .to-top { transition: opacity .2s ease; transform: none; } }

/* Footer */
.foot {
  max-width: var(--max);
  margin: 0 auto;
  padding-block: var(--space-4) var(--space-5);
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  font-size: 14px;
  color: var(--ink-3);
}

/* Reveal */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
.cols .col:nth-child(2) { transition-delay: .1s; }
.cols .col:nth-child(3) { transition-delay: .2s; }
.principles li:nth-child(even) { transition-delay: .1s; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } }

/* Responsive */
@media (max-width: 900px) {
  .cols { grid-template-columns: 1fr; gap: var(--space-4); }
  .vpanel { grid-template-columns: 1fr; gap: var(--space-3); }
  .vpanel > header { position: static; }
  .vlede { max-width: 62ch; }
  .principles { grid-template-columns: 1fr; }
  .about-grid { grid-template-columns: 1fr; gap: var(--space-4); }
  .portrait { order: -1; max-width: 60%; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .nav { gap: 14px; font-size: 13px; }
  .hero { padding-block: var(--space-5) var(--space-6); }
  .figs b { font-size: 26px; }
  .vtabs { gap: var(--space-3); }
  .facts { grid-template-columns: 1fr; }
  .form { grid-template-columns: 1fr; }
  .foot { flex-direction: column; gap: var(--space-1); text-align: center; }
  .top-inner { flex-wrap: wrap; gap: var(--space-2); }
}
