/**
 * ============================================================
 * Portfolio UI Systems & Open Source Inspirations
 * - React Bits (David Haz, MIT License): TechText, TextLoop, ParticleText, VariableProximity, TargetCursor
 * - Magic UI (Dorian Baffier, MIT License): Bento Grid & Border Beam
 * - Motion Primitives (Emil Kowalski, MIT License): Magnetic Buttons & Progressive Blur
 * - Aceternity UI (Manu Arora, MIT License for non-redistributed portfolio): Infinite Moving Cards & 3D Tilt
 * - Asciify & Uiverse.io (MIT License): Toast notification & clean elements
 * ============================================================
 */

/* Theme Variables */
:root {
  --paper: #FAF7FB;
  --surface: #FFFFFF;
  --ink: #160D24;
  --muted: #5E536E;
  --line: #E5DCED;
  --accent: #8B2FC9;
  --soft: #F4EBF7;
  --card-bg: rgba(255, 255, 255, 0.7);
  --ticker-bg-start: #FF9FC8;
  --ticker-bg-end: #B58CF5;
  --ticker-text: #3B0764;
  --ascii-bg: #FF9FC8;
  --ascii-ink: #3B0764;
  --ascii-acc: #6D28D9;
  --target-border: rgba(139, 47, 201, 0.5);
  --target-active: #8B2FC9;
  --hud-tag: #8B2FC9;
  color-scheme: light;
}

[data-theme="dark"] {
  --paper: #0B0714;
  --surface: #140D24;
  --ink: #F7EAF8;
  --muted: #A393B8;
  --line: #291B3D;
  --accent: #D946EF;
  --soft: #1E122E;
  --card-bg: rgba(20, 13, 36, 0.7);
  --ticker-bg-start: #2D0F3F;
  --ticker-bg-end: #4C1D95;
  --ticker-text: #FCE7F3;
  --ascii-bg: #140D24;
  --ascii-ink: #F7EAF8;
  --ascii-acc: #D946EF;
  --target-border: rgba(217, 70, 239, 0.6);
  --target-active: #D946EF;
  --hud-tag: #D946EF;
  color-scheme: dark;
}

/* Nav & Theme Toggle */
.nav-right {
  display: flex;
  align-items: center;
  gap: 20px;
}
.theme-toggle {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}
.theme-toggle:hover {
  background: var(--soft);
  border-color: var(--accent);
  color: var(--accent);
  transform: rotate(15deg);
}
.theme-toggle svg {
  position: absolute;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}
[data-theme="dark"] .theme-toggle .sun-icon {
  transform: translateY(0) scale(1);
  opacity: 1;
}
[data-theme="dark"] .theme-toggle .moon-icon {
  transform: translateY(24px) scale(0.5);
  opacity: 0;
}
:root:not([data-theme="dark"]) .theme-toggle .sun-icon {
  transform: translateY(-24px) scale(0.5);
  opacity: 0;
}
:root:not([data-theme="dark"]) .theme-toggle .moon-icon {
  transform: translateY(0) scale(1);
  opacity: 1;
}

/* 1. REACT BITS: TechText */
.tech-text-wrap {
  position: relative;
  display: block;
  max-width: 100%;
}
.tech-text {
  position: relative;
  display: inline-block;
  white-space: nowrap;
  max-width: 100%;
  margin: 0;
  padding: 0;
}
.tech-text .word {
  display: inline-block;
  white-space: nowrap;
}
.tech-char {
  display: inline-block;
  position: relative;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.15s ease;
  will-change: transform;
}
.tech-char:hover {
  transform: translateY(-3px) scale(1.08);
  color: var(--accent);
  text-shadow: 0 0 12px var(--accent);
}

/* 2. REACT BITS: TextLoop */
.text-loop-container {
  overflow: hidden;
  white-space: nowrap;
  margin: 0 calc(50% - 50vw);
  background: linear-gradient(90deg, var(--ticker-bg-start), var(--ticker-bg-end));
  padding: 12px 0;
  border-block: 1px solid var(--line);
  user-select: none;
  position: relative;
}
.text-loop-track {
  display: flex;
  width: max-content;
  will-change: transform;
}
.text-loop-content {
  display: flex;
  align-items: center;
  gap: 20px;
  padding-right: 20px;
  font: 600 15px var(--body);
  color: var(--ticker-text);
  letter-spacing: 0.02em;
}
.text-loop-content .star {
  opacity: 0.7;
}

