/* ==========================================================================
   Michele Banfi — Academic Portfolio Design System
   Modern, Minimalist, White-Themed Academic & Research Portfolio
   Inspired by danielepoterti.github.io (White/Black with Royal Blue Accents)
   ========================================================================== */

:root {
  /* Color Palette — Clean Light Theme */
  --bg: #ffffff;
  --bg-subtle: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #fcfdfd;
  --bg-tag: #f1f5f9;
  --bg-tag-hover: #e2e8f0;
  
  /* Text colors */
  --text-main: #0f172a;       /* Slate 900 */
  --text-body: #334155;       /* Slate 700 */
  --text-muted: #64748b;      /* Slate 500 */
  --text-faint: #94a3b8;      /* Slate 400 */
  
  /* Blue Accent System */
  --blue: #2563eb;            /* Royal Blue */
  --blue-ink: #1d4ed8;        /* High-contrast Cobalt/Sapphire Blue */
  --blue-dark: #1e40af;       /* Deep Navy Blue */
  --blue-wash: #eff6ff;       /* Soft Blue Tint */
  --blue-rule: #bfdbfe;       /* Subtle Blue Divider/Border */

  /* Semantic Aliases */
  --accent: var(--blue-ink);
  --accent-light: var(--blue-wash);
  --accent-border: var(--blue-rule);
  --accent-text: var(--blue-ink);
  
  /* Borders & Dividers */
  --border: #e2e8f0;          /* Slate 200 */
  --border-subtle: #f1f5f9;   /* Slate 100 */
  --border-focus: var(--blue);
  
  /* Elevation & Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.03);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.04), 0 2px 4px -2px rgba(0, 0, 0, 0.03);
  --shadow-hover: 0 8px 16px -2px rgba(0, 0, 0, 0.06);

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-serif: 'PT Serif', Georgia, Cambria, 'Times New Roman', Times, serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Consolas, Monaco, monospace;

  /* Layout */
  --max-width: 820px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-pill: 9999px;
  
  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  color: var(--text-body);
  background-color: var(--bg);
  line-height: 1.65;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  color: var(--text-main);
}

/* Interactive Canvas Background — Clean & Subtle */
#qec-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
  opacity: 0.65;
  /* Mask out canvas behind the main corpus text so the background behind content is pure white,
     rendering the interactive lattice animation solely along the left and right margins/edges */
  -webkit-mask-image: linear-gradient(
    to right,
    rgba(0, 0, 0, 1) 0%,
    rgba(0, 0, 0, 1) calc(50% - 480px),
    rgba(0, 0, 0, 0) calc(50% - 410px),
    rgba(0, 0, 0, 0) calc(50% + 410px),
    rgba(0, 0, 0, 1) calc(50% + 480px),
    rgba(0, 0, 0, 1) 100%
  );
  mask-image: linear-gradient(
    to right,
    rgba(0, 0, 0, 1) 0%,
    rgba(0, 0, 0, 1) calc(50% - 480px),
    rgba(0, 0, 0, 0) calc(50% - 410px),
    rgba(0, 0, 0, 0) calc(50% + 410px),
    rgba(0, 0, 0, 1) calc(50% + 480px),
    rgba(0, 0, 0, 1) 100%
  );
}

/* App Container */
.page-wrapper {
  position: relative;
  z-index: 1;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 3.5rem 1.5rem 5rem 1.5rem;
  background-color: var(--bg);
}

/* --------------------------------------------------------------------------
   Header & Navigation
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 0;
}

.nav-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.15rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--text-main);
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
  transition: color var(--transition-fast);
}

.brand:hover {
  color: var(--blue-ink);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  list-style: none;
}

.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  transition: color var(--transition-fast);
}

.nav-link:hover {
  color: var(--blue-ink);
}

.nav-divider {
  width: 1px;
  height: 16px;
  background-color: var(--border);
}

.nav-icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition-fast), transform var(--transition-fast);
}

.nav-icon-link:hover {
  color: var(--blue-ink);
  transform: translateY(-1px);
}

.nav-icon-link svg {
  width: 18px;
  height: 18px;
}

/* --------------------------------------------------------------------------
   Hero Section
   -------------------------------------------------------------------------- */
