/* ============================================================
   COLE CLARK — Portfolio
   style.css
   ============================================================ */

/* --- 1. DESIGN TOKENS --------------------------------------- */
:root {
  --p-bg:           #0a0a0a;
  --p-surface:      #111111;
  --p-surface-2:    #181818;
  --p-border:       #222222;
  --p-border-h:     #333333;
  --p-accent:       #6366f1;
  --p-accent-dim:   rgba(99, 102, 241, 0.10);
  --p-accent-glow:  rgba(99, 102, 241, 0.22);
  --p-text:         #f1f5f9;
  --p-muted:        #94a3b8;
  --p-muted-2:      #7f8da2;
  --p-gold:         #f59e0b;
  --p-gold-dim:     rgba(245, 158, 11, 0.10);

  --p-font-ui:      'Inter', system-ui, -apple-system, sans-serif;
  --p-font-mono:    'JetBrains Mono', 'Fira Code', monospace;

  --p-max-width:    1160px;
  --p-nav-height:   60px;
  --p-radius:       8px;
  --p-radius-lg:    12px;
  --p-radius-full:  9999px;
  --p-shadow-accent: rgba(99, 102, 241, 0.16);
  --p-shadow-accent-strong: rgba(99, 102, 241, 0.22);
}

/* --- 2. RESET & BASE ---------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; color-scheme: dark; }

body {
  background-color: var(--p-bg);
  color: var(--p-text);
  font-family: var(--p-font-ui);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
button { font-family: inherit; cursor: pointer; background: none; border: none; }

section[id] { scroll-margin-top: calc(var(--p-nav-height) + 1rem); }

:focus-visible {
  outline: 2px solid var(--p-accent);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: 1rem;
  z-index: 260;
  padding: 0.7rem 1rem;
  border-radius: var(--p-radius);
  background: var(--p-surface);
  border: 1px solid var(--p-border-h);
  color: var(--p-text);
  font-family: var(--p-font-mono);
  font-size: 0.8rem;
  transform: translateY(-180%);
  transition: transform 0.2s ease;
}

.skip-link:focus {
  transform: translateY(0);
}

@supports (animation-timeline: scroll()) {
  body::before {
    content: '';
    position: fixed;
    inset: 0 0 auto;
    height: 3px;
    background: var(--p-accent);
    transform-origin: left center;
    transform: scaleX(0);
    z-index: 240;
    animation: page-progress linear both;
    animation-timeline: scroll(root block);
  }

  @keyframes page-progress {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
  }
}

/* --- 3. TYPOGRAPHY ------------------------------------------ */
h1 { font-size: clamp(2.8rem, 8vw, 5.5rem); font-weight: 700; line-height: 1.04; letter-spacing: -0.03em; }
h2 { font-size: clamp(1.75rem, 4vw, 2.5rem); font-weight: 600; line-height: 1.15; letter-spacing: -0.02em; }
h3 { font-size: clamp(1rem, 2vw, 1.2rem); font-weight: 600; line-height: 1.3; }
p  { line-height: 1.75; }

.section-wrapper { max-width: var(--p-max-width); margin: 0 auto; padding: 0 1.5rem; }
.section-pad { padding: 6rem 0; }

.section-label {
  display: inline-block;
  font-family: var(--p-font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--p-accent);
  margin-bottom: 0.75rem;
}

