/* ============================================
   PORTFOLIO — style.css
   Author: Kenu Añonuevo
   ============================================ */

/* ---------- CSS Variables (Design Tokens) ---------- */
:root {
  --bg-primary:    #081b29;
  --bg-secondary:  #0a2235;
  --bg-card:       #0d2d45;
  --accent:        #0ef;
  --accent-dark:   #00b8cc;
  --text-primary:  #ededed;
  --text-muted:    #8892a4;
  --border:        rgba(0, 238, 255, 0.2);

  --font-main: 'Poppins', sans-serif;
  --transition: 0.3s ease;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px; /* offset for fixed header */
}

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

/* Improve focus visibility for keyboard navigation */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

ul {
  list-style: none;
}

/* ---------- Reusable Layout ---------- */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 5%;
}

.section {
  padding: 90px 0;
}

.section-title {
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  font-weight: 700;
  text-align: center;
  margin-bottom: 0.5rem;
}

.section-title span {
  color: var(--accent);
}

.section-subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 1rem;
  margin-bottom: 3rem;
}

/* ---------- Buttons ---------- */
.btn-box {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: 40px;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: var(--font-main);
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  border: 2px solid transparent;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg-primary);
  border-color: var(--accent);
}

.btn-primary:hover,
.btn-primary:focus-visible {
  background: transparent;
  color: var(--accent);
  box-shadow: 0 0 15px var(--accent), 0 0 40px rgba(0, 238, 255, 0.3);
}

.btn-outline {
  background: transparent;
  color: var(--accent);
  border-color: var(--accent);
}

.btn-outline:hover,
.btn-outline:focus-visible {
  background: var(--accent);
  color: var(--bg-primary);
  box-shadow: 0 0 15px var(--accent);
}

/* ============================================
   HEADER / NAVBAR
   ============================================ */
.header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  padding: 18px 5%;
  background: transparent;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 1000;
  transition: background var(--transition), box-shadow var(--transition);
}

/* Header scrolled state (added by JS) */
.header.scrolled {
  background: rgba(8, 27, 41, 0.95);
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.4);
}

.logo {
  font-size: 1.6rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 1px;
  animation: slideRight 0.8s ease forwards;
}

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

.navbar {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.navbar .nav-link {
  font-size: 1rem;
  font-weight: 500;
  color: #fff;
  position: relative;
  transition: color var(--transition);
}

.navbar .nav-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width var(--transition);
}

.navbar .nav-link:hover,
.navbar .nav-link.active {
  color: var(--accent);
}

.navbar .nav-link:hover::after,
.navbar .nav-link.active::after {
  width: 100%;
}

/* Hamburger button (hidden on desktop) */
.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  z-index: 1100;
}

.menu-toggle span {
  display: block;
  width: 25px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: var(--transition);
}

/* Hamburger open state */
.menu-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle.open span:nth-child(2) { opacity: 0; }
.menu-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ============================================
   HOME SECTION
   ============================================ */
.home {
  position: relative;
  width: 100%;
  min-height: 100vh;
  background: url('wallpaper.jpg') center/cover no-repeat;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 100px 5% 60px;
  gap: 2rem;
}

/* Dark overlay for better text contrast */
.home::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(8, 27, 41, 0.85) 0%,
    rgba(8, 27, 41, 0.5) 100%
  );
  z-index: 0;
}

.home-content {
  position: relative;
  z-index: 1;
  max-width: 580px;
}

.home-greeting {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}

.home-content h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 0.5rem;
}

.home-content h2 {
  font-size: clamp(1.1rem, 2.5vw, 1.5rem);
  font-weight: 500;
  margin-bottom: 1.2rem;
}

.home-content h2 .typed-text {
  color: var(--accent);
}

/* The blinking cursor from typed.js */
.typed-cursor {
  color: var(--accent);
}

.home-description {
  font-size: 1rem;
  color: var(--text-muted);
  max-width: 480px;
  margin-bottom: 1.5rem;
  line-height: 1.8;
}

/* Social icons row */
.home-sci {
  display: flex;
  gap: 14px;
  margin-bottom: 1.8rem;
}