.hero-section {
  margin-bottom: 4rem;
}

.hero-header {
  margin-bottom: 1.25rem;
}

.hero-name {
  font-family: var(--font-serif);
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.015em;
  line-height: 1.2;
  margin-bottom: 0.45rem;
}

.hero-title {
  font-size: 1.1rem;
  color: var(--text-muted);
  font-weight: 400;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.affiliation-link {
  color: var(--blue-ink);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: rgba(29, 78, 216, 0.35);
  text-underline-offset: 3px;
  transition: color var(--transition-fast), text-decoration-color var(--transition-fast);
}

.affiliation-link:hover {
  color: var(--blue);
  text-decoration-color: var(--blue);
}

.hero-bio {
  font-size: 1.05rem;
  color: var(--text-body);
  line-height: 1.7;
  margin-bottom: 1.85rem;
}

.hero-bio p + p {
  margin-top: 0.85rem;
}

.hero-bio strong {
  color: var(--text-main);
  font-weight: 600;
}

.hero-bio a {
  color: var(--blue-ink);
  text-decoration: underline;
  text-decoration-color: rgba(29, 78, 216, 0.35);
  text-underline-offset: 3px;
  transition: color var(--transition-fast), text-decoration-color var(--transition-fast);
}

.hero-bio a:hover {
  color: var(--blue);
  text-decoration-color: var(--blue);
}

/* Hero Interests Bullet List */
.hero-interests {
  list-style: none;
  padding: 0;
  margin: 1rem 0 1.25rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.hero-interests li {
  position: relative;
  padding-left: 1.35rem;
  font-size: 0.98rem;
  line-height: 1.6;
  color: var(--text-body);
}

.hero-interests li::before {
  content: '•';
  position: absolute;
  left: 0.2rem;
  top: 0;
  color: var(--blue-ink);
  font-size: 1.2rem;
  line-height: 1.5;
}

.hero-social-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.25rem;
  margin-top: 1.25rem;
}

.hero-social-link {
  color: var(--blue-ink);
  font-size: 0.96rem;
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: rgba(29, 78, 216, 0.4);
  text-underline-offset: 4px;
  transition: color var(--transition-fast), text-decoration-color var(--transition-fast);
}

.hero-social-link:hover {
  color: var(--blue);
  text-decoration-color: var(--blue);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  font-family: inherit;
}

.btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.btn-primary {
  background-color: var(--text-main);
  color: #ffffff;
  border-color: var(--text-main);
}

.btn-primary:hover {
  background-color: var(--blue-ink);
  border-color: var(--blue-ink);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.btn-outline {
  background-color: var(--bg-card);
  color: var(--text-body);
  border-color: var(--border);
}

.btn-outline:hover {
  border-color: var(--blue-rule);
  color: var(--blue-ink);
  background-color: var(--blue-wash);
  transform: translateY(-1px);
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

/* --------------------------------------------------------------------------
   Section Structure & Typography
   -------------------------------------------------------------------------- */
.section {
  margin-bottom: 4.5rem;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.section-title {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.section-subtitle {
  font-size: 0.88rem;
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   Publications Component
   -------------------------------------------------------------------------- */
.pub-toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 1.75rem;
}

.search-box {
  position: relative;
  width: 100%;
}

.search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  pointer-events: none;
}

.search-icon svg {
  width: 16px;
  height: 16px;
}

.search-input {
  width: 100%;
  padding: 0.6rem 2.4rem 0.6rem 2.35rem;
  background-color: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-family: inherit;
  color: var(--text-main);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.search-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-wash);
}

.search-input::placeholder {
  color: var(--text-faint);
}

.search-clear {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  padding: 0.2rem;
  display: none;
  align-items: center;
  justify-content: center;
}

.search-clear:hover {
  color: var(--text-main);
}

.filter-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.filter-btn {
  background-color: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
}

.filter-btn:hover {
  border-color: var(--blue-rule);
  color: var(--blue-ink);
}

.filter-btn.active {
  background-color: var(--blue-ink);
  color: #ffffff;
  border-color: var(--blue-ink);
}

/* Publication List & Cards */
.pub-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.pub-item {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.35rem 1.5rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.pub-item:hover {
  border-color: var(--blue-rule);
  box-shadow: var(--shadow-sm);
}

.pub-item.hidden {
  display: none;
}

.pub-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.pub-badge {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  background-color: var(--blue-wash);
  color: var(--blue-ink);
  border: 1px solid var(--blue-rule);
}

.pub-year {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-faint);
}

.pub-title {
  font-family: var(--font-serif);
  font-size: 1.18rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.45;
  margin-bottom: 0.45rem;
  letter-spacing: -0.01em;
}

.pub-title a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-fast);
}

.pub-title a:hover {
  color: var(--blue-ink);
}

.pub-authors {
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 0.85rem;
}

.pub-authors .author-me {
  color: var(--blue-ink);
  font-weight: 700;
}

.pub-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.tag {
  font-size: 0.73rem;
  background-color: var(--bg-tag);
  color: var(--text-body);
  padding: 0.18rem 0.5rem;
  border-radius: var(--radius-sm);
  font-weight: 500;
}

.pub-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

/* Expandable Drawer (Abstract & BibTeX) */
.pub-drawer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s cubic-bezier(0, 1, 0, 1), opacity 0.25s ease;
  opacity: 0;
}

