/* ============================================================
   Matteo Silipo Portfolio - Main Stylesheet
   Theme: Dark Cyber / Security Professional
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Mono:ital,wght@0,400;0,700;1,400&family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
  --bg-void:       #050810;
  --bg-deep:       #080d1a;
  --bg-surface:    #0d1526;
  --bg-elevated:   #111d35;
  --bg-card:       #0f1a30;

  --accent:        #00d4ff;
  --accent-dim:    #0099cc;
  --accent-glow:   rgba(0, 212, 255, 0.15);
  --accent-green:  #00ff88;
  --accent-orange: #ff6b35;
  --accent-purple: #7c5cfc;

  --text-primary:  #e8f0fe;
  --text-secondary:#8fa8c8;
  --text-muted:    #4a6080;
  --text-code:     #00d4ff;

  --border:        rgba(0, 212, 255, 0.12);
  --border-bright: rgba(0, 212, 255, 0.35);
  --shadow-glow:   0 0 30px rgba(0, 212, 255, 0.08);
  --shadow-card:   0 8px 32px rgba(0, 0, 0, 0.4);

  --font-display:  'Outfit', sans-serif;
  --font-mono:     'Space Mono', monospace;
  --radius:        12px;
  --radius-lg:     20px;
}

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

html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: var(--font-display);
  background: var(--bg-void);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
}

/* ---- Canvas Background ---- */
#canvas-bg {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  opacity: 0.4;
  pointer-events: none;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { background: var(--accent-dim); border-radius: 3px; }

/* ---- Nav ---- */
nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  padding: 0 2rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(5, 8, 16, 0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.nav-logo {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: 0.05em;
}

.nav-logo span { color: var(--text-secondary); }

.nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
}

.nav-links a {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-secondary);
  text-decoration: none;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: color 0.25s;
  position: relative;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px; left: 0;
  width: 0; height: 1px;
  background: var(--accent);
  transition: width 0.25s;
}

.nav-links a:hover { color: var(--accent); }
.nav-links a:hover::after { width: 100%; }

.nav-admin {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  text-decoration: none;
  border: 1px solid var(--border);
  padding: 0.4rem 0.9rem;
  border-radius: 6px;
  transition: all 0.25s;
}

.nav-admin:hover {
  color: var(--accent);
  border-color: var(--accent-dim);
  background: var(--accent-glow);
}

/* ---- Main Container ---- */
main { position: relative; z-index: 1; }

/* ---- Hero Section ---- */
#hero {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 4rem;
  padding: 100px 8vw 4rem;
  position: relative;
  overflow: hidden;
}

.hero-grid-line {
  position: absolute;
  background: var(--border);
  pointer-events: none;
}

.hero-text { position: relative; z-index: 2; }

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent);
  background: var(--accent-glow);
  border: 1px solid var(--border-bright);
  padding: 0.4rem 1rem;
  border-radius: 100px;
  margin-bottom: 1.5rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.hero-badge::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

.hero-name {
  font-size: clamp(2.5rem, 5vw, 4.5rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.hero-name .accent { color: var(--accent); }

.hero-title {
  font-family: var(--font-mono);
  font-size: clamp(0.85rem, 1.5vw, 1.1rem);
  color: var(--text-secondary);
  letter-spacing: 0.1em;
  margin-bottom: 1.5rem;
}

.hero-title .cursor {
  display: inline-block;
  width: 2px; height: 1.1em;
  background: var(--accent);
  margin-left: 2px;
  animation: blink 1s infinite;
  vertical-align: middle;
}

@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

.hero-desc {
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.75;
  margin-bottom: 2.5rem;
  max-width: 480px;
}

.hero-ctas {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.75rem;
  border-radius: var(--radius);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  transition: all 0.3s;
  cursor: pointer;
  border: none;
  letter-spacing: 0.02em;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg-void);
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
}

.btn-primary:hover {
  background: #33ddff;
  box-shadow: 0 0 35px rgba(0, 212, 255, 0.5);
  transform: translateY(-2px);
}

.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-bright);
}

.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glow);
  transform: translateY(-2px);
}

/* ---- Hero Profile Image ---- */
.hero-visual {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  z-index: 2;
}

.profile-frame {
  position: relative;
  width: clamp(260px, 28vw, 380px);
  height: clamp(260px, 28vw, 380px);
}

.profile-hex {
  position: absolute;
  inset: 0;
  clip-path: polygon(50% 0%, 93% 25%, 93% 75%, 50% 100%, 7% 75%, 7% 25%);
  overflow: hidden;
}

