/* ============================================================
   Diabl0sec — Pablo Sánchez · Portfolio
   Minimal dark · gray/black · Ferrari red accent
   ============================================================ */

/* ---------- Tokens ---------- */
:root {
  /* Surfaces */
  --bg:        #0a0a0b;
  --bg-2:      #0d0d0f;
  --surface:   #111114;
  --surface-2: #15151a;
  --line:      rgba(255, 255, 255, 0.07);
  --line-2:    rgba(255, 255, 255, 0.12);

  /* Text */
  --fg:        #f4f4f3;
  --fg-2:      #b7b7b9;
  --muted:     #7d7d82;
  --faint:     #54545a;

  /* Ferrari red accent */
  --red:       #ff2800;
  --red-soft:  #ff4a28;
  --red-dim:   rgba(255, 40, 0, 0.14);
  --red-line:  rgba(255, 40, 0, 0.35);

  /* Type */
  --sans: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", "SF Mono", ui-monospace, monospace;

  /* Layout */
  --maxw: 1240px;
  --pad: clamp(20px, 5vw, 88px);
  --nav-h: 76px;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--fg);
  line-height: 1.55;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
::selection { background: var(--red); color: #fff; }

/* Subtle grain/vignette base */
body::before {
  content: "";
  position: fixed; inset: 0;
  background:
    radial-gradient(120% 90% at 50% -10%, rgba(255,40,0,0.05), transparent 55%),
    radial-gradient(80% 60% at 100% 100%, rgba(255,255,255,0.018), transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* ---------- Utilities ---------- */
.wrap { max-width: var(--maxw); margin-inline: auto; padding-inline: var(--pad); }
.section { position: relative; z-index: 1; padding-block: clamp(80px, 12vh, 150px); }

.eyebrow {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.eyebrow .idx { color: var(--red); }
.eyebrow::after {
  content: "";
  width: 46px; height: 1px;
  background: var(--line-2);
}

.section-head { margin-bottom: clamp(40px, 6vw, 72px); }
.section-title {
  font-size: clamp(2rem, 4.4vw, 3.4rem);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.02;
  margin-top: 20px;
  text-wrap: balance;
}
.section-title .accent { color: var(--red); }

/* ---------- Navigation ---------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--nav-h);
  z-index: 100;
  display: flex; align-items: center;
  transition: background .35s ease, border-color .35s ease, backdrop-filter .35s ease;
  border-bottom: 1px solid transparent;
}
.nav.scrolled {
  background: rgba(10, 10, 11, 0.72);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid var(--line);
}
.nav .wrap { width: 100%; display: flex; align-items: center; justify-content: space-between; }
.brand {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.02em;
  display: inline-flex; align-items: center; gap: 9px;
}
.brand .dot {
  width: 9px; height: 9px; background: var(--red); border-radius: 2px;
  box-shadow: 0 0 14px var(--red);
  transform: rotate(45deg);
}
.brand .dim { color: var(--muted); }

.nav-links { display: flex; align-items: center; gap: 6px; }
.nav-links a {
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.05em;
  color: var(--fg-2);
  padding: 9px 14px;
  border-radius: 7px;
  transition: color .2s, background .2s;
  position: relative;
}
.nav-links a:hover { color: var(--fg); background: rgba(255,255,255,0.04); }
.nav-links a.active { color: var(--fg); }
.nav-links a.active::before {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: 2px;
  height: 1.5px; background: var(--red);
}

.nav-toggle {
  display: none; background: none; border: 0; cursor: pointer;
  width: 40px; height: 40px; position: relative;
}
.nav-toggle span {
  position: absolute; left: 9px; right: 9px; height: 1.5px; background: var(--fg);
  transition: transform .3s, opacity .3s;
}
.nav-toggle span:nth-child(1) { top: 15px; }
.nav-toggle span:nth-child(2) { top: 20px; }
.nav-toggle span:nth-child(3) { top: 25px; }
body.menu-open .nav-toggle span:nth-child(1) { transform: translateY(5px) rotate(45deg); }
body.menu-open .nav-toggle span:nth-child(2) { opacity: 0; }
body.menu-open .nav-toggle span:nth-child(3) { transform: translateY(-5px) rotate(-45deg); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 12px;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.04em;
  padding: 15px 26px;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  color: var(--fg);
  background: var(--surface);
  transition: border-color .25s, background .25s, transform .25s, color .25s;
  cursor: pointer;
}
.btn:hover { border-color: var(--red-line); background: var(--surface-2); transform: translateY(-2px); }
.btn .arr { color: var(--red); transition: transform .25s; }
.btn:hover .arr { transform: translateX(4px); }
.btn--red {
  background: var(--red); border-color: var(--red); color: #fff;
}
.btn--red:hover { background: var(--red-soft); border-color: var(--red-soft); }
.btn--red .arr { color: #fff; }

/* ============================================================
   HERO
   ============================================================ */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex; align-items: center;
  padding-top: var(--nav-h);
  z-index: 1;
}
.hero::after {
  content: "";
  position: absolute; left: var(--pad); right: var(--pad); bottom: 0; height: 1px;
  background: var(--line);
  max-width: var(--maxw);
  margin-inline: auto;
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.5fr 0.9fr;
  gap: clamp(40px, 6vw, 96px);
  align-items: center;
  width: 100%;
}
.hero-status {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--muted);
  margin-bottom: 30px;
}
.hero-status .live {
  width: 8px; height: 8px; border-radius: 50%; background: var(--red);
  box-shadow: 0 0 0 0 rgba(255,40,0,0.6);
  animation: pulse 2.4s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255,40,0,0.5); }
  70% { box-shadow: 0 0 0 9px rgba(255,40,0,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,40,0,0); }
}
.hero-name {
  font-size: clamp(3.4rem, 10vw, 8.2rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 0.92;
}
.hero-name .ln2 { color: var(--fg); position: relative; display: inline-block; }
.hero-name .ln2::after {
  content: ""; position: absolute; left: 0; bottom: 0.1em; width: 100%; height: 3px;
  background: var(--red);
  transform: scaleX(0); transform-origin: left;
  animation: grow 1s cubic-bezier(.2,.8,.2,1) 0.5s forwards;
}
@keyframes grow { to { transform: scaleX(1); } }

.hero-role {
  margin-top: 30px;
  max-width: 40ch;
  font-size: clamp(1.02rem, 1.6vw, 1.22rem);
  color: var(--fg-2);
  line-height: 1.6;
}
.hero-role .hl { color: var(--fg); }

.cert-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 34px; }
.cert {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--mono); font-size: 12.5px; letter-spacing: 0.06em;
  padding: 9px 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-2);
  color: var(--fg-2);
}
.cert b { color: var(--fg); font-weight: 600; }
.cert .sq { width: 7px; height: 7px; background: var(--red); transform: rotate(45deg); }

