/* =================================================================
   MIKHAEEL PORTFOLIO — DESIGN SYSTEM
   Premium dark-mode · glassmorphism · micro-animations
   ================================================================= */

/* --- Fonts -------------------------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

/* --- Tokens ------------------------------------------------------- */
:root {
  --bg:          #060608;
  --bg-alt:      #0a0a0f;
  --surface:     rgba(14, 14, 22, 0.55);
  --surface-solid:#0e0e16;
  --text:        #ededf0;
  --text-sub:    #a0a0b8;
  --text-muted:  #5c5c72;
  --accent:      #7c6aef;
  --accent-end:  #a78bfa;
  --teal:        #22d3ee;
  --border:      rgba(255,255,255,0.06);
  --border-hover:rgba(124,106,239,0.35);
  --glow:        rgba(124,106,239,0.12);
  --max:         1180px;
  --radius:      16px;
  --radius-sm:   10px;
  --radius-pill: 999px;
  --ease:        cubic-bezier(.16,1,.3,1);
  --ease-spring: cubic-bezier(.34,1.56,.64,1);
  --fast:        .2s;
  --normal:      .35s;
  --slow:        .55s;

  /* Category accents */
  --c-ai:         #8b5cf6;
  --c-bio:        #10b981;
  --c-web:        #06b6d4;
  --c-tools:      #f59e0b;
  --c-auto:       #ec4899;
  --c-research:   #3b82f6;
  --c-experiments:#f97316;
  --c-archived:   #6b7280;
}

/* --- Reset & Base ------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
img { max-width: 100%; display: block; }

/* --- Skip link ---------------------------------------------------- */
.skip {
  position: absolute; left: -9999px;
  background: #fff; color: #000; padding: 12px 20px;
  border-radius: var(--radius-sm); z-index: 100; font-weight: 600;
}
.skip:focus { left: 16px; top: 16px; }

/* --- Scroll reveal ------------------------------------------------ */
.reveal {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity var(--slow) var(--ease), transform var(--slow) var(--ease);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* stagger children */
.reveal-stagger > * {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity var(--normal) var(--ease), transform var(--normal) var(--ease);
}
.reveal-stagger.visible > * { opacity: 1; transform: translateY(0); }
.reveal-stagger.visible > *:nth-child(1)  { transition-delay: .05s; }
.reveal-stagger.visible > *:nth-child(2)  { transition-delay: .10s; }
.reveal-stagger.visible > *:nth-child(3)  { transition-delay: .15s; }
.reveal-stagger.visible > *:nth-child(4)  { transition-delay: .20s; }
.reveal-stagger.visible > *:nth-child(5)  { transition-delay: .25s; }
.reveal-stagger.visible > *:nth-child(6)  { transition-delay: .30s; }
.reveal-stagger.visible > *:nth-child(7)  { transition-delay: .35s; }
.reveal-stagger.visible > *:nth-child(8)  { transition-delay: .40s; }
.reveal-stagger.visible > *:nth-child(9)  { transition-delay: .45s; }
.reveal-stagger.visible > *:nth-child(10) { transition-delay: .50s; }

/* --- Keyframes ---------------------------------------------------- */
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50%      { opacity: .4; }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}
@keyframes gradient-shift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* --- Gradient text ------------------------------------------------ */
.gradient-text {
  background: linear-gradient(135deg, var(--accent), var(--accent-end), var(--teal));
  background-size: 200% 200%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradient-shift 6s ease infinite;
}

/* --- Header ------------------------------------------------------- */
header {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 clamp(20px, 5vw, 48px);
  height: 64px;
  background: rgba(6,6,8,.72);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border-bottom: 1px solid var(--border);
}
.brand {
  font-weight: 900; font-size: 20px; letter-spacing: -.04em;
  text-decoration: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-end));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
