/* =========================================================
   Home page
   ========================================================= */

.block { padding-top: 120px; }
.block__head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 36px;
}
.block__title {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.3rem);
  letter-spacing: -0.04em;
  line-height: 1.1;
}
.block__lede { color: var(--fg-2); max-width: 52ch; margin-top: 26px; }
.text-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--signal);
  font-weight: 600;
  white-space: nowrap;
}
.text-link i { transition: transform 0.3s var(--ease-out); font-size: 0.8em; }
.text-link:hover i { transform: translateX(4px); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: calc(100svh - var(--header-h));
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-block: 40px 72px;
}
.hero__stage {
  position: relative;
  height: clamp(120px, 19vw, 250px);
  margin-bottom: 28px;
}
.hero__stage canvas {
  position: absolute;
  inset: -40px -60px;
  width: calc(100% + 120px);
  height: calc(100% + 80px);
  touch-action: pan-y;
}
/* Text fallback, also what screen readers & no-JS see */
.hero__name {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: clamp(2.2rem, 9.6vw, 8.2rem);
  letter-spacing: -0.01em;
  line-height: 1;
  position: absolute;
  left: 0;
  bottom: 0;
  white-space: nowrap;
  color: var(--fg);
}
.has-particles .hero__name { color: transparent; pointer-events: none; user-select: none; -webkit-user-select: none; }

