/* cavemanwithcomputer.com — one stylesheet, no build step, no dependencies. */

:root {
  --bg:     #fcfcf9;
  --fg:     #1b1b18;
  --muted:  #6f6f66;
  --accent: #14803b;
  --rule:   #e4e4dc;
  --mono:   ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --serif:  Charter, "Bitstream Charter", "Iowan Old Style", Georgia, serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:     #12140f;
    --fg:     #e7e7df;
    --muted:  #8d8d83;
    --accent: #5fd07d;
    --rule:   #292c22;
  }
}

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.6;
  margin: 0;
  padding: 2rem 2rem 6rem;
}

/* Prose is capped for line length; header and footer span the page. */
main { max-width: 40rem; }

::selection { background: var(--accent); color: var(--bg); }

/* ---- links ---- */

a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
a:hover { background: var(--accent); color: var(--bg); text-decoration: none; }

/* ---- header / tabs ---- */

header {
  font-family: var(--mono);
  font-size: 0.85rem;
  margin-bottom: 3rem;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 0.5rem 2rem;
}

nav.tabs {
  display: flex;
  gap: 1.5rem;
}

nav.tabs a {
  padding: 0.4rem 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  text-decoration: none;
}
nav.tabs a:hover { color: var(--fg); background: none; }
nav.tabs a[aria-current="page"] {
  color: var(--fg);
  border-bottom-color: var(--accent);
}

/* ---- headings ---- */

h1 {
  font-family: var(--mono);
  font-weight: 600;
  line-height: 1.3;
  font-size: 1.3rem;
  margin: 0 0 0.25rem;
}

.tagline { color: var(--muted); margin: 0 0 2rem; }

/* the little blinking block after the name */
.cursor {
  color: var(--accent);
  animation: blink 1.2s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .cursor { animation: none; } }

/* ---- entry lists (projects, posts, links) ---- */

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

ul.entries li {
  margin: 0 0 0.65rem;
  display: flex;
  gap: 0.9rem;
  align-items: baseline;
}

ul.entries time {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
  flex: 0 0 5.25rem;
  white-space: nowrap;
}

@media (max-width: 30rem) {
  ul.entries li { display: block; }
  ul.entries time { display: block; flex: none; }
}

/* ---- prose (blog posts) ---- */

article p, article li { line-height: 1.7; }
article > p:first-of-type { margin-top: 0; }

article blockquote {
  margin: 1.5rem 0;
  padding-left: 1rem;
  border-left: 2px solid var(--accent);
  color: var(--muted);
}

article code, article pre {
  font-family: var(--mono);
  font-size: 0.85rem;
}

article pre {
  background: var(--rule);
  padding: 0.9rem 1rem;
  overflow-x: auto;
  border-radius: 3px;
}

article img { max-width: 100%; height: auto; }

hr { border: none; border-top: 1px solid var(--rule); margin: 3rem 0; }

.postmeta {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0 0 2rem;
}

/* ---- prose list (projects, videos) — one paragraph per item ---- */

.list p {
  margin: 0 0 0.85rem;
  line-height: 1.55;
}

/* ---- video clips ---- */

.clip {
  --ar-w: 9;
  --ar-h: 16;
}

/* Fit the real frame in the viewport: as large as possible, never cropped,
   never a 16:9 letterbox. Override --ar-w / --ar-h on the article for
   landscape (16 / 9) or anything else. */
.clip video {
  display: block;
  margin: 0.85rem 0 1.25rem;
  aspect-ratio: var(--ar-w) / var(--ar-h);
  width: min(100%, calc((100vh - 12rem) * var(--ar-w) / var(--ar-h)));
  width: min(100%, calc((100dvh - 12rem) * var(--ar-w) / var(--ar-h)));
  height: auto;
  object-fit: contain;
  background: #111;
}

/* ---- footer ---- */

footer {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 4rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.2rem;
}
footer a { color: var(--muted); }

/* page links and date on the left, social links pushed to the right edge */
footer .social { margin-left: auto; }