nav { display: flex; gap: 8px; }
nav a {
  padding: 6px 14px; border-radius: var(--radius-pill);
  font-size: 13px; font-weight: 500; color: var(--text-sub);
  transition: color var(--fast), background var(--fast);
}
nav a:hover, nav a.active {
  color: var(--text);
  background: rgba(255,255,255,.06);
}

/* Mobile nav toggle */
.nav-toggle {
  display: none; background: none; border: none; cursor: pointer;
  flex-direction: column; gap: 5px; padding: 6px;
}
.nav-toggle span {
  display: block; width: 22px; height: 2px;
  background: var(--text-sub); border-radius: 2px;
  transition: transform var(--normal) var(--ease), opacity var(--fast);
}
.nav-toggle.open span:nth-child(1) { transform: rotate(45deg) translate(5px,5px); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: rotate(-45deg) translate(5px,-5px); }

/* --- Sections ----------------------------------------------------- */
.section {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(72px, 10vw, 120px) clamp(20px, 5vw, 48px);
}
.section-alt {
  max-width: none;
  padding-left: max(20px, calc((100vw - var(--max)) / 2 + 24px));
  padding-right: max(20px, calc((100vw - var(--max)) / 2 + 24px));
  background: linear-gradient(180deg, var(--bg-alt), var(--bg));
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.section-header { margin-bottom: 48px; }

/* --- Eyebrow ------------------------------------------------------ */
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  text-transform: uppercase; letter-spacing: .18em;
  font-size: 11px; font-weight: 700;
  color: var(--accent);
  margin-bottom: 16px;
}
.eyebrow::before {
  content: ''; display: block;
  width: 24px; height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-end));
  border-radius: 2px;
}

/* --- Headings ----------------------------------------------------- */
h1 {
  font-size: clamp(40px, 7vw, 80px);
  font-weight: 800; line-height: .96;
  letter-spacing: -.05em;
  color: var(--text);
}
h2 {
  font-size: clamp(30px, 4.5vw, 52px);
  font-weight: 700; line-height: 1.05;
  letter-spacing: -.04em;
}
h3 { font-size: 22px; font-weight: 700; letter-spacing: -.03em; }

/* --- Hero --------------------------------------------------------- */
.hero {
  min-height: calc(100vh - 64px);
  display: flex; flex-direction: column; justify-content: center;
  position: relative;
}
.hero::before {
  content: ''; position: absolute; inset: 0; z-index: 0;
  background:
    radial-gradient(ellipse 60% 50% at 20% 40%, rgba(124,106,239,.07), transparent),
    radial-gradient(ellipse 50% 40% at 80% 60%, rgba(34,211,238,.05), transparent);
  pointer-events: none;
}
.hero-content { position: relative; z-index: 1; }
.hero h1 { margin: 16px 0 24px; max-width: 900px; }
.lead {
  color: var(--text-sub); max-width: 720px;
  font-size: clamp(17px, 2vw, 21px); line-height: 1.65;
}
.section-sub { color: var(--text-muted); font-size: 14px; margin-top: 8px; }

/* Hero stats */
.hero-stats {
  display: flex; gap: 16px; margin-top: 56px; flex-wrap: wrap;
}
.stat {
  display: flex; flex-direction: column;
  padding: 20px 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(12px);
  min-width: 160px;
  transition: border-color var(--normal), box-shadow var(--normal);
}
.stat:hover {
  border-color: var(--border-hover);
  box-shadow: 0 0 24px var(--glow);
}
.stat-number {
  font-size: 32px; font-weight: 800;
  letter-spacing: -.03em;
  background: linear-gradient(135deg, var(--accent), var(--accent-end));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; font-weight: 500; }

