/* ── View transitions ── */
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.3s;
  animation-timing-function: ease;
}

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

/* ── Custom cursor ── */
*, a, button { cursor: none !important; }

#cursor-glow {
  position: fixed;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 9997;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(255,255,255,0.07) 0%, rgba(255,255,255,0.03) 35%, transparent 70%);
  transition: background 0.3s ease, transform 0.2s ease;
}

[data-theme="light"] #cursor-glow {
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 18%, transparent) 0%, color-mix(in srgb, var(--accent) 7%, transparent) 40%, transparent 70%);
  transition: background 0.3s ease, transform 0.2s ease;
  will-change: left, top;
}

#cursor {
  position: fixed;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text);
  pointer-events: none;
  z-index: 9999;
  transform: translate(-3px, -3px);
  box-shadow: none;
  transition: background 0.2s ease, transform 0.15s cubic-bezier(0.25, 1, 0.5, 1);
  image-rendering: pixelated;
}

[data-theme="light"] #cursor { background: var(--accent); }

body:has(a:hover, button:hover, .tag:hover, .stack-cell:hover, .project-card:hover, .hero-avatar:hover, .hero-name:hover) #cursor {
  background: var(--accent);
  transform: translate(-3px, -3px) scale(2.2);
}

[data-theme="light"] body:has(a:hover, button:hover, .tag:hover, .stack-cell:hover, .project-card:hover, .hero-avatar:hover, .hero-name:hover) #cursor {
  background: var(--accent);
}

body:has(a:hover, button:hover, .tag:hover, .stack-cell:hover, .project-card:hover, .hero-avatar:hover, .hero-name:hover) #cursor-glow {
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 15%, transparent) 0%, color-mix(in srgb, var(--accent) 5%, transparent) 35%, transparent 70%);
  transform: translate(-50%, -50%) scale(1.6);
}

[data-theme="light"] body:has(a:hover, button:hover, .tag:hover, .stack-cell:hover, .project-card:hover, .hero-avatar:hover, .hero-name:hover) #cursor-glow {
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 15%, transparent) 0%, color-mix(in srgb, var(--accent) 5%, transparent) 35%, transparent 70%);
}

/* ── Variables ── */
:root,
[data-theme="dark"] {
  --bg:         #0d1117;
  --surface:    #161b22;
  --border:     #30363d;
  --text:       #e6edf3;
  --muted:      #7d8590;
  --blue:       #2f81f7;
  --yellow:     #e3b341;
  --orange:     #f0883e;
  --green:      #3fb950;
  --purple:     #a371f7;
  --accent:     var(--blue);
  --navbar-bg:  rgba(13, 17, 23, 0.85);
  --font:       'Roboto Mono', monospace;
}

[data-theme="light"] {
  --bg:         #f6f8fa;
  --surface:    #ffffff;
  --border:     #d0d7de;
  --text:       #1f2328;
  --muted:      #656d76;
  --blue:       #0969da;
  --yellow:     #9a6700;
  --orange:     #bc4c00;
  --green:      #1a7f37;
  --purple:     #8250df;
  --navbar-bg:  rgba(246, 248, 250, 0.85);
}

/* ── Base ── */
html { scroll-behavior: smooth; }


body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9375rem;
  line-height: 1.6;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* ── Starfield canvas ── */
#stars {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* ── Navbar ── */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--navbar-bg);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.navbar-inner {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  overflow: hidden;
}

.nav-logo {
  font-family: 'Jersey 25', sans-serif;
  font-size: 1.5rem;
  color: var(--text);
  letter-spacing: 0.02em;
  flex-shrink: 0;
  white-space: nowrap;
}

.nav-links {
  display: flex;
  gap: 1.75rem;
}

.nav-links a {
  font-size: 0.875rem;
  color: var(--muted);
  transition: color 0.15s;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
}

/* ── Nav actions (lang + theme) ── */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#lang-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 30px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-family: var(--font);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  transition: color 0.15s, border-color 0.15s;
  flex-shrink: 0;
}

#lang-toggle:hover { color: var(--text); }

/* ── Theme toggle ── */
#theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  transition: color 0.15s, border-color 0.15s;
  flex-shrink: 0;
}