/* Staggered fade-in */
.fade-in {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.fade-in.visible { opacity: 1; transform: translateY(0); }

/* --- 4. NAV -------------------------------------------------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  height: var(--p-nav-height);
  background: rgba(10, 10, 10, 0.75);
  border-bottom: 1px solid transparent;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: border-color 0.25s, box-shadow 0.25s;
}
.nav.scrolled {
  border-color: var(--p-border);
  box-shadow: 0 1px 24px rgba(0, 0, 0, 0.5);
}
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: var(--p-nav-height);
}
.nav-logo {
  font-family: var(--p-font-mono); font-size: 1rem; font-weight: 600;
  color: var(--p-accent); letter-spacing: 0.06em; flex-shrink: 0;
  transition: opacity 0.15s;
}
.nav-logo:hover { opacity: 0.75; }
.nav-logo-img { display: block; width: auto; height: 28px; }

.nav-links { display: flex; align-items: center; gap: 0.15rem; }
.nav-link {
  font-size: 0.8125rem; font-weight: 500; color: var(--p-muted);
  padding: 0.4rem 0.7rem; border-radius: var(--p-radius);
  transition: color 0.15s, background 0.15s;
}
.nav-link:hover { color: var(--p-text); }
.nav-link.active,
.nav-link[aria-current="true"] { color: var(--p-text); background: var(--p-surface-2); }

.nav-hamburger {
  display: none; flex-direction: column; gap: 5px; padding: 6px;
  border-radius: var(--p-radius); transition: background 0.15s;
}
.nav-hamburger:hover { background: var(--p-surface-2); }
.nav-hamburger span {
  display: block; width: 22px; height: 1.5px; background: var(--p-muted);
  border-radius: 2px; transition: transform 0.22s, opacity 0.22s;
}
.nav-hamburger[aria-expanded="true"] span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.nav-hamburger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-hamburger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

.mobile-menu {
  display: none; background: var(--p-surface);
  border-top: 1px solid var(--p-border); padding: 0.75rem 1.5rem 1.25rem;
}
.mobile-menu.open { display: block; }
.mobile-menu ul { display: flex; flex-direction: column; gap: 0.2rem; }
.mobile-link {
  display: block; font-size: 0.9375rem; font-weight: 500; color: var(--p-muted);
  padding: 0.55rem 0.5rem; border-radius: var(--p-radius);
  transition: color 0.15s, background 0.15s;
}
.mobile-link:hover { color: var(--p-text); background: var(--p-surface-2); }
.mobile-link[aria-current="true"] { color: var(--p-text); background: var(--p-surface-2); }

/* --- 5. BUTTONS --------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-family: var(--p-font-ui); font-size: 0.9375rem; font-weight: 500;
  padding: 0.7rem 1.5rem; border-radius: var(--p-radius);
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.18s;
  white-space: nowrap; cursor: pointer; text-decoration: none;
}
.btn-primary { background: var(--p-accent); color: #fff; border-color: var(--p-accent); }
.btn-primary:hover {
  background: #4f51d1; border-color: #4f51d1;
  box-shadow: 0 0 0 3px var(--p-accent-glow);
}
.btn-ghost { background: transparent; color: var(--p-text); border-color: var(--p-border-h); }
.btn-ghost:hover { border-color: var(--p-accent); color: var(--p-accent); }
.btn-sm { font-size: 0.8125rem; padding: 0.45rem 0.95rem; }
.btn-disabled { opacity: 0.35; pointer-events: none; }

.back-to-top {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 190;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* --- 6. HERO ------------------------------------------------- */
@keyframes hero-load {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
.hero-load-1, .hero-load-2, .hero-load-3,
.hero-load-4, .hero-load-5, .hero-load-6 {
  opacity: 0;
  animation: hero-load 0.55s ease forwards;
}
.hero-load-1 { animation-delay: 0.08s; }
.hero-load-2 { animation-delay: 0.18s; }
.hero-load-3 { animation-delay: 0.32s; }
.hero-load-4 { animation-delay: 0.44s; }
.hero-load-5 { animation-delay: 0.56s; }
.hero-load-6 { animation-delay: 0.70s; }

.hero {
  position: relative; min-height: 100svh; display: flex; align-items: center;
  overflow: hidden; padding-top: var(--p-nav-height);
}

/* Background grid + ambient glow */
.hero-bg {
  position: absolute; inset: 0; z-index: 0;
  background-image:
    linear-gradient(rgba(99, 102, 241, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(99, 102, 241, 0.04) 1px, transparent 1px);
  background-size: 50px 50px;
}
.hero-bg-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.22;
  filter: saturate(0.9);
}
.hero-bg::before {
  content: '';
  position: absolute;
  width: 700px; height: 700px;
  left: -150px; top: -50px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.07) 0%, transparent 65%);
  border-radius: 50%;
  pointer-events: none;
}
.hero-bg::after {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse 90% 70% at 50% 50%, transparent 20%, var(--p-bg) 80%);
}

.hero-inner {
  position: relative; z-index: 1;
  padding-top: 5rem; padding-bottom: 5rem;
  max-width: 780px;
}