/* --- Buttons ------------------------------------------------------ */
.hero-actions, .contact-actions, .detail-actions, .actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 32px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 24px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600;
  border: 1px solid var(--border); background: transparent;
  color: var(--text); cursor: pointer;
  transition: all var(--normal) var(--ease);
  text-decoration: none;
}
.btn:hover {
  border-color: var(--border-hover);
  background: rgba(255,255,255,.04);
  transform: translateY(-1px);
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-end));
  border-color: transparent; color: #fff;
}
.btn-primary:hover {
  box-shadow: 0 4px 24px rgba(124,106,239,.3);
  transform: translateY(-2px);
  background: linear-gradient(135deg, var(--accent), var(--accent-end));
  border-color: transparent;
}
.btn-ghost { border-color: var(--border); }
.btn-lg { padding: 16px 32px; font-size: 16px; }

/* --- Filter bar --------------------------------------------------- */
.filter-bar {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-bottom: 32px;
}
.filter-btn {
  padding: 8px 18px; border-radius: var(--radius-pill);
  font-size: 13px; font-weight: 600;
  background: transparent; border: 1px solid var(--border);
  color: var(--text-sub); cursor: pointer;
  transition: all var(--normal) var(--ease);
}
.filter-btn:hover {
  border-color: var(--border-hover); color: var(--text);
  background: rgba(255,255,255,.03);
}
.filter-btn.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-end));
  border-color: transparent; color: #fff;
}

/* --- Card Grid ---------------------------------------------------- */
.card-grid {
  display: grid;
  gap: 20px;
}
.featured-grid { grid-template-columns: repeat(3, 1fr); }
.compact-grid  { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }

/* --- Cards -------------------------------------------------------- */
.card {
  position: relative;
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(12px);
  transition: transform var(--normal) var(--ease),
              border-color var(--normal),
              box-shadow var(--normal);
  overflow: hidden;
}
.card::before {
  content: ''; position: absolute; top: 0; left: 28px; right: 28px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0;
  transition: opacity var(--normal);
}
.card:hover {
  transform: translateY(-4px);
  border-color: var(--border-hover);
  box-shadow: 0 12px 40px rgba(0,0,0,.35), 0 0 40px var(--glow);
}
.card:hover::before { opacity: .6; }

/* card filter transition */
.card { transition: transform var(--normal) var(--ease), border-color var(--normal), box-shadow var(--normal), opacity var(--normal); }
.card.hidden { opacity: 0; transform: scale(.95); pointer-events: none; position: absolute; visibility: hidden; }

.card-top {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  margin-bottom: 16px;
}
.card-cat {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .08em; color: var(--text-muted);
}
.card-cat-dot {
  width: 8px; height: 8px; border-radius: 50%;
  flex-shrink: 0;
}

/* Status badge */
.status-badge {
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .06em;
  padding: 4px 10px; border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  color: var(--text-muted);
  white-space: nowrap;
}

.card h3 { margin: 0 0 10px; font-size: 20px; }
.card h3 a { transition: color var(--fast); }
.card h3 a:hover { color: var(--accent-end); }
.card-desc { color: var(--text-sub); font-size: 14px; line-height: 1.55; margin-bottom: 14px; }
.card-evidence { font-size: 12px; color: var(--text-muted); margin-bottom: 16px; }

/* chips */
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.chip {
  font-size: 11px; font-weight: 500;
  padding: 4px 10px; border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  color: var(--text-sub); background: rgba(255,255,255,.02);
}

.card-links { display: flex; gap: 16px; }
.card-links a {
  font-size: 13px; font-weight: 600; color: var(--accent-end);
  transition: color var(--fast);
}
.card-links a:hover { color: var(--teal); }

/* --- Skeleton ----------------------------------------------------- */
.skeleton-card {
  height: 260px;
  border-radius: var(--radius);
  background: linear-gradient(90deg, var(--surface-solid) 25%, rgba(30,30,45,.5) 50%, var(--surface-solid) 75%);
  background-size: 800px 100%;
  animation: shimmer 1.8s infinite linear;
  border: 1px solid var(--border);
}

