/* =====================================================================
   Portfolio — @ilcde
   Every colour, radius and easing lives in :root, so the whole site can
   be re-skinned from one block at the top of this file.
   ===================================================================== */

:root {
  --bg: #0d1117;
  --panel: rgba(22, 30, 42, 0.72);
  --panel-hi: rgba(30, 41, 56, 0.9);
  --line: rgba(110, 118, 129, 0.24);
  --line-hi: rgba(106, 255, 223, 0.34);

  --text: #e6edf3;
  --muted: #8b949e;
  --dim: #6e7681;

  --mint: #6affdf;
  --sky: #6ad7ff;
  --cyan: #00c4cc;
  --amber: #f0b849;
  --red: #ff7b72;

  --radius: 16px;
  --radius-lg: 22px;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  --bounce: cubic-bezier(0.175, 0.885, 0.32, 1.275);
  --wrap: 1180px;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  padding: 120px 0 0;
  font-family: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3 { line-height: 1.2; margin: 0 0 14px; font-weight: 600; }
h2 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 14px; }
a { color: var(--mint); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

:focus-visible {
  outline: 2px solid var(--mint);
  outline-offset: 3px;
  border-radius: 6px;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  top: -60px; left: 16px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: 0 0 10px 10px;
  background: var(--mint);
  color: #05231d;
  font-weight: 600;
  transition: top 0.2s ease;
}
.skip-link:focus { top: 0; }

/* ============================== background ============================= */

.aurora {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
}

.aurora__blob {
  position: absolute;
  width: 46vw;
  height: 46vw;
  min-width: 360px;
  min-height: 360px;
  border-radius: 50%;
  filter: blur(110px);
  opacity: 0.5;
  animation: drift 26s ease-in-out infinite alternate;
}

.aurora__blob--1 { top: -14vw; left: -8vw; background: #0f6f7a; }
.aurora__blob--2 { top: 32vh; right: -12vw; background: #17475c; animation-delay: -9s; }
.aurora__blob--3 { bottom: -20vw; left: 28vw; background: #0b5f4f; animation-delay: -17s; }

/* The grid fades out towards the edges instead of stopping abruptly. */
.aurora__grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(110, 118, 129, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(110, 118, 129, 0.12) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(circle at 50% 22%, #000 0%, transparent 72%);
  -webkit-mask-image: radial-gradient(circle at 50% 22%, #000 0%, transparent 72%);
}

@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(4vw, 6vh, 0) scale(1.14); }
}

/* ================================= nav ================================= */

.fancy-nav {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(13, 17, 23, 0.72);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.nav-item {
  position: relative;
  padding: 9px 18px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: color 0.25s ease, background 0.25s ease;
}

.nav-item:hover { color: var(--text); text-decoration: none; }

/* Underline grows from the centre; the active item keeps it. */
.nav-item::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 4px;
  width: 0;
  height: 2px;
  border-radius: 2px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, var(--mint), var(--sky));
  transition: width 0.3s var(--bounce);
}

.nav-item:hover::after { width: 46%; }

.nav-item.active {
  color: var(--text);
  background: rgba(106, 255, 223, 0.1);
}
.nav-item.active::after { width: 46%; }

/* =============================== layout ================================ */

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 24px;
}

.section { padding: 96px 0; }

.section__head {
  max-width: 720px;
  margin-bottom: 42px;
}

.section__lead { color: var(--muted); }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.74rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--cyan);
}

.eyebrow--live {
  padding: 6px 14px;
  border: 1px solid var(--line-hi);
  border-radius: 999px;
  background: rgba(106, 255, 223, 0.07);
  color: var(--mint);
}

.eyebrow__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 0 4px rgba(106, 255, 223, 0.16);
  animation: pulse 2.4s ease-in-out infinite;
}

/* Stale cache and hard failures recolour the same badge. */
.eyebrow--live.is-stale { border-color: rgba(240, 184, 73, 0.4); color: var(--amber); }
.eyebrow--live.is-stale .eyebrow__dot { background: var(--amber); box-shadow: 0 0 0 4px rgba(240, 184, 73, 0.16); }
.eyebrow--live.is-error { border-color: rgba(255, 123, 114, 0.4); color: var(--red); }
.eyebrow--live.is-error .eyebrow__dot { background: var(--red); box-shadow: 0 0 0 4px rgba(255, 123, 114, 0.16); animation: none; }

@keyframes pulse {
  50% { transform: scale(1.35); opacity: 0.65; }
}

/* ================================ hero ================================= */

.hero {
  display: flex;
  align-items: center;
  min-height: min(86vh, 760px);
  padding-top: 24px;
}