/* Status badge */
.hero-status {
  display: inline-flex; align-items: center; gap: 0.55rem;
  font-family: var(--p-font-mono); font-size: 0.75rem; color: var(--p-muted);
  padding: 0.4rem 1rem; margin-bottom: 1.75rem;
  border: 1px solid var(--p-border); border-radius: var(--p-radius-full);
  background: var(--p-surface);
}
.hero-status-dot {
  width: 7px; height: 7px; border-radius: 50%; background: #22c55e; flex-shrink: 0;
  animation: pulse-status 2.5s ease-in-out infinite;
}
@keyframes pulse-status {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.45); }
  50%       { box-shadow: 0 0 0 5px rgba(34, 197, 94, 0); }
}

/* Name with gradient */
.hero-name {
  background: linear-gradient(135deg, #ffffff 0%, #c7d2e8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 1rem;
}

.hero-tagline {
  font-size: clamp(1.05rem, 2.5vw, 1.3rem); font-weight: 500;
  color: var(--p-muted); margin-bottom: 0.875rem; line-height: 1.4;
}
.hero-desc {
  max-width: 520px; color: var(--p-muted-2); font-size: 1rem; margin-bottom: 2.25rem;
}
.hero-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 3rem; }

/* Stats row */
.hero-stats {
  display: flex; align-items: center; gap: 2.5rem;
  padding-top: 2rem; border-top: 1px solid var(--p-border);
}
.hero-stat-num {
  display: block;
  font-family: var(--p-font-mono); font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 600; color: var(--p-text); line-height: 1;
}
.hero-stat-label {
  display: block;
  font-family: var(--p-font-mono); font-size: 0.65rem;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--p-muted-2); margin-top: 0.3rem;
}
.hero-stat { display: flex; flex-direction: column; }
.hero-stat-div { width: 1px; height: 2rem; background: var(--p-border); flex-shrink: 0; }

/* Scroll indicator */
.scroll-indicator {
  position: absolute; bottom: 2rem; left: 50%; transform: translateX(-50%);
}
.scroll-indicator span {
  display: block; width: 1px; height: 44px;
  background: linear-gradient(to bottom, transparent, var(--p-border-h));
  animation: scroll-pulse 2.2s ease-in-out infinite;
}
@keyframes scroll-pulse {
  0%   { opacity: 0; transform: scaleY(0) translateY(0); transform-origin: top; }
  40%  { opacity: 1; transform: scaleY(1) translateY(0); transform-origin: top; }
  80%  { opacity: 0; transform: scaleY(1) translateY(0); transform-origin: top; }
  100% { opacity: 0; }
}

/* --- 7. ABOUT ----------------------------------------------- */
.about { background: var(--p-bg); }
.about-grid {
  display: grid; grid-template-columns: 1fr 360px;
  gap: 5rem; align-items: center; margin-top: 2.5rem;
}
.about-text h2 { margin-bottom: 1.25rem; }
.about-text p { color: var(--p-muted); margin-bottom: 1rem; }
.about-text p:last-child { margin-bottom: 0; }

.about-photo-wrap { position: relative; }
.about-photo-wrap::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: calc(var(--p-radius-lg) + 1px);
  background: linear-gradient(135deg, var(--p-accent), transparent 60%);
  opacity: 0.25;
  z-index: 0;
}
.about-photo {
  position: relative; z-index: 1;
  width: 100%; aspect-ratio: 4 / 5;
  object-fit: cover; object-position: top center;
  border-radius: var(--p-radius-lg);
  border: 1px solid var(--p-border);
}

/* --- 8. SKILLS ---------------------------------------------- */
.skills { background: var(--p-surface); }

.skill-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-top: 2.5rem;
  margin-bottom: 1.25rem;
}
.skill-card {
  background: var(--p-surface-2); border: 1px solid var(--p-border);
  border-radius: var(--p-radius-lg); padding: 1.75rem;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.skill-card:hover {
  border-color: var(--p-border-h);
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(0,0,0,0.25);
}
.skill-cards .skill-card:nth-child(2) { transition-delay: 0.08s; }
.skill-cards .skill-card:nth-child(3) { transition-delay: 0.16s; }

.skill-card-icon {
  font-family: var(--p-font-mono); font-size: 1.35rem; font-weight: 600;
  color: var(--p-accent); opacity: 0.75;
  display: block; margin-bottom: 1rem; line-height: 1;
}
.skill-card-label {
  font-family: var(--p-font-mono); font-size: 0.68rem; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--p-accent); margin-bottom: 1rem;
}

