/* ============================================================
   MARCO SEBASTIÁN ORTEGA MOLINA — Portfolio
   Design inspired by nategentile.com · Red accent edition
   ============================================================ */

/* ---------- DESIGN TOKENS ---------- */
:root {
  --bg: #0a0a0a;
  --bg-2: #121211;
  --fg: #f3f1ea;
  --muted: #8d8d85;
  --line: rgba(243, 241, 234, .14);
  --line-strong: rgba(243, 241, 234, .32);
  --red: #ff2020;
  --red-hover: #ff4444;
  --red-glow: rgba(255, 32, 32, .35);
  --orange: #ff6b35;
  --maxw: 1240px;
  --intro-ease: cubic-bezier(.16, 1, .3, 1);
  --space-grotesk: 'Space Grotesk', system-ui, sans-serif;
  --mono: 'Space Mono', ui-monospace, monospace;
  --inter: 'Inter', system-ui, sans-serif;
}

/* ---------- RESET ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--inter);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
::selection { background: var(--red); color: #fff; }
img, svg, canvas { max-width: 100%; }
ul { list-style: none; }

/* ---------- UTILITIES ---------- */
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 28px; }
.mono { font-family: var(--mono); letter-spacing: .02em; }
.label {
  font-family: var(--mono); font-size: 12px; letter-spacing: .18em;
  text-transform: uppercase; color: var(--muted);
}

/* ---------- PAGE INTRO ANIMATION ---------- */
body::before {
  content: ""; position: fixed; inset: 0; z-index: 999; pointer-events: none;
  background: linear-gradient(180deg, #0a0a0a 0%, #121211 56%, #0a0a0a 100%);
  transform-origin: top;
  opacity: 0;
  animation: pageWash .82s var(--intro-ease) .08s both;
}
@keyframes pageWash {
  0%   { opacity: 1; transform: scaleY(1); }
  100% { opacity: 0; transform: scaleY(0); }
}
@keyframes loadRise {
  0%   { opacity: 0; transform: translate3d(0, 22px, 0); filter: blur(10px); }
  100% { opacity: 1; transform: translate3d(0, 0, 0); filter: blur(0); }
}
header, .brand, .nav-links a, .burger,
h1.manifesto, .hero-deck, .hero-blocks, .hero-extras, .hero-cta-row, .marquee {
  animation: loadRise .78s var(--intro-ease) calc(var(--load-order) * .075s) both;
  will-change: opacity, transform, filter;
}

/* ---------- HEADER ---------- */
header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(10, 10, 10, .82); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  --load-order: 0;
}
.nav { display: flex; align-items: center; justify-content: space-between; height: 66px; }
.brand {
  font-family: var(--space-grotesk); font-weight: 700; font-size: 18px;
  letter-spacing: .01em; display: flex; align-items: center; gap: 9px;
  --load-order: 1;
}
.brand .dot { color: var(--red); font-family: var(--mono); font-weight: 700; }
.brand .tag {
  border: 1px solid var(--line-strong); padding: 2px 7px; border-radius: 2px;
  font-size: 11px; font-family: var(--mono); letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted);
}
.nav-links { display: flex; gap: 30px; align-items: center; }
.nav-links a {
  font-size: 13.5px; color: var(--muted); transition: color .18s;
}
.nav-links a:nth-child(1) { --load-order: 2; }
.nav-links a:nth-child(2) { --load-order: 3; }
.nav-links a:nth-child(3) { --load-order: 4; }
.nav-links a:nth-child(4) { --load-order: 5; }
.nav-links a:nth-child(5) { --load-order: 6; }
.nav-links a:hover { color: var(--fg); }

