/* ==========================================================================
   Prem Patel — Hybrid Developer Portfolio & Academic Résumé
   Synthesizing minimal-light-theme.yliu.me (Static Sidebar) &
   jrosser.co.uk (Isometric 3D Voxel Logo, Confetti Explosion, JetBrains Mono)
   ========================================================================== */

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

html {
  color-scheme: light dark;
  scrollbar-gutter: stable;
  scroll-behavior: smooth;
  font-size: 15px;
}

:root {
  /* Light Theme */
  --bg: #ffffff;
  --bg-subtle: #f8f9fa;
  --bg-card: #ffffff;
  --text: #1a1e24;
  --text-muted: #4b5563;
  --text-subtle: #6b7280;
  --border: #e5e7eb;
  --border-subtle: #f3f4f6;

  --accent-green: #0cbe3b;
  --accent-purple: #8a3ffc;
  --accent-pipe: #af67ff;
  --link-color: #4f46e5;

  --tag-bg: #f3f4f6;
  --tag-text: #374151;
  --tag-border: #e5e7eb;

  --badge-bg: #fef3c7;
  --badge-text: #92400e;
  --badge-border: #fde68a;

  --font-mono: 'JetBrains Mono', ui-monospace, Menlo, Monaco, Consolas, monospace;
}

[data-theme="dark"] {
  /* Dark Theme */
  --bg: #12151a;
  --bg-subtle: #181d24;
  --bg-card: #161b22;
  --text: #f0f3f6;
  --text-muted: #9ca3af;
  --text-subtle: #6b7280;
  --border: #262e3b;
  --border-subtle: #1c232e;

  --accent-green: #5ff26b;
  --accent-purple: #af67ff;
  --accent-pipe: #af67ff;
  --link-color: #5ff26b;

  --tag-bg: #1c232e;
  --tag-text: #d1d5db;
  --tag-border: #2a3545;

  --badge-bg: #272212;
  --badge-text: #fcd34d;
  --badge-border: #453715;
}

/* --------------------------------------------------------------------------
   Base Styles
   -------------------------------------------------------------------------- */
body {
  font-family: var(--font-mono);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding-top: 4.5rem;
  padding-bottom: 4rem;
  transition: background-color 0.15s ease, color 0.15s ease;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--link-color);
}

.link {
  color: var(--link-color);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.link:hover {
  opacity: 0.8;
}

/* --------------------------------------------------------------------------
   Top Sticky Header (J Rosser style)
   -------------------------------------------------------------------------- */
#header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 4rem;
  background-color: var(--bg);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.header-container {
  max-width: 68rem;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-brand-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Isometric Voxel Logo Button */
.voxel-logo-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  outline: none;
}

.voxel-logo-btn:hover {
  transform: scale(1.1) rotate(-3deg);
}

.voxel-logo-btn:active {
  transform: scale(0.95);
}

.voxel-logo-svg {
  width: 32px;
  height: 38px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.header-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}

/* Pipe-separated Nav (Image 2) */
.header-nav {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  font-size: 0.9rem;
  font-weight: 500;
}

.header-nav a {
  color: var(--accent-pipe);
  transition: opacity 0.15s ease;
}

.header-nav a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
  opacity: 0.85;
}

