/* 
 * EMANUELE CIOTOLA PORTFOLIO
 * Design & Development: Emanuele Ciotola
 * Copyright © 2025. All Rights Reserved.
*/

/* --- Fonts --- */
@font-face { font-family: 'Outfit'; font-style: normal; font-weight: 400; font-display: swap; src: url('assets/fonts/outfit-v15-latin-400.woff2') format('woff2'); }
@font-face { font-family: 'Outfit'; font-style: normal; font-weight: 500; font-display: swap; src: url('assets/fonts/outfit-v15-latin-500.woff2') format('woff2'); }
@font-face { font-family: 'Outfit'; font-style: normal; font-weight: 600; font-display: swap; src: url('assets/fonts/outfit-v15-latin-600.woff2') format('woff2'); }
@font-face { font-family: 'Space Grotesk'; font-style: normal; font-weight: 700; font-display: swap; src: url('assets/fonts/space-grotesk-v22-latin-700.woff2') format('woff2'); }

/* --- Variabili --- */
:root {
  --bg-main: #0f172a;
  --bg-secondary: #1e293b;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  
  --accent: #38bdf8;
  --accent-dark: #0284c7;
  --dieti: #f43f5e;
  --dev: #34d399;
  
  --glass-bg: rgba(30, 41, 59, .6);
  --glass-border: rgba(255, 255, 255, .08);
  --glass-highlight: rgba(255, 255, 255, .1);
  
  --font-heading: 'Space Grotesk', sans-serif;
  --font-body: 'Outfit', sans-serif;
}

/* --- Reset & Base --- */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { scroll-behavior: smooth; }

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-body);
  line-height: 1.6;
  overflow-x: hidden;
}

body.no-scroll { overflow: hidden; touch-action: none; }

/* --- Background Effects --- */
.background-glow {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: -2;
  background: radial-gradient(circle at 15% 15%, rgba(56, 189, 248, .08), transparent 40%),
              radial-gradient(circle at 85% 85%, rgba(244, 63, 94, .05), transparent 40%);
}

/* --- Typography & Utils --- */
.container { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 1.5rem; }

h1 {
  font-family: var(--font-heading);
  font-size: clamp(2.5rem, 6vw, 4rem);
  line-height: 1.1;
  margin-bottom: 1.5rem;
  font-weight: 700;
}

.text-gradient {
  background: linear-gradient(135deg, #fff 0%, var(--accent) 100%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.section-spacing { padding-top: 80px; padding-bottom: 80px; }

.section-title {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 4vw, 2.5rem);
  margin-bottom: 3rem;
  text-align: center;
}
.section-subtitle {
  color: var(--text-muted);
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  margin-bottom: 3rem;
  text-align: center;
  text-wrap: balance;
}

/* --- Navbar --- */
.navbar {
  position: fixed;
  top: 0; width: 100%;
  background: rgba(15, 23, 42, .85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--glass-border);
  z-index: 1000;
  padding: 1rem 0;
}

.nav-container {
  width: 100%; max-width: 1100px;
  margin: 0 auto; padding: 0 1.5rem;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}

.logo {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.5rem;
  color: #fff;
  text-decoration: none;
  justify-self: start;
  transition: all .3s;
  z-index: 1001;
}

.nav-links { display: flex; gap: 2rem; list-style: none; justify-self: center; }

.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  transition: .3s;
  font-size: .95rem;
}
.nav-link.active { color: #fff; }

.nav-actions { display: flex; align-items: center; gap: 1rem; justify-self: end; }

.btn-nav-contact {
  background: #fff;
  color: var(--bg-main);
  padding: .4rem 1.1rem;
  border-radius: 99px;
  font-weight: 600;
  text-decoration: none;
  font-size: .9rem;
  transition: all .3s;
}

/* --- Hamburger --- */
.hamburger {
  display: none;
  background: transparent;
  border: none;
  cursor: pointer;
  width: 30px; height: 30px;
  position: relative;
  z-index: 1001;
  padding: 0;
}

.hamburger .line {
  width: 24px; height: 2px;
  background-color: var(--text-main);
  border-radius: 4px;
  position: absolute;
  left: 50%; top: 50%;
  margin-left: -12px;
  margin-top: -1px;
  transition: transform 0.3s cubic-bezier(0.5, -0.15, 0.4, 1.25), opacity 0.3s ease;
  will-change: transform;
}

.hamburger .line:nth-child(1) { transform: translateY(-7px); }
.hamburger .line:nth-child(2) { transform: translateY(0); }
.hamburger .line:nth-child(3) { transform: translateY(7px); }

.hamburger.active .line:nth-child(1) { transform: translateY(0) rotate(-45deg); }
.hamburger.active .line:nth-child(2) { opacity: 0; transform: scale(0); }
.hamburger.active .line:nth-child(3) { transform: translateY(0) rotate(45deg); }

.mobile-only { display: none; }

/* --- Hero Section --- */
#hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 80px;
  gap: 2rem;
}

