/* ============================================================
   Theme tokens — colors lifted from the reference design
   Light + dark follow the OS via prefers-color-scheme.
   ============================================================ */
:root {
  --radius: 0.625rem;
  --background: #faf9f7;      /* nudged off the reference's exact #f7f6f5 */
  --foreground: #0a0a0a;
  --card: #ffffff;
  --muted: #f4f3f1;
  --muted-foreground: #737373;
  --accent-foreground: #464646;
  --border: #e6e4e1;
  --ring: #a1a1a1;

  /* pill nav glass */
  --pill-bg: rgba(250, 249, 247, 0.55);
  --pill-border: rgba(255, 255, 255, 0.6);
  --pill-shadow: 0 12px 34px rgba(0, 0, 0, 0.09);
  --pill-active-bg: #ffffff;

  /* code */
  --code-bg: #f0efec;
  --code-border: #e6e4e1;

  /* accent — deep green */
  --accent: #2f6b4f;
  --accent-strong: #255a41;
  --accent-soft: rgba(47, 107, 79, 0.12);
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #0a0a0a;
    --foreground: #ededed;
    --card: #171717;
    --muted: #262626;
    --muted-foreground: #a1a1a1;
    --accent-foreground: #b5b5b5;
    --border: rgba(255, 255, 255, 0.1);
    --ring: #737373;

    --pill-bg: rgba(23, 23, 23, 0.55);
    --pill-border: rgba(255, 255, 255, 0.12);
    --pill-shadow: 0 12px 34px rgba(0, 0, 0, 0.5);
    --pill-active-bg: #262626;

    --code-bg: #161616;
    --code-border: rgba(255, 255, 255, 0.08);

    /* accent — green, lifted for contrast on #0a0a0a */
    --accent: #6bbf95;
    --accent-strong: #86cfa9;
    --accent-soft: rgba(107, 191, 149, 0.16);
  }
}

/* ============================================================
   Reset / base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  background: var(--background);
  color: var(--foreground);
  font-family: "Geist", "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }

/* ============================================================
   Floating glass pill navigation
   ============================================================ */
.pill-nav {
  position: fixed;
  left: 50%;
  top: 0.75rem;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  align-items: center;
  padding: 0.15rem;
  border-radius: 999px;              /* full pill (reference uses a rounded-rect) */
  border: 1px solid var(--pill-border);
  background: var(--pill-bg);
  box-shadow: var(--pill-shadow);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
}
@media (min-width: 768px) { .pill-nav { top: 1rem; } }

.pill-nav a {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.95rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--muted-foreground);
  border-radius: 999px;
  transition: color 0.25s ease, transform 0.1s ease;
  white-space: nowrap;
}
.pill-nav a:hover { color: var(--accent-foreground); }
.pill-nav a:active { transform: scale(0.97); }
.pill-nav a.active { color: var(--accent-strong); }

/* sliding highlight behind the active item */
.pill-indicator {
  position: absolute;
  z-index: 1;
  top: 0.15rem;
  left: 0;
  height: calc(100% - 0.3rem);
  border-radius: 999px;
  background: var(--pill-active-bg);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1),
              width 0.32s cubic-bezier(0.22, 1, 0.36, 1);
  opacity: 0;
}
.pill-indicator.ready { opacity: 1; }

/* ============================================================
   Layout
   ============================================================ */
main {
  display: flex;
  min-height: 100vh;
  width: 100%;
  flex-direction: column;
  align-items: center;
  padding: 0 2rem;
}
.container {
  width: 100%;
  max-width: 48rem;
  padding: 6rem 0.25rem 6rem;
}
@media (min-width: 768px) {
  .container { padding: 7rem 1rem 12rem; }
}

/* fade-in-up entrance applied when a view is rendered */
.view { animation: fade-up 0.5s cubic-bezier(0.22, 1, 0.36, 1) both; }
@keyframes fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   Typography
   ============================================================ */
h1, h2, h3, h4 { font-weight: 700; line-height: 1.25; }
.greeting { font-size: 1.05rem; font-weight: 700; margin: 0 0 1.25rem; }
.lead { margin: 0; color: var(--foreground); }
.lead + .lead { margin-top: 1rem; }

.section-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 1.75rem;
}
.muted { color: var(--muted-foreground); }

/* Index: understated "Now" line */
.now {
  margin: 1.75rem 0 0;
  color: var(--muted-foreground);
  font-size: 0.95rem;
}
.now-label {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--accent-soft);
  background: var(--accent-soft);
  border-radius: 0.35rem;
  padding: 0.1rem 0.4rem;
  margin-right: 0.6rem;
}

/* Index: focus-areas middot line */
.focus {
  margin: 0.85rem 0 0;
  color: var(--muted-foreground);
  font-size: 0.9rem;
}
.focus .mid {
  color: var(--accent);
  opacity: 0.7;
  margin: 0 0.55rem;
}

/* ============================================================
   Animated underline links (Index social row, inline links)
   ============================================================ */
