/* ============================================================
   nick434434.dev — main stylesheet
   Design tokens up top; swap these to re-skin the whole site.
   ============================================================ */

:root {
  /* palette — dark by default (metal vibes) */
  --bg:        #0e0f13;
  --bg-soft:   #16181f;
  --surface:   #1b1e27;
  --border:    #2a2e3a;
  --text:      #e8e9ee;
  --muted:     #9aa0b0;
  --accent:    #e63946;   /* football-kit red */
  --accent-2:  #ffb703;   /* travel-sun amber  */
  --ring:      color-mix(in srgb, var(--accent) 40%, transparent);

  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "SFMono-Regular", ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;

  --maxw: 980px;
  --radius: 16px;
  --gap: clamp(1rem, 2vw, 1.5rem);
  --ease: cubic-bezier(.2, .7, .2, 1);
}

/* light theme via toggle */
:root[data-theme="light"] {
  --bg:      #f7f7fa;
  --bg-soft: #ffffff;
  --surface: #ffffff;
  --border:  #e4e5ee;
  --text:    #14151a;
  --muted:   #5b6070;
  --accent-2: #b45309;   /* darker amber — readable on light backgrounds */
  --ring:    color-mix(in srgb, var(--accent) 30%, transparent);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background .4s var(--ease), color .4s var(--ease);
}

/* subtle animated gradient wash behind everything */
body::before {
  content: "";
  position: fixed;
  inset: -20vmax;
  z-index: -2;
  background:
    radial-gradient(40vmax 40vmax at 15% 10%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 60%),
    radial-gradient(45vmax 45vmax at 85% 20%, color-mix(in srgb, var(--accent-2) 12%, transparent), transparent 60%),
    radial-gradient(50vmax 50vmax at 50% 100%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 60%);
  filter: saturate(1.1);
  animation: drift 24s var(--ease) infinite alternate;
}
@keyframes drift {
  to { transform: translate3d(0, -3%, 0) rotate(4deg) scale(1.05); }
}

