:root {
  color-scheme: dark;
  --bg: #07070a;
  --bg-2: #0b0c10;
  --panel: rgba(14, 15, 19, 0.76);
  --line: rgba(255, 255, 255, 0.08);
  --text: #f4efe8;
  --muted: rgba(244, 239, 232, 0.72);
  --accent: #ae3925;
  --accent-soft: #d36c55;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.48);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: Inter, system-ui, sans-serif;
  background:
    radial-gradient(circle at 20% 10%, rgba(185, 45, 39, 0.16), transparent 22%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
}

::selection { background: var(--accent); color: #fff; }

body::-webkit-scrollbar { width: 10px; }
body::-webkit-scrollbar-track { background: var(--bg); }
body::-webkit-scrollbar-thumb { background: #2a211e; border-radius: 8px; }
body::-webkit-scrollbar-thumb:hover { background: var(--accent); }

.backdrop,
.cursor-glow,
.grid-overlay,
.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.backdrop {
  background:
    radial-gradient(circle at 78% 18%, rgba(224, 106, 85, 0.08), transparent 20%),
    radial-gradient(circle at 15% 82%, rgba(185, 45, 39, 0.08), transparent 18%);
}

/* Small fixed-size layer moved with transform — compositor-only, no repaints. */
.cursor-glow {
  position: fixed;
  top: -220px;
  left: -220px;
  width: 440px;
  height: 440px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(174, 57, 37, 0.16), transparent 62%);
  opacity: 0.85;
  will-change: transform;
  pointer-events: none;
}

.grid-overlay {
  opacity: 0.05;
  background-image:
    linear-gradient(rgba(255,255,255,0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.08) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(circle at center, black 45%, transparent 95%);
}

.noise {
  opacity: 0.02;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.7' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E");
}

.page {
  width: min(1040px, calc(100% - 22px));
  margin: 0 auto;
}

/* Hero */

.hero { position: relative; }

.hero .page {
  min-height: min(calc(100vh - 60px), 860px);
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  align-items: center;
  gap: 18px;
  padding: 22px;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 30px;
  background: rgba(16, 17, 22, 0.92);
  box-shadow: var(--shadow);
  animation: rise 700ms ease-out both;
  position: relative;
  overflow: hidden;
}

.hero-copy > * {
  opacity: 0;
  animation: slideUpFade 600ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.hero-copy h1 { animation-delay: 150ms; }
.hero-copy .line { animation-delay: 300ms; }
.hero-copy .links { animation-delay: 450ms; }

.eyebrow {
  margin: 0 0 14px;
  color: var(--accent-soft);
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.7rem;
  font-weight: 800;
}

h1 {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
  font-weight: 700;
  font-size: 5rem;
  line-height: 1.04;
  text-wrap: balance;
  overflow-wrap: break-word;
  background: linear-gradient(175deg, #fffaf4 30%, #f3b9a2 75%, #cf7a5f);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.line {
  margin: 12px 0 0;
  max-width: 32ch;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.link-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  text-decoration: none;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 600;
  overflow: hidden;
  transition: transform 220ms cubic-bezier(0.2, 0.8, 0.3, 1), border-color 180ms ease, background 180ms ease;
}

.link-btn svg { width: 17px; height: 17px; fill: currentColor; }

.link-btn:hover {
  border-color: rgba(174, 57, 37, 0.32);
  background: rgba(174, 57, 37, 0.08);
}

/* Shine sweep on the primary pill */
.link-btn.primary::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -80%;
  width: 50%;
  background: linear-gradient(105deg, transparent, rgba(255,255,255,0.55), transparent);
  transform: skewX(-18deg);
  pointer-events: none;
}

.link-btn.primary:hover::after {
  animation: shine 700ms ease-out;
}

.link-btn.primary { background: var(--text); color: var(--bg); border-color: var(--text); }

.link-btn.primary:hover { background: #ffffff; border-color: #ffffff; color: var(--bg); }

.scroll-cue {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--muted);
  animation: bob 2.6s ease-in-out infinite;
}
.scroll-cue svg { width: 20px; height: 20px; fill: currentColor; }
.scroll-cue:hover { color: var(--text); }

/* Profile card */

.profile-card {
  width: 100%;
  max-width: 390px;
  margin-left: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 32px;
  background: rgba(255, 255, 255, 0.02);
  position: relative;
  overflow: hidden;
}

.orb {
  position: absolute;
  inset: auto auto 10% 8%;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(174, 57, 37, 0.38), rgba(174, 57, 37, 0.12) 55%, transparent 75%);
  animation: drift 10s ease-in-out infinite;
  pointer-events: none;
}

.avatar-wrap {
  aspect-ratio: 0.82 / 1;
  border-radius: 30px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.01));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
  animation: framefloat 14s ease-in-out infinite;
}

.avatar {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center 18%;
  transition: transform 220ms ease;
}

.profile-card:hover .avatar { transform: scale(1.03); }

/* Sections */

.section { padding: 96px 0 40px; }

h2 {
  margin: 0 0 22px;
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  font-size: 2.1rem;
  display: flex;
  align-items: baseline;
  gap: 14px;
}

.sec-num {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-soft);
}