.hero__inner { text-align: center; }

.hero__avatar {
  /* Block, because .eyebrow is inline-flex and would otherwise sit beside it. */
  display: block;
  width: 128px;
  height: 128px;
  margin: 0 auto 22px;
  padding: 4px;
  border: 2px solid var(--line-hi);
  border-radius: 50%;
  background: var(--panel);
  object-fit: cover;
}

.hero__name {
  margin: 10px 0 4px;
  font-size: clamp(2.4rem, 7vw, 4.2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(100deg, #ffffff 0%, var(--mint) 52%, var(--sky) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero__handle {
  margin: 0 0 18px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  color: var(--dim);
}
.hero__handle a { color: var(--dim); }
.hero__handle a:hover { color: var(--mint); }

.hero__lead {
  max-width: 620px;
  margin: 0 auto 22px;
  font-size: 1.06rem;
  color: var(--muted);
}
.hero__lead em { color: var(--text); font-style: normal; font-weight: 500; }
.hero__lead strong { color: var(--mint); font-weight: 600; }

.chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 0 0 26px;
  padding: 0;
  list-style: none;
}

.chip {
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  font-size: 0.8rem;
  color: var(--muted);
}

.hero__cta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 26px;
  border: 1px solid var(--line-hi);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
  transition: transform 0.25s var(--bounce), box-shadow 0.25s ease, background 0.25s ease;
}
.btn:hover {
  transform: translateY(-2px);
  background: var(--panel-hi);
  text-decoration: none;
}

.btn--primary {
  border-color: transparent;
  background: linear-gradient(100deg, var(--mint), var(--sky));
  color: #05231d;
  font-weight: 600;
}
.btn--primary:hover { box-shadow: 0 12px 28px rgba(106, 255, 223, 0.24); }

/* ================================ stats ================================ */

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  max-width: 760px;
  margin: 46px auto 0;
}

/* column-reverse so the number reads first while dt stays before dd in HTML. */
.stat {
  display: flex;
  flex-direction: column-reverse;
  gap: 2px;
  padding: 18px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.stat dd {
  margin: 0;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 1.6rem;
  font-weight: 500;
  color: var(--mint);
}

.stat dt {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
}

/* ================================ cards ================================ */

.card {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  backdrop-filter: blur(8px);
  transition: transform 0.3s var(--bounce), border-color 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
  transform: translateY(-4px);
  border-color: var(--line-hi);
  box-shadow: var(--shadow);
}

.cards-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}

.service__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  margin-bottom: 14px;
  border: 1px solid var(--line-hi);
  border-radius: 14px;
  background: rgba(106, 255, 223, 0.08);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  color: var(--mint);
}

.service p { color: var(--muted); font-size: 0.94rem; }

.ticks { margin: 0; padding: 0; list-style: none; }
.ticks li {
  position: relative;
  padding-left: 20px;
  font-size: 0.86rem;
  color: var(--dim);
}
.ticks li::before {
  content: "\2713";
  position: absolute;
  left: 0;
  color: var(--mint);
}

/* =============================== toolbar =============================== */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 34px 0 16px;
}

.field { position: relative; display: flex; }
.field--grow { flex: 1 1 260px; }

.field input,
.field select {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.field input::placeholder { color: var(--dim); }
.field input:focus,
.field select:focus { border-color: var(--line-hi); background: var(--panel-hi); }

.field select {
  padding-right: 38px;
  cursor: pointer;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 55%, calc(100% - 15px) 55%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.pill:hover { color: var(--text); border-color: var(--line-hi); }

.pill[aria-pressed="true"] {
  border-color: transparent;
  background: linear-gradient(100deg, var(--mint), var(--sky));
  color: #05231d;
  font-weight: 600;
}

.pill__count { opacity: 0.7; font-size: 0.74rem; }

.result-line {
  margin: 0 0 18px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.78rem;
  color: var(--dim);
}

/* ============================= repo cards ============================== */

.featured {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 18px;
}

.repos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
}

.repo {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Featured cards get a warm radial tint so they read as a tier above. */
.repo--featured {
  border-color: var(--line-hi);
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(106, 255, 223, 0.12) 0%, transparent 58%),
    var(--panel);
}

.repo__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.repo__name {
  margin: 0;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 1rem;
  word-break: break-word;
}
.repo__name a { color: var(--text); }
.repo__name a:hover { color: var(--mint); text-decoration: none; }

.badges { display: flex; flex-wrap: wrap; gap: 6px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.7rem;
  color: var(--muted);
  white-space: nowrap;
}

.badge--star { border-color: rgba(240, 184, 73, 0.4); color: var(--amber); }
.badge--archived { border-color: rgba(255, 123, 114, 0.35); color: var(--red); }
.badge--fork { border-color: var(--line); color: var(--dim); }

.repo__desc {
  margin: 0;
  font-size: 0.92rem;
  color: var(--muted);
}

.repo__topics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.topic {
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(106, 215, 255, 0.1);
  font-size: 0.72rem;
  color: var(--sky);
}

.repo__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-top: auto;
  padding-top: 4px;
  font-size: 0.76rem;
  color: var(--dim);
}

