/* ==========================================================================
   erictrenkel.com — dark-first, framework-free
   ========================================================================== */

:root {
  --bg: #0b0e14;
  --bg-raise: #11151f;
  --bg-card: #131826;
  --border: #222a3d;
  --border-strong: #2f3a55;
  --text: #dbe2f0;
  --text-dim: #8a94ab;
  --accent: #5eead4;      /* teal */
  --accent-2: #a78bfa;    /* violet */
  --accent-ink: #062e29;
  --shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.6);
  --radius: 14px;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Space Grotesk", var(--font-body);
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

.mono { font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.02em; }
.accent { color: var(--accent); }

/* ---------- backdrop ---------- */

.bg-grid {
  position: fixed; inset: 0; z-index: -2;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 56px 56px;
  opacity: 0.22;
  mask-image: radial-gradient(ellipse 90% 60% at 50% 0%, black 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 90% 60% at 50% 0%, black 30%, transparent 75%);
}

.bg-glow {
  position: fixed; z-index: -1;
  top: -25vh; left: 50%; transform: translateX(-50%);
  width: 90vw; height: 65vh;
  background:
    radial-gradient(closest-side, rgba(94, 234, 212, 0.10), transparent 70%),
    radial-gradient(closest-side at 70% 30%, rgba(167, 139, 250, 0.10), transparent 70%);
  filter: blur(30px);
  pointer-events: none;
}

/* ---------- nav ---------- */

.nav {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  max-width: 1060px; margin: 0 auto;
  padding: 1rem 1.5rem;
  backdrop-filter: blur(10px);
}

.nav::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
}

.nav-logo {
  font-family: var(--font-display);
  font-weight: 700; font-size: 1.35rem;
  color: var(--text);
}
.nav-logo:hover { text-decoration: none; }

/* Square brand dot — matches the wordmark logo (Space Grotesk's period is round). */
.logo-dot {
  display: inline-block;
  width: 0.16em;
  height: 0.16em;
  margin-left: 0.06em;
  background: var(--accent);
}

.nav-links { display: flex; gap: 1.6rem; }
.nav-links a {
  color: var(--text-dim);
  font-size: 0.88rem; font-weight: 500;
}
.nav-links a:hover { color: var(--text); text-decoration: none; }

/* ---------- layout ---------- */

main { max-width: 1060px; margin: 0 auto; padding: 0 1.5rem; }

.section { padding: 4.5rem 0 1rem; }

.section-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 1.9rem);
  font-weight: 700;
  display: flex; align-items: baseline; gap: 0.75rem;
  margin-bottom: 1.8rem;
}
.section-num { font-size: 0.9rem; }

.section-lead { color: var(--text-dim); max-width: 60ch; margin: -0.8rem 0 2rem; }

.subsection-title {
  font-family: var(--font-display);
  font-size: 1.1rem; font-weight: 600;
  color: var(--text-dim);
  margin: 2.5rem 0 1.2rem;
}

/* ---------- hero ---------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(260px, 1fr);
  gap: 3rem;
  align-items: center;
  padding: 5.5rem 0 3rem;
}

.hero-kicker { color: var(--text-dim); margin-bottom: 1rem; }

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 7vw, 4.2rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.02em;
  background: linear-gradient(100deg, var(--text) 40%, var(--accent) 75%, var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-role {
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 2.6vw, 1.5rem);
  font-weight: 600;
  margin-top: 0.7rem;
}
.hero-role .amp { color: var(--accent); font-weight: 500; }

.hero-sub {
  color: var(--text-dim);
  max-width: 54ch;
  margin-top: 1rem;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-top: 1.8rem; }

.btn {
  display: inline-block;
  padding: 0.65rem 1.3rem;
  border-radius: 999px;
  font-weight: 600; font-size: 0.9rem;
  border: 1px solid transparent;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-2px); }

.btn-primary {
  background: linear-gradient(120deg, var(--accent), #7dd3fc);
  color: var(--accent-ink);
}
.btn-primary:hover { box-shadow: 0 8px 30px -8px rgba(94, 234, 212, 0.5); }

.btn-ghost {
  border-color: var(--border-strong);
  color: var(--text);
}
.btn-ghost:hover { border-color: var(--accent); }

.hero-links { display: flex; gap: 1.1rem; margin-top: 2rem; }
.hero-links a { color: var(--text-dim); display: inline-flex; }
.hero-links a:hover { color: var(--accent); transform: translateY(-2px); }
.hero-links a { transition: color 0.15s ease, transform 0.15s ease; }

/* hero stat card */