.home-sci a {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 42px;
  height: 42px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  font-size: 1.1rem;
  color: var(--accent);
  transition: var(--transition);
}

.home-sci a:hover,
.home-sci a:focus-visible {
  background: var(--accent);
  color: var(--bg-primary);
  box-shadow: 0 0 16px var(--accent);
  transform: translateY(-3px);
}

/* CTA buttons row */
.home-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

/* Profile image circle */
.home-img {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
}

.img-circle {
  width: 300px;
  height: 300px;
  border-radius: 50%;
  border: 4px solid var(--accent);
  box-shadow: 0 0 30px rgba(0, 238, 255, 0.3);
  overflow: hidden;
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
}

.img-circle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Scroll down indicator */
.scroll-down {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1;
  color: var(--accent);
  font-size: 2rem;
  animation: bounce 2s infinite;
  transition: color var(--transition);
}

.scroll-down:hover {
  color: #fff;
}

@keyframes bounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50%       { transform: translateX(-50%) translateY(8px); }
}

/* ============================================
   ABOUT SECTION
   ============================================ */
.about {
  background: var(--bg-secondary);
}

.about-content {
  display: flex;
  gap: 4rem;
  align-items: center;
}

.about-img .img-circle {
  width: 280px;
  height: 280px;
}

.about-text h3 {
  font-size: 1.4rem;
  color: var(--accent);
  margin-bottom: 1rem;
}

.about-text p {
  color: var(--text-muted);
  margin-bottom: 1rem;
  line-height: 1.8;
}

.about-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 1.5rem 0 2rem;
}

.info-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.info-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
}

.info-value {
  font-weight: 600;
  color: var(--text-primary);
}

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

.skill-category {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.8rem;
  transition: transform var(--transition), box-shadow var(--transition);
}

.skill-category:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 30px rgba(0, 238, 255, 0.1);
}

.skill-category h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.skill-category ul {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.skill-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  margin-bottom: 6px;
}

.skill-info span:last-child {
  color: var(--accent);
  font-weight: 600;
}

.skill-bar {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
}

.skill-progress {
  height: 100%;
  width: 0; /* animated to --progress via JS */
  background: linear-gradient(90deg, var(--accent-dark), var(--accent));
  border-radius: 4px;
  transition: width 1.2s ease;
}

/* ============================================
   PROJECTS SECTION
   ============================================ */
.projects {
  background: var(--bg-secondary);
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 1.5rem;
}

.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
  display: flex;
  flex-direction: column;
}

.project-card:hover,
.project-card:focus-visible {
  transform: translateY(-6px);
  box-shadow: 0 12px 40px rgba(0, 238, 255, 0.12);
  border-color: var(--accent);
  outline: none;
}

.project-img {
  height: 130px;
  background: linear-gradient(135deg, var(--bg-primary), var(--bg-secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.5rem;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
}

.project-info {
  padding: 1.4rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.project-tag {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent);
  background: rgba(0, 238, 255, 0.1);
  padding: 3px 10px;
  border-radius: 20px;
  align-self: flex-start;
}

.project-info h3 {
  font-size: 1.1rem;
  font-weight: 600;
}

.project-info p {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.7;
  flex: 1;
}

.project-links {
  display: flex;
  gap: 1rem;
  margin-top: 0.5rem;
}

.project-links a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  transition: color var(--transition);
}

.project-links a:hover,
.project-links a:focus-visible {
  color: #fff;
}

/* ============================================
   CONTACT SECTION
   ============================================ */
.contact-content {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: 3rem;
  align-items: start;
}

.contact-info {
  display: flex;
  flex-direction: column;
  gap: 1.8rem;
}

.contact-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.contact-item i {
  font-size: 1.6rem;
  color: var(--accent);
  margin-top: 2px;
  flex-shrink: 0;
}

.contact-item h4 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 3px;
}

.contact-item a,
.contact-item p {
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: color var(--transition);
}

.contact-item a:hover {
  color: var(--accent);
}

/* Contact Form */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

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

.form-group label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
}

.form-group label span {
  color: var(--accent);
}

