/* ============================================================
   Pedro Sánchez Ramírez — portfolio
   Design system: dark OLED, technical-premium.
   Space Grotesk (display) · Inter (body) · JetBrains Mono (labels)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ---------- Tokens ---------- */
:root {
  --bg:          #0A0E14;
  --bg-elev:     #0F1520;
  --surface:     #131A24;
  --surface-2:   #19212E;
  --border:      rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);

  --text:        #E8EDF4;
  --text-muted:  #9AA7B8;
  --text-dim:    #616E7E;

  --accent:      #3DDC84;   /* android-inspired green, used sparingly */
  --accent-hover:#34C476;
  --accent-soft: rgba(61, 220, 132, 0.12);
  --accent-line: rgba(61, 220, 132, 0.28);

  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-body:    'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --container: 1120px;
  --radius:    16px;
  --radius-sm: 10px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* Ambient background: faint top glow. Painted once into a fixed layer;
   kept to cheap gradients so it doesn't repaint heavily on scroll. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(70% 42% at 50% -8%, rgba(61, 220, 132, 0.10), transparent 60%),
    radial-gradient(60% 50% at 88% 4%, rgba(80, 120, 255, 0.05), transparent 70%);
  pointer-events: none;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font: inherit; cursor: pointer; }

::selection { background: var(--accent); color: #06210F; }

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

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: 24px;
}

section { position: relative; padding-block: clamp(64px, 9vw, 120px); }

.section-head { margin-bottom: clamp(32px, 5vw, 56px); max-width: 640px; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.eyebrow::before {
  content: "";
  width: 22px; height: 1px;
  background: var(--accent-line);
}

.section-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(28px, 4.4vw, 44px);
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin-top: 16px;
}
.section-subtitle {
  color: var(--text-muted);
  font-size: clamp(15px, 1.6vw, 17px);
  margin-top: 14px;
  max-width: 60ch;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 12px 20px;
  border-radius: 999px;
  font-weight: 500;
  font-size: 15px;
  border: 1px solid transparent;
  transition: transform .18s var(--ease), background .18s var(--ease),
              border-color .18s var(--ease), color .18s var(--ease);
  white-space: nowrap;
}
.btn svg { width: 17px; height: 17px; }
.btn-primary { background: var(--accent); color: #06210F; font-weight: 600; }
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-2px); }
.btn-ghost { border-color: var(--border-strong); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent-line); background: var(--accent-soft); transform: translateY(-2px); }
.btn-text { color: var(--text-muted); padding: 12px 6px; }
.btn-text:hover { color: var(--accent); }

/* ---------- Tags / chips ---------- */
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--bg-elev);
  white-space: nowrap;
}
.tag--accent { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-muted);
  padding: 7px 14px 7px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255,255,255,0.02);
}
.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(61,220,132,0.6);
  animation: pulse 2.4s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(61,220,132,0.5); }
  70% { box-shadow: 0 0 0 7px rgba(61,220,132,0); }
  100% { box-shadow: 0 0 0 0 rgba(61,220,132,0); }
}
@media (prefers-reduced-motion: reduce) { .status-dot { animation: none; } }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 100;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: rgba(10, 14, 20, 0.72);
  border-bottom: 1px solid transparent;
  transition: border-color .3s, background .3s;
}
.nav.scrolled { border-bottom-color: var(--border); }
.nav-inner {
  max-width: var(--container); margin-inline: auto;
  padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px;
}
.brand { display: inline-flex; align-items: center; gap: 11px; font-family: var(--font-display); font-weight: 600; letter-spacing: -0.01em; }
.brand .monogram {
  width: 34px; height: 34px; border-radius: 9px;
  display: grid; place-items: center;
  border: 1px solid var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font-mono); font-weight: 600; font-size: 15px;
}
.brand span.sub { color: var(--text-dim); font-family: var(--font-mono); font-size: 12px; font-weight: 400; }

.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-links a {
  color: var(--text-muted); font-size: 14px; padding: 8px 12px; border-radius: 8px;
  transition: color .18s, background .18s;
}
.nav-links a:hover { color: var(--text); background: rgba(255,255,255,0.04); }

