/* ==========================================================================
   Luca Di Pietro Martinelli — Portfolio one-page
   ========================================================================== */

:root {
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "Space Grotesk", var(--font-body);

  --color-primary: #2d519b;
  --color-primary-dark: #223f7a;
  --color-accent: #259bdb;

  --color-bg: #ffffff;
  --color-bg-alt: #f4f7fc;
  --color-surface: #ffffff;
  --color-text: #171b2b;
  --color-text-muted: #5b6478;
  --color-border: #e3e8f2;
  --color-tag-bg: #eef2fb;
  --color-tag-text: #2d519b;

  --shadow-sm: 0 1px 3px rgba(23, 27, 43, 0.06), 0 1px 2px rgba(23, 27, 43, 0.08);
  --shadow-md: 0 8px 24px rgba(23, 27, 43, 0.08);
  --shadow-lg: 0 20px 48px rgba(23, 27, 43, 0.12);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;

  --container-width: 1120px;
  --transition: 0.25s ease;
  --header-height: 76px;
}

body[data-theme="dark"] {
  --color-bg: #0b0f1a;
  --color-bg-alt: #121729;
  --color-surface: #151b2e;
  --color-text: #eef1f8;
  --color-text-muted: #a4acc4;
  --color-border: #262f47;
  --color-tag-bg: #1b2338;
  --color-tag-text: #7db6ea;
  --color-accent: #3fb2f0;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 20px 48px rgba(0, 0, 0, 0.55);
}

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

html {
  scroll-behavior: smooth;
  /* Offset sticky header so section titles aren't clipped on anchor jumps */
  scroll-padding-top: var(--header-height);
}

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  transition: background var(--transition), color var(--transition);
  -webkit-font-smoothing: antialiased;
}

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

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

ul { list-style: none; margin: 0; padding: 0; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 0.5em;
  letter-spacing: -0.01em;
}

p { margin: 0 0 1em; }

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--color-primary);
  color: #fff;
  padding: 12px 20px;
  border-radius: 0 0 8px 0;
  z-index: 1000;
}
.skip-link:focus { left: 0; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 13px 28px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition), color var(--transition), border-color var(--transition);
  border: 2px solid transparent;
  cursor: pointer;
}
.btn-primary {
  border: none;
  padding: 15px 30px; /* compensate for removed 2px border so size matches outline buttons */
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  color: #fff;
  box-shadow: var(--shadow-md);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.btn-outline {
  border-color: var(--color-border);
  color: var(--color-text);
}
.btn-outline:hover { border-color: var(--color-primary); color: var(--color-primary); transform: translateY(-2px); }

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--color-bg) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.site-header.is-scrolled {
  border-color: var(--color-border);
  box-shadow: var(--shadow-sm);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  height: 76px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.brand-mark { border-radius: 6px; }
.brand-mark-dark { display: none; }
body[data-theme="dark"] .brand-mark-light { display: none; }
body[data-theme="dark"] .brand-mark-dark { display: block; }

.brand-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  color: var(--color-text);
  white-space: nowrap;
}
.brand-role {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.main-nav ul { display: flex; gap: 28px; }
.main-nav a {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--color-text-muted);
  position: relative;
  padding: 4px 0;
  transition: color var(--transition);
}
.main-nav a:hover { color: var(--color-primary); }

.header-actions { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
  font-weight: 700;
  font-size: 0.75rem;
  transition: border-color var(--transition), transform var(--transition), color var(--transition);
}
.icon-btn:hover { border-color: var(--color-primary); color: var(--color-primary); transform: translateY(-1px); }

.icon-moon { display: none; }
body[data-theme="dark"] .icon-sun { display: none; }
body[data-theme="dark"] .icon-moon { display: block; }

.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  cursor: pointer;
}
.hamburger span {
  width: 18px;
  height: 2px;
  background: var(--color-text);
  border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
}