.hero__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 48px;
  align-items: end;
}
.hero__role {
  font-family: var(--font-head);
  font-size: clamp(0.95rem, 0.85rem + 0.4vw, 1.15rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--signal);
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 1.6em;
}
.hero__role .caret {
  width: 0.55em; height: 1.1em;
  background: var(--amber);
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
.hero__bio {
  margin-top: 14px;
  max-width: 54ch;
  font-size: clamp(1.02rem, 0.95rem + 0.3vw, 1.18rem);
  color: var(--fg-2);
  line-height: 1.65;
}
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.hero__hint {
  margin-top: 22px;
  font-size: 0.86rem;
  color: var(--fg-3);
  display: flex; align-items: center; gap: 8px;
}

/* Presence card */
.presence {
  border: 1px solid var(--line);
  background: rgba(12, 18, 34, 0.75);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  padding: 16px;
  display: grid;
  gap: 14px;
}
.presence__top { display: flex; align-items: center; gap: 12px; }
.presence__avatar { position: relative; width: 48px; height: 48px; flex-shrink: 0; }
.presence__avatar img { width: 48px; height: 48px; border-radius: 50%; }
.presence__dot {
  position: absolute; right: -1px; bottom: -1px;
  width: 15px; height: 15px; border-radius: 50%;
  border: 3px solid var(--ink-1);
  background: var(--fg-3);
}
.presence__dot[data-s="online"] { background: var(--mint); }
.presence__dot[data-s="idle"] { background: var(--amber); }
.presence__dot[data-s="dnd"] { background: var(--rose); }
.presence__who { min-width: 0; }
.presence__name { font-weight: 600; display: block; }
.presence__status { font-size: 0.86rem; color: var(--fg-3); display: block; }
.presence__activity {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border-radius: 10px;
  background: var(--ink-2);
  font-size: 0.86rem;
  color: var(--fg-2);
  min-height: 58px;
}
.presence__activity img { width: 38px; height: 38px; border-radius: 8px; flex-shrink: 0; object-fit: cover; }
.presence__activity .pa-icon {
  width: 38px; height: 38px; border-radius: 8px; flex-shrink: 0;
  display: grid; place-items: center; background: var(--ink-3); color: var(--signal);
}
.presence__activity b { color: var(--fg); font-weight: 600; display: block; }
.presence__activity span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.presence__activity > div { min-width: 0; }
.presence__bar { height: 3px; border-radius: 3px; background: var(--ink-3); margin-top: 6px; overflow: hidden; }
.presence__bar i { display: block; height: 100%; background: var(--mint); width: 0; }

.scroll-cue {
  position: absolute;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  width: 22px; height: 34px;
  border: 1.5px solid var(--fg-3);
  border-radius: 12px;
  opacity: 0.6;
}
.scroll-cue::after {
  content: '';
  position: absolute;
  left: 50%; top: 7px;
  width: 3px; height: 7px; margin-left: -1.5px;
  border-radius: 2px;
  background: var(--fg-2);
  animation: cue 1.8s var(--ease-out) infinite;
}
@keyframes cue { 0% { opacity: 0; transform: translateY(-3px); } 30% { opacity: 1; } 100% { opacity: 0; transform: translateY(10px); } }

/* ---------- Work bento ---------- */
.bento {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  grid-template-rows: auto auto;
  gap: 16px;
}
.tile {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(18, 26, 47, 0.85), rgba(12, 18, 34, 0.85));
  border-radius: 20px;
  padding: 26px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.tile--projects { grid-row: span 2; }
.tile__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.tile__title {
  font-family: var(--font-head);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  display: flex; align-items: center; gap: 12px;
}
.tile__count {
  font-family: var(--font-code);
  font-size: 0.8rem;
  color: var(--fg-3);
  border: 1px solid var(--line);
  padding: 2px 8px;
  border-radius: 999px;
}
.tile__text { color: var(--fg-2); font-size: 0.95rem; max-width: 46ch; }
.tile__foot { margin-top: auto; padding-top: 22px; }

.feature-list { display: grid; gap: 10px; margin-top: 4px; }
.feature-row {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 16px;
  border-radius: 14px;
  border: 1px solid var(--line-soft);
  background: rgba(7, 11, 22, 0.45);
  transition: border-color 0.25s, background-color 0.25s, transform 0.35s var(--ease-out);
}
.feature-row:hover { border-color: rgba(var(--signal-rgb), 0.45); background: rgba(var(--signal-rgb), 0.06); transform: translateX(4px); }
.feature-row__icon {
  width: 52px; height: 52px;
  border-radius: 12px;
  display: grid; place-items: center;
  font-size: 1.45rem;
  background: var(--ink-3);
  color: var(--signal);
}
.feature-row__icon.is-pi { color: #ff6b9d; }
.feature-row__icon.is-net { color: var(--amber); }
.feature-row__icon.is-luko { color: #b49bff; }
.feature-row h3 { font-size: 1.05rem; font-weight: 600; }
.feature-row p { font-size: 0.9rem; color: var(--fg-2); line-height: 1.5; margin-top: 2px; }
.feature-row__stack { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

.feature-row > i { color: var(--fg-3); transition: color 0.2s, transform 0.3s var(--ease-out); }
.feature-row:hover > i { color: var(--signal); transform: translateX(3px); }

.link-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.link-cloud a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(7, 11, 22, 0.45);
  font-size: 0.88rem;
  color: var(--fg-2);
  transition: color 0.2s, border-color 0.2s, transform 0.3s var(--ease-spring);
}
.link-cloud a i { color: var(--signal); font-size: 0.85em; }
.link-cloud a:hover { color: var(--fg); border-color: rgba(var(--signal-rgb), 0.5); transform: translateY(-2px); }

/* ---------- GitHub ---------- */
.gh-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}
.gh-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
  grid-column: 1 / -1;
}
.gh-stat {
  padding: 22px 24px;
  border-right: 1px solid var(--line);
  background: rgba(12, 18, 34, 0.7);
}
.gh-stat:last-child { border-right: 0; }
.gh-stat b {
  display: block;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: clamp(1.4rem, 1rem + 1.4vw, 2rem);
  letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums;
}
.gh-stat span { color: var(--fg-3); font-size: 0.88rem; }
.gh-panel {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(12, 18, 34, 0.7);
  padding: 22px;
  min-width: 0;
}
.gh-panel h3 { font-size: 0.95rem; font-weight: 600; color: var(--fg-2); margin-bottom: 14px; display: flex; justify-content: space-between; }
.gh-chart { overflow-x: auto; padding-bottom: 4px; }
.gh-chart img { min-width: 640px; width: 100%; height: auto; filter: saturate(1.1); opacity: 0.95; }
.gh-panel--chart { grid-column: 1 / -1; }
.repo-list { display: grid; }
.repo {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  padding: 12px 10px;
  margin: 0 -10px;
  border-radius: 10px;
  transition: background-color 0.2s;
}
.repo + .repo { border-top: 1px solid var(--line-soft); }
.repo:hover { background: rgba(var(--signal-rgb), 0.06); }
.repo__name { font-weight: 600; font-size: 0.95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.repo__meta { font-size: 0.8rem; color: var(--fg-3); display: flex; gap: 12px; justify-content: end; align-items: center; white-space: nowrap; }
.repo__desc { grid-column: 1 / -1; font-size: 0.86rem; color: var(--fg-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lang-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 5px; vertical-align: 0; }
.skeleton {
  border-radius: 8px;
  background: linear-gradient(90deg, var(--ink-2) 0%, var(--ink-3) 50%, var(--ink-2) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
  height: 46px;
  margin: 6px 0;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Stack ---------- */
.stack {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--line);
}
.stack__col { padding: 22px 24px 8px 0; }
.stack__col + .stack__col { padding-left: 24px; border-left: 1px solid var(--line-soft); }
.stack__col h3 { font-size: 0.9rem; color: var(--fg-3); font-weight: 600; margin-bottom: 10px; }
.stack__col ul { list-style: none; }
.stack__col li {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
  font-size: 1rem;
  color: var(--fg-2);
  transition: color 0.2s, transform 0.3s var(--ease-out);
}
.stack__col li i { font-size: 1.35rem; width: 26px; text-align: center; color: var(--fg-3); transition: color 0.25s, transform 0.4s var(--ease-spring); }
.stack__col li:hover { color: var(--fg); transform: translateX(4px); }
.stack__col li:hover i { color: var(--c, var(--signal)); transform: scale(1.18) rotate(-6deg); }

/* ---------- Contact + terminal ---------- */
.connect {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: 32px;
  align-items: stretch;
}
/* Intro column matches the terminal's height; the contact cards share what's left */
.connect__intro { display: flex; flex-direction: column; }
.contact-list { display: grid; grid-auto-rows: 1fr; gap: 12px; margin-top: 24px; flex: 1; }
.contact-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(12, 18, 34, 0.7);
  text-align: left;
  width: 100%;
  transition: border-color 0.2s, transform 0.3s var(--ease-out);
}
.contact-row:hover { border-color: rgba(var(--signal-rgb), 0.5); transform: translateX(4px); }
.contact-row > i:first-child {
  flex: none;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  font-size: 1.35rem;
  color: var(--signal);
  background: rgba(var(--signal-rgb), 0.1);
  border: 1px solid rgba(var(--signal-rgb), 0.2);
  transition: background 0.2s;
}
.contact-row:hover > i:first-child { background: rgba(var(--signal-rgb), 0.18); }
.contact-row b { display: block; font-weight: 600; font-size: 1.05rem; margin-bottom: 2px; }
.contact-row span { font-size: 0.86rem; color: var(--fg-3); }
.contact-row > i:last-child { margin-left: auto; color: var(--fg-3); font-size: 0.85rem; }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .hero__row { grid-template-columns: 1fr; gap: 32px; }
  .presence { max-width: 420px; }
  .bento { grid-template-columns: 1fr; }
  .tile--projects { grid-row: auto; }
  .gh-grid { grid-template-columns: 1fr; }
  .gh-stats { grid-template-columns: repeat(2, 1fr); }
  .gh-stat:nth-child(2) { border-right: 0; }
  .gh-stat:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .connect { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .block { padding-top: 88px; }
  .block__head { flex-direction: column; align-items: start; }
  .stack { grid-template-columns: 1fr; }
  .stack__col + .stack__col { padding-left: 0; border-left: 0; border-top: 1px solid var(--line-soft); }
  .stack__col ul { display: grid; grid-template-columns: 1fr 1fr; }
  .feature-row { grid-template-columns: 44px 1fr; padding: 14px; }
  .feature-row__icon { width: 44px; height: 44px; font-size: 1.2rem; }
  .feature-row > i { display: none; }
  .tile { padding: 20px; }
  .hero { padding-top: 24px; }
  .hero__stage canvas { inset: -30px -16px; width: calc(100% + 32px); height: calc(100% + 60px); }
  .scroll-cue { display: none; }
}

/* Contribution grid: columns light up left to right when scrolled into view */
.contrib-svg { width: 100%; min-width: 640px; height: auto; }
.contrib-svg rect { opacity: 0.15; transform-box: fill-box; transform-origin: center; transform: scale(0.4); transition: opacity 0.5s ease, transform 0.6s var(--ease-spring); transition-delay: var(--d); }
.is-in .contrib-svg rect { opacity: 1; transform: none; }
.contrib-svg rect:hover { stroke: var(--fg); stroke-width: 1; }
@media (prefers-reduced-motion: reduce) { .contrib-svg rect { opacity: 1; transform: none; } }
@media (hover: none) { .hero__hint { display: none; } }

/* ---------- Hero intro: elements arrive one after another ---------- */
.js .hero__role, .js .hero__bio, .js .hero__actions, .js .hero__hint, .js .presence {
  animation: rise 1s var(--ease-out) both;
}
.js .hero__role { animation-delay: 0.55s; }
.js .hero__bio { animation-delay: 0.68s; }
.js .hero__actions { animation-delay: 0.8s; }
.js .hero__hint { animation-delay: 0.95s; }
.js .presence { animation: rise-right 1.1s var(--ease-out) 0.9s both; }
.js .scroll-cue { animation: rise 1s var(--ease-out) 1.3s both; }
@keyframes rise { from { opacity: 0; transform: translate3d(0, 26px, 0); filter: blur(6px); } }
@keyframes rise-right { from { opacity: 0; transform: translate3d(40px, 0, 0) scale(0.96); } }
.presence__dot[data-s="online"] { box-shadow: 0 0 0 0 rgba(94, 230, 181, 0.6); animation: dot-pulse 2.2s infinite; }
@keyframes dot-pulse { 70% { box-shadow: 0 0 0 7px rgba(94, 230, 181, 0); } 100% { box-shadow: 0 0 0 0 rgba(94, 230, 181, 0); } }


/* ---------- Live monitor ---------- */
.mon {
  border: 1px solid var(--line);
  border-radius: 22px;
  background:
    radial-gradient(700px 300px at 10% 0%, rgba(var(--signal-rgb), 0.08), transparent 70%),
    linear-gradient(180deg, rgba(18, 26, 47, 0.88), rgba(10, 15, 30, 0.9));
  padding: 22px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(0, 1.25fr);
  grid-template-areas: "bar bar bar bar" "g g g stats" "chart chart chart stats";
  gap: 18px;
  position: relative;
  overflow: hidden;
}
.mon::after {   /* a slow scanline passing over the panel */
  content: '';
  position: absolute; left: 0; right: 0; top: -40%;
  height: 40%;
  background: linear-gradient(180deg, transparent, rgba(var(--signal-rgb), 0.05), transparent);
  animation: mon-scan 6s linear infinite;
  pointer-events: none;
}
@keyframes mon-scan { to { top: 100%; } }
.mon__bar {
  grid-area: bar;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  font-family: var(--font-code);
  font-size: 0.82rem;
  color: var(--fg-3);
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line-soft);
}
.mon__live { display: inline-flex; align-items: center; gap: 8px; color: var(--mint); font-weight: 600; }
.mon__live i { width: 8px; height: 8px; border-radius: 50%; background: var(--mint); animation: dot-pulse 1.6s infinite; box-shadow: 0 0 0 0 rgba(94, 230, 181, 0.6); }
.mon__host { color: var(--fg-2); }
.mon__up { margin-left: auto; }
.mon__up b { color: var(--fg); font-weight: 500; font-variant-numeric: tabular-nums; }
.mon__gauges { grid-area: g; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.gauge {
  position: relative;
  padding: 16px 12px 14px;
  border-radius: 16px;
  background: rgba(7, 11, 22, 0.55);
  border: 1px solid var(--line-soft);
  text-align: center;
}
.gauge svg { width: min(130px, 100%); aspect-ratio: 1; margin: 0 auto; transform: rotate(135deg); display: block; overflow: visible; }
.gauge circle { fill: none; stroke-width: 8; stroke-linecap: round; }
.gauge__track { stroke: rgba(var(--signal-rgb), 0.1); }
.gauge__val { stroke: var(--signal); transition: stroke-dashoffset 0.5s var(--ease-out); filter: drop-shadow(0 0 6px rgba(var(--signal-rgb), 0.6)); }
.gauge__val--amber { stroke: var(--amber); filter: drop-shadow(0 0 6px rgba(var(--amber-rgb), 0.6)); }
.gauge__val--cyan { stroke: #6fd8ff; filter: drop-shadow(0 0 6px rgba(111, 216, 255, 0.6)); }
.gauge__txt { position: absolute; left: 0; right: 0; top: 16px; height: min(130px, calc(100% - 50px)); display: grid; place-content: center; line-height: 1; }
.gauge__txt b { font-family: var(--font-head); font-size: clamp(1.4rem, 1rem + 1.2vw, 2rem); font-weight: 600; letter-spacing: -0.05em; font-variant-numeric: tabular-nums; }
.gauge__txt span { font-size: 0.78rem; color: var(--fg-3); margin-top: 4px; }
.gauge__label { margin-top: 8px; font-size: 0.88rem; color: var(--fg-2); }
.mon__chart { grid-area: chart; border-radius: 16px; background: rgba(7, 11, 22, 0.55); border: 1px solid var(--line-soft); padding: 14px 16px 10px; min-width: 0; }
.mon__chart-head { display: flex; justify-content: space-between; font-size: 0.84rem; color: var(--fg-3); margin-bottom: 8px; font-variant-numeric: tabular-nums; }
.mon__chart canvas { width: 100%; height: 120px; display: block; }
.mon__stats { grid-area: stats; margin: 0; display: grid; align-content: start; border-radius: 16px; background: rgba(7, 11, 22, 0.55); border: 1px solid var(--line-soft); padding: 6px 16px; }
.mon__stats div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 10px 0; }
.mon__stats div + div { border-top: 1px solid var(--line-soft); }
.mon__stats dt { color: var(--fg-3); font-size: 0.86rem; display: flex; gap: 8px; align-items: center; }
.mon__stats dt i { color: var(--signal); width: 16px; text-align: center; font-size: 0.85em; }
.mon__stats dd { margin: 0; color: var(--fg); font-family: var(--font-code); font-size: 0.86rem; text-align: right; font-variant-numeric: tabular-nums; transition: color 0.3s; }
.mon__stats dd.tick { color: var(--amber); transition: none; }
@media (max-width: 980px) {
  .mon { grid-template-columns: 1fr; grid-template-areas: "bar" "g" "chart" "stats"; }
}
@media (max-width: 560px) {
  .mon { padding: 16px; }
  .mon__gauges { gap: 8px; }
  .gauge { padding: 12px 6px 10px; }
  .gauge__label { font-size: 0.78rem; }
  .gauge__txt { top: 12px; }
}
@media (prefers-reduced-motion: reduce) { .mon::after { animation: none; } }

.gh-links { display: flex; flex-wrap: wrap; gap: 8px 22px; align-items: center; }