.skill-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.skill-tags li {
  font-family: var(--p-font-mono); font-size: 0.75rem;
  padding: 0.3rem 0.75rem;
  background: var(--p-surface); border: 1px solid var(--p-border);
  border-radius: var(--p-radius-full); color: var(--p-muted); line-height: 1.4;
  transition: border-color 0.15s, color 0.15s;
}
.skill-tags li:hover { border-color: var(--p-border-h); color: var(--p-text); }

.creds-row {
  display: flex; align-items: center; gap: 2.5rem; flex-wrap: wrap;
  padding: 2rem 2.5rem;
  background: var(--p-surface-2); border: 1px solid var(--p-border);
  border-radius: var(--p-radius-lg);
}
.creds-divider { width: 1px; height: 3rem; background: var(--p-border); flex-shrink: 0; }
.credential-block { padding-left: 1rem; border-left: 2px solid var(--p-accent); }
.credential-label {
  font-family: var(--p-font-mono); font-size: 0.68rem; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--p-accent); margin-bottom: 0.6rem;
}
.credential-title { font-size: 0.9375rem; font-weight: 600; color: var(--p-text); }
.credential-sub { font-size: 0.875rem; color: var(--p-muted); margin-top: 0.1rem; }
.credential-list { display: flex; flex-direction: column; gap: 0.35rem; margin-top: 0.1rem; }
.credential-list li {
  font-size: 0.875rem; color: var(--p-muted);
  display: flex; align-items: baseline; gap: 0.5rem;
}
.credential-list li::before {
  content: '—'; color: var(--p-muted-2);
  font-family: var(--p-font-mono); font-size: 0.7rem; flex-shrink: 0;
}

/* --- 9. ACHIEVEMENTS ---------------------------------------- */
.achievements { background: var(--p-bg); }
.achievements-sub { color: var(--p-muted); font-size: 1rem; margin-top: 0.5rem; }

.comp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 2.5rem;
  margin-bottom: 1.25rem;
}

.comp-card {
  background: var(--p-surface);
  border: 1px solid var(--p-border);
  border-radius: var(--p-radius-lg);
  padding: 1.5rem 1.5rem 1.25rem;
  display: flex; flex-direction: column; gap: 0.35rem;
  transition: transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease;
}
.comp-card:hover {
  border-color: var(--p-border-h);
  transform: translateY(-4px);
  box-shadow: 0 12px 28px var(--p-shadow-accent);
}

/* 1st place card — gold treatment */
.comp-card--gold {
  border-color: rgba(245, 158, 11, 0.30);
  background: linear-gradient(145deg, var(--p-surface), rgba(245, 158, 11, 0.05));
}
.comp-card--gold:hover {
  border-color: rgba(245, 158, 11, 0.60);
  box-shadow: 0 8px 32px rgba(245, 158, 11, 0.12);
}

.comp-place {
  font-family: var(--p-font-mono);
  font-size: clamp(2.2rem, 5vw, 3.25rem);
  font-weight: 600;
  line-height: 1;
  color: var(--p-accent);
  margin-bottom: 0.25rem;
}
.comp-card--gold .comp-place {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.comp-place--qualifier {
  font-size: clamp(1.1rem, 2.5vw, 1.5rem);
}

.comp-name {
  font-size: 0.9375rem; font-weight: 600;
  color: var(--p-text); line-height: 1.3;
}
.comp-eyebrow {
  font-family: var(--p-font-mono); font-size: 0.62rem; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--p-muted-2);
}
.comp-year {
  font-family: var(--p-font-mono); font-size: 0.7rem;
  color: var(--p-muted-2); margin-top: 0.1rem;
}

/* Stagger comp cards */
.comp-card:nth-child(1) { transition-delay: 0.00s; }
.comp-card:nth-child(2) { transition-delay: 0.06s; }
.comp-card:nth-child(3) { transition-delay: 0.12s; }
.comp-card:nth-child(4) { transition-delay: 0.18s; }
.comp-card:nth-child(5) { transition-delay: 0.24s; }

/* Academic stat bar */
.academic-bar {
  display: flex;
  border: 1px solid var(--p-border);
  border-radius: var(--p-radius-lg);
  overflow: hidden;
  background: var(--p-surface);
}
.academic-stat {
  flex: 1; padding: 1.5rem 1.25rem;
  border-right: 1px solid var(--p-border);
  text-align: center;
  transition: background 0.15s;
}
.academic-stat:last-child { border-right: none; }
.academic-stat:hover { background: var(--p-surface-2); }
.academic-num {
  display: block;
  font-family: var(--p-font-mono);
  font-size: clamp(1.1rem, 2.5vw, 1.6rem);
  font-weight: 600; color: var(--p-text); line-height: 1.15;
  margin-bottom: 0.3rem;
}
.academic-label {
  font-family: var(--p-font-mono); font-size: 0.62rem;
  text-transform: uppercase; letter-spacing: 0.09em; color: var(--p-muted-2);
}