/* film grain for texture */
.grain {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

a { color: inherit; }

/* ---------- layout primitives ---------- */
main { width: 100%; }
.hero, .section, .footer-inner, .nav {
  width: min(100% - 2.5rem, var(--maxw));
  margin-inline: auto;
}

/* ---------- nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 0;
  margin-top: .5rem;
  backdrop-filter: blur(8px);
}
.brand {
  font-weight: 800;
  letter-spacing: -.02em;
  text-decoration: none;
  font-size: 1.05rem;
}
.brand span { color: var(--accent); }
.nav-links {
  margin-left: auto;
  display: flex;
  gap: clamp(.75rem, 2vw, 1.4rem);
  align-items: center;
  font-size: .95rem;
}
.nav-links a { text-decoration: none; color: var(--muted); transition: color .2s var(--ease); }
.nav-links a:hover { color: var(--text); }
.nav-links a.ghost {
  color: var(--text);
  border: 1px solid var(--border);
  padding: .35rem .7rem;
  border-radius: 999px;
}
.nav-links a.ghost:hover { border-color: var(--accent); }
@media (max-width: 560px) { .nav-links a:not(.ghost) { display: none; } }

.theme-toggle {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  width: 38px; height: 38px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 1rem;
  transition: transform .3s var(--ease), border-color .2s var(--ease);
}
.theme-toggle:hover { transform: rotate(180deg); border-color: var(--accent); }

/* ---------- hero ---------- */
.hero {
  padding: clamp(3rem, 12vh, 8rem) 0 clamp(2rem, 6vh, 4rem);
}
.eyebrow {
  font-family: var(--mono);
  color: var(--accent);
  font-size: .9rem;
  letter-spacing: .02em;
  margin: 0 0 1rem;
}
.hero h1 {
  font-size: clamp(2.2rem, 7vw, 4.4rem);
  line-height: 1.05;
  letter-spacing: -.03em;
  margin: 0 0 1.25rem;
  font-weight: 800;
}
.accent { color: var(--accent); }
.lede {
  color: var(--muted);
  font-size: clamp(1.05rem, 2.5vw, 1.3rem);
  max-width: 60ch;
  margin: 0 0 2rem;
}

/* rotating word in the headline.
   All candidate words are stacked in a single grid cell, so the box always
   reserves the width AND height of the widest/tallest word — no layout shift
   (horizontal or vertical) as the active word changes. Only the active word
   is visible; the rest sit behind it at opacity 0. */
.rotator {
  display: inline-grid;
  vertical-align: baseline;
  text-align: left;
}
.rotator-word {
  grid-area: 1 / 1;
  color: #ffb703;   /* bright amber — kept in both themes for the hero accent */
  opacity: 0;
  transform: translateY(.35em) rotateX(-40deg);
  transition: opacity .45s var(--ease), transform .45s var(--ease);
  pointer-events: none;
}
.rotator-word.is-active {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.cta { display: flex; gap: .75rem; flex-wrap: wrap; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  text-decoration: none;
  padding: .7rem 1.2rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-weight: 600;
  transition: transform .2s var(--ease), border-color .2s var(--ease), background .2s var(--ease);
}
.btn:hover { transform: translateY(-2px); border-color: var(--accent); }
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn.primary:hover { box-shadow: 0 8px 24px -8px var(--accent); }

/* ---------- sections ---------- */
.section { padding: clamp(2.5rem, 8vh, 5rem) 0; }
/* keep anchored headings clear of the sticky nav when jumped to */
.section[id], .hero { scroll-margin-top: 5rem; }
.section-title {
  font-size: clamp(1.5rem, 4vw, 2rem);
  letter-spacing: -.02em;
  margin: 0 0 1.5rem;
  display: flex;
  align-items: baseline;
  gap: .75rem;
}
.section-title span {
  font-family: var(--mono);
  font-size: .8rem;
  color: var(--accent);
  border: 1px solid var(--border);
  padding: .15rem .5rem;
  border-radius: 6px;
}
.prose p { max-width: 65ch; color: var(--muted); margin: 0 0 1rem; }
.prose p strong, .prose { color: var(--text); }

/* ---------- interest cards ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--gap);
}
.card {
  position: relative;
  background: linear-gradient(160deg, var(--surface), var(--bg-soft));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  overflow: hidden;
  transition: transform .25s var(--ease), border-color .25s var(--ease), box-shadow .25s var(--ease);
  transform-style: preserve-3d;
}
.card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(400px circle at var(--mx, 50%) var(--my, 0%), color-mix(in srgb, var(--accent) 14%, transparent), transparent 40%);
  opacity: 0;
  transition: opacity .3s var(--ease);
  pointer-events: none;
}
.card:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); box-shadow: 0 20px 40px -24px rgba(0,0,0,.6); }
.card:hover::after { opacity: 1; }
.card-emoji { font-size: 2.2rem; line-height: 1; margin-bottom: .75rem; }
.card h3 { margin: 0 0 .5rem; font-size: 1.25rem; }
.card p { margin: 0 0 1.25rem; color: var(--muted); font-size: .97rem; }
.card-tag {
  font-family: var(--mono);
  font-size: .75rem;
  color: var(--accent-2);
  border: 1px dashed var(--border);
  padding: .2rem .55rem;
  border-radius: 999px;
}

/* ---------- repos ---------- */
.repo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--gap);
  margin: 1.5rem 0;
}
.repo-card {
  display: block;
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.1rem 1.2rem;
  transition: transform .2s var(--ease), border-color .2s var(--ease);
}
.repo-card:hover { transform: translateY(-3px); border-color: var(--accent); }
.repo-card h3 { margin: 0 0 .4rem; font-size: 1.05rem; color: var(--text); }
.repo-card p { margin: 0 0 .9rem; color: var(--muted); font-size: .9rem; min-height: 2.5em; }
.repo-meta { display: flex; gap: 1rem; font-size: .8rem; color: var(--muted); font-family: var(--mono); }
.repo-meta .dot { width: .7em; height: .7em; border-radius: 50%; display: inline-block; vertical-align: middle; margin-right: .3em; background: var(--accent); }
.repo-skeleton { height: 128px; border-radius: 12px; border: 1px solid var(--border); background:
  linear-gradient(100deg, var(--surface) 30%, var(--bg-soft) 50%, var(--surface) 70%);
  background-size: 200% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- footer ---------- */
.footer { border-top: 1px solid var(--border); margin-top: 4rem; padding: 2rem 0 3rem; }
.footer-inner { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; color: var(--muted); font-size: .9rem; }
.socials { display: flex; gap: 1.25rem; }
.socials a { text-decoration: none; color: var(--muted); transition: color .2s var(--ease); }
.socials a:hover { color: var(--accent); }
.colophon { width: min(100% - 2.5rem, var(--maxw)); margin: 1rem auto 0; color: var(--muted); font-size: .8rem; font-family: var(--mono); opacity: .7; }

/* ---------- scroll reveal ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* focus visibility for keyboard users */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* visually hidden but available to screen readers */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