/* 3. REACT BITS: ParticleText */
.particle-text-wrap {
  position: relative;
  width: 100%;
  max-width: 600px;
  height: 80px;
  margin-bottom: 16px;
}
#particle-canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: pointer;
}
.particle-link-sr {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

/* 4. REACT BITS: VariableProximity */
.vp-word {
  display: inline-block;
  white-space: pre-wrap;
  will-change: font-variation-settings;
}

/* 5. REACT BITS: TargetCursor */
.target-cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 28px;
  height: 28px;
  pointer-events: none;
  z-index: 999999;
  transform: translate(-50%, -50%);
  transition: width 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              height 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.2s ease,
              border-radius 0.25s ease;
  will-change: transform, width, height;
}
.tc-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5px;
  height: 5px;
  background: var(--target-active);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.tc-bracket {
  position: absolute;
  width: 8px;
  height: 8px;
  border: 2px solid var(--target-border);
  transition: all 0.2s ease;
}
.tc-tl { top: 0; left: 0; border-right: none; border-bottom: none; }
.tc-tr { top: 0; right: 0; border-left: none; border-bottom: none; }
.tc-bl { bottom: 0; left: 0; border-right: none; border-top: none; }
.tc-br { bottom: 0; right: 0; border-left: none; border-top: none; }

/* Target locked state */
.target-cursor.locked {
  border-radius: 6px;
}
.target-cursor.locked .tc-bracket {
  border-color: var(--target-active);
  width: 12px;
  height: 12px;
}
.target-cursor.locked .tc-dot {
  opacity: 0.4;
  transform: translate(-50%, -50%) scale(0.7);
}
.target-cursor.down .tc-bracket {
  transform: scale(0.85);
}

@media (pointer: coarse), (hover: none) {
  .target-cursor {
    display: none !important;
  }
}

/* 6. SCROLL ANIMATIONS: Parallax, Motion Blur & Section Reveals */
body {
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.parallax-layer {
  will-change: transform, filter;
}

/* Section entrance reveal */
.scroll-reveal {
  opacity: 0;
  transform: translateY(36px);
  filter: blur(10px);
  transition: opacity 0.85s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.85s cubic-bezier(0.16, 1, 0.3, 1),
              filter 0.85s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform, filter;
}
.scroll-reveal.revealed {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0px);
}

/* Row stagger animations */
.row {
  transition: transform 0.2s ease, border-color 0.2s ease;
}

/* 7. Featured Project Card (HealthBridge) */
.featured-project {
  position: relative;
  background: linear-gradient(135deg, rgba(139, 47, 201, 0.04), rgba(255, 159, 200, 0.07));
  border: 1px solid rgba(139, 47, 201, 0.22) !important;
  border-radius: 14px;
  padding: 32px !important;
  box-shadow: 0 4px 20px -4px rgba(139, 47, 201, 0.1), 0 0 0 1px rgba(139, 47, 201, 0.04);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease, border-color 0.25s ease;
}

/* 8. Portrait Backdrop & Shape Switcher */
.portrait-backdrop {
  position: absolute;
  left: 6%;
  right: 6%;
  top: 10%;
  bottom: 0;
  z-index: 1;
  background: linear-gradient(150deg, rgba(139, 47, 201, 0.28) 0%, rgba(255, 159, 200, 0.38) 100%);
  border: 1.5px solid rgba(139, 47, 201, 0.38);
  box-shadow: 0 12px 36px -6px rgba(139, 47, 201, 0.22), 0 0 30px rgba(255, 159, 200, 0.18);
  clip-path: polygon(50% 0%, 75% 6.7%, 93.3% 25%, 100% 50%, 100% 100%, 75% 100%, 50% 100%, 25% 100%, 0% 100%, 0% 50%, 6.7% 25%, 25% 6.7%);
  transition: clip-path 0.65s cubic-bezier(0.16, 1, 0.3, 1),
              background 0.3s ease,
              border-color 0.3s ease,
              box-shadow 0.3s ease;
  will-change: clip-path;
}