.hero-content { flex: 1; max-width: 600px; }

.role-badge {
  display: inline-flex; align-items: center; gap: .6rem;
  background: rgba(56, 189, 248, .1);
  color: var(--accent);
  padding: .5rem 1rem;
  border-radius: 99px;
  font-size: .85rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  border: 1px solid rgba(56, 189, 248, .2);
}
.dot {
  width: 8px; height: 8px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--accent);
  animation: pulse 2s infinite;
}

.hero-desc {
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  color: var(--text-muted);
  margin-bottom: 2rem;
  max-width: 500px;
  text-wrap: balance;
}

.hero-socials { display: flex; gap: 20px; margin-bottom: 35px; }

.social-icon {
  width: 45px; height: 45px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  color: var(--text-muted);
  background: var(--glass-bg);
  transition: all .3s cubic-bezier(.4, 0, .2, 1);
  will-change: transform, box-shadow, border-color;
}

.cta-wrapper { display: flex; flex-wrap: wrap; gap: 1rem; }

.btn {
  padding: 14px 32px;
  border-radius: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: all .3s;
  display: inline-block;
  will-change: transform, box-shadow, border-color;
}
.btn-primary { background: var(--accent); color: var(--bg-main); }
.btn-outline { background: var(--glass-bg); border: 1px solid var(--glass-border); color: var(--text-main); }

.hero-visual { position: relative; width: 400px; aspect-ratio: 1 / 1; height: auto; flex-shrink: 0; }

.image-frame {
  width: 100%; height: 100%;
  border-radius: 30px;
  overflow: hidden;
  border: 1px solid var(--glass-border);
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.8), rgba(56, 189, 248, 0.1));
  display: flex; align-items: center; justify-content: center;
  position: relative;
  transform: rotate(3deg);
  transition: 0.5s;
  will-change: transform;
  -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; touch-action: manipulation; 
}
.image-frame.is-touching { transform: rotate(0deg); } /* todo */
.image-frame img {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  object-fit: cover; z-index: 2;
  transition: transform 0.5s ease;
  pointer-events: none; -webkit-touch-callout: none;
}
.profile-msg {
  font-family: var(--font-heading); font-size: 1.1rem;
  color: rgba(255, 255, 255, 0.5); text-align: center; line-height: 1.2;
  z-index: 1; user-select: none;
}

.floating-icon {
  position: absolute;
  background: var(--glass-bg); padding: 12px;
  border-radius: 12px; color: var(--text-muted); opacity: .8;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
  will-change: transform;
}
.floating-icon svg { line-height: 1; display: block; }
.icon-1 { top: -20px; left: -20px; animation: float 6s infinite ease-in-out; }
.icon-2 { bottom: 40px; right: -30px; animation: float 8s infinite ease-in-out reverse; }

/* --- Marquee --- */
.marquee-strip {
  background: rgba(5, 11, 20, .7); padding: 20px 0;
  overflow: hidden;
  border-top: 1px solid var(--glass-border); border-bottom: 1px solid var(--glass-border);
  transform: rotate(-1deg); margin: 40px 0;
  cursor: grab; user-select: none;
}
.marquee-track { display: flex; width: max-content; animation: scrollMarquee 45s linear infinite; will-change: transform; }
.marquee-content { display: flex; align-items: center; flex-shrink: 0; }
.marquee-content span {
  font-family: var(--font-heading); font-weight: 700; font-size: 1.5rem;
  word-spacing: 1rem; color: var(--text-muted); padding-right: 1.5rem;
  white-space: nowrap;
}
.marquee-strip:active .marquee-track { animation-play-state: paused; cursor: grabbing; }

/* --- About (Cards) --- */
.info-card { display: flex; flex-direction: column; align-items: center; text-align: center; text-wrap: balance; height: 100%; }

