/* ============================================================
   Alex Rivera — Portfolio
   Dark theme, hand-written CSS, fully responsive
   ============================================================ */

:root {
  --bg: #0a0d12;
  --bg-surface: #12161d;
  --bg-surface-2: #171c25;
  --border: #232a35;
  --border-strong: #2e3745;
  --text: #e6e9ef;
  --text-muted: #9aa4b2;
  --text-dim: #6b7484;
  --accent: #2dd4bf;
  --accent-2: #6366f1;
  --accent-soft: rgba(45, 212, 191, 0.12);

  --font-head: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;

  --container: 1120px;
  --radius: 14px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

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

a { color: inherit; text-decoration: none; }
ul { list-style: none; }
img { max-width: 100%; display: block; }

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 24px;
  border-radius: 10px;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.2s var(--ease), background 0.2s var(--ease),
    border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.btn-primary {
  background: var(--accent);
  color: #04110f;
  box-shadow: 0 8px 24px -10px rgba(45, 212, 191, 0.6);
}
.btn-primary:hover { transform: translateY(-2px); background: #34e3cf; }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(10, 13, 18, 0.72);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease), background 0.3s var(--ease);
}
.site-header.scrolled { border-color: var(--border); background: rgba(10, 13, 18, 0.9); }
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 70px;
}
.logo { display: flex; align-items: center; gap: 10px; }
.logo-mark { color: var(--accent); display: flex; }
.logo-text {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
}
.nav { display: flex; align-items: center; gap: 6px; }
.nav-link {
  padding: 8px 14px;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 500;
  transition: color 0.2s var(--ease), background 0.2s var(--ease);
}
.nav-link:hover { color: var(--text); }
.nav-link.active { color: var(--accent); }
.nav-cta {
  color: var(--text);
  border: 1px solid var(--border-strong);
  margin-left: 6px;
}
.nav-cta:hover { border-color: var(--accent); color: var(--accent); }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}
.nav-toggle span {
  width: 24px; height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.3s var(--ease), opacity 0.3s var(--ease);
}
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding: 120px 0 100px;
  overflow: hidden;
}
.hero-bg {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 50% -10%, rgba(99, 102, 241, 0.18), transparent 55%),
    linear-gradient(180deg, rgba(10, 13, 18, 0.55), rgba(10, 13, 18, 0.95)),
    url("../images/hero-bg.jpg");
  background-size: cover;
  background-position: center;
  opacity: 0.85;
  z-index: -1;
}
.hero-inner { max-width: 780px; }
.eyebrow {
  display: inline-block;
  font-family: var(--font-head);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 20px;
  padding: 6px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--accent-soft);
}
.hero-title {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: clamp(2.2rem, 5.5vw, 3.75rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin-bottom: 22px;
}
.hero-sub {
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: var(--text-muted);
  max-width: 620px;
  margin-bottom: 34px;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; }

/* ---------- Sections ---------- */
.section { padding: 96px 0; }
.section-tag {
  display: inline-block;
  font-family: var(--font-head);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}
.section-title {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: clamp(1.7rem, 3.5vw, 2.5rem);
  letter-spacing: -0.02em;
  margin-bottom: 26px;
}

/* ---------- About ---------- */
.about-text {
  font-size: clamp(1.05rem, 2vw, 1.3rem);
  color: var(--text-muted);
  max-width: 760px;
  line-height: 1.7;
}

/* ---------- Projects ---------- */
.project-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 22px;
  margin-top: 12px;
}
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 30px;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s var(--ease), border-color 0.3s var(--ease),
    background 0.3s var(--ease);
}
.card:hover {
  transform: translateY(-4px);
  border-color: var(--border-strong);
  background: var(--bg-surface-2);
}
.card-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
}
.card-title {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1.3rem;
  letter-spacing: -0.01em;
}
.card-index {
  font-family: var(--font-head);
  font-size: 0.9rem;
  color: var(--text-dim);
}
.card-desc { color: var(--text-muted); margin-bottom: 20px; flex-grow: 1; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.tags li {
  font-size: 0.78rem;
  font-weight: 500;
  padding: 5px 11px;
  border-radius: 7px;
  color: var(--text);
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
}
.card-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--accent);
  align-self: flex-start;
  transition: gap 0.2s var(--ease);
}
.card-link:hover { gap: 11px; }

/* ---------- Skills ---------- */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 22px;
  margin-top: 12px;
}
.skill-group {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px 22px;
}
.skill-heading {
  font-family: var(--font-head);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text);
}
.chip-list { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-list li {
  font-size: 0.82rem;
  padding: 6px 12px;
  border-radius: 999px;
  color: var(--text-muted);
  border: 1px solid var(--border);
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.skill-group:hover .chip-list li { color: var(--text); border-color: var(--border-strong); }

/* ---------- Contact ---------- */
.contact {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(circle at 50% 0%, rgba(45, 212, 191, 0.08), transparent 60%),
    var(--bg);
}
.contact-inner { max-width: 720px; }
.contact-text {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-bottom: 30px;
  max-width: 600px;
}
.contact-actions { display: flex; flex-wrap: wrap; gap: 14px; }

/* ---------- Footer ---------- */
.site-footer { padding: 44px 0; }
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 18px;
}
.footer-name { font-family: var(--font-head); font-weight: 600; }
.social { display: flex; gap: 12px; }
.social-link {
  width: 40px; height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  color: var(--text-muted);
  border: 1px solid var(--border);
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease),
    transform 0.2s var(--ease);
}
.social-link:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-2px); }
.footer-copy { color: var(--text-dim); font-size: 0.88rem; }

/* ---------- Reveal animation ---------- */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}
.reveal.visible { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .skills-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  .nav-toggle { display: flex; }
  .nav {
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 16px 24px 24px;
    background: rgba(10, 13, 18, 0.98);
    border-bottom: 1px solid var(--border);
    transform: translateY(-120%);
    transition: transform 0.35s var(--ease);
    z-index: 40;
  }
  .nav.open { transform: translateY(0); }
  .nav-link { padding: 12px 14px; font-size: 1rem; }
  .nav-cta { margin-left: 0; text-align: center; }

  .project-grid { grid-template-columns: 1fr; }
  .section { padding: 72px 0; }
  .hero { padding: 90px 0 72px; }
}

@media (max-width: 480px) {
  .skills-grid { grid-template-columns: 1fr; }
  .container { padding: 0 18px; }
  .card { padding: 24px; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
}