.photo-break {
  position: relative;
  height: clamp(220px, 36vw, 420px);
  overflow: hidden;
  background: var(--p-bg);
}
.photo-break-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.42;
}
.photo-break-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(10, 10, 10, 0.7) 0%, rgba(10, 10, 10, 0.2) 45%, rgba(10, 10, 10, 0.82) 100%);
}

/* --- 10. PROJECTS ------------------------------------------- */
.projects { background: var(--p-surface); }
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem; margin-top: 2.5rem;
}
.project-card {
  background: var(--p-surface-2); border: 1px solid var(--p-border);
  border-radius: var(--p-radius-lg); padding: 1.75rem;
  display: flex; flex-direction: column;
  transition: transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease;
}
.project-card:hover {
  border-color: var(--p-border-h);
  transform: translateY(-4px);
  box-shadow: 0 12px 34px var(--p-shadow-accent);
}
.project-card--featured {
  grid-column: span 2;
  border-color: var(--p-border-h);
  background: linear-gradient(145deg, var(--p-surface-2), rgba(99, 102, 241, 0.04));
}
.project-card--featured:hover {
  border-color: rgba(99, 102, 241, 0.45);
  box-shadow: 0 14px 42px var(--p-shadow-accent-strong);
}
.project-card--placeholder { display: none; }
.project-screenshot {
  margin-bottom: 1.25rem;
  border: 1px solid var(--p-border);
  border-radius: var(--p-radius);
  overflow: hidden;
  background: var(--p-surface);
}
.project-screenshot img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.project-top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.25rem; gap: 0.75rem;
}
.project-top--tags-only { justify-content: flex-start; }
.project-top--tags-only .project-tech { justify-content: flex-start; }
.project-badge {
  font-family: var(--p-font-mono); font-size: 0.65rem; font-weight: 600;
  letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--p-accent); background: var(--p-accent-dim);
  border: 1px solid rgba(99, 102, 241, 0.22);
  padding: 0.2rem 0.65rem; border-radius: var(--p-radius-full);
}
.project-tech { display: flex; flex-wrap: wrap; gap: 0.35rem; justify-content: flex-end; }
.project-tech span {
  font-family: var(--p-font-mono); font-size: 0.68rem;
  padding: 0.2rem 0.55rem;
  background: var(--p-surface); border: 1px solid var(--p-border);
  border-radius: var(--p-radius-full); color: var(--p-muted);
}
.project-title {
  font-size: 1.125rem; font-weight: 600; color: var(--p-text); margin-bottom: 0.35rem;
}
.project-meta {
  font-family: var(--p-font-mono); font-size: 0.72rem;
  color: var(--p-accent); margin-bottom: 0.75rem; opacity: 0.8;
}
.project-desc {
  font-size: 0.9375rem; color: var(--p-muted);
  line-height: 1.65; flex: 1; margin-bottom: 0.875rem;
}
.project-role {
  font-family: var(--p-font-mono); font-size: 0.72rem;
  color: var(--p-muted-2); margin-bottom: 1.5rem;
}
.project-actions { display: flex; gap: 0.5rem; margin-top: auto; }

.is-loading {
  position: relative;
  overflow: hidden;
}

.is-loading::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.2s ease-in-out infinite;
}

.hero-stat--skeleton,
.comp-card--skeleton,
.project-card--skeleton {
  pointer-events: none;
}

.hero-stat--skeleton {
  min-width: 110px;
}

.comp-card--skeleton,
.project-card--skeleton {
  min-height: 220px;
}

.skeleton-line,
.skeleton-pill {
  display: block;
  border-radius: var(--p-radius-full);
  background: rgba(148, 163, 184, 0.12);
}

.skeleton-line {
  height: 0.85rem;
  margin-bottom: 0.65rem;
}

.skeleton-line:last-child {
  margin-bottom: 0;
}