/* Buttons */
.btn {
  font-family: var(--mono); font-size: 13px; letter-spacing: .04em;
  text-transform: uppercase; font-weight: 700;
  background: var(--red); color: #fff;
  padding: 11px 18px; border: 1px solid var(--red); border-radius: 2px;
  transition: transform .12s, background .18s, box-shadow .18s;
  cursor: pointer; display: inline-block;
}
.btn:hover {
  background: var(--red-hover); transform: translateY(-1px);
  box-shadow: 0 4px 20px var(--red-glow);
}
.btn.ghost {
  background: transparent; color: var(--fg); border-color: var(--line-strong);
}
.btn.ghost:hover {
  border-color: var(--red); color: var(--red); background: transparent;
}
.nav-links a.nav-cta { font-size: 12px; padding: 9px 15px; color: #fff; }

/* Burger menu */
.burger {
  display: none; background: none; border: 1px solid var(--line-strong);
  color: var(--fg); width: 40px; height: 38px; border-radius: 2px;
  font-size: 18px; cursor: pointer; --load-order: 2;
}

/* ---------- HERO ---------- */
.hero { position: relative; padding: 104px 0 72px; border-bottom: 1px solid var(--line); }
.hero-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none;
  -webkit-mask-image: radial-gradient(ellipse 82% 78% at 50% 52%, #000 28%, transparent 92%);
  mask-image: radial-gradient(ellipse 82% 78% at 50% 52%, #000 28%, transparent 92%);
}
.hero .wrap { position: relative; }
h1.manifesto {
  font-family: var(--space-grotesk); font-weight: 700;
  font-size: clamp(40px, 7.4vw, 104px); line-height: .97; letter-spacing: -.025em;
  margin-bottom: 22px; max-width: 100%; --load-order: 2;
}
h1.manifesto .dim { color: var(--muted); }
h1.manifesto .hit { color: var(--red); }
.hero-deck {
  font-family: var(--space-grotesk); font-weight: 600;
  font-size: clamp(19px, 2.4vw, 28px); line-height: 1.18; letter-spacing: -.012em;
  color: var(--fg); width: 100%; max-width: 920px; margin-bottom: 56px;
  --load-order: 3;
}
.hero-deck b { color: var(--red); }
.hero-blocks {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px;
  background: var(--line); border: 1px solid var(--line);
  width: 100%; max-width: 920px; margin: 0 0 16px;
  --load-order: 4;
}
.hero-blocks .hero-block {
  animation: loadRise .72s var(--intro-ease) calc(var(--load-order) * .075s) both;
  will-change: opacity, transform, filter;
}
.hero-blocks .hero-block:nth-child(1) { --load-order: 5; }
.hero-blocks .hero-block:nth-child(2) { --load-order: 6; }
.hero-blocks .hero-block:nth-child(3) { --load-order: 7; }
.hero-block {
  background: var(--bg-2); padding: 18px 18px 20px;
  display: flex; flex-direction: column; gap: 7px; min-height: 108px;
}
.hero-block .hb-k {
  font-family: var(--space-grotesk); font-weight: 700;
  font-size: clamp(17px, 1.5vw, 21px); letter-spacing: -.01em; line-height: 1.05;
  color: var(--red);
}
.hero-block .hb-v { font-size: 13px; color: #cfcdc4; line-height: 1.4; }
.hero-extras {
  width: 100%; max-width: 920px; margin: 16px 0 48px;
  font-size: 13px; color: var(--muted); --load-order: 6;
}
.hero-extras b { color: #cfcdc4; font-weight: 600; }
.hero-cta-row {
  display: flex; gap: 16px; align-items: center; flex-wrap: wrap;
  --load-order: 7;
}

/* ---------- MARQUEE ---------- */
.marquee {
  border-bottom: 1px solid var(--line); background: var(--bg-2);
  overflow: hidden; white-space: nowrap; padding: 14px 0;
  --load-order: 9;
}
.marquee-track {
  display: inline-block; animation: scroll 32s linear infinite;
  font-family: var(--mono); font-size: 13px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted);
}
.marquee-track span { margin: 0 26px; }
.marquee-track span b { color: var(--red); }
@keyframes scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ---------- SECTIONS ---------- */
section { position: relative; }
.sec { padding: 96px 0; border-bottom: 1px solid var(--line); }
.sec-head { display: flex; align-items: baseline; gap: 18px; margin-bottom: 54px; }
.sec-num { font-family: var(--mono); font-size: 13px; color: var(--red); font-weight: 700; }
.sec-title {
  font-family: var(--space-grotesk); font-weight: 700;
  font-size: clamp(28px, 4vw, 52px); line-height: 1.02; letter-spacing: -.02em;
}
.sec-title .hit { color: var(--red); }
.sec-intro {
  max-width: 640px; color: #cfcdc4; font-size: 17px;
  margin-top: -30px; margin-bottom: 48px;
}

/* ---------- PROJECTS (accordion) ---------- */
.mod { border-bottom: 1px solid var(--line); cursor: pointer; }
.mod:first-child { border-top: 1px solid var(--line); }
.mod-head {
  display: flex; align-items: center; gap: 26px;
  padding: 26px 4px; transition: padding-left .2s;
}
.mod:hover .mod-head { padding-left: 14px; }
.mod-n {
  font-family: var(--mono); font-size: 13px; color: var(--red);
  font-weight: 700; width: 34px; flex-shrink: 0;
}
.mod-t {
  font-family: var(--space-grotesk); font-weight: 600;
  font-size: clamp(18px, 2.2vw, 27px); letter-spacing: -.01em; flex: 1;
}
.mod-toggle {
  font-family: var(--mono); color: var(--muted); font-size: 22px;
  transition: transform .25s; flex-shrink: 0;
}
.mod.open .mod-toggle { transform: rotate(45deg); color: var(--red); }
.mod-body { overflow: hidden; }
html.js .mod-body { max-height: 0; transition: max-height .35s ease; }
.mod-body-inner {
  padding: 0 4px 30px 60px; color: #cfcdc4; font-size: 15px; max-width: 760px;
}
.mod-body-inner .tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.mod-body-inner .tags span {
  font-family: var(--mono); font-size: 11px; letter-spacing: .04em;
  border: 1px solid var(--line-strong); padding: 4px 9px; border-radius: 2px;
  color: var(--muted); transition: border-color .2s, color .2s;
}
.mod-body-inner .tags span:hover { border-color: var(--red); color: var(--red); }
.mod-body-inner .links {
  display: flex; gap: 16px; margin-top: 16px; flex-wrap: wrap;
}
.mod-body-inner .links a {
  font-family: var(--mono); font-size: 12px; letter-spacing: .04em;
  color: var(--red); border-bottom: 1px dotted rgba(255, 32, 32, .4);
  transition: color .15s, border-color .15s;
}
.mod-body-inner .links a:hover {
  color: var(--red-hover); border-bottom-color: var(--red);
}

/* ---------- SKILLS (chips) ---------- */
.stack { display: flex; flex-wrap: wrap; gap: 12px; }
.stack .chip {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-2); border: 1px solid var(--line);
  padding: 11px 16px; border-radius: 2px;
  transition: border-color .2s, background .2s, transform .12s;
}
.stack .chip:hover {
  border-color: var(--red); background: var(--bg); transform: translateY(-1px);
}
.stack .chip span {
  font-family: var(--mono); font-size: 13px; letter-spacing: .03em; color: #cfcdc4;
}
.skills-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1px; background: var(--line); border: 1px solid var(--line);
}
.skill-group {
  background: var(--bg); padding: 30px 26px;
  transition: background .2s;
}
.skill-group:hover { background: var(--bg-2); }
.skill-group .sg-title {
  font-family: var(--mono); font-size: 12px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--red); margin-bottom: 16px;
}
.skill-group .stack { margin-top: 0; }

