: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: #07080c;          /* unified — was #0a0c14, created a visible 3rd shade */
  --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 0 72px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background 0.3s;
}
.page-inner { flex: 1; }
.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: none;
  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: 6px;
  border: none;
  background: transparent;
  color: var(--page-text);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: color 0.2s, transform 0.2s;
  padding: 0;
}
.theme-toggle:hover { transform: rotate(-12deg); color: var(--nav-hover); }
.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: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 48px;
  align-items: center;
  padding: 80px 64px 60px;
  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;
}

/* epigraph — Quranic verse between hero and timeline */
.epigraph {
  max-width: 720px;
  margin: 0 auto;
  padding: 96px 32px 24px;
  text-align: center;
  color: var(--ink);
}
.epigraph-ar {
  font-size: clamp(22px, 3.2vw, 32px);
  line-height: 1.7;
  font-weight: 400;
  margin: 0 0 18px;
  color: var(--ink);
  letter-spacing: 0;
  /* prefer a proper Arabic typeface if available */
  font-family: "SF Arabic", "Geeza Pro", "Amiri", "Scheherazade New", serif;
  opacity: 0.92;
}
.epigraph-en {
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-dim);
  margin: 0 0 10px;
  font-style: italic;
  max-width: 56ch;
  margin-left: auto;
  margin-right: auto;
}
.epigraph-cite {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin: 0;
}
.epigraph-hint {
  color: var(--accent);
  opacity: 0.7;
}

/* timeline — vertical-axis blog index, rhys.dev-style */
.timeline {
  max-width: 760px;
  margin: 0 auto;
  padding: 56px 32px 80px;      /* tighter top so the year row sits closer to the nav */
  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: 135px;
  bottom: 100px;
  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; }

/* project entries: only the "project" tag gets the same cyan→violet→magenta gradient as "Solomon" */
.entry[data-tag="project"] .entry-tag {
  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;
}
.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; }

/* ===== light mode below-canvas area =====
   Canvas/hero stays dark always (it's a night sky). Everything below it —
   page-inner, timeline, footer — flips to light bg + dark text in light
   mode for proper reading contrast. */
[data-theme="light"] .page-inner {
  background: var(--page-bg);
  background-image: none;
}
[data-theme="light"] .timeline {
  background: var(--page-bg);
  color: var(--page-text);
}
[data-theme="light"] .timeline::before { background: var(--page-line); }
[data-theme="light"] .entry-date,
[data-theme="light"] .entry-tag { color: var(--page-mute); }
[data-theme="light"] .entry-tag::before {
  background: var(--page-mute);
  box-shadow: 0 0 0 3px var(--page-bg);
}
[data-theme="light"] .entry-content h3 { color: var(--page-text); }
[data-theme="light"] .entry-content p  { color: var(--page-dim); }
[data-theme="light"] .year-row > span  { color: var(--page-text); }
[data-theme="light"] .year-row::after  { background: var(--page-line); }
[data-theme="light"] .entry { border-top-color: var(--page-line); }

/* 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); }

/* newsletter signup card — sits between timeline and footer */
.subscribe {
  max-width: 520px;
  margin: 12px auto 64px;
  padding: 32px 24px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--ink);
}
.subscribe h2 {
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: 0 0 8px;
  color: var(--ink);
}
.subscribe p {
  margin: 0 0 20px;
  font-size: 14px;
  color: var(--ink-dim);
}
.subscribe-form {
  display: flex;
  gap: 8px;
  max-width: 400px;
  margin: 0 auto;
}
.subscribe-form input {
  flex: 1;
  padding: 12px 16px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  font-size: 14px;
  font-family: var(--sans);
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}
.subscribe-form input::placeholder { color: var(--ink-mute); }
.subscribe-form input:focus { border-color: var(--accent); background: rgba(125,249,255,0.05); }
.subscribe-form button {
  padding: 12px 22px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(100deg, var(--accent) 0%, var(--accent-2) 50%, var(--accent-3) 100%);
  color: #0b0d14;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: filter 0.2s, transform 0.15s;
}
.subscribe-form button:hover { filter: brightness(1.15); transform: translateY(-1px); }

