:root {
  /* canvas (always dark — it's a night sky in both modes) */
  --bg: #07080c;
  --bg-2: #0c0e15;
  --ink: #e7ecf3;
  --ink-dim: #8a94a6;
  --ink-mute: #4a5267;
  --line: rgba(255,255,255,0.08);
  --line-2: rgba(255,255,255,0.04);
  --accent: #7df9ff;
  --accent-2: #b388ff;
  --accent-3: #ff5fa2;
  --warn: #ffd166;
  --mono: ui-monospace, "JetBrains Mono", "SF Mono", Menlo, monospace;
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Helvetica Neue", sans-serif;

  /* theme-able (page frame + nav) */
  --page-bg: #ffffff;
  --page-text: #0b0d14;
  --page-dim: #4a5267;
  --page-mute: #8a94a6;
  --page-line: rgba(0,0,0,0.08);
  --page-line-soft: rgba(0,0,0,0.05);
  --nav-bg: #ffffff;
  --nav-hover: #6a5cff;
  --shadow-plate: 0 30px 80px -20px rgba(0,0,0,0.35);
}
[data-theme="dark"] {
  --page-bg: #07080c;
  --page-text: #e7ecf3;
  --page-dim: #b6becc;
  --page-mute: #6a7488;
  --page-line: rgba(255,255,255,0.12);
  --page-line-soft: rgba(255,255,255,0.06);
  --nav-bg: #0a0c14;
  --nav-hover: #b388ff;
  --shadow-plate: 0 30px 80px -20px rgba(0,0,0,0.85);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--page-bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* white frame around the page — heavier gutter on top + left + right,
   matching browserbase's framed-canvas feel. the nav sits in the top gutter. */
.page-frame {
  background: var(--page-bg);
  padding: 0 72px 22px 72px;
  min-height: 100vh;
  transition: background 0.3s;
}
.page-inner {
  position: relative;
  background: var(--bg);
  border-radius: 0;
  background-image:
    radial-gradient(1200px 600px at 80% -10%, rgba(125,249,255,0.10), transparent 60%),
    radial-gradient(900px 500px at -10% 20%, rgba(179,136,255,0.10), transparent 60%),
    linear-gradient(180deg, #07080c 0%, #05060a 100%);
  box-shadow: 0 0 0 1px var(--page-line), var(--shadow-plate);
  isolation: isolate;
  transition: box-shadow 0.3s;
}
/* round only the top corners of the canvas-bearing region;
   hero needs overflow: hidden to actually clip the radius */
.hero { border-radius: 0; }

/* texture overlays */
.grain {
  pointer-events: none;
  position: fixed; inset: 0; z-index: 100;
  opacity: 0.06; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='0.9'/></svg>");
}
.scanlines {
  pointer-events: none;
  position: fixed; inset: 0; z-index: 99;
  background: repeating-linear-gradient(180deg, rgba(255,255,255,0.015) 0 1px, transparent 1px 3px);
}

/* nav — lives in the white frame above the dark canvas, sticky on scroll */
.nav {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 30px;
  background: var(--nav-bg);
  border-bottom: 1px solid var(--page-line);
  margin: 0 -72px 0 -72px;
  transition: background 0.3s, border-color 0.3s;
}
.brand {
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--page-text);
  text-decoration: none;
  font-size: 18px;
  display: inline-flex; align-items: center; gap: 12px;
  transition: color 0.3s;
}
.brand .dot {
  width: 12px; height: 12px; border-radius: 3px;
  background: linear-gradient(135deg, #b388ff, #ff5fa2);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.08);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.85; transform: scale(0.95); }
}
.nav nav { display: flex; align-items: center; gap: 24px; }
.nav nav a {
  color: var(--page-text);
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  position: relative;
  transition: color 0.2s;
}
.nav nav a:hover { color: var(--nav-hover); }

/* theme toggle button */
.theme-toggle {
  width: 36px; height: 36px;
  border-radius: 999px;
  border: 1px solid var(--page-line);
  background: transparent;
  color: var(--page-text);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.2s;
}
.theme-toggle:hover { background: rgba(0,0,0,0.04); transform: rotate(-12deg); }
[data-theme="dark"] .theme-toggle:hover { background: rgba(255,255,255,0.06); }
.theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun  { display: block; }

/* hero */
.hero {
  position: relative;
  min-height: 92vh;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 48px;
  align-items: center;
  padding: 80px 64px 60px;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}
#hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  z-index: 0;
  opacity: 0.95;
}
.hero-copy { position: relative; z-index: 2; max-width: 600px; }
.eyebrow {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 18px;
  opacity: 0.85;
}
.hero h1 {
  font-size: clamp(40px, 6vw, 76px);
  line-height: 1.02;
  letter-spacing: -0.03em;
  margin: 0 0 22px;
  font-weight: 600;
}
.grad {
  background: linear-gradient(100deg, var(--accent) 0%, var(--accent-2) 50%, var(--accent-3) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  background-size: 200% 100%;
  animation: shift 8s ease-in-out infinite;
}
@keyframes shift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
.lede {
  font-size: 17px;
  color: var(--ink-dim);
  max-width: 50ch;
}
.kbd {
  font-family: var(--mono);
  font-size: 0.92em;
  background: rgba(125,249,255,0.08);
  border: 1px solid rgba(125,249,255,0.25);
  padding: 1px 7px;
  border-radius: 4px;
  color: var(--accent);
}
.cta-row { display: flex; gap: 10px; margin-top: 32px; }
.btn {
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  display: inline-flex; align-items: center; gap: 8px;
  transition: transform 0.15s, box-shadow 0.2s, background 0.2s, color 0.2s;
  border: 1px solid transparent;
  white-space: nowrap;
}

/* pill — fully rounded, generous side padding, browserbase-style */
.btn.pill {
  border-radius: 999px;
  padding: 12px 22px;
  line-height: 1;
}
.btn.pill .chev,
.btn.pill .ext {
  font-size: 14px;
  display: inline-block;
  transform: translateY(-0.5px);
}
.btn.pill .chev { font-weight: 700; }

.pill-primary {
  background: #0b0d14;
  color: #ffffff;
  border-color: #0b0d14;
  box-shadow: 0 8px 24px -10px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.04) inset;
}
.pill-primary:hover {
  background: #1a1f2e;
  transform: translateY(-1px);
  box-shadow: 0 12px 28px -10px rgba(125,249,255,0.35), 0 0 0 1px rgba(125,249,255,0.25) inset;
}
.ingest-arrow {
  transition: transform 0.25s ease;
}
.btn.pill:hover .ingest-arrow {
  transform: translate(2px, 3px);
}

.pill-ghost {
  background: rgba(255,255,255,0.08);
  color: var(--ink);
  border-color: rgba(255,255,255,0.10);
  backdrop-filter: blur(6px);
}
.pill-ghost:hover {
  background: rgba(255,255,255,0.14);
  border-color: rgba(255,255,255,0.20);
}

.hero-meta {
  position: absolute;
  bottom: 32px;
  left: 64px;
  right: 64px;
  z-index: 2;
  display: flex;
  gap: 40px;
  font-family: var(--mono);
  font-size: 12px;
  padding-top: 18px;
  border-top: 1px dashed var(--line);
}
.hero-meta > div { display: flex; flex-direction: column; gap: 4px; }
.meta-k { color: var(--ink-mute); text-transform: uppercase; letter-spacing: 0.1em; font-size: 10px; }
.meta-v { color: var(--ink); }
.meta-v.live {
  color: #6affb6;
  display: inline-flex; align-items: center; gap: 6px;
}
.meta-v.live::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: #6affb6; box-shadow: 0 0 8px #6affb6;
  animation: pulse 1.6s ease-in-out infinite;
}