.pub-drawer.open {
  max-height: 500px;
  transition: max-height 0.35s ease-in-out, opacity 0.3s ease;
  opacity: 1;
}

.abstract-content {
  margin-top: 1rem;
  padding: 1rem 1.15rem;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  color: var(--text-body);
  line-height: 1.65;
}

.bibtex-wrapper {
  position: relative;
  margin-top: 1rem;
}

.bibtex-content {
  background-color: #0f172a;
  color: #e2e8f0;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.6;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  overflow-x: auto;
  white-space: pre;
}

.bibtex-copy-btn {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0.25rem 0.55rem;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: background var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.bibtex-copy-btn:hover {
  background: rgba(255, 255, 255, 0.22);
}

.no-results {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
  font-size: 0.95rem;
  display: none;
}

/* --------------------------------------------------------------------------
   Projects & Code
   -------------------------------------------------------------------------- */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.project-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  text-decoration: none;
  color: inherit;
  transition: border-color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
}

.project-card:hover {
  border-color: var(--blue-rule);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px -2px rgba(29, 78, 216, 0.06);
}

.project-top {
  margin-bottom: 1rem;
}

.project-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.4rem;
}

.project-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-main);
  font-family: var(--font-mono);
  transition: color var(--transition-fast);
}

.project-card:hover .project-name {
  color: var(--blue-ink);
}

.project-arrow {
  color: var(--text-faint);
  transition: transform var(--transition-fast), color var(--transition-fast);
}

.project-card:hover .project-arrow {
  color: var(--blue-ink);
  transform: translate(2px, -2px);
}

.project-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.project-footer {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-faint);
  font-family: var(--font-mono);
}

.project-lang-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.lang-python { background-color: #3572A5; }
.lang-cpp { background-color: #f34b7d; }
.lang-rust { background-color: #dea584; }
.lang-swift { background-color: #f05138; }

/* --------------------------------------------------------------------------
   Libraries Section
   -------------------------------------------------------------------------- */
.library-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.4rem 1.6rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.library-card:hover {
  border-color: var(--blue-rule);
  box-shadow: 0 4px 12px -2px rgba(29, 78, 216, 0.06);
}

.library-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.library-name {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  font-family: var(--font-mono);
  letter-spacing: -0.01em;
}

.library-name a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-fast);
}

.library-name a:hover {
  color: var(--blue-ink);
}

.pip-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: #0f172a;
  color: #e2e8f0;
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  margin: 0.85rem 0;
}

.pip-cmd {
  user-select: all;
  white-space: nowrap;
  overflow-x: auto;
}

.pip-copy {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  font-size: 0.72rem;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast);
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-left: 0.75rem;
  flex-shrink: 0;
}

.pip-copy:hover {
  background: rgba(255, 255, 255, 0.22);
}

.library-desc {
  font-size: 0.92rem;
  color: var(--text-body);
  line-height: 1.6;
  margin-bottom: 0.85rem;
}