.mobile-nav {
  display: none;
  max-height: 0;
  overflow: hidden;
  background: var(--color-bg);
  border-bottom: 1px solid transparent;
  transition: max-height var(--transition), border-color var(--transition);
}
.mobile-nav.is-open { max-height: 400px; border-color: var(--color-border); }
.mobile-nav ul { padding: 12px 24px 20px; display: flex; flex-direction: column; gap: 4px; }
.mobile-nav a {
  display: block;
  padding: 12px 0;
  font-weight: 500;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
}

/* ---------- Hero ---------- */

.hero {
  padding: 72px 0 96px;
  background:
    radial-gradient(circle at 85% -10%, color-mix(in srgb, var(--color-accent) 18%, transparent), transparent 55%),
    radial-gradient(circle at -10% 110%, color-mix(in srgb, var(--color-primary) 14%, transparent), transparent 55%);
}

.hero-inner {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 56px;
  align-items: center;
}

.eyebrow {
  display: inline-block;
  font-weight: 600;
  color: var(--color-primary);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.8rem;
  margin-bottom: 12px;
}

.hero h1 {
  font-size: clamp(2.1rem, 4.2vw, 3.1rem);
  margin-bottom: 6px;
}

.hero-role {
  font-size: clamp(1.15rem, 2vw, 1.4rem);
  font-weight: 600;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 4px;
}

.hero-subrole {
  color: var(--color-text-muted);
  font-weight: 500;
  margin-bottom: 18px;
}

.hero-summary {
  color: var(--color-text-muted);
  max-width: 56ch;
  font-size: 1.02rem;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 28px;
  font-size: 0.92rem;
  color: var(--color-text-muted);
}
.meta-item { display: inline-flex; align-items: center; gap: 6px; }
.meta-item a:hover { color: var(--color-primary); }
.meta-item svg { color: var(--color-primary); flex-shrink: 0; }

.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 28px; }

.hero-socials { display: flex; gap: 14px; }
.hero-socials a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  transition: all var(--transition);
}
.hero-socials a:hover {
  color: #fff;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  border-color: transparent;
  transform: translateY(-2px);
}

.hero-photo { display: flex; justify-content: center; }
.photo-frame {
  position: relative;
  width: min(340px, 100%);
  aspect-ratio: 1 / 1;
  border-radius: 32px;
  padding: 8px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  box-shadow: var(--shadow-lg);
}
.photo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  border-radius: 26px;
  display: block;
}
.photo-placeholder {
  width: 100%;
  height: 100%;
  border-radius: 26px;
  background: var(--color-surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  padding: 24px;
}
.photo-initials {
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.photo-placeholder-label {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

/* ---------- Sections ---------- */

.section { padding: 88px 0; }
.section-alt { background: var(--color-bg-alt); }

.section-title {
  font-size: clamp(1.6rem, 2.6vw, 2.1rem);
  margin-bottom: 12px;
}
.section-lead {
  color: var(--color-text-muted);
  max-width: 62ch;
  margin-bottom: 40px;
}

.section, .project-card, .timeline-item, .education-card {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.section.is-visible, .project-card.is-visible, .timeline-item.is-visible, .education-card.is-visible {
  opacity: 1;
  transform: none;
}

/* ---------- About ---------- */

.about-grid { display: grid; gap: 24px; max-width: 900px; }
.about-text { color: var(--color-text-muted); font-size: 1.02rem; }

.about-highlights {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 12px;
}
.about-highlights li {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.about-highlights strong {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--color-primary);
}
.about-highlights span { color: var(--color-text-muted); font-size: 0.9rem; }

/* ---------- Timeline ---------- */

.subsection-title {
  font-size: 1.05rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  margin: 40px 0 20px;
}
.subsection-title:first-of-type { margin-top: 0; }

.timeline {
  position: relative;
  padding-left: 28px;
  border-left: 2px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.timeline-item { position: relative; }
.timeline-dot {
  position: absolute;
  left: -34px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  box-shadow: 0 0 0 4px var(--color-bg-alt), 0 0 0 5px var(--color-border);
}
.timeline-content {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 20px 24px;
}
.timeline-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
}
.timeline-head h4 { margin: 0; font-size: 1.05rem; }
.timeline-period {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-primary);
  white-space: nowrap;
}
.timeline-org {
  font-weight: 600;
  color: var(--color-text-muted);
  margin: 2px 0 10px;
  font-size: 0.92rem;
}
.timeline-content p:last-child { margin-bottom: 0; color: var(--color-text-muted); }

/* ---------- Projects ---------- */

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 32px;
}
.filter-btn {
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-muted);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.filter-btn:hover { border-color: var(--color-primary); color: var(--color-primary); }
.filter-btn.active {
  border: none;
  padding: 10px 19px; /* compensate for removed 1px border */
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  color: #fff;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

.project-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 26px;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.project-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: color-mix(in srgb, var(--color-primary) 40%, var(--color-border));
}
.project-card-head { margin-bottom: 10px; }
.project-card-head h3 { font-size: 1.15rem; margin-bottom: 2px; }
.project-client { font-size: 0.82rem; color: var(--color-primary); font-weight: 600; }
.project-card p { color: var(--color-text-muted); font-size: 0.93rem; }
.project-role { font-style: italic; font-size: 0.86rem !important; }

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
  padding-top: 14px;
}
.project-tags span {
  background: var(--color-tag-bg);
  color: var(--color-tag-text);
  font-size: 0.74rem;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
}

.project-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 16px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--color-primary);
  transition: color var(--transition), gap var(--transition);
}
.project-link::after {
  content: "→";
  transition: transform var(--transition);
}
.project-link:hover {
  color: var(--color-accent);
}
.project-link:hover::after {
  transform: translateX(3px);
}

