/* ---------- Fonts (self-hosted, latin subset, SIL OFL) ---------- */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 600; /* one variable file covers all weights */
  font-display: swap;
  src: url(assets/fonts/inter-latin.woff2) format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(assets/fonts/jetbrains-mono-latin-400.woff2) format('woff2');
}

/* ---------- Theme tokens ---------- */
:root {
  --page-bg: #EEF0F4;
  --text: #111318;
  --muted: #596070;
  --body: #353A46;
  --card-bg: rgba(255, 255, 255, 0.82);
  --card-border: #E6E9EE;
  --track: #F1F3F6;
  --indicator: #FFFFFF;
  --chip-bg: #F1F3F6;
  --accent-bg: #E8EEFF;
  --accent-fg: #2440B3;
  --btn-bg: #111318;
  --btn-fg: #FFFFFF;
  --blob-1: #9DB4FF;
  --blob-2: #FFC2A8;
  --blob-opacity: 0.6;
  --dot-ring: #FFFFFF;
  --focus: #4F6BFF;
  --ease-out: cubic-bezier(.2, .7, .2, 1);
}

[data-theme="dark"] {
  --page-bg: #0B0C10;
  --text: #F2F3F5;
  --muted: #A2A8B5;
  --body: #C9CDD6;
  --card-bg: rgba(20, 22, 28, 0.78);
  --card-border: rgba(255, 255, 255, 0.08);
  --track: #1A1D24;
  --indicator: #2A2E38;
  --chip-bg: #20232B;
  --accent-bg: rgba(110, 135, 255, 0.16);
  --accent-fg: #AFC0FF;
  --btn-bg: #F2F3F5;
  --btn-fg: #0B0C10;
  --blob-1: #3346B8;
  --blob-2: #8A3B5C;
  --blob-opacity: 0.45;
  --dot-ring: #14161C;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: clamp(40px, 8vw, 104px) 16px;
  background: var(--page-bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  overflow-x: hidden;
  position: relative;
  transition: background-color .4s ease, color .4s ease;
}

a { color: inherit; }
.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 13px; }
.muted { color: var(--muted); }

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

/* ---------- Background blobs ---------- */
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: var(--blob-opacity);
  pointer-events: none;
  transition: background-color .4s ease;
}
.blob-1 { left: 12%; top: 6%; width: 420px; height: 420px; background: var(--blob-1); animation: drift1 16s ease-in-out infinite; }
.blob-2 { right: 10%; bottom: 4%; width: 380px; height: 380px; background: var(--blob-2); animation: drift2 18s ease-in-out infinite; }

/* ---------- Card ---------- */
.card {
  position: relative;
  width: 100%;
  max-width: 580px;
  padding: clamp(22px, 5vw, 36px);
  display: flex;
  flex-direction: column;
  gap: 24px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 26px;
  box-shadow: 0 1px 2px rgba(17, 19, 24, .06), 0 24px 60px rgba(17, 19, 24, .12);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  animation: rise .8s var(--ease-out) both;
  transition: background-color .4s ease, border-color .4s ease;
}

/* ---------- Profile ---------- */
.profile { display: flex; align-items: flex-start; gap: 16px; }
.avatar-wrap { position: relative; flex: none; width: 72px; height: 72px; border-radius: 50%; background: var(--chip-bg); }
.avatar { display: block; width: 72px; height: 72px; border-radius: 50%; object-fit: cover; background: var(--chip-bg); }
.status-dot {
  position: absolute; right: 2px; bottom: 2px;
  width: 13px; height: 13px; border-radius: 50%;
  background: #22C55E; border: 2px solid var(--dot-ring);
  animation: pulse 2s ease-out infinite;
}
.profile-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.profile h1 { margin: 0; font-size: 24px; line-height: 1.2; font-weight: 600; letter-spacing: -0.025em; }
.profile p { margin: 0; font-size: 15px; }
.location { display: flex; align-items: center; gap: 6px; font-size: 14px !important; }

.icon-btn {
  flex: none; width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer;
  border: 1px solid var(--card-border); background: var(--track); color: var(--text);
  transition: transform .3s ease, background-color .4s ease;
}
.icon-btn:hover { transform: rotate(-15deg); }
.icon-sun { display: none; }
[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }

/* ---------- Now pill ---------- */
.now {
  margin: 0; align-self: flex-start;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 12px; border-radius: 999px;
  background: var(--track); color: var(--muted); font-size: 13px;
}
.now strong { color: var(--text); font-weight: 500; }