.profile-hex img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center top;
  filter: grayscale(10%) contrast(1.05);
  transition: filter 0.4s;
}

.profile-hex:hover img { filter: grayscale(0%) contrast(1.1); }

.hex-border {
  position: absolute;
  inset: -4px;
  clip-path: polygon(50% 0%, 93% 25%, 93% 75%, 50% 100%, 7% 75%, 7% 25%);
  background: linear-gradient(135deg, var(--accent), var(--accent-purple), var(--accent));
  z-index: -1;
  animation: rotateBorder 6s linear infinite;
}

@keyframes rotateBorder {
  0% { filter: hue-rotate(0deg); }
  100% { filter: hue-rotate(360deg); }
}

.hex-glow {
  position: absolute;
  inset: -20px;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  z-index: -2;
}

.profile-stats {
  position: absolute;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.profile-stats.right { right: -130px; top: 50%; transform: translateY(-50%); }
.profile-stats.left  { left: -130px;  top: 50%; transform: translateY(-50%); }

.stat-chip {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.6rem 1rem;
  text-align: center;
  min-width: 110px;
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-card);
}

.stat-chip .num {
  display: block;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--accent);
  font-family: var(--font-mono);
}

.stat-chip .lbl {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ---- Sections ---- */
section {
  padding: 6rem 8vw;
  position: relative;
}

section:nth-child(even) { background: var(--bg-deep); }

.section-header {
  margin-bottom: 3.5rem;
}

.section-tag {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}

.section-title {
  font-size: clamp(1.8rem, 3vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

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

/* ---- Timeline (Experience) ---- */
.timeline {
  position: relative;
  padding-left: 2.5rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 1px;
  background: linear-gradient(to bottom, var(--accent), transparent);
}

.timeline-item {
  position: relative;
  margin-bottom: 2.5rem;
  animation: fadeUp 0.6s ease both;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -2.5rem;
  top: 6px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--bg-void);
  border: 2px solid var(--accent);
  box-shadow: 0 0 10px var(--accent);
  transform: translateX(-4px);
}

.timeline-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.75rem;
  transition: border-color 0.3s, transform 0.3s, box-shadow 0.3s;
}

.timeline-card:hover {
  border-color: var(--border-bright);
  transform: translateX(4px);
  box-shadow: var(--shadow-glow);
}

.timeline-meta {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.timeline-role {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
}

.timeline-period {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent);
  background: var(--accent-glow);
  padding: 0.25rem 0.75rem;
  border-radius: 100px;
  border: 1px solid var(--border-bright);
}

.timeline-company {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}

.timeline-body {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

.timeline-body ul {
  list-style: none;
  padding: 0;
}

.timeline-body li {
  padding: 0.25rem 0 0.25rem 1.2rem;
  position: relative;
}

.timeline-body li::before {
  content: '›';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: bold;
}

/* ---- Skills ---- */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.skill-category {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: border-color 0.3s;
}

.skill-category:hover { border-color: var(--border-bright); }

.skill-cat-title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.skill-cat-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.skill-item { margin-bottom: 1rem; }

.skill-head {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.4rem;
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.skill-head span:last-child {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent);
}

.skill-bar {
  height: 4px;
  background: var(--bg-elevated);
  border-radius: 2px;
  overflow: hidden;
}

.skill-fill {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent-dim), var(--accent));
  width: 0;
  transition: width 1.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 8px rgba(0, 212, 255, 0.4);
}

/* ---- Certifications ---- */
.certs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.cert-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  position: relative;
  overflow: hidden;
  transition: all 0.3s;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.cert-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-purple));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s;
}

.cert-card:hover { border-color: var(--border-bright); box-shadow: var(--shadow-glow); transform: translateY(-4px); }
.cert-card:hover::before { transform: scaleX(1); }

.cert-badge {
  width: 48px; height: 48px;
  background: var(--accent-glow);
  border: 1px solid var(--border-bright);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  margin-bottom: 0.25rem;
}

.cert-issuer {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.cert-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
  line-height: 1.3;
}

.cert-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
  flex: 1;
}

.cert-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.cert-date {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
}

.cert-view {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: var(--accent);
  text-decoration: none;
  transition: gap 0.2s;
}

.cert-view:hover { gap: 0.7rem; }

/* ---- News ---- */
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.5rem;
}

.news-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all 0.3s;
  display: flex;
  flex-direction: column;
}

.news-card:hover { border-color: var(--border-bright); box-shadow: var(--shadow-glow); transform: translateY(-4px); }