.static-glass {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 16px; padding: 2rem;
  cursor: default; transition: border-color 0.3s;
}

.bento-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(295px, 1fr));
  gap: 1.5rem; justify-content: center;
}

.card-icon-bg {
  width: 56px; height: 56px;
  background: rgba(56, 189, 248, 0.1); color: var(--accent);
  border-radius: 16px; margin-bottom: 1.5rem; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.dieti-bg { background: rgba(244, 63, 94, 0.1); color: var(--dieti); }
.dev-bg { background: rgba(16, 185, 129, 0.1); color: var(--dev); }

.info-card h3 { font-family: var(--font-heading); font-size: 1.4rem; margin-bottom: 0.75rem; }
.info-card p { font-size: 0.95rem; color: var(--text-muted); line-height: 1.6; }

/* --- CV Timeline --- */
.timeline { position: relative; margin: 0 auto 60px auto; }
.timeline-line {
  position: absolute; left: 50%; top: 0; width: 2px; height: 100%;
  background: linear-gradient(to bottom, transparent, var(--accent), transparent);
  transform: translateX(-50%); box-shadow: 0 0 15px var(--accent);
}

.timeline-item {
  display: flex; justify-content: center; align-items: center;
  margin-bottom: 60px; position: relative;
  opacity: 0; transform: translateY(30px); transition: all .6s ease;
}
.timeline-item.visible { opacity: 1; transform: translateY(0); }

.timeline-dot {
  position: absolute; left: 50%; width: 16px; height: 16px;
  background: var(--bg-main); border: 2px solid var(--accent);
  border-radius: 50%; transform: translateX(-50%); z-index: 5;
  box-shadow: 0 0 10px var(--accent); animation: timeline-pulse 3s infinite ease-in;
}

.timeline-content { width: 45%; padding: 30px; border-radius: 20px; position: relative; }

.glass-card {
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  backdrop-filter: blur(10px); text-wrap: pretty;
  transition: transform .3s ease, border-color .3s; will-change: transform, border-color;
}

.timeline-item.left { justify-content: flex-start; }
.timeline-item.right { justify-content: flex-end; }
.timeline-item.left .timeline-content { margin-right: auto; text-align: right; }
.timeline-item.right .timeline-content { margin-left: auto; text-align: left; }

.timeline-content .date {
  display: inline-block; font-size: .9rem; color: var(--accent);
  margin-bottom: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px;
}
.timeline-content h3 { font-family: var(--font-heading); font-size: 1.5rem; margin-bottom: 5px; }
.timeline-content h4 { color: var(--text-muted); font-weight: 400; margin-bottom: 15px; font-size: 1rem; }

.skills-chips { display: flex; gap: .5rem; margin-top: 1.5rem; flex-wrap: wrap; }
.timeline-item.left .skills-chips { justify-content: flex-end; }

.skills-chips span {
  font-size: .8rem; background: rgba(255,255,255,.05);
  padding: 5px 12px; border-radius: 6px; color: var(--text-muted);
}

.cv-download-wrapper { text-align: center; margin-top: 80px; }

.btn-icon-text {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 16px 40px; opacity: 0; transform: translateY(30px); will-change: transform, opacity;
}
.btn-icon-text.visible { opacity: 1; transform: translateY(0); }

/* --- Projects --- */
.projects-list { display: flex; flex-direction: column; gap: 4rem; }
.project-wrapper { display: block; }

.glass-interactive {
  position: relative; background: rgba(30, 41, 59, .4);
  border: 1px solid var(--glass-border); border-radius: 20px;
  overflow: hidden; transition: all .3s ease; cursor: pointer;
}

.project-row { display: flex; align-items: stretch; min-height: 320px; }
.project-wrapper:nth-child(even) .project-row { flex-direction: row-reverse; }

.project-head h3 { margin-bottom: 1rem; font-family: var(--font-heading); font-size: 1.8rem; }
.project-text { flex: 1; padding: 3rem; display: flex; flex-direction: column; justify-content: center; }

.tags { display: flex; gap: .5rem; margin: 1.5rem 0; flex-wrap: wrap; }
.tags span {
  font-size: .8rem; background: rgba(255,255,255,.05);
  padding: 5px 12px; border-radius: 6px; color: var(--text-muted);
}

.cta-text {
  color: var(--accent); text-decoration: none; font-weight: 600;
  display: inline-flex; align-items: center; gap: 5px;
  margin-top: auto; transition: gap .3s ease;
}
.cta-text::after { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 1; }
.cta-text svg { font-size: inherit; width: 1.25rem; height: 1.25rem; }

.project-visual {
  flex: 1; min-height: 250px; position: relative;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; color: rgba(255, 255, 255, .6);
  font-family: var(--font-heading); font-size: 1.1rem; text-align: center;
  padding: 1rem; transition: all .5s ease; opacity: .8;
  will-change: transform, opacity;
}

.project-visual img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; z-index: 2; }
.fallback-msg { position: relative; z-index: 1; transition: transform .5s ease; will-change: transform; }