.lang-toggle { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; margin-left: 6px; }
.lang-toggle a { padding: 6px 11px; font-family: var(--font-mono); font-size: 12px; color: var(--text-dim); transition: color .18s, background .18s; }
.lang-toggle a.active { color: #06210F; background: var(--accent); font-weight: 600; }
.lang-toggle a:not(.active):hover { color: var(--text); }

.nav-cta { display: inline-flex; align-items: center; gap: 12px; }
.menu-btn { display: none; background: none; border: 0; color: var(--text); width: 40px; height: 40px; }

/* ---------- Hero ---------- */
.hero { padding-top: clamp(56px, 9vw, 104px); padding-bottom: clamp(48px, 7vw, 88px); }
.hero-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: clamp(32px, 5vw, 72px); align-items: center; }

.hero h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(38px, 6.6vw, 74px);
  line-height: 1.02;
  letter-spacing: -0.035em;
  margin: 22px 0 0;
}
.hero h1 .accent { color: var(--accent); }
.hero-lead {
  color: var(--text-muted);
  font-size: clamp(16px, 1.9vw, 19px);
  line-height: 1.6;
  margin-top: 24px;
  max-width: 54ch;
}
.hero-lead strong { color: var(--text); font-weight: 600; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 34px; }
.hero-meta { margin-top: 30px; display: flex; flex-wrap: wrap; gap: 10px 26px; align-items: center; }

.stat-row { display: flex; flex-wrap: wrap; gap: 26px; margin-top: 40px; padding-top: 30px; border-top: 1px solid var(--border); }
.stat .num { font-family: var(--font-display); font-weight: 600; font-size: clamp(24px, 3vw, 32px); letter-spacing: -0.02em; }
.stat .num .u { color: var(--accent); }
.stat .lbl { font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-dim); margin-top: 4px; }

