/* Johann Piedras — personal resume site. Design tokens from the handoff. */

:root {
  --bg: #0a0c10;
  --panel: #12151c;
  --ink: #f2f4f8;
  --sub: #98a1b0;
  --faint: #5d6470;
  --line: rgba(255, 255, 255, 0.09);
  --accent: #32CD32;
  --maxw: 1140px;
  --pad: 40px;
}

:root[data-theme="light"] {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #14171c;
  --sub: #525a68;
  --faint: #8a93a3;
  --line: rgba(12, 18, 28, 0.12);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: 'Geist', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; transition: color 0.15s ease; }
a:hover { color: var(--accent); }

.mono { font-family: 'Geist Mono', ui-monospace, monospace; }

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding-left: var(--pad);
  padding-right: var(--pad);
}

.kicker {
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 13px;
  color: var(--accent);
  letter-spacing: 0.14em;
  margin-bottom: 14px;
}

.section { padding-top: 96px; padding-bottom: 40px; }

h2.title {
  margin: 0 0 48px;
  font-size: clamp(32px, 4.5vw, 52px);
  font-weight: 700;
  letter-spacing: -0.03em;
}

/* ---------- Nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px var(--pad);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 74%, transparent);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}
.nav__brand {
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
}
.nav__links {
  display: flex;
  align-items: center;
  gap: 28px;
  font-size: 14px;
  color: var(--sub);
}
.nav__cta {
  color: var(--bg);
  background: var(--ink);
  padding: 8px 18px;
  border-radius: 99px;
  font-weight: 600;
  font-size: 13px;
}
.nav__cta:hover { color: var(--bg); filter: brightness(0.9); }
.nav__toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: transparent;
  color: var(--sub);
  cursor: pointer;
  padding: 0;
}
.nav__toggle:hover { color: var(--accent); border-color: var(--accent); }
.nav__toggle svg { width: 16px; height: 16px; }
.nav__menu-btn { display: none; }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; }
.hero__bg {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  width: 100%;
  height: 320px;
  opacity: 0.22;
  pointer-events: none;
}
.hero__inner {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 56px;
  align-items: center;
  padding-top: 110px;
  padding-bottom: 90px;
}
.hero__kicker {
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 13px;
  color: var(--accent);
  letter-spacing: 0.14em;
  margin-bottom: 22px;
  display: flex;
  align-items: center;
}
.hero__kicker .type {
  overflow: hidden;
  white-space: nowrap;
  animation: typein 2.4s steps(49, end) both;
}
.hero__kicker .cursor {
  width: 8px;
  height: 15px;
  background: var(--accent);
  margin-left: 4px;
  flex: none;
  animation: blink 1s step-end infinite;
}
.hero__h1 {
  margin: 0;
  font-size: clamp(56px, 9vw, 118px);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 0.98;
  background: linear-gradient(180deg, var(--ink) 55%, color-mix(in srgb, var(--ink) 45%, var(--bg)));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero__sub {
  max-width: 560px;
  margin: 28px 0 0;
  font-size: 19px;
  color: var(--sub);
  text-wrap: pretty;
}
.hero__buttons { display: flex; gap: 14px; margin-top: 36px; flex-wrap: wrap; }
.hero__meta {
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 12.5px;
  color: var(--sub);
  margin-top: 34px;
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
}
.hero__meta a { color: var(--accent); }
.hero__photo {
  width: 280px;
  height: 280px;
  border-radius: 50%;
  padding: 6px;
  border: 1px solid var(--line);
  background: var(--panel);
}
.hero__photo img,
.hero__photo .slot {
  width: 268px;
  height: 268px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  padding: 13px 26px;
  border-radius: 99px;
  font-weight: 600;
  font-size: 15px;
  font-family: 'Geist', sans-serif;
  cursor: pointer;
  border: 1px solid transparent;
  transition: filter 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.btn--accent { background: var(--accent); color: #fff; }
.btn--accent:hover { color: #fff; filter: brightness(1.1); }
.btn--outline { border: 1px solid var(--line); color: var(--ink); background: transparent; }
.btn--outline:hover { color: var(--ink); border-color: var(--accent); }
.btn--sm { padding: 10px 20px; font-size: 13.5px; }
.btn--sm.btn--outline:hover { color: var(--accent); }

/* ---------- Stats ---------- */
.stats {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.stats__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 32px;
  padding-top: 44px;
  padding-bottom: 44px;
}
.stat__num {
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 34px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.stat__cap { font-size: 13.5px; color: var(--sub); margin-top: 6px; }

/* ---------- Experience ---------- */
.xp { display: grid; gap: 0; }
.xp__row {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 28px;
  padding: 30px 0;
  border-top: 1px solid var(--line);
}
.xp__row:last-child { border-bottom: 1px solid var(--line); }
.xp__date { font-family: 'Geist Mono', ui-monospace, monospace; font-size: 12.5px; color: var(--sub); }
.xp__body { display: flex; gap: 18px; }
.xp__logo {
  width: 46px;
  height: 46px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  overflow: hidden;
}
.xp__logo img { width: 100%; height: 100%; object-fit: contain; display: block; background: #fff; padding: 5px; }
.xp__logo .slot { width: 100%; height: 100%; object-fit: contain; display: block; }
.xp__role { font-size: 21px; font-weight: 600; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.xp__role .at { color: var(--sub); font-weight: 500; }
.xp__desc { margin: 10px 0 0; color: var(--sub); max-width: 680px; text-wrap: pretty; }
.xp__more {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 26px;
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 12.5px;
  color: var(--sub);
}
.xp__more a { color: var(--accent); }
.dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
  animation: pulsedot 2.4s infinite;
}

/* ---------- Products ---------- */
.cards3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 30px;
  transition: border-color 0.18s ease, transform 0.18s ease;
}
.card:hover { color: var(--ink); border-color: var(--accent); transform: translateY(-3px); }
.card__logo {
  width: 44px;
  height: 44px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 5px;
  object-fit: contain;
  display: block;
  margin-bottom: 2px;
}
.card__domain { font-family: 'Geist Mono', ui-monospace, monospace; font-size: 12px; color: var(--accent); }
.card__title { font-size: 22px; font-weight: 600; letter-spacing: -0.01em; }
.card__desc { margin: 0; font-size: 14.5px; color: var(--sub); text-wrap: pretty; }
.card__visit { margin-top: auto; font-size: 14px; color: var(--sub); }

/* ---------- Case studies ---------- */
.cases { display: grid; gap: 24px; }
.case {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 48px;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 48px;
  align-items: center;
}
.case--mirror { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
.case__kicker {
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 12px;
  color: var(--accent);
  letter-spacing: 0.12em;
  margin-bottom: 14px;
}
.case__h3 { margin: 0; font-size: clamp(24px, 3vw, 34px); font-weight: 700; letter-spacing: -0.02em; }
.case__rows { display: grid; gap: 18px; margin-top: 26px; }
.case__rows > div { display: flex; gap: 14px; }
.case__label {
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 12px;
  color: var(--accent);
  flex: none;
  width: 64px;
}
.case__val { font-size: 14.5px; color: var(--sub); }
.case__metrics { display: flex; gap: 26px; margin-top: 28px; font-family: 'Geist Mono', ui-monospace, monospace; }
.case__metric .v { font-size: 24px; font-weight: 600; color: var(--ink); }
.case__metric .k { font-size: 11px; color: var(--sub); letter-spacing: 0.08em; }
.case__media { height: 340px; min-width: 0; }
.case__media img, .case__media .slot { width: 100%; height: 100%; border-radius: 16px; object-fit: cover; display: block; }

/* ---------- Skills ---------- */
.skills {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 20px 32px;
  border-top: 1px solid var(--line);
  padding-top: 28px;
}
.skills__label {
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 13px;
  color: var(--sub);
  padding-top: 4px;
}
.skills__row-sep { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 28px; }
.skills__chips { display: flex; flex-wrap: wrap; gap: 8px; }
.skills__chips.sep { border-top: 1px solid var(--line); padding-top: 24px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 6px 14px;
  font-size: 13.5px;
  color: var(--sub);
}
.chip img { width: 15px; height: 15px; display: block; filter: invert(0.6); }
:root[data-theme="light"] .chip img { filter: invert(0.45); }

.edu { margin-top: 72px; }
.edu__kicker {
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 12px;
  letter-spacing: 0.14em;
  color: var(--accent);
  margin-bottom: 18px;
}
.edu__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.edu__card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 26px;
  display: grid;
  gap: 6px;
}
.edu__label { font-family: 'Geist Mono', ui-monospace, monospace; font-size: 11px; letter-spacing: 0.12em; color: var(--sub); }
.edu__title { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.edu__school { font-size: 14px; color: var(--sub); }

/* ---------- Contact ---------- */
.contact { max-width: var(--maxw); margin: 80px auto 0; padding: 0 var(--pad) 100px; }
.contact__card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 72px 56px;
  text-align: center;
}
.contact__h2 { margin: 0; font-size: clamp(34px, 5vw, 58px); font-weight: 700; letter-spacing: -0.035em; }
.contact__sub { margin: 18px auto 0; max-width: 520px; color: var(--sub); text-wrap: pretty; }
.contact__presets { display: flex; gap: 10px; justify-content: center; margin-top: 30px; flex-wrap: wrap; }
.form { max-width: 600px; margin: 26px auto 0; text-align: left; display: grid; gap: 12px; }
.form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form input, .form textarea {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px 16px;
  color: var(--ink);
  font-family: 'Geist', sans-serif;
  font-size: 15px;
  outline: none;
  width: 100%;
}
.form textarea { resize: vertical; }
.form input:focus, .form textarea:focus { border-color: var(--accent); }
.form__send { justify-self: center; border: none; }
.form__note { text-align: center; font-family: 'Geist Mono', ui-monospace, monospace; font-size: 11.5px; color: var(--sub); }

.footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-top: 36px;
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 12px;
  color: var(--sub);
  flex-wrap: wrap;
}
.footer__links { display: flex; gap: 18px; }