/* ---------- Skills ---------- */

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 24px;
}
.skill-group {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 24px;
}
.skill-group h3 { font-size: 1rem; margin-bottom: 14px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-list li {
  background: var(--color-tag-bg);
  color: var(--color-tag-text);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 999px;
}

/* ---------- Education ---------- */

.education-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
}
.education-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-primary);
  border-radius: var(--radius-md);
  padding: 26px;
}
.education-card h3 { font-size: 1.08rem; margin-bottom: 6px; }
.education-org { color: var(--color-text-muted); margin-bottom: 4px; }
.education-grade { font-weight: 600; color: var(--color-primary); margin-bottom: 0; }

/* ---------- Contact ---------- */

.contact-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
}
.contact-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 22px;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
a.contact-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: color-mix(in srgb, var(--color-primary) 40%, var(--color-border));
}
.contact-card svg { color: var(--color-primary); flex-shrink: 0; }
.contact-card span { display: block; }
.contact-card strong { display: block; font-size: 0.95rem; margin-bottom: 2px; }
.contact-card span span { color: var(--color-text-muted); font-size: 0.88rem; word-break: break-word; }
.contact-card-static { cursor: default; }

/* ---------- Footer ---------- */

.site-footer {
  padding: 40px 0;
  border-top: 1px solid var(--color-border);
  background: var(--color-bg-alt);
}
.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}
.footer-logo-dark { display: none; }
body[data-theme="dark"] .footer-logo-light { display: none; }
body[data-theme="dark"] .footer-logo-dark { display: block; }
.footer-inner p { margin: 0; color: var(--color-text-muted); font-size: 0.85rem; }

/* ---------- Responsive ---------- */

@media (max-width: 960px) {
  .main-nav { display: none; }
  .hamburger { display: flex; }
  .mobile-nav { display: block; }
  .hero-inner { grid-template-columns: 1fr; }
  .hero-photo { order: -1; }
  .photo-frame { width: min(260px, 60%); margin: 0 auto; }
  .about-highlights { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  :root { --header-height: 68px; }
  .container { padding: 0 18px; }
  .section { padding: 64px 0; }
  .hero { padding: 48px 0 64px; }
  .header-inner { height: 68px; }
  .brand-role { display: none; }
  .timeline { padding-left: 22px; }
  .timeline-dot { left: -28px; }
}
