/* Colours and fonts live here; change the look by changing these. */
:root {
  --bg: #ffffff;
  --surface: #f5f9fd;
  --text: #0f1b2b;
  --muted: #5a6b7e;
  --rule: #e2eaf3;
  --accent: #1f7cc1;
  --accent-soft: #8fd0ff33;
  --on-accent: #ffffff;

  --serif: "Instrument Serif", Georgia, serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1320;
    --surface: #111c2d;
    --text: #f4f8fc;
    --muted: #93a4b8;
    --rule: #1f2c3f;
    --accent: #8fd0ff;
    --accent-soft: #8fd0ff24;
    --on-accent: #0b1320;
  }
}

:root[data-theme="dark"] {
  --bg: #0b1320;
  --surface: #111c2d;
  --text: #f4f8fc;
  --muted: #93a4b8;
  --rule: #1f2c3f;
  --accent: #8fd0ff;
  --accent-soft: #8fd0ff24;
  --on-accent: #0b1320;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
}

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

.wrap {
  max-width: 62rem;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Top bar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 3.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--mono);
  font-size: 0.9rem;
  font-weight: 500;
}

.wave-mark {
  width: 1.6rem;
  height: 1rem;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.nav a:hover { color: var(--text); }

.theme-toggle {
  background: none;
  border: 1px solid var(--rule);
  border-radius: 999px;
  width: 2rem;
  height: 2rem;
  color: var(--text);
  cursor: pointer;
  font-size: 1rem;
}

.theme-toggle:hover { border-color: var(--accent); }

/* Hero */

.hero {
  padding: 6rem 0 3.5rem;
}

.eyebrow {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--accent);
}

h1 {
  margin: 0.25rem 0 1rem;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(3rem, 9vw, 5.5rem);
  line-height: 1;
  letter-spacing: -0.01em;
}

.lede {
  max-width: 36rem;
  margin: 0 0 2rem;
  font-size: 1.1rem;
  color: var(--muted);
}

.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }

.button {
  padding: 0.6rem 1.1rem;
  border: 1px solid var(--rule);
  border-radius: 0.5rem;
  font-size: 0.9rem;
  font-weight: 500;
}

.button:hover { border-color: var(--accent); }

.button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.button.primary:hover { filter: brightness(1.08); }

/* The "now" line under the hero */

.signal-line {
  position: relative;
  padding: 1.1rem 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--muted);
}

.signal-line span::before {
  content: "";
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  margin-right: 0.6rem;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0.25rem var(--accent-soft);
  vertical-align: middle;
}

/* Sections: title on the left, content on the right; stacked on phones */

.section {
  display: grid;
  grid-template-columns: 11rem 1fr;
  gap: 2rem;
  padding: 3.5rem 0;
  border-bottom: 1px solid var(--rule);
}

.section > h2 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 2rem;
  line-height: 1.1;
}

.section > :not(h2) { grid-column: 2; }

.section-intro { margin: 0 0 1.25rem; color: var(--muted); }

.more {
  display: inline-block;
  margin-top: 1rem;
  font-size: 0.9rem;
  color: var(--accent);
}

/* Writing */

.posts { list-style: none; margin: 0; padding: 0; }

.post {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.2rem 1.5rem;
  padding: 1rem 0;
  border-bottom: 1px dashed var(--rule);
}

.posts li:first-child .post { padding-top: 0; }

.post-title { font-weight: 600; }

.post:hover .post-title { color: var(--accent); }

.post-summary { grid-column: 1; color: var(--muted); font-size: 0.95rem; }

.meta {
  grid-column: 2;
  grid-row: 1 / span 2;
  display: flex;
  align-items: start;
  gap: 0.4rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
}

.tag {
  padding: 0 0.35rem;
  border: 1px solid var(--rule);
  border-radius: 0.25rem;
}

/* Projects */

.cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.75rem;
  border: 1px solid var(--rule);
  border-radius: 0.75rem;
  background: var(--surface);
  transition: border-color 0.15s, transform 0.15s;
}

.card:hover { border-color: var(--accent); transform: translateY(-2px); }

.cover {
  aspect-ratio: 16 / 7;
  margin-bottom: 0.5rem;
  border-radius: 0.5rem;
  background:
    radial-gradient(circle at calc(var(--seed) * 23%) 30%, var(--accent-soft), transparent 60%),
    var(--bg);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.cover svg {
  width: 100%;
  height: 60%;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}

.card-title { font-weight: 600; }

.card-text { color: var(--muted); font-size: 0.92rem; }

.card-url {
  margin-top: auto;
  padding-top: 0.4rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--accent);
}

/* Notes */

.notes { list-style: none; margin: 0; padding: 0; }

.notes li {
  display: flex;
  gap: 1rem;
  padding: 0.45rem 0;
}

.notes time {
  flex: none;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
  padding-top: 0.15rem;
}

.notes a:hover { color: var(--accent); }

/* Contact */

.links { display: flex; flex-wrap: wrap; gap: 0.75rem; }

.links a {
  display: inline-flex;
  align-items: center;
  line-height: 1;
  gap: 0.45rem;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-size: 0.9rem;
  color: var(--muted);
}

.links a:hover { border-color: var(--accent); color: var(--accent); }

.link-icon {
  display: block;
  flex: none;
  width: 1rem;
  height: 1rem;
  fill: currentColor;
}

/* Footer */

.footer {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding-top: 2rem;
  padding-bottom: 3rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
}

/* Phones */

@media (max-width: 640px) {
  .nav a:not(:nth-child(-n+2)) { display: none; }
  .hero { padding: 4rem 0 2.5rem; }
  .section { grid-template-columns: 1fr; gap: 1.25rem; padding: 2.5rem 0; }
  .section > :not(h2) { grid-column: 1; }
  .cards { grid-template-columns: 1fr; }
  .post { grid-template-columns: 1fr; }
  .meta { grid-column: 1; grid-row: auto; margin-top: 0.3rem; }
}