[data-theme="dark"] .portrait-backdrop {
  background: linear-gradient(150deg, rgba(76, 29, 149, 0.55) 0%, rgba(217, 70, 239, 0.28) 100%);
  border: 1.5px solid rgba(217, 70, 239, 0.4);
  box-shadow: 0 12px 40px -4px rgba(217, 70, 239, 0.32), 0 0 32px rgba(168, 85, 247, 0.25);
}

.portrait-backdrop.shape-arch {
  clip-path: polygon(50% 0%, 75% 6.7%, 93.3% 25%, 100% 50%, 100% 100%, 75% 100%, 50% 100%, 25% 100%, 0% 100%, 0% 50%, 6.7% 25%, 25% 6.7%);
}

.portrait-backdrop.shape-circle {
  clip-path: polygon(50% 0%, 75% 6.7%, 93.3% 25%, 100% 50%, 93.3% 75%, 75% 93.3%, 50% 100%, 25% 93.3%, 6.7% 75%, 0% 50%, 6.7% 25%, 25% 6.7%);
}

.portrait-backdrop.shape-hexagon {
  clip-path: polygon(50% 0%, 50% 0%, 93.3% 25%, 93.3% 25%, 93.3% 75%, 93.3% 75%, 50% 100%, 50% 100%, 6.7% 75%, 6.7% 75%, 6.7% 25%, 6.7% 25%);
}

.portrait-backdrop.shape-pill {
  clip-path: polygon(50% 0%, 75% 4%, 90% 12%, 90% 50%, 90% 88%, 75% 96%, 50% 100%, 25% 96%, 10% 88%, 10% 50%, 10% 12%, 25% 4%);
}

.portrait-subject {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: auto;
}

.portrait-subject canvas,
.portrait-subject img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  filter: contrast(1.04) brightness(1.02) saturate(0.96) hue-rotate(-6deg) drop-shadow(0 14px 28px rgba(45, 15, 65, 0.22));
}

[data-theme="dark"] .portrait-subject canvas,
[data-theme="dark"] .portrait-subject img {
  filter: contrast(1.06) brightness(0.98) saturate(0.95) hue-rotate(-8deg) drop-shadow(0 16px 36px rgba(15, 5, 25, 0.45));
}

.portrait-subject img {
  display: none;
}

.art.fallback .portrait-subject img {
  display: block;
}

.art.fallback .portrait-subject canvas {
  display: none;
}

[data-theme="dark"] .featured-project {
  background: linear-gradient(135deg, rgba(217, 70, 239, 0.06), rgba(76, 29, 149, 0.15));
  border: 1px solid rgba(217, 70, 239, 0.3) !important;
  box-shadow: 0 4px 24px -2px rgba(217, 70, 239, 0.14), 0 0 16px -2px rgba(217, 70, 239, 0.08);
}

.featured-project:hover {
  border-color: var(--accent) !important;
  box-shadow: 0 8px 30px -4px rgba(139, 47, 201, 0.22), 0 0 20px rgba(139, 47, 201, 0.12);
}

[data-theme="dark"] .featured-project:hover {
  box-shadow: 0 8px 32px -4px rgba(217, 70, 239, 0.28), 0 0 24px rgba(217, 70, 239, 0.18);
}

.pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--accent);
  border: 1px solid rgba(139, 47, 201, 0.2);
  white-space: nowrap;
}

[data-theme="dark"] .pill {
  background: rgba(217, 70, 239, 0.12);
  border-color: rgba(217, 70, 239, 0.3);
  color: var(--accent);
}

.project-desc {
  line-height: 1.55;
}

.project-stack {
  font-size: 13px;
  color: var(--muted);
  font-family: var(--body);
  font-weight: 500;
  margin-top: 8px;
  letter-spacing: 0.01em;
  line-height: 1.6;
}

.stack-item {
  display: inline-block;
  white-space: nowrap;
}