.hero-card {
  background: linear-gradient(160deg, var(--bg-card), var(--bg-raise));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.8rem;
  text-align: center;
}

.avatar {
  width: 112px; height: 112px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  outline: 4px solid color-mix(in srgb, var(--accent) 18%, transparent);
  margin-bottom: 1.3rem;
}

.stats {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
  border-top: 1px solid var(--border);
  padding-top: 1.2rem;
}

.stat b {
  display: block;
  font-family: var(--font-display);
  font-size: 1.45rem; font-weight: 700;
  color: var(--accent);
}
.stat span { font-size: 0.72rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.08em; }

.stats-note { color: var(--text-dim); margin-top: 1.2rem; opacity: 0.7; }

/* ---------- about ---------- */

.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(220px, 1fr);
  gap: 2.5rem;
}

.about-text p + p { margin-top: 1rem; }
.about-text { color: var(--text-dim); }
.about-text p:first-child { color: var(--text); font-size: 1.06rem; }

.about-stack {
  background: var(--bg-raise);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem;
  align-self: start;
}
.about-stack h3 { color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.1em; font-size: 0.72rem; margin-bottom: 1rem; }

.chip-list { list-style: none; display: flex; flex-wrap: wrap; gap: 0.45rem; }
.chip-list li {
  font-family: var(--font-mono); font-size: 0.75rem;
  padding: 0.28rem 0.65rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: var(--text-dim);
}

/* ---------- experience timeline ---------- */

.timeline {
  position: relative;
  display: grid;
  gap: 1.6rem;
}
.timeline::before {
  content: "";
  position: absolute; left: 0; top: 8px; bottom: 8px;
  width: 1px;
  background: linear-gradient(var(--accent), var(--accent-2), transparent);
  opacity: 0.5;
}

.tl-item { position: relative; padding-left: 1.8rem; }
.tl-item::before {
  content: "";
  position: absolute; left: -4px; top: 7px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent);
}

.tl-meta { color: var(--text-dim); margin-bottom: 0.5rem; }

.tl-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.7rem;
  transition: border-color 0.2s ease;
}
.tl-card:hover { border-color: var(--border-strong); }

.tl-card h3 { font-family: var(--font-display); font-size: 1.15rem; font-weight: 600; }
.tl-org { color: var(--accent); font-size: 0.88rem; margin: 0.15rem 0 0.9rem; }

.tl-card ul { list-style: none; display: grid; gap: 0.5rem; color: var(--text-dim); font-size: 0.92rem; }
.tl-card li { padding-left: 1.1rem; position: relative; }
.tl-card li::before {
  content: "▹";
  position: absolute; left: 0; top: 0;
  color: var(--accent);
}

.tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 1.1rem; }
.tags span {
  font-size: 0.72rem;
  padding: 0.22rem 0.6rem;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  color: var(--accent);
  border-radius: 999px;
}

/* ---------- projects ---------- */

.featured { display: grid; gap: 1.4rem; }

.feat-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1.5rem;
  background: linear-gradient(160deg, var(--bg-card), var(--bg-raise));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.7rem 1.9rem;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.feat-card:hover { border-color: var(--accent); transform: translateY(-3px); }

.feat-card h3 { font-family: var(--font-display); font-size: 1.25rem; font-weight: 600; }
.feat-card h3 a { color: var(--text); }
.feat-card h3 a:hover { color: var(--accent); text-decoration: none; }