.link-row { display: flex; flex-wrap: wrap; gap: 0.75rem 1.5rem; margin-top: 2rem; }
.ulink {
  position: relative;
  padding: 0.25rem 0;
  color: var(--accent-foreground);
  white-space: nowrap;
  transition: color 0.3s ease, transform 0.3s ease;
}
.ulink::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -0.1rem;
  height: 1px;
  width: 100%;
  background: var(--accent);
  opacity: 0.35;
  transition: width 0.3s ease, opacity 0.3s ease;
}
@media (min-width: 768px) {
  .ulink::after { width: 0; opacity: 1; }
}
.ulink:hover {
  color: var(--accent-strong);
  transform: translateX(2px);
}
.ulink:hover::after { width: 100%; opacity: 1; }

/* ============================================================
   Work list
   ============================================================ */
.entry-list { display: flex; flex-direction: column; gap: 2rem; }
.entry { display: flex; flex-direction: column; gap: 0.35rem; }
.entry-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 1rem;
}
.entry-role { font-weight: 600; }
.entry-org { color: var(--muted-foreground); }
.entry-dates { font-size: 0.85rem; color: var(--muted-foreground); white-space: nowrap; }
.entry-desc { margin: 0.15rem 0 0; color: var(--foreground); }

/* ============================================================
   Blog list
   ============================================================ */
.post-list { display: flex; flex-direction: column; gap: 1.75rem; }
.post-item { display: flex; flex-direction: column; gap: 0.3rem; }
.post-link {
  font-weight: 600;
  transition: color 0.25s ease, transform 0.25s ease;
  width: fit-content;
}
.post-link:hover { color: var(--accent-strong); transform: translateX(2px); }
.post-date { font-size: 0.85rem; color: var(--muted-foreground); }
.post-excerpt { margin: 0.1rem 0 0; color: var(--muted-foreground); }

/* ============================================================
   Projects
   ============================================================ */
.project-list { display: flex; flex-direction: column; gap: 1.75rem; }
.project { display: flex; flex-direction: column; gap: 0.4rem; }
.project-name { font-weight: 600; width: fit-content; transition: transform 0.25s ease; }
.project-name:hover { transform: translateX(2px); }
.project-desc { margin: 0; color: var(--muted-foreground); }
.tag-row { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.15rem; }
.tag {
  font-size: 0.72rem;
  font-weight: 500;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--accent-soft);
  color: var(--accent);
  background: var(--accent-soft);
}

/* ============================================================
   Blog post (single) — prose
   ============================================================ */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.875rem;
  color: var(--muted-foreground);
  margin-bottom: 2rem;
  transition: color 0.25s ease, transform 0.25s ease;
}
.back-link:hover { color: var(--foreground); transform: translateX(-2px); }

.post-header { margin-bottom: 2.5rem; }
.post-header h1 { font-size: 1.7rem; margin: 0 0 0.6rem; line-height: 1.2; }
.post-meta { font-size: 0.85rem; color: var(--muted-foreground); display: flex; flex-wrap: wrap; gap: 0.5rem 0.75rem; align-items: center; }
.post-meta .dot { opacity: 0.5; }

.prose { color: var(--foreground); }
.prose > * + * { margin-top: 1.15rem; }
.prose h2 {
  font-size: 1.3rem;
  margin-top: 2.5rem;
  margin-bottom: 0.25rem;
  scroll-margin-top: 5rem;
}
.prose h3 {
  font-size: 1.08rem;
  margin-top: 1.75rem;
  margin-bottom: 0.25rem;
  scroll-margin-top: 5rem;
}
.prose p { margin: 0; }
.prose a:not(.ulink) {
  color: var(--accent-strong);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: var(--accent-soft);
}
.prose a:not(.ulink):hover { text-decoration-color: var(--accent); }
.prose strong { font-weight: 700; }
.prose hr { border: none; border-top: 1px solid var(--border); margin: 2.5rem 0; }
.prose ul, .prose ol { margin: 0; padding-left: 1.4rem; }
.prose li { margin: 0.3rem 0; }

/* inline + block code */
.prose code {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85em;
  color: var(--accent-strong);
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: 0.35rem;
  padding: 0.1rem 0.35rem;
}
.prose pre {
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  overflow-x: auto;
  line-height: 1.5;
}
.prose pre code {
  color: var(--foreground);
  background: none;
  border: none;
  padding: 0;
  font-size: 0.85rem;
}

/* figures with SVG diagrams (dark card, like source) */
.prose figure {
  margin: 1.75rem 0;
  background: #1e1e2e;
  border: 1px solid #313244;
  border-radius: 12px;
  padding: 1.5rem 1rem 1rem;
  text-align: center;
}
.prose figure img { max-width: 100%; height: auto; }
.prose figcaption {
  font-size: 0.85rem;
  color: #a6adc8;
  margin-top: 0.85rem;
}

/* table of contents */
.toc {
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.1rem 1.35rem;
  margin: 1.75rem 0;
}
.toc-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-foreground);
  margin: 0 0 0.6rem;
}
.toc ol { margin: 0; padding-left: 1.2rem; }
.toc li { margin: 0.25rem 0; }
.toc a {
  color: var(--accent-foreground);
  text-decoration: none;
  transition: color 0.2s ease;
}
.toc a:hover { color: var(--accent-strong); text-decoration: underline; text-underline-offset: 2px; }

/* callout */
.callout {
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  background: var(--muted);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  margin: 1.75rem 0;
}
.callout-title {
  font-weight: 700;
  font-size: 0.95rem;
  margin: 0 0 0.4rem;
}
.callout p { margin: 0; color: var(--foreground); }

/* trailing italic note */
.prose em { color: var(--muted-foreground); }