/* footer — mirror of the top nav: full-width bar, themed bg, top border */
.foot {
  margin: 0 -72px 0 -72px;
  padding: 18px 30px;
  background: var(--nav-bg);
  border-top: 1px solid var(--page-line);
  display: flex; justify-content: space-between; align-items: center;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-dim);
  transition: background 0.3s, border-color 0.3s, color 0.3s;
}
[data-theme="light"] .foot { color: var(--page-dim); }
.foot-links { display: flex; gap: 18px; }
.foot-links a { color: var(--ink-dim); text-decoration: none; }
.foot-links a:hover { color: var(--accent); }

/* responsive */
/* tablet */
@media (max-width: 880px) {
  .page-frame { padding: 0 24px 14px 24px; }
  .nav { margin: 0 -24px 0 -24px; padding: 14px 24px; }
  .foot { margin: 0 -24px 0 -24px; padding: 16px 24px; }
  .nav nav { gap: 16px; }
  .nav nav a { font-size: 14px; }

  .hero { grid-template-columns: 1fr; padding: 60px 32px 80px; min-height: 78vh; }
  @media (orientation: portrait) { .hero { min-height: 92vh; } }

  .timeline { padding: 64px 24px 56px; }
  .timeline::before { left: calc(32px + 70px + 4px); }

  .feed, .blog { padding: 64px 24px; }
}

/* phone */
@media (max-width: 600px) {
  .page-frame { padding: 0 12px 12px 12px; }
  .nav {
    margin: 0 -12px 0 -12px;
    padding: 12px 16px;
  }
  .nav nav { gap: 14px; }
  .nav nav a { font-size: 13px; }
  .brand { font-size: 16px; }
  .theme-toggle { width: 32px; height: 32px; }

  .hero { padding: 48px 24px 64px; min-height: 100vh; }
  .hero h1 { font-size: clamp(34px, 11vw, 56px); }
  .hero .lede { font-size: 15px; }
  .btn.pill { padding: 11px 18px; font-size: 14px; }

  /* timeline: centered single-column flow on mobile, no axis line */
  .timeline { padding: 56px 24px 48px; text-align: center; }
  .timeline::before { display: none; }

  .timeline .entry {
    display: block;
    padding: 18px 0;
    position: relative;
    text-align: center;
  }
  .timeline .entry::after { display: none; }   /* no axis dot on mobile */

  /* date + tag inline at the top, centered */
  .entry-date {
    display: inline;
    text-align: center;
    padding: 0;
    margin: 0 10px 0 0;
    font-size: 12px;
  }
  .entry-tag {
    display: inline;
    padding: 0;
    font-size: 12px;
  }
  .entry-tag::before { display: none; }

  .entry-content { display: block; margin-top: 8px; text-align: center; }
  .entry-content h3 { font-size: 17px; }
  .entry-content p {
    font-size: 14px;
    max-width: none;             /* override desktop max-width: 56ch so text uses full mobile width */
    margin-left: auto;
    margin-right: auto;
  }

  .year-row {
    display: block;
    padding: 28px 0 18px;
    position: relative;
    text-align: center;
  }
  .year-row > span {
    display: inline-block;
    text-align: center;
    font-size: 16px;
  }
  .year-row::after { display: none; }

  .foot { margin: 0 -12px 0 -12px; padding: 16px 16px; flex-direction: column; gap: 8px; text-align: center; font-size: 11px; }

  /* post pages */
  .post-inner { padding: 32px 16px 56px; }
  .post-header h1 { font-size: clamp(28px, 8vw, 38px); }
  .post-lede { font-size: 16px; }
  .post-body { font-size: 16px; }
  .back-link { margin-bottom: 32px; }
}