.project-visual.gradient-1, 
.project-visual.gradient-2, 
.project-visual.gradient-3 {
  background-size: calc(100% - 2px) calc(100% - 2px);
  background-position: center;
  background-repeat: no-repeat;
}
.gradient-1 { background: linear-gradient(135deg, #1e3a8a, #3b82f6); }
.gradient-2 { background: linear-gradient(135deg, #be123c, #f43f5e); }
.gradient-3 { background: linear-gradient(135deg, #064e3b, #10b981); }

/* --- Footer --- */
footer { margin-top: 100px; border-top: 1px solid var(--glass-border); background: #020617; padding: 60px 0; }
.footer-inner { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 30px; }

.footer-socials { display: flex; gap: 1.5rem; }
.footer-socials a { color: var(--text-muted); text-decoration: none; font-weight: 500; transition: .3s; }

.copyright { color: var(--text-muted); font-size: .85rem; }

/* --------------------------
   - ANIMATIONS (KEYFRAMES) -
   -------------------------- */
@keyframes pulse { 0% { opacity: 1; } 50% { opacity: .5; } 100% { opacity: 1; } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-15px); } }
@keyframes scrollMarquee { 0% { transform: translateX(0); } 100% { transform: translateX(-50%); } }
@keyframes timeline-pulse {
  0%, 100% { box-shadow: 0 0 20px var(--accent); border-color: var(--accent); }
  50% { box-shadow: 0 0 10px rgba(56, 189, 248, .5); border-color: rgba(56, 189, 248, .6); }
}

/* -----------------
   - MEDIA QUERIES -
   ----------------- */

@media (max-width: 1200px) {
  .nav-container { padding: 0 3rem; }
  .container { padding: 3rem; }
  .hero-visual { width: clamp(350px, 30vw, 400px); }
}

@media (max-width: 1050px) {
  .hero-visual { width: clamp(300px, 30vw, 350px); }
  .bento-grid { grid-template-columns: repeat(2, 1fr); }
  .info-card:last-child { grid-column: span 2; max-width: 550px; width: 100%; margin: 0 auto; }
}

@media (max-width: 900px) {
  .hero-visual { width: clamp(200px, 25vw, 300px); }
  .floating-icon { display: none; }
  
  .timeline { padding-left: 0; margin: 0 auto 40px auto; }
  .timeline-line { left: 7px; transform: translateX(-50%); }
  .timeline-item { flex-direction: column; align-items: flex-start; margin-left: 37px; margin-bottom: 3rem; }
  .timeline-dot { left: -30px; top: 50%; transform: translate(-50%, -50%); }
  
  .timeline-item.left .timeline-content,
  .timeline-item.right .timeline-content { width: 100%; text-align: left; margin: 0; }
  .timeline-item.left, .timeline-item.right { justify-content: flex-start; }
  .timeline-item.left .skills-chips { justify-content: flex-start; }
  .cv-download-wrapper { margin-top: 3rem; }
  
  .project-row, .project-wrapper:nth-child(even) .project-row { flex-direction: column-reverse; }
  .project-wrapper { max-width: 525px; margin: 0 auto; width: 100%; }
  .glass-interactive { width: 100%; max-width: none; }
  .project-visual { min-height: 250px; flex: none; width: 100%; }
  .project-text { padding: 2rem 1.5rem; }  
}

@media (max-width: 768px) {
  .nav-container { display: flex; justify-content: space-between; }
  .nav-links, .nav-actions { display: none; }
  .hamburger { display: block; }
  
  .nav-menu {
    position: fixed; top: 0; right: 0;
    width: 100%; height: 100vh;
    background: rgba(15, 23, 42, 0.98);
    backdrop-filter: blur(20px);
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    transform: translateX(100%); 
    transition: transform 0.4s cubic-bezier(0.77, 0, 0.175, 1);
    z-index: 1000;
  }
  .nav-menu.active { transform: translateX(0); }
  
  .nav-menu .nav-links { display: flex; flex-direction: column; gap: 2.5rem; text-align: center; }
  .nav-menu .nav-link { 
    font-family: var(--font-heading); font-size: 2rem; 
    font-weight: 700; color: var(--text-muted); 
    text-transform: uppercase; letter-spacing: 2px; display: block;
  }
  .nav-menu .nav-link:hover, .nav-menu .nav-link.active { color: var(--accent); }
  
  .mobile-only { display: block; }
  
  #hero { flex-direction: column; text-align: center; justify-content: center; padding-top: 100px; gap: 3.5rem; }
  .hero-visual { width: clamp(250px, 50vw, 300px); }
  .floating-icon { display: block; }
  .cta-wrapper, .hero-socials { justify-content: center; }
}

@media (max-width: 650px) {
  .bento-grid { grid-template-columns: 1fr; }
  .info-card:last-child { grid-column: auto; max-width: 100%; }
  .info-card { padding: 1.5rem; }
  .project-wrapper { max-width: 425px; }
}

@media (max-width: 420px) {
  .nav-container, .container { padding-left: 1.5rem; padding-right: 1.5rem; }
  h1 { font-size: 2.2rem; }
  .btn { width: 100%; justify-content: center; }
  .nav-actions { display: none; }
  .logo { font-size: 1.2rem; }
  .hero-visual { max-width: 240px; max-height: 240px; }
  .project-head h3 { font-size: 1.4rem; }
  .footer-socials { gap: 1rem; }
}

/* -----------------------------------------------
   - INTERACTIVE STATES (HOVER / FOCUS / ACTIVE) -
   ----------------------------------------------- */

/* --- MOUSE DEVICES (Hover Effects) --- */
@media (hover: hover) {
  /* Navbar */
  .nav-link:hover { color: #fff; }
  .btn-nav-contact:hover { background-color: var(--accent); box-shadow: 0 0 25px rgba(56, 189, 248, .4); }
  
  /* Hero & Buttons */
  .social-icon:hover { color: #fff; border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 10px 30px rgba(0,0,0,.5); }
  .btn-primary:hover { box-shadow: 0 0 25px rgba(56, 189, 248, .4); transform: translateY(-2px); }
  .btn-outline:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 10px 30px rgba(0,0,0,.5); }
  
  /* Cards & Footer */
  .static-glass:hover { border-color: rgba(255,255,255,0.2); }
  .glass-card:hover { border-color: rgba(255,255,255,.2); }
  .footer-socials a:hover { color: var(--accent); }
  
  /* Projects (Complex Hover) */
  .project-wrapper:hover .glass-interactive { border-color: var(--accent); transform: translateY(-5px); box-shadow: 0 10px 30px rgba(0,0,0,.3); }
  .project-wrapper:hover .cta-text { gap: 15px; }
  .project-wrapper:hover .project-visual { opacity: 1; transform: scale(1.05); }
  .project-wrapper:hover .fallback-msg { transform: translateX(-.5rem); }
  .project-wrapper:nth-child(even):hover .fallback-msg { transform: translateX(.5rem); }
}

/* --- TOUCH DEVICES (Active/Click Effects) --- */
/* Navbar */
.nav-link:active { color: #fff; }
.btn-nav-contact:active { background-color: var(--accent); box-shadow: 0 0 25px rgba(56, 189, 248, .4); }

/* Hero & Buttons */
.social-icon:active { color: #fff; border-color: var(--accent); transform: scale(0.95); box-shadow: 0 5px 15px rgba(0,0,0,.5); }
.btn:active { transform: scale(0.98); }
.btn-primary:active { box-shadow: 0 0 15px rgba(56, 189, 248, .4); }
.btn-outline:active { border-color: var(--accent); }

/* Footer */
.footer-socials a:active { color: var(--accent); }

/* Projects */
.project-wrapper:active .glass-interactive { border-color: var(--accent); transform: scale(0.98); box-shadow: 0 5px 15px rgba(0,0,0,.2); }
.project-wrapper:active .cta-text { gap: 15px; }
.project-wrapper:active .project-visual { opacity: 1; transform: scale(1.02); }
.project-wrapper:active .fallback-msg { transform: translateX(0); }
.project-wrapper:nth-child(even):active .fallback-msg { transform: translateX(0); }