/* ---------- EXPERIENCE STATS ---------- */
.stats-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px;
  background: var(--line); border: 1px solid var(--line);
}
.stat-card {
  background: var(--bg); padding: 30px 26px 32px;
  min-height: 200px; display: flex; flex-direction: column;
  justify-content: space-between; transition: background .2s;
}
.stat-card:hover { background: var(--bg-2); }
.stat-num {
  font-family: var(--space-grotesk); font-weight: 700;
  font-size: 46px; line-height: 1; color: var(--red); letter-spacing: -.03em;
}
.stat-card p { font-size: 14.5px; color: #cfcdc4; margin-top: 18px; }
.stat-card .stat-sub {
  font-family: var(--mono); font-size: 11px; color: var(--muted);
  margin-top: 14px; letter-spacing: .04em;
}

/* ---------- ABOUT ME (profile card) ---------- */
.profile-card {
  display: grid; grid-template-columns: auto 1fr; gap: 34px; align-items: center;
  border: 1px solid var(--line-strong); padding: 34px;
  background: linear-gradient(120deg, var(--bg-2), var(--bg));
}
.profile-avatar {
  width: 130px; height: 130px; border-radius: 2px;
  background: linear-gradient(135deg, #1c1c1a, #0a0a0a);
  border: 1px solid var(--line-strong);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--space-grotesk); font-weight: 700; font-size: 40px;
  color: var(--red); overflow: hidden;
}
.profile-avatar img {
  width: 100%; height: 100%; object-fit: cover;
}
.profile-card .role {
  font-family: var(--mono); font-size: 12px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--red); margin-bottom: 8px;
}
.profile-card h3 {
  font-family: var(--space-grotesk); font-weight: 700;
  font-size: clamp(24px, 3vw, 38px); letter-spacing: -.02em; margin-bottom: 10px;
}
.profile-card p { color: #cfcdc4; font-size: 15.5px; max-width: 640px; }
.profile-links {
  display: flex; gap: 16px; margin-top: 20px; flex-wrap: wrap;
}
.profile-links a {
  font-family: var(--mono); font-size: 12px; letter-spacing: .04em;
  color: var(--muted); border: 1px solid var(--line-strong);
  padding: 8px 16px; border-radius: 2px;
  transition: all .18s;
}
.profile-links a:hover {
  color: var(--red); border-color: var(--red);
  box-shadow: 0 0 12px rgba(255, 32, 32, .15);
}

/* ---------- FINAL CTA ---------- */
.final {
  padding: 110px 0; text-align: center;
  background: radial-gradient(ellipse 70% 90% at 50% 0%, rgba(255, 32, 32, .07), transparent 70%);
  border-bottom: 1px solid var(--line);
}
.final h2 {
  font-family: var(--space-grotesk); font-weight: 700;
  font-size: clamp(34px, 6vw, 76px); line-height: 1; letter-spacing: -.03em;
  margin-bottom: 24px;
}
.final h2 .hit { color: var(--red); }
.final p { color: #cfcdc4; font-size: 18px; max-width: 540px; margin: 0 auto 40px; }
.final .cta-links {
  display: flex; gap: 16px; justify-content: center; flex-wrap: wrap;
}

/* ---------- FOOTER ---------- */
footer { padding: 42px 0; color: var(--muted); border-top: 1px solid var(--line); }
.foot {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
  font-family: var(--mono); font-size: 12px; letter-spacing: .04em;
}
.foot-left { justify-self: start; }
.foot-brand { justify-self: center; color: #cfcdc4; }
.foot-right { justify-self: end; }

/* ---------- SCROLL REVEAL ---------- */
.reveal { opacity: 1; transform: none; }
html.js .reveal { opacity: 0; transform: translateY(24px); transition: opacity .7s ease, transform .7s ease; }
html.js .reveal.in { opacity: 1; transform: none; }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 900px) {
  .nav-links { display: none; }
  .burger { display: block; }
  .nav-links.open {
    display: flex; position: absolute; top: 66px; left: 0; right: 0;
    background: var(--bg); flex-direction: column; gap: 0;
    border-bottom: 1px solid var(--line); padding: 8px 0;
  }
  .nav-links.open a { padding: 14px 28px; border-top: 1px solid var(--line); }
  .hero-blocks { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .skills-grid { grid-template-columns: 1fr; }
  .profile-card { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .wrap { padding: 0 20px; }
  h1.manifesto { font-size: 38px; line-height: 1.02; letter-spacing: 0; margin-bottom: 18px; }
  .hero-deck { margin-bottom: 36px; font-size: 20px; line-height: 1.2; }
  .hero { padding: 60px 0 48px; }
  .sec { padding: 68px 0; }
  .stats-grid { grid-template-columns: 1fr; }
  .hero-block { min-height: 0; padding: 20px 18px; }
  .foot { grid-template-columns: 1fr; text-align: center; }
  .foot-left, .foot-brand, .foot-right { justify-self: center; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important; transition: none !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; filter: none; }
}