/* Hero visual: terminal-style card */
.hero-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--surface), var(--bg-elev));
  overflow: hidden;
  box-shadow: 0 30px 80px -40px rgba(0,0,0,0.8);
}
.hero-card .bar { display: flex; align-items: center; gap: 7px; padding: 13px 16px; border-bottom: 1px solid var(--border); background: rgba(255,255,255,0.015); }
.hero-card .bar i { width: 11px; height: 11px; border-radius: 50%; background: #2b3340; display: inline-block; }
.hero-card .bar i:first-child { background: #ff5f57; }
.hero-card .bar i:nth-child(2) { background: #febc2e; }
.hero-card .bar i:nth-child(3) { background: #28c840; }
.hero-card .bar span { margin-left: 8px; font-family: var(--font-mono); font-size: 12px; color: var(--text-dim); }
.hero-card pre {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.85;
  padding: 20px;
  overflow-x: auto;
  color: var(--text-muted);
}
.hero-card pre .k { color: #7aa2ff; }        /* keyword */
.hero-card pre .s { color: var(--accent); }   /* string / value */
.hero-card pre .c { color: var(--text-dim); } /* comment */
.hero-card pre .p { color: #c792ea; }         /* punctuation-ish */

/* ---------- Projects (case studies) ---------- */
.project {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255,255,255,0.018), transparent);
  padding: clamp(24px, 3.4vw, 44px);
  margin-bottom: 28px;
  transition: border-color .3s var(--ease);
}
.project:hover { border-color: var(--border-strong); }
.project-grid { display: grid; grid-template-columns: 1.05fr 0.95fr; gap: clamp(28px, 4vw, 56px); align-items: center; }
.project--reverse .project-grid { grid-template-columns: 0.95fr 1.05fr; }
.project--reverse .project-visual { order: -1; }

.project-label { display: flex; align-items: center; gap: 10px; font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-dim); }
.project-label .badge { color: var(--accent); }
.project h3 { font-family: var(--font-display); font-weight: 600; font-size: clamp(26px, 3.4vw, 38px); letter-spacing: -0.025em; margin: 16px 0 0; }
.project .oneliner { color: var(--text); font-size: clamp(16px, 1.8vw, 18px); margin-top: 12px; font-weight: 500; }
.project p.body { color: var(--text-muted); margin-top: 14px; font-size: 15.5px; }

.highlights { list-style: none; margin-top: 22px; display: grid; gap: 11px; }
.highlights li { display: flex; gap: 12px; font-size: 14.5px; color: var(--text-muted); }
.highlights li b { color: var(--text); font-weight: 600; }
.highlights li .ic { color: var(--accent); flex-shrink: 0; margin-top: 2px; }
.highlights li .ic svg { width: 17px; height: 17px; }

.project .tags { margin-top: 24px; }
.project-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }

/* Aura phones */
.phones { display: flex; justify-content: center; align-items: flex-end; gap: 14px; perspective: 1400px; }
.phone {
  --w: 210px;
  width: var(--w);
  aspect-ratio: 1125 / 2436;
  border-radius: 30px;
  padding: 7px;
  background: linear-gradient(160deg, #20262f, #0c0f15);
  border: 1px solid rgba(255,255,255,0.10);
  box-shadow: 0 26px 60px -28px rgba(0,0,0,0.9);
  position: relative;
  transition: transform .5s var(--ease);
}
/* Home indicator (gesture bar) — sits at the BOTTOM on iOS and Android */
.phone::after { content:""; position:absolute; bottom:13px; left:50%; transform:translateX(-50%); width:92px; height:4px; border-radius:2px; background:rgba(255,255,255,0.30); z-index:2; }
.phone img { width: 100%; height: 100%; object-fit: cover; border-radius: 24px; }
.phones .phone:nth-child(1) { --w: 178px; transform: rotate(-6deg) translateY(14px); z-index:1; }
.phones .phone:nth-child(2) { z-index: 3; }
.phones .phone:nth-child(3) { --w: 178px; transform: rotate(6deg) translateY(14px); z-index:1; }
.project:hover .phones .phone:nth-child(1) { transform: rotate(-8deg) translateY(6px); }
.project:hover .phones .phone:nth-child(3) { transform: rotate(8deg) translateY(6px); }

/* Polymarket pipeline diagram wrapper */
.pipeline { width: 100%; }
.pipeline svg { width: 100%; height: auto; display: block; }
.note-inline { margin-top: 16px; font-family: var(--font-mono); font-size: 12px; color: var(--text-dim); display: flex; gap: 8px; align-items: flex-start; }
.note-inline .ic { color: var(--text-dim); flex-shrink: 0; }
.note-inline .ic svg { width: 15px; height: 15px; }

/* ---------- Experience timeline ---------- */
.timeline { position: relative; margin-top: 8px; }
.tl-item { position: relative; padding-left: 32px; padding-bottom: 40px; }
.tl-item::before { content:""; position:absolute; left: 6px; top: 6px; bottom: -6px; width: 1px; background: var(--border); }
.tl-item:last-child::before { display: none; }
.tl-item::after { content:""; position:absolute; left: 0; top: 5px; width: 13px; height: 13px; border-radius: 50%; background: var(--bg); border: 2px solid var(--accent-line); }
.tl-item.current::after { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }

.tl-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; }
.tl-role { font-family: var(--font-display); font-weight: 600; font-size: 19px; letter-spacing: -0.01em; }
.tl-company { color: var(--accent); font-weight: 500; }
.tl-date { font-family: var(--font-mono); font-size: 12px; color: var(--text-dim); margin-left: auto; white-space: nowrap; }
.tl-meta { font-family: var(--font-mono); font-size: 12.5px; color: var(--text-dim); margin-top: 4px; }
.tl-desc { color: var(--text-muted); font-size: 14.5px; margin-top: 12px; max-width: 68ch; }

.client-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 18px; }
.client-card { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; background: var(--bg-elev); transition: border-color .25s; }
.client-card:hover { border-color: var(--border-strong); }
.client-card .cc-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.client-card .cc-name { font-weight: 600; font-size: 15px; }
.client-card .cc-sector { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-dim); }
.client-card .cc-date { font-family: var(--font-mono); font-size: 11px; color: var(--text-dim); white-space: nowrap; }
.client-card p { color: var(--text-muted); font-size: 13.5px; margin-top: 8px; }

/* ---------- Skills ---------- */
.skills-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.skill-group { border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; background: linear-gradient(180deg, rgba(255,255,255,0.015), transparent); }
.skill-group h4 { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-dim); display: flex; align-items: center; gap: 9px; }
.skill-group h4 .ic { color: var(--accent); }
.skill-group h4 .ic svg { width: 16px; height: 16px; }
.skill-group .tags { margin-top: 16px; }