.news-img {
  height: 180px;
  background: linear-gradient(135deg, var(--bg-surface), var(--bg-elevated));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  border-bottom: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

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

.news-img::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 50%, rgba(5, 8, 16, 0.6));
}

.news-body { padding: 1.5rem; flex: 1; display: flex; flex-direction: column; }

.news-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.news-cat {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.25rem 0.7rem;
  border-radius: 100px;
  border: 1px solid;
}

.news-cat.aggiornamento { color: var(--accent); border-color: rgba(0,212,255,0.3); background: rgba(0,212,255,0.06); }
.news-cat.certificazione { color: var(--accent-green); border-color: rgba(0,255,136,0.3); background: rgba(0,255,136,0.06); }
.news-cat.progetto { color: var(--accent-purple); border-color: rgba(124,92,252,0.3); background: rgba(124,92,252,0.06); }
.news-cat.evento { color: var(--accent-orange); border-color: rgba(255,107,53,0.3); background: rgba(255,107,53,0.06); }
.news-cat.altro { color: var(--text-muted); border-color: var(--border); background: transparent; }

.news-time {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
}

.news-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
  line-height: 1.4;
  margin-bottom: 0.75rem;
}

.news-excerpt {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.65;
  flex: 1;
}

/* ---- Contact ---- */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: start;
}

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

.contact-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.3s;
}

.contact-item:hover { border-color: var(--border-bright); }

.contact-icon {
  width: 44px; height: 44px;
  background: var(--accent-glow);
  border: 1px solid var(--border-bright);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.contact-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-family: var(--font-mono);
  margin-bottom: 0.2rem;
}

.contact-value {
  font-size: 0.95rem;
  color: var(--text-primary);
  font-weight: 500;
}

.contact-value a { color: var(--accent); text-decoration: none; }
.contact-value a:hover { text-decoration: underline; }

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

.form-group { display: flex; flex-direction: column; gap: 0.4rem; }

.form-group label {
  font-size: 0.78rem;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.form-group input,
.form-group textarea,
.form-group select {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1.1rem;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 0.95rem;
  transition: border-color 0.25s, box-shadow 0.25s;
  outline: none;
  width: 100%;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
}

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

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

.alert {
  padding: 0.9rem 1.2rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  border: 1px solid;
}

.alert-success { background: rgba(0,255,136,0.08); color: var(--accent-green); border-color: rgba(0,255,136,0.3); }
.alert-error   { background: rgba(255,107,53,0.08); color: var(--accent-orange); border-color: rgba(255,107,53,0.3); }

/* ---- Footer ---- */
footer {
  background: var(--bg-deep);
  border-top: 1px solid var(--border);
  padding: 3rem 8vw;
  text-align: center;
  position: relative;
  z-index: 1;
}

.footer-logo {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  color: var(--accent);
  margin-bottom: 1rem;
}

.footer-copy {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ---- Animations ---- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fade-up { animation: fadeUp 0.6s ease both; }

[data-delay="1"] { animation-delay: 0.1s; }
[data-delay="2"] { animation-delay: 0.2s; }
[data-delay="3"] { animation-delay: 0.3s; }
[data-delay="4"] { animation-delay: 0.4s; }
[data-delay="5"] { animation-delay: 0.5s; }

/* ---- Certifications Modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 16, 0.9);
  backdrop-filter: blur(8px);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-lg);
  padding: 2rem;
  max-width: 800px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 0 60px rgba(0, 212, 255, 0.15);
  transform: scale(0.95);
  transition: transform 0.3s;
}

.modal-overlay.active .modal-box { transform: scale(1); }

.modal-close {
  float: right;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 8px;
  width: 32px; height: 32px;
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.modal-close:hover { border-color: var(--accent); color: var(--accent); }

.modal-embed {
  width: 100%;
  min-height: 500px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  margin-top: 1rem;
}

/* ---- Responsive ---- */
@media (max-width: 900px) {
  #hero {
    grid-template-columns: 1fr;
    text-align: center;
    padding: 100px 6vw 3rem;
  }

  .hero-visual { order: -1; }
  .profile-stats.right,
  .profile-stats.left { display: none; }
  .hero-desc { max-width: 100%; }
  .hero-ctas { justify-content: center; }
  .contact-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .nav-links { display: none; }
}

@media (max-width: 600px) {
  section { padding: 4rem 5vw; }
  .skills-grid,
  .certs-grid,
  .news-grid { grid-template-columns: 1fr; }
}