#theme-toggle:hover { color: var(--text); }

/* ── Page container ── */
.page {
  position: relative;
  z-index: 1;
  max-width: 760px;
  margin: 0 auto;
  padding: 100px 1.5rem 80px;
  display: flex;
  flex-direction: column;
  gap: 3.5rem;
}

/* ── Scroll offset for fixed navbar ── */
section[id] { scroll-margin-top: 68px; }

/* ── Section titles ── */
.section-title {
  font-size: 1.0625rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  padding-left: 0.75rem;
  line-height: 1.4;
  color: var(--accent);
  border-left: 3px solid currentColor;
}

/* ── Hero ── */
.hero {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  padding-top: 1.5rem;
}

.hero-avatar {
  width: 104px;
  height: 104px;
  border-radius: 50%;
  border: 2px solid var(--border);
  overflow: hidden;
  flex-shrink: 0;
}

.hero-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.hero-avatar:hover img {
  transform: scale(1.12);
}

.hero-info {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

@keyframes name-glow {
  0%   { opacity: 1;    text-shadow: 0 0 28px rgba(255,255,255,0.22), 0 0 55px rgba(255,255,255,0.08); }
  15%  { opacity: 0.4;  text-shadow: none; }
  28%  { opacity: 0.95; text-shadow: 0 0 22px rgba(255,255,255,0.18), 0 0 48px rgba(255,255,255,0.06); }
  47%  { opacity: 0.25; text-shadow: none; }
  60%  { opacity: 0.85; text-shadow: 0 0 30px rgba(255,255,255,0.2), 0 0 60px rgba(255,255,255,0.07); }
  73%  { opacity: 0.5;  text-shadow: none; }
  88%  { opacity: 1;    text-shadow: 0 0 26px rgba(255,255,255,0.2), 0 0 52px rgba(255,255,255,0.07); }
  100% { opacity: 1;    text-shadow: 0 0 28px rgba(255,255,255,0.22), 0 0 55px rgba(255,255,255,0.08); }
}

.hero-name {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
  animation: name-glow 14s ease-in-out infinite;
}

[data-theme="light"] .hero-name {
  animation: none;
  text-shadow: none;
}

.hero-handle {
  font-size: 0.9rem;
  color: var(--muted);
  margin-top: -0.15rem;
}

.hero-status {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

@keyframes status-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(63, 185, 80, 0.7); }
  50%       { box-shadow: 0 0 0 6px rgba(63, 185, 80, 0); }
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
  animation: status-glow 2s ease-in-out infinite;
}

.hero-bio {
  font-size: 0.9375rem;
  color: var(--text);
  max-width: 460px;
  margin-top: 0.5rem;
}

.hero-socials {
  display: flex;
  gap: 0.85rem;
  margin-top: 0.6rem;
}

.hero-socials a {
  color: var(--muted);
  display: flex;
  align-items: center;
  transition: color 0.15s;
}

.hero-socials a:hover { color: var(--text); }

/* ── Body text ── */
.body-text {
  color: var(--muted);
  margin-bottom: 0.75rem;
  font-size: 0.9375rem;
}

.body-text:last-child { margin-bottom: 0; }

.section .card + .card {
  margin-top: 1rem;
}