/* --- Activity ----------------------------------------------------- */
.activity-grid { display: grid; gap: 12px; }
.activity-item {
  display: flex; justify-content: space-between; align-items: center;
  gap: 16px; padding: 16px 20px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color var(--normal), transform var(--fast);
}
.activity-item:hover {
  border-color: var(--border-hover);
  transform: translateX(4px);
}
.activity-icon {
  font-size: 16px; flex-shrink: 0;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.03);
  border-radius: var(--radius-sm);
}
.activity-info { flex: 1; min-width: 0; }
.activity-repo { font-weight: 600; font-size: 14px; }
.activity-type { font-size: 12px; color: var(--text-muted); }
.activity-time { font-size: 12px; color: var(--text-muted); white-space: nowrap; }

/* --- Skills ------------------------------------------------------- */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.skill-card {
  padding: 24px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color var(--normal);
}
.skill-card:hover { border-color: var(--border-hover); }
.skill-card h3 {
  font-size: 14px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-muted); margin-bottom: 14px;
}

/* --- Timeline ----------------------------------------------------- */
.timeline {
  position: relative;
  padding-left: 32px;
  border-left: 2px solid var(--border);
}
.timeline li {
  position: relative;
  padding: 0 0 32px;
}
.timeline li::before {
  content: '';
  position: absolute; left: -37px; top: 6px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
  transition: background var(--fast), box-shadow var(--fast);
}
.timeline li:hover::before {
  background: var(--accent);
  box-shadow: 0 0 12px var(--glow);
}
.timeline-date {
  font-size: 12px; font-weight: 600; color: var(--accent-end);
  margin-bottom: 4px;
}
.timeline-title { font-weight: 600; font-size: 15px; }
.timeline-desc { font-size: 14px; color: var(--text-sub); margin-top: 4px; }

/* --- About -------------------------------------------------------- */
.about-content {
  max-width: 760px;
}
.about-content p {
  font-size: 17px; line-height: 1.7; color: var(--text-sub);
}

/* --- Contact ------------------------------------------------------ */
.contact-content { max-width: 700px; }
.availability {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 8px 18px; border-radius: var(--radius-pill);
  background: rgba(16,185,129,.08);
  border: 1px solid rgba(16,185,129,.2);
  font-size: 13px; font-weight: 600; color: #6ee7b7;
  margin-bottom: 24px;
}
.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #10b981;
  animation: pulse-dot 2s ease-in-out infinite;
}
.contact-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 32px; }
.contact-tag {
  padding: 6px 14px; border-radius: var(--radius-pill);
  font-size: 13px; font-weight: 500;
  border: 1px solid var(--border); color: var(--text-sub);
}
.privacy-note {
  font-size: 12px; color: var(--text-muted); margin-top: 24px;
}

/* --- Footer ------------------------------------------------------- */
footer {
  border-top: 1px solid var(--border);
  padding: clamp(40px, 6vw, 72px) clamp(20px, 5vw, 48px);
}
.footer-content {
  max-width: var(--max); margin: 0 auto;
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 40px; flex-wrap: wrap;
}
.footer-brand .brand { font-size: 24px; }
.footer-brand p { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.footer-links { display: flex; flex-direction: column; gap: 8px; }
.footer-links a {
  font-size: 13px; color: var(--text-sub);
  transition: color var(--fast);
}
.footer-links a:hover { color: var(--accent-end); }
.footer-meta p { font-size: 12px; color: var(--text-muted); }

/* --- Scroll-to-top ------------------------------------------------ */
.scroll-top {
  position: fixed; bottom: 32px; right: 32px;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--border);
  backdrop-filter: blur(12px);
  color: var(--text); font-size: 18px; font-weight: 700;
  cursor: pointer; z-index: 40;
  opacity: 0; transform: translateY(16px);
  transition: opacity var(--normal), transform var(--normal),
              border-color var(--fast), box-shadow var(--fast);
  pointer-events: none;
}
.scroll-top.visible {
  opacity: 1; transform: translateY(0); pointer-events: auto;
}
.scroll-top:hover {
  border-color: var(--border-hover);
  box-shadow: 0 0 20px var(--glow);
}

