/* ============================================================
   Yusniel Ruiz — Portfolio
   ============================================================ */

:root,
:root[data-theme='light'] {
  --bg: oklch(98% 0.006 75);
  --bg-shade: oklch(96% 0.008 75);
  --bg-card: oklch(99% 0.003 75);
  --text: oklch(20% 0.01 75);
  --text-soft: oklch(35% 0.012 75);
  --text-mute: oklch(45% 0.02 75);
  --border: oklch(89% 0.008 75);
  --border-soft: oklch(88% 0.008 75);
  --border-strong: oklch(75% 0.01 75);
  --border-faint: oklch(93% 0.006 75);
  --accent: oklch(56% 0.16 45);
  --accent-hover: oklch(46% 0.17 45);
  --card-hover-border: oklch(75% 0.04 45);
  --shadow-sm: 0 1px 3px oklch(0% 0 0 / 0.05), 0 1px 2px oklch(0% 0 0 / 0.04);
  --shadow-lg: 0 16px 32px oklch(0% 0 0 / 0.1);
  --selection-bg: oklch(86% 0.07 45);

  /* fixed dark band (contact/footer) — identical in both themes */
  --dark: oklch(18% 0.014 75);
  --dark-card: oklch(22% 0.016 75);
  --dark-border: oklch(30% 0.02 75);

  --font-display: 'Archivo', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
  --font-body: 'Source Sans 3', Helvetica, Arial, sans-serif;
}

:root[data-theme='dark'] {
  --bg: oklch(19% 0.012 75);
  --bg-shade: oklch(23% 0.014 75);
  --bg-card: oklch(24% 0.014 75);
  --text: oklch(95% 0.006 75);
  --text-soft: oklch(82% 0.012 75);
  --text-mute: oklch(66% 0.016 75);
  --border: oklch(33% 0.016 75);
  --border-soft: oklch(31% 0.016 75);
  --border-strong: oklch(44% 0.018 75);
  --border-faint: oklch(28% 0.015 75);
  --accent: oklch(68% 0.17 45);
  --accent-hover: oklch(76% 0.16 45);
  --card-hover-border: oklch(50% 0.09 45);
  --shadow-sm: 0 1px 3px oklch(0% 0 0 / 0.4), 0 1px 2px oklch(0% 0 0 / 0.32);
  --shadow-lg: 0 16px 32px oklch(0% 0 0 / 0.55);
  --selection-bg: oklch(42% 0.1 45 / 0.6);
}

html { scroll-behavior: smooth; }

* { box-sizing: border-box; }

section[id], header#top {
  scroll-margin-top: 76px;
}

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

::selection { background: var(--selection-bg); }

.accent { color: var(--accent); }

/* ---------- scroll progress ---------- */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: oklch(62% 0.16 45);
  z-index: 60;
  transition: width 0.1s ease;
}

.scroll-progress::after {
  content: '';
  position: absolute;
  top: 50%;
  right: -1px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: oklch(62% 0.16 45);
  transform: translate(50%, -50%);
  box-shadow: 0 0 10px 3px oklch(62% 0.16 45 / 0.65);
}

/* ---------- scroll rail ---------- */
.rail {
  display: none;
  position: fixed;
  left: 30px;
  top: 50%;
  transform: translateY(-50%);
  height: min(56vh, 460px);
  width: 2px;
  z-index: 45;
}

@media (min-width: 1080px) {
  .rail { display: block; }
}

.rail__track {
  position: absolute;
  inset: 0;
  background: var(--border-soft);
  border-radius: 2px;
  transition: background-color 0.3s ease;
}

.rail__fill {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 0%;
  background: var(--accent);
  border-radius: 2px;
  transition: height 0.1s linear;
}

.rail__fill::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: oklch(62% 0.16 45);
  transform: translate(-50%, 50%);
  box-shadow: 0 0 9px 3px oklch(62% 0.16 45 / 0.6);
}

.rail__marker {
  position: absolute;
  left: 50%;
  top: 0;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--border-soft);
  transform: translate(-50%, -50%);
  cursor: pointer;
  padding: 0;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.rail__marker:hover {
  border-color: var(--accent);
  transform: translate(-50%, -50%) scale(1.15);
}