.about-copy {
  margin: 0;
  max-width: 62ch;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.7;
}
.about-copy strong { color: var(--text); }

.tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  margin: 20px 0 0;
}
.tags li {
  padding: 5px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  transition: border-color 180ms ease, color 180ms ease;
}
.tags li:hover { border-color: rgba(174, 57, 37, 0.4); color: var(--text); }

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.project {
  position: relative;
  display: block;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.02);
  color: inherit;
  text-decoration: none;
  overflow: hidden;
  transition: transform 180ms ease, border-color 180ms ease;
}

.project::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(220px circle at var(--mx, 50%) var(--my, 50%),
    rgba(211, 108, 85, 0.13), transparent 65%);
  opacity: 0;
  transition: opacity 250ms ease;
  pointer-events: none;
}
.project:hover::before { opacity: 1; }
.project:hover { transform: translateY(-3px); border-color: rgba(174, 57, 37, 0.35); }

.project h3 { margin: 0 26px 8px 0; font-family: "Fraunces", Georgia, serif; font-size: 1.25rem; }
.project p { margin: 0 0 14px; color: var(--muted); font-size: 0.88rem; line-height: 1.55; }
.project .arrow {
  position: absolute;
  top: 16px;
  right: 18px;
  color: var(--accent-soft);
  font-size: 1rem;
  opacity: 0.7;
  transition: transform 200ms ease, opacity 200ms ease;
}
.project:hover .arrow { transform: translate(3px, -3px); opacity: 1; }
.project .lang {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-soft);
}
.project .meta { display: flex; align-items: center; gap: 10px; }
.lang-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.project .stars { font-size: 0.78rem; color: var(--muted); }
.project .upd { font-size: 0.75rem; color: rgba(244, 239, 232, 0.5); }

.repo-status {
  margin: -10px 0 20px;
  font-size: 0.82rem;
  color: var(--accent-soft);
}
.project.more { border-style: dashed; align-content: center; }

/* Footer */

footer { padding: 60px 0 36px; }
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  padding-top: 28px;
}
.footer-inner .links { margin-top: 0; }
.copyright { margin: 0; color: var(--muted); font-size: 0.85rem; }

/* Discord presence chip */

.rpc {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-top: 16px;
  padding: 7px 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,0.03);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
}
.rpc[hidden] { display: none; }
.hero-copy .rpc { animation-delay: 550ms; }
.rpc-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: 0 0 auto;
}

/* Reveal on scroll */

.reveal {
  transition: opacity 600ms cubic-bezier(0.16, 1, 0.3, 1), transform 600ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* Hidden only while JS is active and the section hasn't revealed yet */
html.js .reveal:not(.in) {
  opacity: 0;
  transform: translateY(18px);
}

:focus-visible {
  outline: 2px solid var(--accent-soft);
  outline-offset: 3px;
  border-radius: 4px;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes slideUpFade {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(18px, -12px) scale(1.08); }
}
@keyframes framefloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}
@keyframes bob {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, 6px); }
}
@keyframes shine {
  from { left: -80%; }
  to { left: 130%; }
}

/* Back to top */

.to-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(16, 17, 22, 0.95);
  color: var(--text);
  cursor: pointer;
  opacity: 0;
  transform: translateY(14px);
  pointer-events: none;
  transition: opacity 300ms ease, transform 300ms ease, border-color 180ms ease;
}

.to-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.to-top:hover { border-color: rgba(174, 57, 37, 0.45); }

.to-top svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  transition: transform 220ms ease;
}

.to-top:hover svg { transform: translateY(-2px); }

@media (max-width: 900px) {
  h1 { font-size: 3.6rem; }
  .hero .page { grid-template-columns: 1fr; min-height: auto; padding-top: 56px; padding-bottom: 64px; }
  .profile-card { max-width: none; margin-left: 0; }
}

@media (max-width: 560px) {
  .page { width: min(100% - 18px, 980px); }
  h1 { font-size: 2.7rem; }
  .section { padding: 64px 0 24px; }
  .footer-inner { justify-content: center; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .backdrop, .orb, .avatar-wrap, .scroll-cue,
  .hero .page, .hero-copy > *, html.js .reveal {
    animation: none !important;
    transition: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
  .to-top { opacity: 1; transform: translateY(0); }
}

@media (hover: none) and (pointer: coarse) {
  .cursor-glow, .grid-overlay { display: none; }
}