/* --- Project detail ----------------------------------------------- */
.project-hero { padding-top: clamp(48px, 6vw, 80px); }
.breadcrumb {
  display: flex; gap: 8px; align-items: center;
  font-size: 13px; color: var(--text-muted); margin-bottom: 24px;
}
.breadcrumb a { color: var(--text-sub); transition: color var(--fast); }
.breadcrumb a:hover { color: var(--accent-end); }
.breadcrumb span { color: var(--text-muted); }

.detail-title { margin-bottom: 16px; }
.detail-desc { font-size: 18px; color: var(--text-sub); line-height: 1.6; max-width: 760px; margin-bottom: 24px; }

.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px; margin: 40px 0;
}
.meta-card {
  padding: 20px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  transition: border-color var(--normal);
}
.meta-card:hover { border-color: var(--border-hover); }
.meta-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); margin-bottom: 6px; }
.meta-value { font-size: 15px; font-weight: 600; }

.evidence-panel {
  margin-top: 24px; padding: 28px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius);
}
.evidence-panel h2 { font-size: 18px; margin-bottom: 16px; letter-spacing: -.02em; }
.evidence-panel ul { padding-left: 0; }
.evidence-panel li {
  padding: 8px 0; border-bottom: 1px solid var(--border);
  font-size: 14px; color: var(--text-sub);
  display: flex; gap: 8px;
}
.evidence-panel li:last-child { border-bottom: none; }

.readme-panel {
  margin-top: 24px; padding: 28px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius);
}
.readme-panel h2 { font-size: 18px; margin-bottom: 16px; letter-spacing: -.02em; }
.readme-content {
  white-space: pre-wrap; word-break: break-word;
  font-size: 13px; line-height: 1.65; color: var(--text-sub);
  max-height: 400px; overflow-y: auto;
  padding: 20px; background: rgba(0,0,0,.3);
  border-radius: var(--radius-sm); border: 1px solid var(--border);
}
.readme-content::-webkit-scrollbar { width: 6px; }
.readme-content::-webkit-scrollbar-track { background: transparent; }
.readme-content::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* --- Error -------------------------------------------------------- */
.card.error {
  border-color: rgba(239,68,68,.25);
  background: rgba(239,68,68,.04);
}

/* --- Responsive --------------------------------------------------- */
@media (max-width: 960px) {
  .featured-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  nav { display: none; }
  nav.open {
    display: flex; flex-direction: column;
    position: fixed; inset: 64px 0 0;
    background: rgba(6,6,8,.96);
    backdrop-filter: blur(20px);
    padding: 32px 24px; gap: 4px; z-index: 49;
  }
  nav.open a { padding: 14px 20px; font-size: 16px; border-radius: var(--radius-sm); }
  .nav-toggle { display: flex; }
  .featured-grid, .compact-grid { grid-template-columns: 1fr; }
  .hero-stats { flex-direction: column; }
  .stat { min-width: auto; }
  h1 { font-size: clamp(32px, 8vw, 56px); }
  .section { padding-top: 64px; padding-bottom: 64px; }
  .footer-content { flex-direction: column; gap: 24px; }
  .meta-grid { grid-template-columns: 1fr 1fr; }
  .scroll-top { bottom: 20px; right: 20px; width: 40px; height: 40px; }
  .activity-item { flex-direction: column; align-items: flex-start; gap: 8px; }
}
@media (max-width: 480px) {
  header { padding: 0 16px; }
  .section { padding-left: 16px; padding-right: 16px; }
  .section-alt { padding-left: 16px; padding-right: 16px; }
  .meta-grid { grid-template-columns: 1fr; }
}