.stack-dot {
  display: inline-block;
  margin: 0 4px;
  opacity: 0.6;
}

.project-links {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  align-self: center;
  justify-content: flex-end;
}

.btn-demo {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff !important;
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.2s ease, opacity 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 2px 8px rgba(139, 47, 201, 0.25);
}

.btn-demo:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(139, 47, 201, 0.4);
}

.btn-demo .arrow {
  font-size: 12px;
  transition: transform 0.2s ease;
}

.btn-demo:hover .arrow {
  transform: translate(2px, -2px);
}

@media (max-width: 768px) {
  .bento-card,
  .featured-project.bento-card {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
    padding: 20px !important;
    align-items: stretch !important;
  }
  .project-links {
    width: 100%;
    margin-top: 10px;
    align-self: stretch;
    justify-content: stretch;
    flex-direction: column;
    gap: 8px;
  }
  .project-links a,
  .project-links .btn-demo,
  .project-links .btn-github {
    width: 100%;
    display: inline-flex;
    justify-content: center;
    box-sizing: border-box;
    text-align: center;
  }
}

/* 9. Bento Grid & Magic UI Border Beam */
.bento-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
}

.bento-card {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1.4fr auto;
  gap: 28px;
  align-items: center;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--card-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 32px !important;
  margin: 0;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease, border-color 0.25s ease;
  overflow: hidden;
}

.bento-card h3 {
  font: 700 20px var(--display);
  margin: 0;
}

.bento-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 10px 30px -6px rgba(139, 47, 201, 0.16);
}

[data-theme="dark"] .bento-card {
  background: rgba(20, 13, 36, 0.65);
  border-color: var(--line);
}

[data-theme="dark"] .bento-card:hover {
  box-shadow: 0 10px 32px -4px rgba(217, 70, 239, 0.22);
}

.bento-featured {
  background: linear-gradient(135deg, rgba(139, 47, 201, 0.05), rgba(255, 159, 200, 0.09));
  border-color: rgba(139, 47, 201, 0.35);
}

[data-theme="dark"] .bento-featured {
  background: linear-gradient(135deg, rgba(217, 70, 239, 0.08), rgba(76, 29, 149, 0.18));
  border-color: rgba(217, 70, 239, 0.38);
}

.border-beam {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  padding: 1.5px;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  -webkit-mask-composite: xor;
  z-index: 2;
  overflow: hidden;
}

.border-beam::after {
  content: "";
  position: absolute;
  inset: -100%;
  background: conic-gradient(from 0deg, transparent 0deg 300deg, var(--accent) 330deg, #FF9FC8 360deg);
  animation: border-beam-spin 6s linear infinite;
}

@keyframes border-beam-spin {
  to { transform: rotate(360deg); }
}

/* 10. Secondary Button (.btn-github) & Magnetic Buttons */
.btn-github {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 16px;
  border-radius: 999px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink) !important;
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.btn-github:hover {
  border-color: var(--accent);
  background: var(--soft);
  color: var(--accent) !important;
}

.magnetic {
  display: inline-flex;
  will-change: transform;
}

/* 11. Progressive Blur at Hero Bottom (Motion Primitives) */
.hero {
  position: relative;
}

.progressive-blur {
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 80px;
  pointer-events: none;
  z-index: 4;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  mask-image: linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0.4) 40%, black 100%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0.4) 40%, black 100%);
  transition: backdrop-filter 0.3s ease;
}

/* 12. Aceternity Infinite Moving Cards & 3D Tilt */
.highlights-sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.highlights-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.highlights-view-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 8px;
  background: var(--soft);
  border: 1px solid var(--line);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.highlights-view-toggle:hover {
  background: var(--paper);
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(139, 47, 201, 0.15);
}

.highlights-view-toggle.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 4px 14px rgba(139, 47, 201, 0.3);
}

.highlights-view-toggle svg {
  display: block;
}

.highlights-view-toggle .icon-tabs {
  display: none;
}

.highlights-view-toggle.active .icon-grid {
  display: none;
}

.highlights-view-toggle.active .icon-tabs {
  display: block;
}