/* ---------- About + Education ---------- */
.about-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: clamp(28px, 4vw, 56px); align-items: start; }
.about-text p { color: var(--text-muted); font-size: clamp(15px, 1.7vw, 17px); margin-top: 16px; }
.about-text p:first-child { margin-top: 0; }
.about-text strong { color: var(--text); font-weight: 600; }

.info-card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.info-block { padding: 20px 22px; border-bottom: 1px solid var(--border); }
.info-block:last-child { border-bottom: 0; }
.info-block h5 { font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 12px; }
.info-row { display: flex; justify-content: space-between; gap: 14px; align-items: baseline; padding: 5px 0; }
.info-row .t { font-weight: 500; font-size: 14.5px; }
.info-row .m { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-dim); white-space: nowrap; }
.info-row a.t:hover { color: var(--accent); }
.lang-bar { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.lang-bar .t { font-weight: 500; font-size: 14px; min-width: 74px; }
.lang-bar .track { flex: 1; height: 5px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.lang-bar .fill { height: 100%; background: var(--accent); border-radius: 3px; }
.lang-bar .lvl { font-family: var(--font-mono); font-size: 11px; color: var(--text-dim); }

/* ---------- Contact ---------- */
.contact { text-align: center; }
.contact-box {
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 1.4);
  background:
    radial-gradient(90% 140% at 50% 0%, var(--accent-soft), transparent 55%),
    var(--surface);
  padding: clamp(40px, 6vw, 76px) 24px;
}
.contact h2 { font-family: var(--font-display); font-weight: 600; font-size: clamp(30px, 5vw, 52px); letter-spacing: -0.03em; }
.contact h2 .accent { color: var(--accent); }
.contact p { color: var(--text-muted); max-width: 46ch; margin: 16px auto 0; font-size: clamp(15px, 1.7vw, 17px); }
.contact-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 32px; }
.socials { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 30px; }
.social {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 10px 16px; border: 1px solid var(--border); border-radius: 999px;
  font-size: 14px; color: var(--text-muted);
  transition: color .2s, border-color .2s, transform .2s;
}
.social svg { width: 17px; height: 17px; }
.social:hover { color: var(--accent); border-color: var(--accent-line); transform: translateY(-2px); }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--border); padding-block: 34px; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between; }
.footer .muted { color: var(--text-dim); font-family: var(--font-mono); font-size: 12px; }
.footer a.muted:hover { color: var(--text-muted); }

/* ---------- Scroll reveal ---------- */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-card { max-width: 480px; }
  .project-grid, .project--reverse .project-grid { grid-template-columns: 1fr; }
  .project--reverse .project-visual { order: 0; }
  .project-visual { margin-top: 8px; }
  .about-grid { grid-template-columns: 1fr; }
  .skills-grid { grid-template-columns: repeat(2, 1fr); }

  /* Collapse primary nav into a hamburger menu before it gets cramped */
  .nav-links { display: none; }
  .nav-links.open {
    display: flex; flex-direction: column; align-items: stretch;
    position: absolute; top: 100%; left: 0; right: 0;
    background: var(--bg-elev); border-bottom: 1px solid var(--border);
    padding: 12px 16px; gap: 2px;
  }
  .nav-links.open a { padding: 12px; }
  .nav-links.open .lang-toggle { margin: 8px 0 0; align-self: flex-start; }
  .menu-btn { display: grid; place-items: center; }
}
@media (max-width: 680px) {
  /* Trim the nav to brand + hamburger; the hero and menu carry the CTAs */
  .nav-cta .btn-primary { display: none; }
  .brand br { display: none; }
  .brand .sub { display: none; }
  .brand { font-size: 16px; }

  .skills-grid { grid-template-columns: 1fr; }
  .client-cards { grid-template-columns: 1fr; }
  .tl-date { margin-left: 0; width: 100%; }
  .stat-row { gap: 20px; }
  .phone { --w: 150px !important; }
  .phones .phone:nth-child(1), .phones .phone:nth-child(3) { --w: 128px !important; }
}