/* --------------------------------------------------------------------------
   External Projects / Badge Styling
   -------------------------------------------------------------------------- */
.project-role-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--blue-ink);
  background: var(--blue-wash);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-pill);
  margin-bottom: 0.5rem;
  border: 1px solid var(--blue-rule);
}

/* --------------------------------------------------------------------------
   Timeline / Experience & Academic Background
   -------------------------------------------------------------------------- */
.section-subheading {
  font-family: var(--font-serif);
  font-size: 1.12rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 1.75rem 0 1rem 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.timeline {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  position: relative;
  margin-bottom: 2rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background-color: var(--border);
}

.timeline-item {
  position: relative;
  padding-left: 1.75rem;
}

.timeline-dot {
  position: absolute;
  left: 0;
  top: 7px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: var(--bg);
  border: 2px solid var(--blue-ink);
}

.timeline-period {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.timeline-role {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.timeline-org {
  font-size: 0.9rem;
  color: var(--text-body);
  margin-top: 0.1rem;
}



.timeline-desc {
  font-size: 0.86rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
  line-height: 1.55;
}

.timeline-thesis {
  font-size: 0.86rem;
  color: var(--text-body);
  margin-top: 0.35rem;
}

.timeline-competencies {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.4rem;
}

.competency-tag {
  font-size: 0.74rem;
  font-family: var(--font-mono);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-sm);
}

/* --------------------------------------------------------------------------
   Contact & Footer
   -------------------------------------------------------------------------- */
.contact-card {
  background-color: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.contact-text {
  font-size: 0.95rem;
  color: var(--text-body);
}

.contact-links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.75rem;
}

.contact-link-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text-main);
  font-size: 0.88rem;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.contact-link-item > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-link-item:hover {
  border-color: var(--blue-rule);
  color: var(--blue-ink);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px -2px rgba(29, 78, 216, 0.08);
}

.contact-arrow {
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.95rem;
  flex-shrink: 0;
  margin-left: 0.5rem;
  transition: transform var(--transition-fast), color var(--transition-fast);
}

.contact-link-item:hover .contact-arrow {
  color: var(--blue-ink);
  transform: translate(2px, -2px);
}

.site-footer {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  color: var(--text-faint);
}

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

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.footer-links a:hover {
  color: var(--blue-ink);
}

/* --------------------------------------------------------------------------
   Floating Controls (Animation Toggle & Back to Top)
   -------------------------------------------------------------------------- */
.floating-controls {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 90;
}

.floating-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.floating-btn:hover {
  color: var(--blue-ink);
  border-color: var(--blue-rule);
  transform: translateY(-2px);
}

.floating-btn svg {
  width: 16px;
  height: 16px;
}

/* Toast notification */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #0f172a;
  color: #fff;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
  z-index: 1000;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* --------------------------------------------------------------------------
   Responsive Adjustments
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
  #qec-canvas {
    -webkit-mask-image: linear-gradient(
      to right,
      rgba(0, 0, 0, 0.85) 0%,
      rgba(0, 0, 0, 0) 36px,
      rgba(0, 0, 0, 0) calc(100% - 36px),
      rgba(0, 0, 0, 0.85) 100%
    );
    mask-image: linear-gradient(
      to right,
      rgba(0, 0, 0, 0.85) 0%,
      rgba(0, 0, 0, 0) 36px,
      rgba(0, 0, 0, 0) calc(100% - 36px),
      rgba(0, 0, 0, 0.85) 100%
    );
  }
}

@media (max-width: 680px) {
  .page-wrapper {
    padding: 2.25rem 1.15rem 4rem 1.15rem;
  }

  .nav-container {
    padding: 0.9rem 1.15rem;
    gap: 0.75rem;
  }

  .nav-links {
    gap: 0.85rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .nav-link {
    font-size: 0.84rem;
    white-space: nowrap;
  }

  .hero-name {
    font-size: 1.95rem;
  }

  .hero-title {
    font-size: 0.98rem;
  }

  .hero-social-links {
    gap: 0.75rem 1.15rem;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }

  .pub-item {
    padding: 1.15rem;
  }

  .site-footer {
    flex-direction: column;
    gap: 0.75rem;
    align-items: flex-start;
  }
}
