:root {
  --ink: #1B1D2B;
  --ink-muted: #6B6E82;
  --paper: #ECEADF;
  --paper-line: #D8D5C7;
  --surface: #E3E0D1;
  --accent: #E24F2C;
  --accent-ink: #ffffff;
  --accent-gold: #C98A1F;

  --bg: var(--paper);
  --fg: var(--ink);
  --fg-muted: var(--ink-muted);
  --border: var(--paper-line);
  --card-bg: var(--surface);
  --code-bg: #DEDBCB;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1B1D2B;
    --fg: #ECE9DE;
    --fg-muted: #9698AC;
    --border: #2D303F;
    --card-bg: #22242F;
    --code-bg: #171923;
    --accent: #FF6F47;
    --accent-gold: #E8B339;
  }
}
:root[data-theme="dark"] {
  --bg: #1B1D2B;
  --fg: #ECE9DE;
  --fg-muted: #9698AC;
  --border: #2D303F;
  --card-bg: #22242F;
  --code-bg: #171923;
  --accent: #FF6F47;
  --accent-gold: #E8B339;
}
:root[data-theme="light"] {
  --bg: var(--paper);
  --fg: var(--ink);
  --fg-muted: var(--ink-muted);
  --border: var(--paper-line);
  --card-bg: var(--surface);
  --code-bg: #DEDBCB;
  --accent: #E24F2C;
  --accent-gold: #C98A1F;
}

* { box-sizing: border-box; }
html { color-scheme: light dark; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  transition: background .2s ease, color .2s ease;
}
h1, h2, h3 {
  font-family: Georgia, "Iowan Old Style", "Palatino Linotype", "Times New Roman", serif;
  font-weight: 700;
  text-wrap: balance;
  margin: 0;
  letter-spacing: -0.01em;
}
.mono {
  font-family: "SF Mono", "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
}
a { color: inherit; }
p { margin: 0; }
img, svg { max-width: 100%; }

.wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 28px;
}

/* ---------- nav ---------- */
header.top {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.top-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.logo {
  text-decoration: none;
  display: flex;
  align-items: center;
  flex: none;
}
.logo img {
  width: 48px;
  height: 48px;
  display: block;
  object-fit: contain;
  border-radius: 4px;
}
nav.links {
  display: flex;
  gap: 22px;
  font-size: 13px;
}
nav.links a {
  text-decoration: none;
  color: var(--fg-muted);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  position: relative;
  padding-bottom: 2px;
}
nav.links a:hover, nav.links a:focus-visible, nav.links a.active { color: var(--fg); }
nav.links a::after {
  content: "";
  position: absolute;
  left: 0; right: 100%; bottom: -2px;
  height: 1px;
  background: var(--accent);
  transition: right .18s ease;
}
nav.links a:hover::after, nav.links a:focus-visible::after, nav.links a.active::after { right: 0; }
@media (max-width: 640px) { nav.links { display: none; } }

/* ---------- hero ---------- */
.hero {
  padding: 76px 0 64px;
}
.prompt {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--fg-muted);
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 6px 12px;
  margin-bottom: 26px;
}
.cursor {
  display: inline-block;
  width: 7px; height: 14px;
  background: var(--accent);
  animation: blink 1.1s steps(1) infinite;
}
@media (prefers-reduced-motion: reduce) { .cursor { animation: none; opacity: .7; } }
@keyframes blink { 50% { opacity: 0; } }

.hero h1 {
  font-size: clamp(2.2rem, 5.4vw, 3.4rem);
  line-height: 1.08;
  max-width: 15ch;
}
.hero h1 em {
  font-style: italic;
  color: var(--accent);
}
.hero p.sub {
  margin-top: 22px;
  max-width: 56ch;
  font-size: 18px;
  color: var(--fg-muted);
}
.cta-row {
  margin-top: 34px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  padding: 12px 20px;
  border-radius: 5px;
  border: 1px solid transparent;
}
.btn.primary {
  background: var(--accent);
  color: var(--accent-ink);
}
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost {
  border-color: var(--border);
  color: var(--fg);
}
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.hero-meta {
  margin-top: 22px;
  font-size: 12.5px;
  color: var(--fg-muted);
}