.hero-cta { margin-top: 44px; display: flex; gap: 14px; flex-wrap: wrap; }

/* Portrait */
.hero-photo {
  position: relative;
  aspect-ratio: 4 / 5;
  border: 1px solid var(--line-2);
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface);
}
.hero-photo img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(0.35) contrast(1.03); }
.hero-photo .ph {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background:
    repeating-linear-gradient(135deg, #141417 0 12px, #0f0f12 12px 24px);
  color: var(--faint); font-family: var(--mono); font-size: 12px; letter-spacing: 0.1em;
  text-align: center; padding: 20px;
}
.hero-photo figcaption {
  position: absolute; left: 0; bottom: 0; right: 0;
  padding: 14px 16px;
  font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.08em;
  color: var(--fg-2);
  background: linear-gradient(transparent, rgba(8,8,9,0.92));
  display: flex; justify-content: space-between; align-items: center;
}
.hero-photo figcaption .red { color: var(--red); }
.hero-corner {
  position: absolute; width: 18px; height: 18px; border: 1.5px solid var(--red); z-index: 2;
}
.hero-corner.tl { top: 12px; left: 12px; border-right: 0; border-bottom: 0; }
.hero-corner.br { bottom: 12px; right: 12px; border-left: 0; border-top: 0; }

/* ============================================================
   ABOUT
   ============================================================ */
.about-grid { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: clamp(40px, 6vw, 90px); align-items: start; }
.about-lead {
  font-size: clamp(1.3rem, 2.4vw, 1.9rem);
  line-height: 1.4;
  letter-spacing: -0.015em;
  color: var(--fg);
  text-wrap: pretty;
}
.about-lead .dim { color: var(--muted); }

.skills { display: grid; gap: 0; border-top: 1px solid var(--line); }
.skill {
  display: flex; align-items: baseline; gap: 22px;
  padding: 22px 4px;
  border-bottom: 1px solid var(--line);
  transition: padding-left .3s ease, background .3s ease;
}
.skill:hover { padding-left: 16px; background: linear-gradient(90deg, rgba(255,40,0,0.05), transparent 40%); }
.skill .num { font-family: var(--mono); font-size: 12px; color: var(--red); min-width: 34px; }
.skill h3 { font-size: clamp(1.05rem, 1.7vw, 1.3rem); font-weight: 500; letter-spacing: -0.01em; }
.skill .ar { margin-left: auto; color: var(--faint); transition: color .3s, transform .3s; font-family: var(--mono); }
.skill:hover .ar { color: var(--red); transform: translateX(4px); }

/* ============================================================
   CVE PORTFOLIO (home block)
   ============================================================ */
.cve-block { background: var(--bg-2); border-block: 1px solid var(--line); }
.cve-portfolio { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: clamp(40px, 6vw, 90px); align-items: center; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.stat {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 30px 26px;
  background: var(--surface);
  position: relative;
  overflow: hidden;
}
.stat::before {
  content: ""; position: absolute; top: 0; left: 0; width: 3px; height: 100%; background: var(--red);
  transform: scaleY(0); transform-origin: top; transition: transform .5s ease;
}
.stat.in::before { transform: scaleY(1); }
.stat .big {
  font-size: clamp(2.6rem, 5vw, 3.8rem); font-weight: 700; letter-spacing: -0.03em; line-height: 1;
  font-feature-settings: "tnum";
}
.stat .lbl { font-family: var(--mono); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-top: 12px; }
.stat.span2 { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.stat.span2 .lbl { margin-top: 0; }

.cve-cta-card p { color: var(--fg-2); margin: 22px 0 30px; max-width: 42ch; }

/* ============================================================
   EXPERIENCE
   ============================================================ */
.timeline { display: grid; gap: 0; }
.job {
  display: grid;
  grid-template-columns: 0.55fr 1.45fr;
  gap: clamp(24px, 4vw, 64px);
  padding: clamp(34px, 4vw, 52px) 0;
  border-top: 1px solid var(--line);
  position: relative;
}
.job:last-child { border-bottom: 1px solid var(--line); }
.job-meta .role-num { font-family: var(--mono); font-size: 12px; color: var(--red); letter-spacing: 0.1em; }
.job-meta .company {
  font-family: var(--mono); font-size: 13px; letter-spacing: 0.08em;
  color: var(--fg); margin-top: 14px; display: inline-flex; align-items: center; gap: 9px;
}
.job-meta .company .sq { width: 7px; height: 7px; background: var(--red); transform: rotate(45deg); }
.job h3 {
  font-size: clamp(1.4rem, 2.6vw, 2.1rem); font-weight: 600; letter-spacing: -0.025em; line-height: 1.08;
}
.job .summary { color: var(--fg-2); margin-top: 14px; max-width: 56ch; }
.job ul.points { margin-top: 26px; display: grid; gap: 13px; }
.job ul.points li {
  position: relative; padding-left: 26px; color: var(--fg-2); font-size: 0.98rem;
}
.job ul.points li::before {
  content: ""; position: absolute; left: 0; top: 0.62em; width: 9px; height: 1px; background: var(--red);
}

/* ============================================================
   CONTACT
   ============================================================ */
.contact { text-align: center; }
.contact-inner { max-width: 760px; margin-inline: auto; }
.contact h2 {
  font-size: clamp(2.6rem, 7vw, 5.6rem); font-weight: 700; letter-spacing: -0.04em; line-height: 0.96;
}
.contact h2 .accent { color: var(--red); }
.contact p { color: var(--fg-2); font-size: clamp(1.05rem, 1.8vw, 1.25rem); margin-top: 26px; }
.contact-actions { margin-top: 46px; display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--line); position: relative; z-index: 1; }
.footer .wrap {
  padding-block: 34px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.footer .brand { font-size: 14px; }
.footer .copy { font-family: var(--mono); font-size: 12px; color: var(--muted); letter-spacing: 0.05em; }

/* ============================================================
   CVE DETAILS PAGE
   ============================================================ */
.subnav {
  position: fixed; top: 0; left: 0; right: 0; height: var(--nav-h); z-index: 100;
  background: rgba(10,10,11,0.72);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center;
}
.subnav .wrap { width: 100%; display: flex; align-items: center; justify-content: space-between; }
.back-link {
  font-family: var(--mono); font-size: 13px; letter-spacing: 0.04em; color: var(--fg-2);
  display: inline-flex; align-items: center; gap: 10px; transition: color .2s, gap .2s;
}
.back-link:hover { color: var(--fg); gap: 14px; }
.back-link .arr { color: var(--red); }

.cve-hero { padding-top: calc(var(--nav-h) + clamp(70px, 12vh, 130px)); padding-bottom: clamp(50px, 8vh, 90px); }
.cve-hero h1 {
  font-size: clamp(2.6rem, 6vw, 5rem); font-weight: 700; letter-spacing: -0.04em; line-height: 0.98; margin-top: 22px;
  text-wrap: balance;
}
.cve-hero h1 .accent { color: var(--red); }
.cve-hero .meta {
  margin-top: 34px; display: flex; flex-wrap: wrap; gap: 14px;
  font-family: var(--mono); font-size: 12.5px; letter-spacing: 0.05em; color: var(--muted);
}
.cve-hero .meta .chip {
  padding: 8px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-2);
}
.cve-hero .meta .chip b { color: var(--fg); }
.cve-hero .meta .chip .r { color: var(--red); }

/* group */
.cve-group { padding-block: clamp(40px, 6vh, 70px); border-top: 1px solid var(--line); }
.cve-group-head {
  display: flex; align-items: baseline; gap: 18px; margin-bottom: 34px; flex-wrap: wrap;
}
.cve-group-head .gnum { font-family: var(--mono); font-size: 13px; color: var(--red); }
.cve-group-head h2 { font-size: clamp(1.5rem, 3vw, 2.3rem); font-weight: 600; letter-spacing: -0.025em; }
.cve-group-head .count {
  font-family: var(--mono); font-size: 12px; color: var(--muted); margin-left: auto;
  border: 1px solid var(--line); padding: 5px 11px; border-radius: 20px;
}

.cve-list { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.cve-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  padding: 26px 26px 24px;
  display: flex; flex-direction: column;
  transition: border-color .3s, transform .3s, background .3s;
  position: relative;
  overflow: hidden;
}
.cve-card:hover { border-color: var(--line-2); transform: translateY(-3px); background: var(--surface-2); }
.cve-card .top { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.cve-id {
  font-family: var(--mono); font-size: 13px; letter-spacing: 0.03em; color: var(--fg);
  font-weight: 500;
}
.sev {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase;
  font-weight: 600; padding: 5px 10px; border-radius: 6px; white-space: nowrap;
}
.sev--critical { background: var(--red); color: #fff; }
.sev--high { background: var(--red-dim); color: var(--red-soft); border: 1px solid var(--red-line); }
.sev--medium { background: rgba(255,255,255,0.06); color: var(--fg-2); border: 1px solid var(--line-2); }
.sev--low { background: rgba(255,255,255,0.04); color: var(--muted); border: 1px solid var(--line); }

.cve-card h3 {
  font-size: 1.12rem; font-weight: 600; letter-spacing: -0.01em; line-height: 1.25;
  margin-top: 18px; color: var(--fg); text-wrap: pretty;
}
.cve-card .desc { color: var(--fg-2); font-size: 0.93rem; line-height: 1.55; margin-top: 12px; }
.cve-card .tags {
  margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; gap: 8px;
}
.cve-card .tag {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em; color: var(--muted);
  padding: 5px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg-2);
}
.cve-card .tag b { color: var(--fg-2); font-weight: 500; }

/* ---------- Reveal animation ---------- */
.js [data-reveal] { opacity: 0; transform: translateY(26px); transition: opacity .7s cubic-bezier(.2,.7,.2,1), transform .7s cubic-bezier(.2,.7,.2,1); }
.js [data-reveal].in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  [data-reveal] { opacity: 1; transform: none; }
  html { scroll-behavior: auto; }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 980px) {
  .hero-grid { grid-template-columns: 1fr; gap: 48px; }
  .hero-photo { max-width: 380px; }
  .about-grid, .cve-portfolio { grid-template-columns: 1fr; }
  .job { grid-template-columns: 1fr; gap: 18px; }
}

@media (max-width: 720px) {
  body { font-size: 16px; }
  .nav-toggle { display: block; }
  .nav-links {
    position: fixed; inset: var(--nav-h) 0 auto 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: rgba(9,9,10,0.97);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--line);
    padding: 10px var(--pad) 24px;
    transform: translateY(-12px); opacity: 0; pointer-events: none;
    transition: transform .3s, opacity .3s;
  }
  body.menu-open .nav-links { transform: none; opacity: 1; pointer-events: auto; }
  .nav-links a { padding: 15px 6px; font-size: 14px; border-bottom: 1px solid var(--line); border-radius: 0; }
  .nav-links a.active::before { display: none; }
  .nav-links a.active { color: var(--red); }
  .stat-grid { grid-template-columns: 1fr; }
  .cve-list { grid-template-columns: 1fr; }
  .hero-cta .btn, .contact-actions .btn { width: 100%; justify-content: center; }
}