/* ── Cards ── */
.card {
  background: rgba(22, 27, 34, 0.25);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

[data-theme="light"] .card {
  background: rgba(255, 255, 255, 0.25);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

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

.card-subtitle {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

.card-meta {
  text-align: right;
  flex-shrink: 0;
}

.meta-primary {
  font-size: 0.875rem;
  color: var(--text);
  font-weight: 500;
}

.meta-secondary {
  font-size: 0.8125rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

.company-name {
  font-size: 0.875rem;
  color: var(--orange);
  margin-top: 0.2rem;
}

.honors {
  font-size: 0.875rem;
  color: var(--text);
}

/* ── Coursework label ── */
.coursework-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ── Tags ── */
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag {
  font-size: 0.78rem;
  padding: 0.2rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--muted);
  background: transparent;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.tag:hover {
  border-color: var(--accent);
  color: var(--text);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

/* ── Accordion ── */
.accordion {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.accordion-item {
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.accordion-trigger {
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem 1rem;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.875rem;
  text-align: left;
}

.accordion-trigger:hover { color: var(--text); }

.accordion-item:hover {
  background: rgba(255,255,255,0.04);
}

[data-theme="light"] .accordion-item:hover {
  background: rgba(0,0,0,0.04);
}

@keyframes dot-pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 50%, transparent); }
  50%       { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 0%, transparent); }
}

@keyframes text-marquee {
  0%, 15%  { transform: translateX(0); }
  55%, 70% { transform: translateX(-55%); }
  100%     { transform: translateX(0); }
}

@keyframes dot-ring {
  0%   { transform: scale(1);   opacity: 0.8; }
  100% { transform: scale(3.2); opacity: 0;   }
}

.accordion-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  flex-shrink: 0;
  position: relative;
  animation: dot-pulse 2s ease-in-out infinite;
}

.accordion-trigger[aria-expanded="true"] .accordion-dot {
  background: var(--accent);
  animation: none;
}

.accordion-trigger[aria-expanded="true"] .accordion-dot::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  animation: dot-ring 0.5s ease-out forwards;
}

.accordion-name { flex: 1; }

.accordion-chevron {
  flex-shrink: 0;
  color: var(--muted);
  transition: transform 0.2s ease;
}

.accordion-trigger[aria-expanded="true"] .accordion-chevron {
  transform: rotate(180deg);
}

.accordion-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease;
}

.accordion-body p {
  padding: 0 1rem 0.9rem 1rem;
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.6;
}

/* ── Wider breakout for stack + projects ── */
#stack {
  width: min(900px, 100vw - 3rem);
  margin-inline: calc((min(760px, 100vw - 3rem) - min(900px, 100vw - 3rem)) / 2);
}

#projects {
  width: min(1040px, 100vw - 3rem);
  margin-inline: calc((min(760px, 100vw - 3rem) - min(1040px, 100vw - 3rem)) / 2);
}

/* ── Tech Stack Grid ── */
.stack-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.stack-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 1.5rem 1rem;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background 0.15s;
}

.stack-cell:hover {
  background: color-mix(in srgb, var(--accent) 4%, transparent);
}

.stack-cell.featured {
  grid-column: span 2;
}

.stack-cell:nth-child(2),
.stack-cell:nth-child(6),
.stack-cell:nth-child(10),
.stack-cell:nth-child(14) {
  border-right: none;
}

.stack-name {
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
}

[data-theme="dark"] .stack-cell img[alt="GitHub"] {
  filter: invert(1) brightness(0.85);
}

/* ── Projects Grid ── */
.projects-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.project-card {
  background: rgba(22, 27, 34, 0.25);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

[data-theme="light"] .project-card {
  background: rgba(255, 255, 255, 0.25);
}

.project-header {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.project-icon {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--text);
  flex-shrink: 0;
  transition: transform 0.25s ease;
}

.project-icon::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--text) 15%, transparent);
  pointer-events: none;
  transition: box-shadow 0.25s ease;
}

.project-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.project-title-group { flex: 1; min-width: 0; }

.project-name {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-url {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-badge {
  flex-shrink: 0;
  font-size: 0.72rem;
  padding: 0.15rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--muted);
  background: transparent;
  white-space: nowrap;
}

.project-desc {
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.55;
}

.project-card {
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 7%, transparent);
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.project-card:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 4%, transparent);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 20%, transparent);
}

.project-card:hover .project-icon {
  box-shadow: 0 0 14px color-mix(in srgb, var(--accent) 45%, transparent);
  transform: scale(1.06);
}

.project-card:hover .project-icon::after {
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--text) 30%, transparent);
}

/* ── Footer ── */
.footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid #21262d;
  background: var(--navbar-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.footer-inner {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.footer-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
}

.footer-logo {
  font-family: 'Jersey 25', sans-serif;
  font-size: 1.5rem;
  color: var(--text);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

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

.footer-links a {
  font-size: 0.875rem;
  color: var(--muted);
  transition: color 0.15s;
}

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

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 0;
  font-size: 0.8125rem;
  color: var(--muted);
}

.footer-bottom a {
  color: var(--muted);
  transition: color 0.15s;
}

.footer-bottom a:hover { color: var(--text); }

.footer-sep { opacity: 0.4; }

/* ── Resize transition ── */
.resizing * {
  transition: padding 0.2s ease, gap 0.2s ease, width 0.25s ease, margin 0.25s ease, font-size 0.2s ease !important;
}

/* ── 1024px — Laptop ── */
@media (max-width: 1024px) {
  #projects {
    width: min(1024px, 100vw - 3rem);
    margin-inline: calc((min(760px, 100vw - 3rem) - min(1024px, 100vw - 3rem)) / 2);
  }
}