/* Category Tabs */
.highlights-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.highlight-tab {
  font-family: var(--body);
  font-size: 12.5px;
  font-weight: 500;
  padding: 4px 11px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.highlight-tab:hover {
  color: var(--ink);
  border-color: var(--accent);
  background: var(--soft);
}

.highlight-tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(139, 47, 201, 0.25);
}

/* Link inside highlight card */
.highlight-project-link {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1.5px solid transparent;
  transition: border-color 0.2s ease, transform 0.15s ease, color 0.15s ease;
  position: relative;
  z-index: 2;
}

.highlight-project-link:hover {
  border-bottom-color: var(--accent);
  transform: translateY(-1px);
}

.highlight-project-link .arrow {
  font-size: 11px;
  display: inline-block;
  transition: transform 0.2s ease;
}

.highlight-project-link:hover .arrow {
  transform: translate(2px, -2px);
}

.infinite-cards-wrap {
  position: relative;
  overflow: hidden;
  margin: 0;
  padding: 12px 0;
  mask-image: linear-gradient(to right, transparent 0%, black 6%, black 94%, transparent 100%);
  -webkit-mask-image: linear-gradient(to right, transparent 0%, black 6%, black 94%, transparent 100%);
}

.infinite-cards-track {
  display: flex;
  gap: 20px;
  width: max-content;
  will-change: transform;
}

.tilt-card {
  width: 320px;
  flex-shrink: 0;
  perspective: 1000px;
  cursor: pointer;
}

.tilt-card-inner {
  background: var(--card-bg);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px 22px;
  height: 100%;
  transition: transform 0.15s ease-out, border-color 0.25s ease, box-shadow 0.25s ease;
  transform-style: preserve-3d;
  will-change: transform;
}

.tilt-card:hover .tilt-card-inner {
  border-color: var(--accent);
  box-shadow: 0 10px 30px -4px rgba(139, 47, 201, 0.22);
}

[data-theme="dark"] .tilt-card:hover .tilt-card-inner {
  box-shadow: 0 10px 32px -4px rgba(217, 70, 239, 0.26);
}

.tilt-card dt {
  font: 700 16px var(--display);
  color: var(--ink);
  margin-bottom: 6px;
}

.tilt-card dd {
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.5;
}

/* Highlights Grid Mode */
#highlights.view-grid .infinite-cards-wrap {
  overflow: visible;
  mask-image: none;
  -webkit-mask-image: none;
  padding: 4px 0 0;
}

#highlights.view-grid .infinite-cards-track {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  width: 100%;
  transform: none !important;
}

#highlights.view-grid .tilt-card {
  width: 100%;
}

#highlights.view-grid .tilt-card[aria-hidden="true"] {
  display: none !important;
}

@media (max-width: 820px) {
  .highlights-title-row {
    margin-bottom: 2px;
  }
  .highlights-tabs {
    margin-bottom: 4px;
  }
}

/* 13. Asciify Toast Notification */
.asciify-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(30px);
  background: var(--paper);
  color: var(--ink);
  border: 1.5px solid var(--accent);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2), 0 0 16px rgba(139, 47, 201, 0.25);
  padding: 10px 18px;
  border-radius: 999px;
  font: 600 13.5px "Courier New", monospace;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 1000000;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}

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

.asciify-toast .toast-icon {
  color: var(--accent);
}

/* 14. Responsive Mobile Navigation & Layout Enhancements */
@media (max-width: 640px) {
  .wrap {
    padding: 0 16px !important;
  }
  .nav-toggle {
    display: flex;
  }
  .nav-links {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    left: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    background: var(--card-bg);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
    z-index: 100;
  }
  .nav-links.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }
  .nav-links a {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 15px;
  }
  .nav-links a:hover,
  .nav-links a:focus-visible {
    background: var(--soft);
    color: var(--accent);
  }
  .highlights-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
    scrollbar-width: none;
  }
  .highlights-tabs::-webkit-scrollbar {
    display: none;
  }
  .particle-text-wrap {
    height: 60px;
  }
}