.form-group input,
.form-group textarea {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 0.95rem;
  font-family: var(--font-main);
  color: var(--text-primary);
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-muted);
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 238, 255, 0.15);
}

.form-group input.invalid,
.form-group textarea.invalid {
  border-color: #ff6b6b;
}

.form-error {
  font-size: 0.8rem;
  color: #ff6b6b;
  min-height: 1rem;
}

.form-group textarea {
  resize: vertical;
  min-height: 130px;
}

.form-success {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0, 238, 255, 0.1);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 14px 18px;
  color: var(--accent);
  font-size: 0.95rem;
}

.form-success[hidden] {
  display: none;
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
  background: #060f19;
  padding: 28px 5%;
  text-align: center;
  border-top: 1px solid var(--border);
}

.footer .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer p {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  gap: 1rem;
}

.footer-links a {
  font-size: 1.3rem;
  color: var(--text-muted);
  transition: color var(--transition);
}

.footer-links a:hover,
.footer-links a:focus-visible {
  color: var(--accent);
}

/* ============================================
   BACK TO TOP BUTTON
   ============================================ */
.back-to-top {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 44px;
  height: 44px;
  background: var(--accent);
  color: var(--bg-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  box-shadow: 0 4px 16px rgba(0, 238, 255, 0.3);
  transition: var(--transition);
  opacity: 0;
  pointer-events: none;
  z-index: 999;
}

.back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
}

.back-to-top:hover,
.back-to-top:focus-visible {
  background: var(--bg-primary);
  color: var(--accent);
  border: 2px solid var(--accent);
  box-shadow: 0 0 20px var(--accent);
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes slideRight {
  from { transform: translateX(-60px); opacity: 0; }
  to   { transform: translateX(0);     opacity: 1; }
}

@keyframes slideLeft {
  from { transform: translateX(60px);  opacity: 0; }
  to   { transform: translateX(0);     opacity: 1; }
}

.animate-slide-right {
  opacity: 0;
  animation: slideRight 0.8s ease forwards;
  animation-delay: var(--delay, 0s);
}

.animate-slide-left {
  opacity: 0;
  animation: slideLeft 0.8s ease forwards;
  animation-delay: var(--delay, 0s);
}

/* Scroll reveal animation (triggered by JS) */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================
   RESPONSIVE — Tablet (≤ 900px)
   ============================================ */
@media (max-width: 900px) {
  .home {
    flex-direction: column;
    justify-content: center;
    text-align: center;
    padding-top: 120px;
  }

  .home-sci {
    justify-content: center;
  }

  .home-cta {
    justify-content: center;
  }

  .home-img {
    order: -1; /* photo above text on mobile */
  }

  .img-circle {
    width: 220px;
    height: 220px;
  }

  .about-content {
    flex-direction: column;
    text-align: center;
  }

  .about-img {
    display: flex;
    justify-content: center;
  }

  .about-info {
    grid-template-columns: 1fr;
  }

  .contact-content {
    grid-template-columns: 1fr;
  }

  .footer .container {
    flex-direction: column;
    text-align: center;
  }
}

/* ============================================
   RESPONSIVE — Mobile (≤ 600px)
   ============================================ */
@media (max-width: 600px) {
  /* Mobile nav */
  .menu-toggle {
    display: flex;
  }

  .navbar {
    position: fixed;
    top: 0;
    right: -100%;
    width: min(75vw, 280px);
    height: 100vh;
    background: rgba(8, 27, 41, 0.97);
    backdrop-filter: blur(12px);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 2.5rem;
    border-left: 1px solid var(--border);
    transition: right 0.35s ease;
    z-index: 1000;
  }

  .navbar.open {
    right: 0;
  }

  .navbar .nav-link {
    font-size: 1.2rem;
  }

  .section {
    padding: 70px 0;
  }

  .projects-grid,
  .skills-grid {
    grid-template-columns: 1fr;
  }

  .home-cta {
    flex-direction: column;
    align-items: center;
  }

  .btn-box {
    width: 100%;
    justify-content: center;
    max-width: 260px;
  }
}

/* ============================================
   REDUCED MOTION — respect user preferences
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