.skeleton-line--short { width: 38%; }
.skeleton-line--mid { width: 62%; }
.skeleton-line--wide { width: 88%; }
.skeleton-line--stat { width: 72px; height: 1.8rem; }
.skeleton-line--meta { width: 112px; }
.skeleton-line--title { width: 80%; height: 1rem; }

.skeleton-pill {
  width: 96px;
  height: 1.45rem;
  margin-bottom: 1rem;
}

@keyframes shimmer {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}

/* --- 11. SERVICES ------------------------------------------- */
.services { background: var(--p-bg); }
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem; margin-top: 2.5rem;
}
.service-card {
  background: var(--p-surface); border: 1px solid var(--p-border);
  border-radius: var(--p-radius-lg); padding: 1.5rem;
  transition: border-color 0.2s;
}
.service-card:hover { border-color: var(--p-border-h); }
.service-icon {
  font-size: 1.1rem; display: block; margin-bottom: 0.875rem;
  color: var(--p-accent); opacity: 0.65;
}
.service-title { font-size: 1rem; font-weight: 600; color: var(--p-text); margin-bottom: 0.4rem; }
.service-desc { font-size: 0.875rem; color: var(--p-muted); line-height: 1.6; }
.services-cta { margin-top: 2.5rem; font-size: 0.9375rem; color: var(--p-muted); }
.services-cta a {
  color: var(--p-accent); font-weight: 500;
  border-bottom: 1px solid transparent; transition: border-color 0.15s;
}
.services-cta a:hover { border-color: var(--p-accent); }

/* --- 12. WRITEUPS CTA BANNER -------------------------------- */
/* (Contact = 13, Footer = 14, Writeups page = 15, Responsive = 16) */
.writeups-cta-wrap { background: var(--p-bg); }
.writeups-cta-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 2.5rem; flex-wrap: wrap;
  border: 1px solid rgba(99, 102, 241, 0.28);
  border-radius: var(--p-radius-lg);
  padding: 3rem 3.5rem;
  background: linear-gradient(135deg, var(--p-surface), rgba(99, 102, 241, 0.07));
  transition: border-color 0.2s, box-shadow 0.2s;
}
.writeups-cta-inner:hover {
  border-color: rgba(99, 102, 241, 0.50);
  box-shadow: 0 8px 48px rgba(99, 102, 241, 0.10);
}
.writeups-cta-text h2 { margin-top: 0.25rem; }
.writeups-cta-desc {
  color: var(--p-muted); font-size: 0.9375rem;
  margin-top: 0.75rem; max-width: 440px; line-height: 1.6;
}
.writeups-cta-btn { white-space: nowrap; flex-shrink: 0; }

/* --- 13. CONTACT -------------------------------------------- */
.contact { background: var(--p-surface); padding: 6rem 0 8rem; }
.contact-inner { max-width: 640px; }
.contact h2 { margin-bottom: 0.875rem; }
.contact-desc { color: var(--p-muted); margin-bottom: 2rem; font-size: 1.0625rem; }
.contact-email {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-family: var(--p-font-mono);
  font-size: clamp(1.05rem, 2.5vw, 1.35rem);
  font-weight: 600; color: var(--p-accent);
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s, opacity 0.15s;
}
.contact-email:hover { border-color: var(--p-accent); opacity: 0.8; }
.contact-arrow { transition: transform 0.2s; }
.contact-email:hover .contact-arrow { transform: translate(2px, -2px); }

/* --- 14. FOOTER --------------------------------------------- */
.footer {
  background: var(--p-bg); border-top: 1px solid var(--p-border); padding: 1.5rem 0;
}
.footer-inner {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.footer-copy { font-family: var(--p-font-mono); font-size: 0.8rem; color: var(--p-muted-2); }
.footer-link { font-family: var(--p-font-mono); font-size: 0.8rem; color: var(--p-muted); transition: color 0.15s; }
.footer-link:hover { color: var(--p-accent); }
.footer-links { display: flex; gap: 1.5rem; }

/* --- 15. WRITEUPS PAGE -------------------------------------- */
.writeups-header { background: var(--p-bg); padding-bottom: 0; }
.writeups-header h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  margin-top: 0.5rem; margin-bottom: 0;
}
.writeups-sub {
  max-width: 560px; color: var(--p-muted); font-size: 1.0625rem;
  margin-top: 0.875rem;
}