.rail__marker.is-active {
  background: var(--accent);
  border-color: var(--accent);
  transform: translate(-50%, -50%) scale(1.3);
}

.rail__marker-label {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-mute);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.rail__marker:hover .rail__marker-label,
.rail__marker.is-active .rail__marker-label {
  opacity: 1;
}

/* ---------- nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px clamp(20px, 5vw, 64px);
  background: color-mix(in oklch, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.nav__logo {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
  letter-spacing: 0.02em;
}

.nav__links {
  display: flex;
  gap: 30px;
  align-items: center;
}

.nav__links a {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-soft);
  font-family: var(--font-mono);
}

.nav__right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  padding: 0;
  transition: background-color 0.25s ease, border-color 0.25s ease, transform 0.15s ease;
}

.theme-toggle:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.theme-toggle svg {
  width: 17px;
  height: 17px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }

:root[data-theme='dark'] .theme-toggle .icon-sun { display: block; }
:root[data-theme='dark'] .theme-toggle .icon-moon { display: none; }

.nav__menu-btn {
  display: none;
  background: none;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 14px;
  cursor: pointer;
  color: var(--text);
  font-family: var(--font-mono);
}

.nav__mobile-menu {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 12px clamp(20px, 5vw, 64px);
  gap: 4px;
}

.nav__mobile-menu[hidden] {
  display: none;
}

.nav__mobile-menu a {
  padding: 12px 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  font-family: var(--font-mono);
  border-bottom: 1px solid var(--border-faint);
}

@media (max-width: 760px) {
  .nav__links { display: none; }
  .nav__menu-btn { display: block; }
}

@media (min-width: 761px) {
  .nav__mobile-menu { display: none !important; }
}

/* ---------- hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
}

.net-canvas {
  position: absolute;
  inset: -10% 0 0 0;
  width: 100%;
  height: 110%;
  display: block;
  pointer-events: none;
  will-change: transform;
}

.hero__content {
  position: relative;
  z-index: 1;
  padding: clamp(56px, 10vw, 120px) clamp(20px, 5vw, 64px) clamp(48px, 7vw, 80px);
  max-width: 1200px;
  margin: 0 auto;
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: oklch(66% 0.17 145);
  margin-right: 9px;
  vertical-align: middle;
  animation: status-pulse 2.2s ease-out infinite;
}

@keyframes status-pulse {
  0% { box-shadow: 0 0 0 0 oklch(66% 0.17 145 / 0.55); }
  70% { box-shadow: 0 0 0 9px oklch(66% 0.17 145 / 0); }
  100% { box-shadow: 0 0 0 0 oklch(66% 0.17 145 / 0); }
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin: 0 0 24px;
}

.eyebrow--muted {
  font-weight: 500;
  color: var(--text-mute);
}

.hero__title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(38px, 7vw, 84px);
  line-height: 1.02;
  margin: 0 0 28px;
  letter-spacing: -0.03em;
  max-width: 900px;
}

.hero__lede {
  font-size: clamp(17px, 2vw, 20px);
  line-height: 1.6;
  color: var(--text-soft);
  max-width: 640px;
  margin: 0 0 36px;
}

.hero__actions {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 56px;
}

.btn {
  display: inline-block;
  padding: 14px 28px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 15px;
  transition: transform 0.15s ease, border-color 0.15s ease, background-color 0.25s ease, color 0.25s ease;
}

.btn--primary {
  background: var(--text);
  color: var(--bg);
}
.btn--primary:hover { transform: translateY(-2px); color: var(--bg); }

.btn--outline {
  border: 1.5px solid var(--border-strong);
  color: var(--text);
}
.btn--outline:hover { border-color: var(--accent); color: var(--text); }

.hero__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}

.badge {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 14px;
  background: var(--bg-shade);
  border-radius: 20px;
  color: var(--text-soft);
  transition: background-color 0.25s ease, color 0.25s ease;
}

/* ---------- scroll reveal ---------- */
.reveal {
  opacity: 0;
  transform: translateY(26px) scale(0.97);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1), transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

.reveal.d1 { transition-delay: 0.1s; }
.reveal.d2 { transition-delay: 0.2s; }
.reveal.d3 { transition-delay: 0.3s; }