.repo__meta span { display: inline-flex; align-items: center; gap: 6px; }

.lang-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  /* Colour is set inline per language by app.js. */
  background: var(--dim);
}

.repo__links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 4px;
  border-top: 1px solid var(--line);
}

.repo__links a {
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.78rem;
  color: var(--muted);
  transition: color 0.2s ease, border-color 0.2s ease;
}

.repo__links a:hover { color: var(--mint); border-color: var(--line-hi); text-decoration: none; }
.repo__links a.is-demo { color: var(--mint); border-color: var(--line-hi); }

/* ======================== loading & fallbacks ========================== */

.skeleton-text {
  display: block;
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(110, 118, 129, 0.12) 25%, rgba(110, 118, 129, 0.26) 37%, rgba(110, 118, 129, 0.12) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}

.skeleton-text--title { width: 55%; height: 18px; margin-bottom: 6px; }
.skeleton-text--short { width: 40%; }
.repo--skeleton { gap: 10px; min-height: 150px; }
.stat .skeleton-text { width: 60%; height: 22px; }

@keyframes shimmer {
  from { background-position: 100% 0; }
  to   { background-position: 0 0; }
}

.notice {
  margin: 0 0 18px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-left-width: 3px;
  border-radius: 12px;
  background: var(--panel);
  font-size: 0.88rem;
  color: var(--muted);
}

.notice--warn { border-left-color: var(--amber); }
.notice--error { border-left-color: var(--red); }
.notice a { color: var(--mint); }

.empty {
  grid-column: 1 / -1;
  padding: 46px 20px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-lg);
  text-align: center;
  color: var(--dim);
}

/* ================================ about ================================ */

.about__grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 24px;
  align-items: start;
}

.quote {
  margin: 0 0 22px;
  padding: 18px 22px;
  border-left: 3px solid var(--mint);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--panel);
  font-size: 1.02rem;
  color: var(--text);
}

.facts { margin: 0 0 18px; padding: 0; list-style: none; }

.facts li {
  position: relative;
  margin-bottom: 12px;
  padding-left: 22px;
  font-size: 0.94rem;
  color: var(--muted);
}

.facts li::before {
  content: "";
  position: absolute;
  top: 10px;
  left: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(100deg, var(--mint), var(--sky));
}

.facts strong { color: var(--text); font-weight: 600; }

.about__meta {
  margin: 0;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.78rem;
  color: var(--dim);
}

.about__stack {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
}

.about__stack img { margin-bottom: 8px; }

.stack-label {
  margin: 14px 0 6px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dim);
}

/* =============================== contact =============================== */

.contact__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.contact-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.contact-card:hover { text-decoration: none; }

.contact-card__label {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dim);
}

.contact-card__value {
  font-size: 0.98rem;
  color: var(--text);
  word-break: break-word;
}

/* ================================ footer =============================== */

.footer {
  margin-top: 40px;
  padding: 30px 0 40px;
  border-top: 1px solid var(--line);
}

.footer__inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--dim);
}

.footer p { margin: 0; }

/* =============================== reveal ================================ */

/* Scoped to .js: with JavaScript blocked or broken, nothing is ever hidden. */
.js .reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* ============================= responsive ============================== */

@media (max-width: 880px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .about__grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  body { padding: 24px 0 92px; }
  .section { padding: 64px 0; }
  .hero { min-height: auto; }

  /* On small screens the pill becomes a bottom bar that scrolls sideways. */
  .fancy-nav {
    top: auto;
    bottom: 12px;
    width: calc(100% - 24px);
    justify-content: space-between;
    overflow-x: auto;
    border-radius: 18px;
    scrollbar-width: none;
  }
  .fancy-nav::-webkit-scrollbar { display: none; }
  .nav-item { padding: 9px 12px; font-size: 0.7rem; }

  .toolbar { flex-direction: column; }
  .footer__inner { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  .js .reveal { opacity: 1; transform: none; }
}

@media print {
  .aurora, .fancy-nav, .toolbar, .filters { display: none; }
  body { padding-top: 0; background: #fff; color: #000; }
  .card { border: 1px solid #ccc; background: none; }
}