/* feed — clean, narrow, breathing room */
.feed, .blog {
  max-width: 720px;
  margin: 0 auto;
  padding: 88px 32px 72px;
}

/* timeline — vertical-axis blog index, rhys.dev-style */
.timeline {
  max-width: 760px;
  margin: 0 auto;
  padding: 96px 32px 72px;
  position: relative;
  color: var(--ink);
  /* always tall enough that scrolling to it pushes the hero entirely out of view,
     even when filtering hides most entries */
  min-height: 100vh;
}
/* the vertical axis line */
.timeline::before {
  content: "";
  position: absolute;
  left: calc(50% - 760px/2 + 32px + 70px + 4px);
  top: 130px;
  bottom: 90px;
  width: 1px;
  background: var(--line);
}
/* responsive: when timeline shrinks, anchor line from a fixed offset */
@media (max-width: 824px) {
  .timeline::before { left: calc(32px + 70px + 4px); }
}

.timeline .entry {
  display: grid;
  grid-template-columns: 70px 80px 1fr;
  column-gap: 24px;
  padding: 14px 0;
  border-top: none;
  position: relative;
  align-items: start;
}
.timeline .entry::before { content: none; }

.entry-date {
  text-align: right;
  font-size: 13px;
  color: var(--ink-mute);
  padding-top: 3px;
  font-family: var(--sans);
  letter-spacing: 0;
  text-transform: none;
  margin: 0;
  display: block;
}
.entry-tag {
  font-size: 13px;
  color: var(--ink-mute);
  padding-top: 3px;
  padding-left: 14px;
  position: relative;
}
.entry-tag::before {
  content: "";
  position: absolute;
  left: -8px; top: 9px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--ink-mute);
  box-shadow: 0 0 0 3px var(--bg);
}
.entry-content h3 {
  font-size: 18px;
  margin: 0 0 6px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.35;
  color: var(--ink);
}
.entry-content h3 a {
  color: inherit;
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0 1px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  transition: background-size 0.3s ease;
}
.entry-content h3 a:hover { background-size: 100% 1px; }
.entry-content p {
  margin: 0;
  color: var(--ink-dim);
  font-size: 14px;
  line-height: 1.55;
  max-width: 56ch;
}