.nav-pipe {
  color: var(--accent-pipe);
  opacity: 0.6;
  font-weight: 300;
  user-select: none;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-minimal {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 0.6rem;
  border-radius: 4px;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-minimal:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

.theme-toggle-btn {
  padding: 0.35rem 0.5rem;
  min-width: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --------------------------------------------------------------------------
   Two-Column Minimal-Light Layout
   -------------------------------------------------------------------------- */
.site-wrapper {
  max-width: 68rem;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 0 1.5rem;
  display: flex;
  gap: 3.5rem;
  align-items: flex-start;
}

/* Static Left Sidebar (Minimal Light Style - Image 4) */
.sidebar {
  width: 230px;
  flex-shrink: 0;
  position: -webkit-sticky;
  position: sticky;
  top: 5.5rem;
  align-self: flex-start;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.sidebar-avatar {
  margin-bottom: 1.15rem;
}

.sidebar-avatar img {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 20%;
  border: 2px solid var(--border);
  background-color: var(--bg-subtle);
  display: block;
}

.sidebar-name {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 0.35rem;
  color: var(--text);
}

.sidebar-position {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.sidebar-affiliation {
  font-size: 0.825rem;
  color: var(--text-subtle);
  margin-bottom: 1.15rem;
}

.sidebar-email {
  font-size: 0.775rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.sidebar-email button {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.sidebar-email button:hover {
  color: var(--link-color);
}

/* Minimal Light Social Icons Row (Image 4) */
.sidebar-social {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.sidebar-icon-link {
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.sidebar-icon-link:hover {
  color: var(--link-color);
  background-color: var(--bg-subtle);
  transform: translateY(-2px);
}

.sidebar-icon-link svg {
  width: 19px;
  height: 19px;
  fill: currentColor;
}

/* Right Main Content Column */
.main-content {
  flex: 1;
  min-width: 0;
}

/* --------------------------------------------------------------------------
   Hero / About Section (with Image 1 Inline Labeled Icons)
   -------------------------------------------------------------------------- */
.hero-greeting h2 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  min-height: 2.3rem;
}

.typewriter-cursor {
  display: inline-block;
  width: 3px;
  height: 1.15em;
  background-color: var(--link-color);
  margin-left: 4px;
  border-radius: 1px;
  animation: cursor-blink 0.85s infinite;
  vertical-align: middle;
}

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

@media (prefers-reduced-motion: reduce) {
  .typewriter-cursor {
    animation: none;
  }
}

/* Image 1 Icon Bar with Text Labels */
.labeled-icons-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem 0.9rem;
  margin-bottom: 1.25rem;
  font-size: 0.825rem;
}

.labeled-icon {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-muted);
  transition: color 0.15s ease;
}

.labeled-icon:hover {
  color: var(--link-color);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.labeled-icon svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
  flex-shrink: 0;
}

/* Bio Prose */
.bio-prose {
  font-size: 0.925rem;
  color: var(--text-muted);
  line-height: 1.75;
}

.bio-prose p {
  margin-bottom: 1rem;
}

.bio-prose p:last-child {
  margin-bottom: 0;
}

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

/* --------------------------------------------------------------------------
   Sections
   -------------------------------------------------------------------------- */
.section {
  padding-top: 2.5rem;
  padding-bottom: 1rem;
}

.section:first-child {
  padding-top: 0.5rem;
}

.section-heading {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 1.25rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.section-subtext {
  font-size: 0.775rem;
  font-weight: 400;
  color: var(--text-subtle);
}

/* --------------------------------------------------------------------------
   Projects (Clean Structured Cards)
   -------------------------------------------------------------------------- */
.project-card {
  padding: 1.25rem;
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 1.25rem;
  transition: border-color 0.15s ease;
}

.project-card:hover {
  border-color: var(--text-muted);
}

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

.project-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.project-title a:hover {
  color: var(--link-color);
  text-decoration: underline;
}

.badge {
  font-size: 0.725rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  background-color: var(--badge-bg);
  color: var(--badge-text);
  border: 1px solid var(--badge-border);
  white-space: nowrap;
}

.project-meta {
  font-size: 0.8rem;
  color: var(--text-subtle);
  margin-bottom: 0.6rem;
}

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

.tag {
  font-size: 0.7rem;
  font-weight: 500;
  padding: 0.15rem 0.45rem;
  border-radius: 3px;
  background-color: var(--tag-bg);
  border: 1px solid var(--tag-border);
  color: var(--tag-text);
}

.project-bullets {
  list-style: none;
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 0.85rem;
}

.project-bullets li {
  position: relative;
  padding-left: 1.15rem;
  line-height: 1.55;
}

.project-bullets li::before {
  content: "•";
  position: absolute;
  left: 0.2rem;
  color: var(--link-color);
  font-size: 1rem;
  line-height: 1.4;
}

.project-bullets strong {
  color: var(--text);
  font-weight: 600;
}

.project-links {
  display: flex;
  gap: 0.6rem;
  font-size: 0.775rem;
  margin-top: 0.5rem;
}

.action-link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.55rem;
  border-radius: 3px;
  border: 1px solid var(--border);
  background-color: var(--bg-subtle);
  color: var(--text-muted);
  font-weight: 600;
}

.action-link:hover {
  border-color: var(--text-muted);
  color: var(--text);
}

/* --------------------------------------------------------------------------
   Vertical Connected Timeline (J Rosser Style)
   -------------------------------------------------------------------------- */
.timeline {
  position: relative;
  padding-left: 1.5rem;
  margin-top: 0.75rem;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 0.35rem;
  top: 0.5rem;
  bottom: 0.5rem;
  width: 1px;
  background-color: var(--border);
}

.timeline-entry {
  position: relative;
  padding-bottom: 1.75rem;
}

.timeline-entry:last-child {
  padding-bottom: 0;
}

.timeline-node {
  position: absolute;
  left: -1.5rem;
  top: 0.45rem;
  transform: translateX(calc(0.35rem - 3.5px));
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent-purple);
}

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

.timeline-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

.timeline-date {
  font-size: 0.775rem;
  color: var(--text-subtle);
  white-space: nowrap;
}

.timeline-subtitle {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.timeline-body {
  font-size: 0.825rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.timeline-body strong {
  color: var(--text);
}

.timeline-body ul {
  list-style: none;
  margin-top: 0.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.timeline-body li {
  position: relative;
  padding-left: 1rem;
}

.timeline-body li::before {
  content: "–";
  position: absolute;
  left: 0;
  color: var(--text-subtle);
}

/* --------------------------------------------------------------------------
   Skills Grid
   -------------------------------------------------------------------------- */
.skills-block {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.skill-col {
  padding: 1rem;
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.skill-col h3 {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.6rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--border-subtle);
}

.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.skill-pill {
  font-size: 0.75rem;
  padding: 0.15rem 0.45rem;
  border-radius: 3px;
  background-color: var(--tag-bg);
  border: 1px solid var(--tag-border);
  color: var(--tag-text);
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.site-footer {
  max-width: 68rem;
  margin: 3.5rem auto 0 auto;
  padding: 1.5rem 1.5rem 0 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.site-footer a {
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.site-footer a:hover {
  color: var(--link-color);
}

/* --------------------------------------------------------------------------
   Party Hat Explosion Easter Egg (Image 3)
   -------------------------------------------------------------------------- */
.party-particle {
  position: fixed;
  pointer-events: none;
  z-index: 99999;
  transform-origin: center center;
  animation: partyFly 1.2s cubic-bezier(0.12, 0.8, 0.32, 1) forwards;
}

.party-dot {
  border-radius: 50%;
}

@keyframes partyFly {
  0% {
    opacity: 1;
    transform: translate(0, 0) scale(0.4) rotate(0deg);
  }
  25% {
    opacity: 1;
    transform: translate(calc(var(--dx) * 0.4), calc(var(--dy) * 0.4)) scale(1.25) rotate(calc(var(--rot) * 0.4));
  }
  100% {
    opacity: 0;
    transform: translate(var(--dx), calc(var(--dy) + 40px)) scale(0.6) rotate(var(--rot));
  }
}

.party-bounce {
  animation: partyBounce 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes partyBounce {
  0% { transform: scale(1); }
  50% { transform: scale(1.3) rotate(-8deg); }
  100% { transform: scale(1); }
}

/* Toast */
#toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(50px);
  background-color: var(--text);
  color: var(--bg);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.4rem 0.9rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s ease;
  z-index: 1000;
}

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

/* --------------------------------------------------------------------------
   Writing / Blog Section (Anthropic Style Numbered Previews)
   -------------------------------------------------------------------------- */
.section-intro-text {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.blog-preview-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.blog-preview-item {
  display: block;
  border-top: 1px solid var(--border);
  padding: 1.15rem 0.5rem 0.5rem 0.5rem;
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.blog-preview-item:hover {
  border-top-color: var(--accent-pipe);
  transform: translateX(4px);
}

.blog-preview-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}

.blog-preview-num {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent-pipe);
}

.blog-preview-tag {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.blog-preview-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.45rem;
  letter-spacing: -0.01em;
}

.blog-preview-item:hover .blog-preview-title {
  color: var(--link-color);
}

.blog-preview-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 0.65rem;
}

.blog-preview-link {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--link-color);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.blog-section-cta {
  display: flex;
  justify-content: flex-start;
  margin-top: 1.25rem;
}

.btn-all-posts {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.65rem 1.15rem;
  border-radius: 6px;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  transition: all 0.15s ease;
}

.btn-all-posts:hover {
  background-color: var(--border-subtle);
  border-color: var(--text-muted);
  transform: translateY(-2px);
  color: var(--link-color);
}

/* --------------------------------------------------------------------------
   Responsive Layout (Mobile, Tablet, Desktop)
   -------------------------------------------------------------------------- */

/* Prevent horizontal overflow on any device without breaking position: sticky */
html, body {
  overflow-x: clip;
}

/* Tablets Landscape & Small Laptops (1024px and down) */
@media (max-width: 1024px) {
  .site-wrapper {
    gap: 2.25rem;
    padding: 1.5rem 1.25rem 0 1.25rem;
  }

  .sidebar {
    width: 200px;
  }
}

/* Tablets Portrait (900px and down) */
@media (max-width: 900px) {
  .site-wrapper {
    flex-direction: column;
    gap: 1.75rem;
  }

  .sidebar {
    width: 100%;
    position: static;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1.5rem;
  }
}

/* Specific Tablet Card Mode (641px to 900px) */
@media (min-width: 641px) and (max-width: 900px) {
  .sidebar {
    flex-direction: row;
    text-align: left;
    align-items: center;
    justify-content: flex-start;
    gap: 1.75rem;
  }

  .sidebar-avatar {
    margin-bottom: 0;
    flex-shrink: 0;
  }

  .sidebar-avatar img {
    width: 105px;
    height: 105px;
  }

  .sidebar-details {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
  }

  .sidebar-social {
    justify-content: flex-start;
    margin-top: 0.35rem;
  }
}

/* Mobile Phones (640px and down) */
@media (max-width: 640px) {
  body {
    padding-top: 5.6rem;
  }

  #header {
    height: auto;
    min-height: 3.4rem;
    padding: 0.35rem 0;
  }

  .header-container {
    padding: 0 0.85rem;
    flex-wrap: wrap;
    gap: 0.35rem;
  }

  .header-brand-group {
    gap: 0.5rem;
  }

  .voxel-logo-svg {
    width: 26px;
    height: 32px;
  }

  .header-title {
    font-size: 1.05rem;
  }

  .header-nav {
    display: flex;
    order: 3;
    width: 100%;
    justify-content: space-around;
    padding-top: 0.35rem;
    border-top: 1px solid var(--border-subtle);
    font-size: 0.82rem;
    gap: 0.25rem;
  }

  .nav-pipe {
    opacity: 0.4;
  }

  .site-wrapper {
    padding: 1rem 0.85rem 0 0.85rem;
    gap: 1.5rem;
  }

  .sidebar {
    padding-bottom: 1.25rem;
    gap: 0.5rem;
  }

  .sidebar-avatar {
    margin-bottom: 0.65rem;
  }

  .sidebar-avatar img {
    width: 92px;
    height: 92px;
  }

  .sidebar-name {
    font-size: 1.25rem;
  }

  .sidebar-position {
    font-size: 0.85rem;
  }

  .sidebar-affiliation {
    font-size: 0.78rem;
  }

  .sidebar-social {
    gap: 0.5rem;
  }

  .sidebar-icon-link {
    width: 36px;
    height: 36px;
  }

  .hero-greeting h2 {
    font-size: 1.45rem;
    margin-bottom: 0.75rem;
  }

  .bio-prose {
    font-size: 0.9rem;
    line-height: 1.6;
  }

  .project-card {
    padding: 1rem;
    margin-bottom: 1rem;
  }

  .project-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }

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

  .badge {
    font-size: 0.68rem;
    padding: 0.12rem 0.4rem;
  }

  .project-meta {
    font-size: 0.76rem;
    margin-bottom: 0.5rem;
  }

  .tags {
    gap: 0.25rem;
    margin-bottom: 0.6rem;
  }

  .tag {
    font-size: 0.68rem;
    padding: 0.12rem 0.4rem;
  }

  .project-bullets li {
    font-size: 0.82rem;
    padding-left: 1rem;
  }

  .project-links {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .action-link {
    min-height: 34px;
    padding: 0.3rem 0.65rem;
    font-size: 0.75rem;
  }

  .skills-block {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .skill-col {
    padding: 0.85rem;
  }

  .skill-pill {
    font-size: 0.7rem;
    padding: 0.15rem 0.45rem;
  }

  .timeline {
    padding-left: 1.25rem;
  }

  .timeline-node {
    left: -1.25rem;
    top: 0.4rem;
  }

  .timeline-title {
    font-size: 0.95rem;
  }

  .timeline-date {
    font-size: 0.75rem;
  }

  .timeline-entry {
    padding-bottom: 1.25rem;
  }
}

/* Extra Small Phones (380px and down) */
@media (max-width: 380px) {
  html {
    font-size: 14px;
  }

  .header-container {
    padding: 0 0.6rem;
  }

  .header-title {
    font-size: 0.95rem;
  }

  .header-nav {
    font-size: 0.75rem;
    gap: 0.2rem;
  }

  .sidebar-social {
    gap: 0.35rem;
  }

  .sidebar-icon-link {
    width: 32px;
    height: 32px;
  }

  .sidebar-icon-link svg {
    width: 17px;
    height: 17px;
  }

  .site-wrapper {
    padding: 0.85rem 0.6rem 0 0.6rem;
  }
}

/* --------------------------------------------------------------------------
   Print-to-PDF (@media print)
   -------------------------------------------------------------------------- */
@media print {
  @page {
    margin: 1.2cm 1.4cm;
    size: A4 portrait;
  }

  body {
    padding: 0 !important;
    background: #ffffff !important;
    color: #111827 !important;
    font-size: 9.5pt !important;
    line-height: 1.45 !important;
  }

  #header,
  .btn-minimal,
  .action-link,
  .site-footer,
  #toast,
  .party-particle {
    display: none !important;
  }

  .site-wrapper {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
  }

  .sidebar {
    width: 100% !important;
    position: static !important;
    border-bottom: 1.5pt solid #111827 !important;
    padding-bottom: 0.75rem !important;
    margin-bottom: 0.75rem !important;
    text-align: left !important;
    align-items: flex-start !important;
  }

  .sidebar-avatar {
    display: none !important;
  }

  .sidebar-name {
    font-size: 16pt !important;
  }

  .sidebar-position,
  .sidebar-affiliation,
  .sidebar-email {
    font-size: 9pt !important;
    margin-bottom: 0.15rem !important;
  }

  .sidebar-social {
    display: none !important;
  }

  .section {
    padding-top: 0.85rem !important;
    padding-bottom: 0.35rem !important;
    page-break-inside: avoid;
  }

  .section-heading {
    font-size: 10.5pt !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.04em !important;
    border-bottom: 1pt solid #111827 !important;
    margin-bottom: 0.5rem !important;
    padding-bottom: 0.2rem !important;
  }

  .project-card {
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
    margin-bottom: 0.75rem !important;
    page-break-inside: avoid;
  }

  .project-title {
    font-size: 9.5pt !important;
  }

  .badge {
    border: 0.5pt solid #9ca3af !important;
    background: transparent !important;
    color: #111827 !important;
    font-size: 7.5pt !important;
  }

  .tags {
    margin-bottom: 0.35rem !important;
  }

  .tag {
    border: 0.5pt solid #d1d5db !important;
    background: transparent !important;
    color: #374151 !important;
    font-size: 7pt !important;
    padding: 0.05rem 0.3rem !important;
  }

  .project-bullets {
    font-size: 8.5pt !important;
    gap: 0.2rem !important;
    margin-bottom: 0.3rem !important;
  }

  .timeline {
    padding-left: 1rem !important;
  }

  .timeline::before {
    left: 0.2rem !important;
    background-color: #9ca3af !important;
  }

  .timeline-node {
    left: -1rem !important;
    transform: translateX(calc(0.2rem - 2.5px)) !important;
    width: 5px !important;
    height: 5px !important;
    background-color: #111827 !important;
  }

  .timeline-entry {
    padding-bottom: 0.65rem !important;
    page-break-inside: avoid;
  }

  .timeline-title {
    font-size: 9pt !important;
  }

  .timeline-date {
    font-size: 8pt !important;
  }

  .timeline-subtitle {
    font-size: 8.5pt !important;
    margin-bottom: 0.15rem !important;
  }

  .timeline-body {
    font-size: 8pt !important;
  }

  .skills-block {
    grid-template-columns: 1fr 1fr !important;
    gap: 0.5rem !important;
  }

  .skill-col {
    border: 0.5pt solid #e5e7eb !important;
    background: transparent !important;
    padding: 0.5rem !important;
    page-break-inside: avoid;
  }

  .skill-col h3 {
    font-size: 8pt !important;
    margin-bottom: 0.25rem !important;
  }

  .skill-pill {
    border: 0.5pt solid #e5e7eb !important;
    background: transparent !important;
    color: #111827 !important;
    font-size: 7pt !important;
    padding: 0.05rem 0.25rem !important;
  }
}

/* ==========================================================================
   Papers I Read Section Styles
   ========================================================================== */
.papers-hero {
  margin-bottom: 1.5rem;
}

.papers-progress-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  transition: border-color 0.15s ease;
}

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

.papers-progress-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.papers-progress-stats {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.papers-progress-bar-bg {
  width: 100%;
  height: 9px;
  background-color: var(--bg-subtle);
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.papers-progress-bar-fill {
  height: 100%;
  width: 0%;
  background-color: var(--accent-green);
  border-radius: 4px;
  transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.papers-controls {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.15rem 1.25rem;
  margin-bottom: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.papers-search-input {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 0.55rem 0.85rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  background-color: var(--bg-subtle);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease;
}

.papers-search-input:focus {
  border-color: var(--accent-purple);
}

.papers-filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
}

.papers-select {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 0.4rem 0.65rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  background-color: var(--bg-subtle);
  color: var(--text);
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s ease;
}

.papers-select:focus {
  border-color: var(--accent-purple);
}

.papers-reset-btn {
  font-family: var(--font-mono);
  font-size: 0.775rem;
  font-weight: 600;
  padding: 0.4rem 0.65rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  background-color: var(--bg-subtle);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.papers-reset-btn:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

.papers-count-indicator {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-left: auto;
}

.stage-group {
  margin-bottom: 2.5rem;
}

.stage-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.15rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}

.stage-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.stage-years {
  font-size: 0.8rem;
  color: var(--text-subtle);
  font-weight: 400;
}

.paper-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.15rem 1.25rem;
  margin-bottom: 1rem;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, opacity 0.15s ease;
}

.paper-card:hover {
  border-color: var(--text-muted);
}

.paper-card:focus-visible {
  outline: 2px solid var(--accent-purple);
  outline-offset: 2px;
}

.paper-card.status-planned {
  opacity: 0.78;
}

.paper-card.status-planned:hover {
  opacity: 1;
}

.paper-card.is-expanded {
  border-color: var(--accent-purple);
  opacity: 1;
}

.paper-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}

.paper-card-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.45;
  margin: 0;
}

.paper-card-top-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.paper-quick-link {
  font-size: 0.72rem;
  padding: 0.12rem 0.5rem;
  line-height: 1.4;
}

.paper-status-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.55rem;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  flex-shrink: 0;
}

.paper-status-badge.planned {
  background-color: var(--tag-bg);
  color: var(--text-subtle);
  border: 1px solid var(--tag-border);
}

.paper-status-badge.reading {
  background-color: var(--badge-bg);
  color: var(--badge-text);
  border: 1px solid var(--badge-border);
}

.paper-status-badge.read {
  background-color: rgba(95, 242, 107, 0.15);
  color: var(--accent-green);
  border: 1px solid rgba(95, 242, 107, 0.35);
}

.paper-card-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.75rem;
  align-items: center;
}

.paper-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.4rem;
}

.paper-tag {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  background-color: var(--tag-bg);
  color: var(--tag-text);
  border: 1px solid var(--tag-border);
  border-radius: 3px;
  font-size: 0.72rem;
  font-weight: 500;
}

.paper-expand-hint {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  color: var(--text-subtle);
  margin-top: 0.6rem;
  transition: color 0.15s ease;
}

.paper-card:hover .paper-expand-hint {
  color: var(--link-color);
}

.paper-chevron {
  display: inline-block;
  font-size: 0.65rem;
  transition: transform 0.2s ease;
}

.paper-card.is-expanded .paper-chevron {
  transform: rotate(180deg);
}

.paper-details {
  display: none;
  margin-top: 0.95rem;
  padding-top: 0.95rem;
  border-top: 1px dashed var(--border);
  font-size: 0.86rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.paper-card.is-expanded .paper-details {
  display: block;
  cursor: default;
  user-select: text;
}

.paper-field {
  margin-bottom: 0.75rem;
}

.paper-field:last-child {
  margin-bottom: 0;
}

.paper-field-label {
  font-weight: 700;
  color: var(--text);
  display: block;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.15rem;
}

.paper-reading-banner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background-color: rgba(138, 63, 252, 0.08);
  border: 1px solid rgba(138, 63, 252, 0.25);
  border-radius: 4px;
  padding: 0.4rem 0.65rem;
  margin-bottom: 0.75rem;
  font-size: 0.78rem;
  color: var(--text);
}

.paper-reading-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--accent-purple);
  box-shadow: 0 0 8px var(--accent-purple);
  flex-shrink: 0;
  animation: pulse-dot 2s infinite ease-in-out;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.paper-nav-tabs {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.paper-tab-btn {
  background: var(--bg-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.22rem 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}

.paper-tab-btn:hover {
  border-color: var(--text-muted);
  color: var(--text);
}

.paper-tab-btn.active {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
  font-weight: 600;
}

.paper-tab-btn .tab-count {
  background: var(--border);
  color: var(--text-muted);
  padding: 0.05rem 0.35rem;
  border-radius: 9999px;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1.2;
}

.paper-tab-btn.active .tab-count {
  background: var(--bg);
  color: var(--text);
}

.paper-overview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

.paper-overview-col {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.paper-terms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.55rem;
}

.paper-term-card {
  background-color: var(--bg-subtle);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-purple);
  border-radius: 4px;
  padding: 0.45rem 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  cursor: default;
}

.paper-term-card .paper-term-title {
  font-weight: 600;
  color: var(--text);
  font-size: 0.8rem;
  line-height: 1.35;
}

.paper-term-card .paper-term-def {
  color: var(--text-muted);
  font-size: 0.77rem;
  line-height: 1.45;
  margin: 0;
}

.paper-takeaways-cards {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.paper-takeaway-item {
  background-color: var(--bg-subtle);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-green);
  border-radius: 4px;
  padding: 0.5rem 0.75rem;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--text-muted);
  cursor: default;
}

@media (max-width: 640px) {
  .paper-overview-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
}

.paper-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.85rem;
  padding-top: 0.6rem;
  border-top: 1px dashed var(--border);
}

.paper-collapse-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.55rem;
  border-radius: 3px;
  border: 1px solid var(--border);
  background-color: var(--bg-subtle);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  margin-left: auto;
}

.paper-collapse-btn:hover {
  border-color: var(--text-muted);
  color: var(--text);
  background-color: var(--border);
}

.paper-empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  background-color: var(--bg-card);
  border: 1px dashed var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

@media (max-width: 640px) {
  .papers-controls {
    padding: 1rem;
  }

  .papers-count-indicator {
    width: 100%;
    margin-left: 0;
  }
}