.feed-section { background: var(--p-bg); }
.feed-toolbar {
  display: grid;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.feed-search-field {
  display: grid;
  gap: 0.55rem;
}

.feed-search-label {
  font-family: var(--p-font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--p-accent);
}

.feed-search-input {
  width: 100%;
  padding: 0.85rem 1rem;
  border-radius: var(--p-radius);
  border: 1px solid var(--p-border);
  background: var(--p-surface);
  color: var(--p-text);
  font: inherit;
}

.feed-results-bar {
  display: grid;
  gap: 0.85rem;
}

.feed-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.feed-filter-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.2rem;
  padding: 0.45rem 0.9rem;
  border-radius: var(--p-radius-full);
  border: 1px solid var(--p-border-h);
  background: transparent;
  color: var(--p-muted);
  font-family: var(--p-font-mono);
  font-size: 0.75rem;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.feed-filter-btn:hover,
.feed-filter-btn.is-active {
  border-color: var(--p-accent);
  background: var(--p-accent);
  color: #fff;
}

.feed-count {
  color: var(--p-muted);
  font-size: 0.92rem;
}

.feed-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}

.feed-card {
  background: var(--p-surface); border: 1px solid var(--p-border);
  border-radius: var(--p-radius-lg); padding: 1.75rem;
  display: flex; flex-direction: column;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.feed-card:hover {
  border-color: var(--p-border-h);
  transform: translateY(-3px);
  box-shadow: 0 10px 36px rgba(0, 0, 0, 0.3);
}

.feed-card-top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.75rem; margin-bottom: 1rem;
}

.feed-tag {
  font-family: var(--p-font-mono); font-size: 0.65rem; font-weight: 600;
  letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--p-accent); background: var(--p-accent-dim);
  border: 1px solid rgba(99, 102, 241, 0.22);
  padding: 0.2rem 0.65rem; border-radius: var(--p-radius-full);
  white-space: nowrap;
}

.feed-date {
  font-family: var(--p-font-mono); font-size: 0.7rem;
  color: var(--p-muted-2); white-space: nowrap; margin-left: auto;
}

.feed-title {
  font-size: 1.0625rem; font-weight: 600; color: var(--p-text);
  line-height: 1.35; margin-bottom: 0.625rem;
}

.feed-desc {
  font-size: 0.9rem; color: var(--p-muted); line-height: 1.65;
  flex: 1; margin-bottom: 1.25rem;
}

.feed-actions { margin-top: auto; }

.feed-empty {
  grid-column: 1 / -1;
  font-family: var(--p-font-mono); font-size: 0.875rem;
  color: var(--p-muted-2); text-align: center; padding: 4rem 0;
}

.feed-empty[hidden] { display: none; }

@media print {
  nav, .admin-shell, .btn, .hero-bg, .photo-break, .back-to-top, .scroll-indicator { display: none !important; }
  body { background: white; color: black; }
  a[href]::after { content: " (" attr(href) ")"; font-size: 0.8em; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .fade-in { opacity: 1; transform: none; }
}

/* --- 16. RESPONSIVE ----------------------------------------- */
@media (max-width: 960px) {
  .nav-links { display: none; }
  .nav-hamburger { display: flex; }

  .about-grid { grid-template-columns: 1fr; gap: 2.5rem; }
  .about-photo-wrap { order: -1; max-width: 300px; }

  .skill-cards { grid-template-columns: 1fr; }
  .creds-divider { display: none; }
  .creds-row { flex-direction: column; align-items: flex-start; gap: 1.5rem; padding: 1.75rem; }

  .project-card--featured { grid-column: span 1; }

  .hero-stats { gap: 1.5rem; }

  .section-pad { padding: 4.5rem 0; }
}

@media (max-width: 640px) {
  .hero-stats { flex-wrap: wrap; gap: 1.25rem; }
  .hero-stat-div { display: none; }

  .comp-grid { grid-template-columns: repeat(2, 1fr); }

  .academic-bar { flex-direction: column; }
  .academic-stat { border-right: none; border-bottom: 1px solid var(--p-border); }
  .academic-stat:last-child { border-bottom: none; }

  .hero-actions { flex-direction: column; align-items: flex-start; }

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

  .writeups-cta-inner { flex-direction: column; align-items: flex-start; padding: 2rem; }
  .writeups-cta-btn { width: 100%; justify-content: center; }

  .footer-inner { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
  .feed-filter-bar { gap: 0.45rem; }
  .back-to-top {
    right: 1rem;
    bottom: 1rem;
  }
}