.feat-blurb { color: var(--text-dim); font-size: 0.93rem; margin-top: 0.6rem; max-width: 72ch; }

.feat-links { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 0.9rem; font-size: 0.85rem; }

.feat-side {
  display: flex; flex-direction: column; align-items: flex-end; gap: 0.5rem;
  white-space: nowrap;
}

.repo-stats { display: flex; gap: 0.9rem; color: var(--text-dim); font-size: 0.85rem; align-items: center; }
.repo-stats .stars { color: var(--text); font-weight: 600; }
.repo-stats svg { vertical-align: -2px; margin-right: 3px; fill: currentColor; }

.lang { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.8rem; color: var(--text-dim); }
.lang i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* repo grid */

.repo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.repo-card {
  display: flex; flex-direction: column; gap: 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 1.3rem;
  transition: border-color 0.2s ease, transform 0.2s ease;
  color: inherit;
}
.repo-card:hover { border-color: var(--accent); transform: translateY(-3px); text-decoration: none; }

.repo-card h4 {
  font-family: var(--font-mono);
  font-size: 0.92rem; font-weight: 500;
  color: var(--accent);
}

.repo-card p { color: var(--text-dim); font-size: 0.85rem; flex: 1; }

.repo-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 0.4rem; }

.more-link { margin-top: 2rem; text-align: center; }

.feat-meta {
  color: var(--accent);
  font-size: 0.75rem;
  margin-top: 0.6rem;
  opacity: 0.9;
}

/* ---------- writing ---------- */

.post-list { display: grid; gap: 0.7rem; }

.post-card {
  display: flex; align-items: baseline; gap: 1.2rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.4rem;
  color: var(--text);
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.post-card:hover { border-color: var(--accent); transform: translateY(-2px); text-decoration: none; }
.post-date { color: var(--text-dim); white-space: nowrap; }
.post-title { font-weight: 500; }

.aside-foot {
  color: var(--text-dim);
  margin-top: 1rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--border);
}

/* ---------- education / contact ---------- */

.edu-card, .contact-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.7rem 1.9rem;
}

.edu-card h3 { font-family: var(--font-display); font-size: 1.1rem; }
.edu-org { color: var(--text-dim); font-weight: 400; font-size: 0.95rem; }
.edu-card p { color: var(--text-dim); margin-top: 0.7rem; font-size: 0.95rem; }

.contact { padding-bottom: 4rem; }
.contact-card { text-align: center; padding: 3rem 2rem; }
.contact-big {
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 3vw, 1.6rem);
  font-weight: 600;
  max-width: 30ch; margin: 0 auto 1.6rem;
}
.contact-card .hero-actions { justify-content: center; margin-top: 0; }

/* ---------- footer ---------- */

.footer {
  border-top: 1px solid var(--border);
  margin-top: 2rem;
  padding: 2rem 1.5rem 2.5rem;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.85rem;
}
.footer p + p { margin-top: 0.5rem; }

/* ---------- reveal animation ---------- */

/* Only hide-for-reveal when JS has confirmed it can un-hide (body.js). */
body.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.6s ease, transform 0.6s ease; }
body.js .reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  body.js .reveal { opacity: 1; transform: none; transition: none; }
  .btn, .feat-card, .repo-card { transition: none; }
}

/* ---------- responsive ---------- */

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; padding-top: 3.5rem; gap: 2rem; }
  .hero-card { max-width: 380px; }
  .about-grid { grid-template-columns: 1fr; }
  .feat-card { grid-template-columns: 1fr; }
  .feat-side { flex-direction: row; align-items: center; }
  .nav-links { gap: 1rem; }
  .nav-links a:nth-child(3) { display: none; }
}

/* "Also elsewhere" footnote under the repo grid */
.elsewhere { text-align: center; color: var(--text-dim); margin-top: 1.2rem; }
.elsewhere a { color: var(--text-dim); text-decoration: underline; text-underline-offset: 3px; }
.elsewhere a:hover { color: var(--accent); }