/* Prefers-reduced-motion overrides */
@media (prefers-reduced-motion: reduce) {
  .scroll-reveal {
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
    transition: none !important;
  }
  .parallax-layer {
    transform: none !important;
    filter: none !important;
  }
  .target-cursor {
    display: none !important;
  }
}

/* Portfolio refinement: shared contrast, spacing and focus treatment */
:root {
  --paper: #fbf9fc;
  --surface: #fff;
  --ink: #21142d;
  --muted: #665b72;
  --line: #e7deed;
  --accent: #7130a4;
  --accent-strong: #7130a4;
  --soft: #f2eaf7;
  --card-bg: #fff;
  --ticker-bg-start: #f1e6f8;
  --ticker-bg-end: #e9def4;
  --ticker-text: #3a2050;
  --ascii-ink: #372044;
  --ascii-acc: #7130a4;
  --target-border: rgb(113 48 164 / 45%);
  --target-active: #7130a4;
  --hud-tag: #7130a4;
  --space-section: clamp(52px, 7vw, 84px);
}
[data-theme="dark"] {
  --paper: #100b17;
  --surface: #191220;
  --ink: #f7f1fa;
  --muted: #b7a9c3;
  --line: #33263d;
  --accent: #c58be8;
  --accent-strong: #783d99;
  --soft: #24192d;
  --card-bg: #191220;
  --ticker-bg-start: #261832;
  --ticker-bg-end: #30203c;
  --ticker-text: #f3e8fa;
  --ascii-ink: #f3e8fa;
  --ascii-acc: #c58be8;
  --target-border: rgb(197 139 232 / 55%);
  --target-active: #d6a8ed;
  --hud-tag: #d6a8ed;
}