/* ---------- Tabs ---------- */
.tablist {
  position: relative; display: flex; padding: 4px; border-radius: 12px;
  background: var(--track); transition: background-color .4s ease;
}
.indicator {
  position: absolute; left: 4px; top: 4px;
  width: calc((100% - 8px) / 4); /* one quarter per tab: About, Stack, Projects, Connect */ height: calc(100% - 8px);
  border-radius: 9px; background: var(--indicator);
  box-shadow: 0 1px 3px rgba(17, 19, 24, .18);
  transform: translateX(calc(var(--tab-index, 0) * 100%));
  transition: transform .38s cubic-bezier(.3, .8, .2, 1), background-color .4s ease;
}
/* Set for one frame when the page opens on another tab's URL, so the pill doesn't slide in from About. */
.tablist.instant .indicator { transition: none; }
.tab {
  position: relative; flex: 1 1 0; min-width: 0; min-height: 44px; padding: 0 2px; /* equal widths, so the pill lines up */
  border: none; border-radius: 9px; background: transparent; cursor: pointer;
  font: 500 14px 'Inter', system-ui, sans-serif; color: var(--muted);
  transition: color .25s;
}
.tab[aria-selected="true"] { color: var(--text); }
@media (max-width: 360px) { .tab { font-size: 13px; } } /* four tabs fit on 320px phones */

/* ---------- Panels ---------- */
.panels { min-height: 268px; overflow: hidden; }
.panel { display: flex; flex-direction: column; gap: 14px; }
.panel[hidden] { display: none; }
.panel.enter-left  { animation: slideL .4s var(--ease-out) both; }
.panel.enter-right { animation: slideR .4s var(--ease-out) both; }

#panel-about p { margin: 0; font-size: 16px; line-height: 1.68; color: var(--body); }

#panel-stack { gap: 20px; }
.group { display: flex; flex-direction: column; gap: 8px; }
.label { margin: 0; font-size: 13px; font-weight: 500; color: var(--muted); }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; font-size: 14px; }
.chips li { padding: 9px 13px; border-radius: 10px; background: var(--chip-bg); transition: transform .2s ease; }
.chips li:hover { transform: translateY(-2px); }
.chips.accent li { background: var(--accent-bg); color: var(--accent-fg); }

#panel-projects, #panel-connect { gap: 10px; }
.link-row {
  min-height: 60px; display: flex; align-items: center; gap: 14px; padding: 0 18px;
  border-radius: 14px; text-decoration: none; font-weight: 500;
  background: var(--track); border: 1px solid var(--card-border); color: var(--text);
  transition: transform .2s ease, box-shadow .2s ease;
}
.link-row.primary { background: var(--btn-bg); color: var(--btn-fg); border-color: transparent; }
.link-row:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(17, 19, 24, .16); }
.link-text { flex: 1; display: flex; flex-direction: column; }
.link-text small { font-size: 13px; font-weight: 400; opacity: .7; }
/* Project cards: a short description under the subtitle; icon and arrow stay at the top. */
.link-row.project { align-items: flex-start; padding: 16px 18px; }
.link-row.project .arr { margin-top: 2px; }
/* The project's own app icon (a self-hosted copy: img-src is 'self' only). */
.project-icon { flex: none; width: 36px; height: 36px; border-radius: 8px; }
.link-desc { margin-top: 8px; font-size: 14px; font-weight: 400; line-height: 1.55; color: var(--body); }
.arr { transition: transform .2s ease; }
.link-row:hover .arr { transform: translate(2px, -2px); }

/* ---------- Footer ---------- */
.card-footer {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px;
  padding-top: 18px; border-top: 1px solid var(--card-border);
  font-size: 13px; color: var(--muted);
}

/* ---------- Entrance stagger ---------- */
.rise { animation: rise .7s var(--ease-out) both; }
.d1 { animation-delay: .12s; }
.d2 { animation-delay: .18s; }
.d3 { animation-delay: .24s; }
.d4 { animation-delay: .32s; }

/* ---------- Keyframes ---------- */
@keyframes rise   { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes slideL { from { opacity: 0; transform: translateX(18px); }  to { opacity: 1; transform: none; } }
@keyframes slideR { from { opacity: 0; transform: translateX(-18px); } to { opacity: 1; transform: none; } }
@keyframes drift1 { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(60px, 40px) scale(1.12); } }
@keyframes drift2 { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(-50px, -30px) scale(1.08); } }
@keyframes pulse  {
  0%   { box-shadow: 0 0 0 0 rgba(34, 197, 94, .55); }
  70%  { box-shadow: 0 0 0 9px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