/* ---------- data / network divider ---------- */
.data-divider {
  position: relative;
  height: 34px;
  overflow: hidden;
  background: var(--bg);
  transition: background-color 0.3s ease;
}

.data-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border) 15%, var(--border) 85%, transparent);
  transform: translateY(-50%);
}

.data-divider__bits {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.35em;
  color: var(--text);
  opacity: 0.07;
  animation: bits-scroll 55s linear infinite;
}

@keyframes bits-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

.data-divider__sweep {
  position: absolute;
  top: 50%;
  left: -18%;
  width: 18%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  transform: translateY(-50%);
  animation: data-sweep 6s linear infinite;
  filter: drop-shadow(0 0 5px oklch(56% 0.16 45 / 0.7));
}

@keyframes data-sweep {
  0% { left: -18%; }
  100% { left: 100%; }
}

/* ---------- sections ---------- */
.section {
  padding: clamp(56px, 7vw, 88px) clamp(20px, 5vw, 64px);
  max-width: 1200px;
  margin: 0 auto;
}

.section--shaded {
  max-width: none;
  padding-left: 0;
  padding-right: 0;
  background: var(--bg-shade);
  transition: background-color 0.3s ease;
}

.section--shaded .section__inner,
.section--dark .section__inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 clamp(20px, 5vw, 64px);
}

.section__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(28px, 3.6vw, 42px);
  margin: 0 0 48px;
  letter-spacing: -0.02em;
}

.section__subtitle {
  font-size: 16px;
  color: var(--text-soft);
  max-width: 680px;
  margin: 0 0 48px;
}

.section__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 48px;
}

/* ---------- about ---------- */
.about__lead {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(24px, 3.4vw, 34px);
  line-height: 1.4;
  color: var(--text);
  max-width: 920px;
  margin: 0 0 56px;
  letter-spacing: -0.01em;
}

.about__lead em {
  color: var(--accent);
  font-style: normal;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 32px;
}

.stat__value {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(34px, 4vw, 48px);
  color: var(--text);
  letter-spacing: -0.02em;
}

.stat__label {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-mute);
  margin-top: 6px;
}

/* ---------- skills ---------- */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.skill-card,
.work-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease,
    background-color 0.3s ease;
}

.skill-card::before,
.work-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -40%;
  width: 40%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--group-color, var(--accent)), transparent);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.skill-card:hover::before,
.work-card:hover::before {
  opacity: 1;
  animation: card-scan 1.4s linear infinite;
}

@keyframes card-scan {
  0% { left: -40%; }
  100% { left: 100%; }
}

.skill-card:hover,
.work-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--card-hover-border);
}

.skill-card__head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.skill-card__dot {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background: var(--group-color);
  flex-shrink: 0;
}

.skill-card h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  margin: 0;
  color: var(--text);
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  font-family: var(--font-mono);
  font-size: 12.5px;
  padding: 6px 11px;
  background: var(--bg-shade);
  border-radius: 16px;
  color: var(--text-soft);
  transition: background 0.15s ease, color 0.15s ease;
}

.skill-card .pill:hover {
  background: var(--group-color);
  color: oklch(99% 0.005 75);
}

.pill--muted {
  font-size: 13px;
  padding: 6px 12px;
  color: var(--text-soft);
}

/* ---------- experience ---------- */
.timeline__item {
  display: flex;
  gap: 28px;
  padding: 26px 0;
  border-top: 1px solid var(--border-soft);
  flex-wrap: wrap;
  transition: border-color 0.3s ease;
}

.timeline__dates {
  width: 140px;
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 13.5px;
  color: var(--accent);
  font-weight: 600;
  padding-top: 2px;
}

.timeline__body { flex: 1; min-width: 280px; }

.timeline__body h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 19px;
  margin: 0 0 4px;
  color: var(--text);
}

.timeline__meta {
  margin: 0 0 12px;
  font-size: 14.5px;
  color: var(--text-soft);
  font-weight: 600;
}

.timeline__summary {
  margin: 0;
  font-size: 15px;
  line-height: 1.65;
  color: var(--text-soft);
  max-width: 640px;
}