/* ---------- Image placeholders (swap for real <img>) ---------- */
.slot {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  width: 100%;
  height: 100%;
  background: color-mix(in srgb, var(--ink) 4%, var(--bg));
  border: 1px dashed var(--line);
  color: var(--faint);
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
  padding: 8px;
}
.hero__photo .slot { border-radius: 50%; }
.xp__logo .slot { border-radius: 11px; border-style: solid; font-size: 9px; }
.case__media .slot { border-radius: 16px; }

/* ---------- Reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(28px); }
.reveal.in { opacity: 1; transform: none; transition: opacity 0.7s ease, transform 0.7s ease; }

/* ---------- Animations ---------- */
@keyframes typein { from { max-width: 0; } to { max-width: 60ch; } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes draw { from { stroke-dashoffset: 100; } to { stroke-dashoffset: 0; } }
@keyframes pulsedot { 0%, 100% { opacity: 0.25; } 50% { opacity: 1; } }

.draw-line { stroke-dasharray: 100; stroke-dashoffset: 100; }
.draw-line.in { animation: draw 1.8s ease-out both; }
.hero__bg polyline { stroke-dasharray: 100; animation: draw 2.8s 0.4s ease-out both; }
.hero__bg circle { animation: pulsedot 3s infinite; }
.hero__bg circle:nth-of-type(1) { animation-delay: 0.6s; }
.hero__bg circle:nth-of-type(2) { animation-delay: 1.2s; }
.hero__bg circle:nth-of-type(3) { animation-delay: 1.8s; }
.hero__bg circle:nth-of-type(4) { animation-delay: 2.4s; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  :root { --pad: 24px; }
  .hero__inner { grid-template-columns: 1fr; gap: 40px; padding-top: 72px; }
  .hero__photo { order: -1; }
  .stats__grid { grid-template-columns: repeat(2, 1fr); gap: 28px; }
  .cards3 { grid-template-columns: 1fr; }
  .case, .case--mirror { grid-template-columns: 1fr; gap: 28px; padding: 32px; }
  .case__media { order: 2 !important; height: 240px; }
  .edu__grid { grid-template-columns: 1fr; }
  .skills { grid-template-columns: 1fr; gap: 8px; }
  .skills__label { padding-top: 20px; }
  .skills__row-sep { padding-top: 20px; }
  .contact__card { padding: 48px 24px; }
}

@media (max-width: 640px) {
  .nav__links a:not(.nav__cta) { display: none; }
  .xp__row { grid-template-columns: 1fr; gap: 10px; }
  .form__row { grid-template-columns: 1fr; }
  .footer { flex-direction: column; gap: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; }
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; }
  .hero__kicker .type { max-width: none; }
}