html { scroll-padding-top: 24px; }
body { transition: background-color .25s ease, color .25s ease; }
.nav-links a { position: relative; transition: color .18s ease, opacity .18s ease; }
.nav-links a:hover, .nav-links a:focus-visible { color: var(--accent); }
.nav-links a:focus-visible { outline-offset: 5px; }
.hero { isolation: isolate; gap: clamp(28px, 5vw, 64px); }
#hero-bg { position: absolute; inset: 0; height: 100%; z-index: -1; pointer-events: none; opacity: .34; mask-image: linear-gradient(to bottom, #000 0%, rgb(0 0 0 / 75%) 48%, transparent 100%); -webkit-mask-image: linear-gradient(to bottom, #000 0%, rgb(0 0 0 / 75%) 48%, transparent 100%); }
.hero > :not(#hero-bg) { position: relative; z-index: 1; }
.tech-text { font-size: clamp(2rem, 5.2vw, 4.2rem); letter-spacing: -.045em; }
.hero-lead { max-width: 20ch; font-size: clamp(1.3rem, 2.7vw, 2rem) !important; line-height: 1.18 !important; letter-spacing: -.025em !important; }
.tag { margin-top: 26px; }
.tag p:last-child { max-width: 42ch; margin-top: 14px; }
.hero-actions { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-top: 28px; }
.hero-cta { display: inline-flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 21px; border-radius: 999px; background: var(--accent-strong); color: #fff; font-weight: 600; text-decoration: none; transition: transform .2s ease, opacity .2s ease; }
.hero-cta:hover { transform: translateY(-2px); opacity: .9; }
.availability { display: inline-flex; align-items: center; gap: 9px; color: var(--muted); font-size: 13px; }
.availability span { width: 8px; height: 8px; border-radius: 50%; background: #3d9a69; }
.links { gap: 8px; margin-top: 19px; }
.links a { min-height: 34px; padding: 5px 11px; border: 0; color: var(--muted); font-size: 13px; }
.links a:hover { background: var(--soft); color: var(--accent); transform: translateY(-1px); }
.links a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.about > div { display: grid; grid-template-columns: minmax(0, 1fr) minmax(190px, .55fr); gap: clamp(24px, 5vw, 56px); align-items: start; }
.about-copy { max-width: 62ch; }
.about-copy p { max-width: 62ch; line-height: 1.72; }
.about-copy p + p { margin-top: 15px; }
.about-facts { border-top: 1px solid var(--line); }
.about-facts div { display: block; padding: 13px 0; border-bottom: 1px solid var(--line); }
.about-facts span { display: block; margin-bottom: 3px; color: var(--muted); font-size: 12px; }
.about-facts strong { font-size: 14px; font-weight: 600; line-height: 1.45; }
section { padding-block: var(--space-section); }
#projects { scroll-margin-top: 20px; }
.bento-card, .featured-project { padding: clamp(20px, 3vw, 30px) !important; border-radius: 18px; backdrop-filter: none; -webkit-backdrop-filter: none; }
.bento-card { gap: clamp(16px, 2.5vw, 28px); }
.bento-card h3 { font-size: 23px; letter-spacing: -.02em; }
.project-desc { max-width: 54ch; line-height: 1.58; }
.pill { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 26%, transparent); white-space: normal; }
.project-stack { margin-top: 12px; }
.btn-demo, .btn-github { min-height: 42px; padding: 9px 17px; transition: transform .2s ease, opacity .2s ease; }
.btn-demo { background: var(--accent-strong); }
.btn-github { border-color: var(--accent); background: var(--soft); color: var(--accent) !important; }
.btn-github:hover { background: var(--accent); color: #fff !important; }
.bento-grid > .more { align-self: flex-start; margin-top: 0; min-height: 46px; padding: 11px 19px; border-radius: 999px; background: var(--ink); color: var(--paper); text-decoration: none; transition: transform .2s ease, opacity .2s ease; }
.bento-grid > .more:hover { opacity: .88; transform: translateY(-2px); }
.border-beam::after { opacity: .55; animation-duration: 10s; }
.highlights-tabs { gap: 8px; }
.highlight-tab { min-height: 36px; padding: 6px 13px; font-size: 13px; transition: background-color .18s ease, color .18s ease, border-color .18s ease, opacity .18s ease; }
.highlight-tab.active { background: var(--accent-strong); border-color: var(--accent-strong); color: #fff; box-shadow: none; }
.highlight-tab:focus-visible, .highlights-view-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.tilt-card-inner { background: var(--surface); backdrop-filter: none; -webkit-backdrop-filter: none; border-radius: 16px; padding: 22px; }
.tilt-card[data-category="leadership"]:first-child .tilt-card-inner,
.tilt-card[data-category="leadership"]:nth-child(3) .tilt-card-inner,
.tilt-card[data-category="hackathons"]:nth-child(4) .tilt-card-inner,
.tilt-card[data-category="hackathons"]:nth-child(5) .tilt-card-inner { border-color: color-mix(in srgb, var(--accent) 48%, var(--line)); }
.tilt-card[data-category="hackathons"]:nth-child(6) .tilt-card-inner,
.tilt-card[data-category="badges"] .tilt-card-inner { opacity: .78; }
.contact-invitation { margin: 2px 0 18px; color: var(--muted); }
.contact .particle-text-wrap { margin-top: 16px; max-width: 520px; height: 56px; }
.contact #particle-canvas { cursor: default; }
.contact a.big { display: inline-block; border-bottom-width: 2px; }
.contact li a:hover, .contact li a:focus-visible { color: var(--accent); }
.contact ul { gap: 10px 22px; }
.asciify-toast { font-family: var(--body); box-shadow: 0 10px 30px rgb(0 0 0 / 14%); }

@media (max-width: 820px) {
  .about > div { grid-template-columns: 1fr; gap: 26px; }
  .about-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
  .about-facts div { padding: 12px 0; }
  .hero { gap: 30px; }
  .art { max-width: 340px; }
}
@media (max-width: 480px) {
  .wrap { padding-inline: 18px !important; }
  .tech-text { font-size: clamp(1.48rem, 7vw, 2rem); }
  .hero { padding-top: 24px; }
  .hero-lead { max-width: 19ch; }
  .about-facts { grid-template-columns: 1fr; gap: 0; }
  .about-facts div { padding: 10px 0; }
  .bento-card, .featured-project { padding: 20px !important; }
  .project-links { flex-direction: row; }
  .project-links a { width: auto; }
  .contact a.big { font-size: clamp(20px, 6vw, 30px); }
  .particle-text-wrap { height: 54px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
  .border-beam { display: none; }
}