/* ---------- log / timeline ---------- */
main.log {
  position: relative;
  max-width: 900px;
  margin: 0 auto;
  padding: 20px 28px 40px;
}
.spine {
  position: absolute;
  top: 0;
  bottom: 60px;
  left: calc(28px + 20px);
  width: 1px;
  background: var(--border);
}
.entry {
  display: grid;
  grid-template-columns: 40px 1fr;
  column-gap: 24px;
  padding: 56px 0;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.entry:last-child { border-bottom: none; }
.entry .marker {
  position: relative;
}
.entry .dot {
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
  position: relative;
  z-index: 1;
  margin-top: 6px;
}
.entry .tag {
  display: block;
  margin-top: 10px;
  font-size: 12px;
  color: var(--fg-muted);
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}
@media (max-width: 640px) {
  .entry { grid-template-columns: 26px 1fr; column-gap: 14px; }
  .entry .tag { display: none; }
  .spine { left: calc(28px + 13px); }
}

.eyebrow {
  font-size: 12.5px;
  letter-spacing: 0.06em;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 10px;
  display: block;
}
.entry h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  max-width: 22ch;
}
.entry > .content > p.lede {
  margin-top: 16px;
  max-width: 60ch;
  color: var(--fg-muted);
  font-size: 16.5px;
}

/* ---------- card grids ---------- */
.grid {
  margin-top: 30px;
  display: grid;
  gap: 16px;
}
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 720px) {
  .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr; }
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 20px 20px 22px;
  transition: transform .15s ease, border-color .15s ease;
}
.card:hover { transform: translateY(-2px); border-color: var(--accent); }
.card .kicker {
  font-size: 12.5px;
  color: var(--accent);
  display: inline-block;
  padding: 2px 8px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-radius: 4px;
  margin-bottom: 12px;
}
.card h3 {
  font-size: 17px;
  font-family: -apple-system, "Segoe UI", Arial, sans-serif;
  font-weight: 700;
}
.card p {
  margin-top: 8px;
  font-size: 14.5px;
  color: var(--fg-muted);
  line-height: 1.5;
}

/* user story cards get a quote-like left rule */
.card.story {
  border-left: 3px solid var(--accent-gold);
}
.card.story p.story-text {
  color: var(--fg);
  font-size: 15px;
}

/* host / contributor cards */
.host {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.avatar {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: var(--code-bg);
  border: 1px solid var(--border);
  flex: none;
  display: flex; align-items: center; justify-content: center;
  font-family: "SF Mono", monospace;
  font-weight: 700;
  color: var(--accent);
}

/* distribution pills */
.pill-row {
  margin-top: 28px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.pill {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 16px;
  max-width: 100%;
  border: 1px dashed var(--border);
  border-radius: 999px;
  font-size: 13.5px;
  color: var(--fg-muted);
  text-decoration: none;
}
.pill[href]:hover { border-color: var(--accent); color: var(--fg); }
.pill .branch {
  font-family: "SF Mono", monospace;
  font-size: 11.5px;
  color: var(--accent-gold);
}
.pill strong { color: var(--fg); font-weight: 600; }

/* project pages */
.projects-hero {
  padding-bottom: 32px;
}
.projects-hero h1 {
  max-width: none;
}
.projects-log {
  padding-top: 0;
}
.project-entry {
  padding-top: 34px;
}
.projects-list {
  margin-top: 30px;
  display: grid;
  gap: 18px;
}
.project-card {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 18px;
  transition: transform .15s ease, border-color .15s ease;
}
.project-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}
.shorts-shell {
  width: 100%;
  max-width: 260px;
  aspect-ratio: 9 / 16;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  background: var(--code-bg);
}
.shorts-shell iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
.project-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}
.project-copy .kicker {
  font-size: 12.5px;
  color: var(--accent);
  display: inline-block;
  padding: 2px 8px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-radius: 4px;
}
.project-copy h3 {
  font-family: -apple-system, "Segoe UI", Arial, sans-serif;
  font-size: clamp(1.35rem, 3vw, 2rem);
  font-weight: 700;
}
.project-copy p {
  max-width: 58ch;
  font-size: 15.5px;
  color: var(--fg-muted);
}
.project-actions {
  margin-top: 6px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
@media (max-width: 760px) {
  .project-card { grid-template-columns: 1fr; }
  .shorts-shell { max-width: min(100%, 360px); }
}

/* footer */
footer {
  border-top: 1px solid var(--border);
  padding: 56px 0 34px;
}
footer .wrap { display: flex; flex-direction: column; gap: 26px; }
footer h2 { font-size: clamp(1.6rem, 4vw, 2.2rem); max-width: 18ch; }
footer p.lede { color: var(--fg-muted); max-width: 52ch; margin-top: 14px; }
.foot-meta {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
  color: var(--fg-muted);
  padding-top: 26px;
  border-top: 1px solid var(--border);
}

/* scroll reveal */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .5s ease, transform .5s ease;
}
.reveal.in { opacity: 1; transform: translateY(0); }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}
