@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;800&display=swap');

/* Design Tokens */
:root {
  /* Prefer OKLCH; provide fallbacks via @supports below */
  --bg: oklch(0.17 0.03 260);
  --bg-elev: oklch(0.20 0.04 260);
  --text: oklch(0.93 0.02 260);
  --muted: oklch(0.78 0.03 260);
  --primary: oklch(0.72 0.14 240);
  --accent: oklch(0.72 0.13 140);
  --warn: oklch(0.75 0.16 60);
  --card: oklch(0.21 0.04 260);
  --outline: color-mix(in oklch, white 6%, transparent);
  --glow: 0 8px 40px color-mix(in oklch, oklch(0.72 0.14 240) 25%, transparent);
  --dur-fast: 120ms;
  --dur: 200ms;
  --dur-slow: 320ms;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --field-opacity: 0.06;
  --field-scale: 1;
}

@supports not (color: oklch(50% 0.1 200)) {
  :root {
    --bg: #0b1020;
    --bg-elev: #0f1530;
    --text: #e7e9ee;
    --muted: #a8b0c0;
    --primary: #7aa2f7;
    --accent: #9ece6a;
    --warn: #ff9e64;
    --card: #111831;
    --outline: rgba(255, 255, 255, 0.06);
    --glow: 0 8px 40px rgba(122, 162, 247, 0.25);
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, 'Helvetica Neue', Arial, 'Noto Sans', 'Apple Color Emoji', 'Segoe UI Emoji';
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
}

/* Focus mode & high contrast applied via body classes */
body.focus-mode #art-canvas {
  opacity: 0;
}

body.focus-mode .grain {
  opacity: 0;
}

body.high-contrast {
  --text: #ffffff;
  --muted: #d7dbe6;
  --outline: rgba(255, 255, 255, 0.18);
}

.grain {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  mix-blend-mode: overlay;
  opacity: 0.04;
}

.site {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

.toggle {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--outline);
  background: rgba(122, 162, 247, 0.1);
  color: var(--text);
  cursor: pointer;
}

#art-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  transition: opacity var(--dur) var(--ease);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 22px;
  border-right: 1px solid var(--outline);
  background: #0e1530;
  /* more opaque */
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand .avatar {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  border: 1px solid var(--outline);
  box-shadow: var(--glow);
}

.brand .title {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand .name {
  font-weight: 800;
  letter-spacing: 0.3px;
}

.brand .tag {
  color: var(--muted);
  font-size: 13px;
}

.nav {
  margin-top: 28px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav a {
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
  border: 1px solid transparent;
  transition: transform var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}

.nav a:hover {
  transform: translateX(4px);
  background: rgba(122, 162, 247, 0.10);
  border-color: var(--outline);
}

.content {
  padding: 36px 40px 60px 0;
}

.container {
  background: var(--bg-elev);
  border: 1px solid var(--outline);
  border-radius: 16px;
  padding: 28px;
  box-shadow: none;
}

h1,
h2,
h3 {
  color: var(--text);
  letter-spacing: 0.2px;
}

h1 {
  font-size: clamp(32px, 2vw + 16px, 52px);
  margin: 0 0 8px;
}

.hero h1 {
  color: var(--text);
}

@supports (-webkit-background-clip: text) or (background-clip: text) {
  .hero h1 {
    background: linear-gradient(90deg, #9ece6a, #7aa2f7, #ff9e64);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
  }
}

.lead {
  color: var(--muted);
  margin: 0 0 22px;
}

.button-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.button {
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--primary);
  color: #061026;
  font-weight: 700;
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 6px 24px rgba(122, 162, 247, 0.35);
}

.button.primary {
  background: linear-gradient(90deg, var(--primary), var(--accent));
  background-size: 200% 100%;
  background-position: 0% 50%;
  transition: background-position var(--dur) var(--ease), filter var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.button.primary:hover,
.button.primary:focus-visible { background-position: 100% 50%; }

.button.secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--outline);
}

.button:hover {
  filter: brightness(1.05);
}

.grid {
  margin-top: 22px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.card {
  position: relative;
  display: block;
  border-radius: 14px;
  padding: 18px;
  background: #141c3c;
  /* more opaque */
  border: 1px solid var(--outline);
  --tx: 0px;
  --ty: 0px;
  --rx: 0deg;
  --ry: 0deg;
  --mx: 50%;
  transform: perspective(800px) translate(var(--tx), var(--ty)) rotateX(var(--rx)) rotateY(var(--ry));
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
  color: var(--text);
  text-decoration: none;
}

.card:hover {
  box-shadow: 0 14px 50px rgba(122, 162, 247, 0.25);
  border-color: rgba(122, 162, 247, 0.35);
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(220px 90px at var(--mx) -20%, rgba(255, 255, 255, 0.16), transparent 60%);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur) var(--ease);
}

.card:hover::before {
  opacity: 1;
}

.card .repo-name {
  font-weight: 700;
}

.card .repo-desc {
  color: #c8cfdd;
  /* higher contrast */
  min-height: 44px;
  margin: 6px 0 10px;
}

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

.badge {
  font-size: 12px;
  color: #0c1330;
  background: var(--accent);
  border-radius: 999px;
  padding: 4px 10px;
}

.badge.muted {
  background: rgba(255, 255, 255, 0.16);
  color: var(--text);
}

.footer {
  margin-top: 18px;
  color: var(--muted);
  font-size: 13px;
}

.hero {
  position: relative;
}

.reveal {
  opacity: 0;
  transform: translateY(10px);
}

.reveal.in {
  opacity: 1;
  transform: none;
  transition: all 560ms var(--ease);
}

html:not(.js) .reveal {
  opacity: 1;
  transform: none;
}

/* Chromatic Thread underline */
.link-underline {
  position: relative;
  display: inline-block;
}

.link-underline::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  background-size: 200% 100%;
  background-position: 0% 50%;
  transform: scaleX(.6);
  transform-origin: left;
  transition: transform var(--dur) var(--ease), background-position var(--dur) var(--ease);
}

.link-underline:hover::after {
  transform: scaleX(1);
  background-position: 100% 50%;
}

@media (prefers-reduced-motion: reduce) {
  .link-underline::after { transition: none; }
}

/* Sacred Field removed for clean baseline */

/* Liquid Split removed for clean baseline */

/* Feral Corner removed for clean baseline */

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

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

  .liquid-split::after {
    filter: none;
  }
}

@media (max-width: 980px) {
  .site {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--outline);
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 8px;
  }

  .content {
    padding: 22px;
  }
}