/* ── 768px — Tablet ── */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .footer-links { display: none; }

  #stack, #projects { width: 100%; margin-inline: 0; }

  .page { padding: 80px 1.25rem 70px; gap: 3rem; }

  .projects-grid { grid-template-columns: 1fr 1fr; }

  .stack-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ── 425px — Mobile L ── */
@media (max-width: 425px) {
  body { overflow-x: hidden; }

  .footer-top { justify-content: center; }

  .project-title-group { overflow: hidden; }

  .project-name,
  .project-url {
    overflow: visible;
    text-overflow: clip;
    white-space: nowrap;
    display: inline-block;
    animation: text-marquee 7s ease-in-out infinite;
  }

  .project-url { animation-delay: 0.3s; }

  .page { padding: 74px 1rem 60px; gap: 2.5rem; }

  .hero { flex-direction: column; gap: 1rem; }
  .hero-name { font-size: 1.45rem; }
  .hero-bio { font-size: 0.875rem; }

  .card { padding: 1rem 1.1rem; }
  .card-header { flex-direction: column; gap: 0.35rem; }
  .card-meta { text-align: left; }

  .stack-grid { grid-template-columns: repeat(2, 1fr); }
  .stack-cell.featured { grid-column: span 2; }
  .stack-cell { border-right: 1px solid var(--border); }
  .stack-cell:nth-child(2n),
  .stack-cell:nth-child(1) {
    border-right: none;
  }

  .projects-grid { grid-template-columns: 1fr; }

  .footer-bottom { flex-wrap: wrap; justify-content: center; gap: 0.3rem; }
}

/* ── 375px — Mobile M ── */
@media (max-width: 375px) {
  .nav-logo, .footer-logo { font-size: 1.3rem; }

  .page { padding: 70px 0.9rem 55px; gap: 2.25rem; }

  .hero-name { font-size: 1.3rem; }
  .hero-bio { font-size: 0.8375rem; }

  .card { padding: 0.9rem 1rem; }
  .stack-cell { padding: 1.2rem 0.75rem; }
}

/* ── 320px — Mobile S ── */
@media (max-width: 320px) {
  .page { padding: 64px 0.75rem 50px; gap: 2rem; }

  .navbar-inner { height: 46px; padding: 0 0.75rem; }
  .nav-logo, .footer-logo { font-size: 1.25rem; }
  #lang-toggle { width: 28px; height: 26px; font-size: 0.62rem; }
  #theme-toggle { width: 26px; height: 26px; }

  .hero-avatar { width: 80px; height: 80px; }
  .hero-name { font-size: 1.15rem; }
  .hero-handle { font-size: 0.78rem; }
  .hero-bio { font-size: 0.8rem; }
  .hero-socials { gap: 0.6rem; }

  .section-title { font-size: 0.9rem; }

  .card { padding: 0.8rem 0.875rem; gap: 0.6rem; }
  .card-title { font-size: 0.875rem; }

  .tag { font-size: 0.7rem; padding: 0.12rem 0.45rem; }

  .stack-cell { padding: 1rem 0.6rem; }

  .project-card { padding: 0.85rem 0.9rem; }
  .project-name { font-size: 0.85rem; }

  .footer-bottom { font-size: 0.73rem; }
}

/* ── Loader ── */
#loader-wrapper {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.4s ease, visibility 0.4s ease;
  opacity: 1;
  visibility: visible;
}

#loader-wrapper.fade-out {
  opacity: 0;
  visibility: hidden;
}

.loader-circle {
  width: 44px;
  height: 44px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  box-shadow: 0 0 16px color-mix(in srgb, var(--accent) 20%, transparent);
  transition: border-top-color 0.3s ease;
}

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