/* year separator row */
.year-row {
  display: grid;
  grid-template-columns: 70px 80px 1fr;
  column-gap: 24px;
  align-items: center;
  padding: 36px 0 24px;
  position: relative;
}
.year-row > span {
  grid-column: 1;
  text-align: right;
  font-size: 18px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.year-row::after {
  content: "";
  grid-column: 2 / -1;
  height: 1px;
  background: var(--line);
  margin-left: 14px;
}
.year-row:first-child { padding-top: 0; }

/* filter bar — appears when timeline is filtered */
.filter-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  margin-bottom: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,0.02);
  font-size: 13px;
  width: fit-content;
}
.filter-label { color: var(--ink-mute); }
.filter-current {
  color: var(--ink);
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(125,249,255,0.10);
  border: 1px solid rgba(125,249,255,0.25);
}
.filter-clear {
  background: none;
  border: none;
  color: var(--ink-dim);
  font: inherit;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 999px;
  transition: color 0.15s, background 0.15s;
}
.filter-clear:hover { color: var(--ink); background: rgba(255,255,255,0.05); }

/* hide non-matching entries */
.timeline[data-filter="blog"] .entry[data-tag="project"],
.timeline[data-filter="project"] .entry[data-tag="blog"] { display: none; }

/* hide year rows that have no following visible entries — set via JS */
.year-row.is-empty { display: none; }

/* highlight active nav filter */
.nav nav a.is-active { color: var(--nav-hover); }
.section-title {
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin: 0 0 44px;
  font-weight: 500;
  font-family: var(--sans);
}
.section-title span { display: none; }

.entry {
  display: block;
  padding: 28px 0;
  border-top: 1px solid var(--line);
  position: relative;
}
.entry:first-of-type { border-top: none; padding-top: 0; }

.entry-date {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-mute);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: inline-block;
  margin-right: 12px;
}
.entry-body {
  display: block;
}
.entry-body .meta-row {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 10px;
}
.entry-body h3 {
  font-size: 21px;
  margin: 0 0 8px;
  font-weight: 500;
  letter-spacing: -0.015em;
  line-height: 1.3;
  color: var(--ink);
}
.entry-body h3 a {
  color: inherit;
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0 1px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  transition: background-size 0.3s ease;
}
.entry-body h3 a:hover { background-size: 100% 1px; }
.entry-body p {
  margin: 0;
  color: var(--ink-dim);
  font-size: 15px;
  line-height: 1.55;
  max-width: 60ch;
}

.tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid;
}
.tag-blog  { color: var(--accent);   border-color: rgba(125,249,255,0.3);   background: rgba(125,249,255,0.06); }
.tag-space { color: var(--accent-2); border-color: rgba(179,136,255,0.3);   background: rgba(179,136,255,0.06); }
.tag-idea  { color: var(--warn);     border-color: rgba(255,209,102,0.3);   background: rgba(255,209,102,0.06); }
.tag-proj  { color: var(--accent-3); border-color: rgba(255,95,162,0.3);    background: rgba(255,95,162,0.06); }

/* footer */
.foot {
  border-top: 1px solid var(--line);
  padding: 28px 32px;
  display: flex; justify-content: space-between; align-items: center;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-mute);
}
.foot-links { display: flex; gap: 18px; }
.foot-links a { color: var(--ink-dim); text-decoration: none; }
.foot-links a:hover { color: var(--accent); }

/* responsive */
@media (max-width: 880px) {
  .hero { grid-template-columns: 1fr; padding: 60px 24px 100px; min-height: 80vh; }
  .hero-meta { left: 24px; right: 24px; flex-wrap: wrap; gap: 20px; }
  .nav { padding: 14px 20px; }
  .nav nav { gap: 14px; }
  .entry { grid-template-columns: 1fr; gap: 8px; }
  .entry-date { padding-top: 0; }
  .feed, .blog { padding: 64px 24px; }
}