.timeline__list {
  margin: 0;
  padding: 0 0 0 18px;
  max-width: 640px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.timeline__list li {
  font-size: 15px;
  line-height: 1.65;
  color: var(--text-soft);
  padding-left: 4px;
}

.timeline__list li::marker {
  color: var(--accent);
}

.edu-cert-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin-top: 48px;
}

.info-card {
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 24px;
  transition: border-color 0.3s ease;
}

.info-card h4 {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.04em;
  margin: 0 0 14px;
  color: var(--text-mute);
}

.info-card p {
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--text-soft);
  margin: 0;
}

/* ---------- work ---------- */
.work-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
}

.work-card__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.work-card__tag {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-mute);
  letter-spacing: 0.04em;
}

.work-card__number {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 13px;
  color: var(--group-color);
}

.work-card h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 19px;
  margin: 0 0 12px;
  color: var(--text);
}

.work-card p {
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--text-soft);
  margin: 0 0 16px;
  flex: 1;
}

.work-card__outcome {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--group-color);
  margin: 0 !important;
  flex: none !important;
}

/* ---------- contact (fixed dark band — unaffected by theme) ---------- */
.section--dark {
  position: relative;
  overflow: hidden;
  max-width: none;
  padding: clamp(56px, 7vw, 96px) 0;
  background: var(--dark);
  color: oklch(97% 0.006 75);
}

.net-canvas--dark {
  opacity: 0.9;
}

.contact-layout {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 56px;
  flex-wrap: wrap;
}

.contact-info { flex: 1; min-width: 280px; }

.eyebrow--dark { color: oklch(70% 0.14 45); }

.section__title--dark {
  color: oklch(97% 0.006 75);
  font-size: clamp(28px, 3.8vw, 44px);
  margin-bottom: 28px;
}

.contact-email {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(20px, 2.6vw, 28px);
  font-weight: 700;
  color: oklch(97% 0.006 75);
  margin-bottom: 28px;
  border-bottom: 2px solid oklch(70% 0.14 45);
  padding-bottom: 6px;
  width: fit-content;
}
.contact-email:hover { color: oklch(97% 0.006 75); opacity: 0.85; }

.contact-detail {
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 15px;
  color: oklch(80% 0.01 75);
  margin-bottom: 24px;
}

.contact-linkedin {
  color: oklch(90% 0.006 75);
  font-weight: 600;
}

.contact-form {
  flex: 1;
  min-width: 300px;
  background: var(--dark-card);
  border: 1px solid var(--dark-border);
  border-radius: 14px;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-success {
  padding: 16px;
  background: oklch(32% 0.07 145);
  border-radius: 8px;
  font-size: 14.5px;
  color: oklch(95% 0.02 145);
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-field label {
  font-size: 13px;
  font-weight: 600;
  color: oklch(75% 0.01 75);
  font-family: var(--font-mono);
}

.form-field input,
.form-field textarea {
  padding: 12px 14px;
  border-radius: 6px;
  border: 1px solid oklch(38% 0.02 75);
  background: oklch(97% 0.006 75);
  font-size: 14.5px;
  color: oklch(20% 0.01 75);
  font-family: inherit;
}

.form-field textarea { resize: vertical; }

.btn--send {
  margin-top: 6px;
  background: oklch(62% 0.16 45);
  color: oklch(15% 0.01 45);
  border: none;
  padding: 14px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: transform 0.15s ease;
}
.btn--send:hover { transform: translateY(-1px); }

/* ---------- footer (fixed dark band — unaffected by theme) ---------- */
.footer {
  padding: 24px clamp(20px, 5vw, 64px);
  background: oklch(15% 0.012 75);
  color: oklch(55% 0.014 75);
  font-size: 13px;
  font-family: var(--font-mono);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

/* ---------- print ---------- */
@media print {
  .scroll-progress, .nav__menu-btn, .nav__mobile-menu, .net-canvas, .data-divider, .rail, .theme-toggle { display: none !important; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  html { scroll-behavior: auto; }
  .reveal { opacity: 1 !important; transform: none !important; }
  .net-canvas, .data-divider__bits, .data-divider__sweep { display: none !important; }
}
