/* === Design tokens ===
   Shared with andyp.ai. Color tokens are overwritten at runtime by
   theme-bootstrap.js and time-theme.js (Puerto Rico time of day), so
   keep the names stable. */
:root {
  --bg-primary: #faf9f7;
  --bg-surface: rgba(255, 253, 250, 0.7);
  --text-primary: #1a1714;
  --text-secondary: #6b6560;
  --text-muted: #76706c;
  --accent: #0d7a5f;
  --accent-hover: #0a6650;
  --accent-subtle: rgba(13, 122, 95, 0.08);
  --accent-border: rgba(13, 122, 95, 0.15);
  --highlight: #c4873b;
  --border: rgba(0, 0, 0, 0.06);

  --font-serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-mono: "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;

  --measure: 680px;
  --gutter: 24px;
  --text-xl: clamp(2rem, 5vw, 2.75rem);
  --text-lg: 1.375rem;
  --text-md: 1.1875rem;
  --text-sm: 0.8125rem;
  --text-xs: 0.6875rem;
  --leading: 1.55;
  --theme-fade: 2s ease;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-primary: #0d0b09;
    --bg-surface: rgba(22, 19, 16, 0.85);
    --text-primary: #d4cfc8;
    --text-secondary: #a09890;
    --text-muted: #7f7a74;
    --accent: #3dbf96;
    --accent-hover: #2da67f;
    --accent-subtle: rgba(61, 191, 150, 0.1);
    --accent-border: rgba(61, 191, 150, 0.2);
    --highlight: #d4993f;
    --border: rgba(255, 255, 255, 0.06);
  }
}

/* === Base === */
*,
*::before,
*::after {
  box-sizing: border-box;
}

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

::selection {
  background: var(--accent-subtle);
  color: var(--text-primary);
}

body {
  margin: 0;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-serif);
  font-optical-sizing: auto;
  font-size: var(--text-md);
  line-height: var(--leading);
  font-feature-settings: "kern", "liga", "onum";
  -webkit-font-smoothing: antialiased;
  transition: background-color var(--theme-fade), color var(--theme-fade);
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.16em;
  text-decoration-color: color-mix(in oklab, var(--accent) 45%, transparent);
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

a:hover {
  text-decoration-color: currentColor;
}

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

button,
input {
  font: inherit;
  color: inherit;
}

h1,
h2,
h3,
h4,
p,
ul,
ol {
  margin: 0;
}

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

/* Small mono labels: eyebrows, nav, tags, dates, footer */
.mono,
.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: lowercase;
  color: var(--text-muted);
  transition: color var(--theme-fade);
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

/* Hairline that runs out from an eyebrow to the right edge */
.eyebrow::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* === Page frame === */
.container {
  width: min(100% - 2 * var(--gutter), var(--measure));
  margin-inline: auto;
  padding-top: clamp(28px, 6vh, 56px);
}

main {
  display: block;
  padding-bottom: 72px;
}

/* === Site header === */
.site-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px 24px;
  padding-bottom: 14px;
  margin-bottom: 56px;
  border-bottom: 1px solid var(--border);
}

.site-title {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

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

.nav-links {
  display: flex;
  gap: 20px;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  letter-spacing: 0.04em;
}

.nav-links a,
.link-row a {
  color: var(--text-primary);
  text-decoration: none;
}

.nav-links a::before,
.link-row a::before {
  content: "/";
  color: var(--accent);
  margin-right: 4px;
  opacity: 0.6;
  transition: opacity 0.2s ease;
}

.nav-links a:hover,
.link-row a:hover {
  color: var(--accent);
}

.nav-links a:hover::before,
.link-row a:hover::before {
  opacity: 1;
}

/* A hairline-ruled row of mono links (socials) */
.link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
  padding: 14px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  letter-spacing: 0.04em;
}

/* === Tags === */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  list-style: none;
  padding: 0;
}

.tag-link {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--accent);
  text-decoration: none;
  transition: color var(--theme-fade);
}

.tag-link::before {
  content: "#";
  opacity: 0.5;
}

.tag-link:hover {
  text-decoration: underline;
  text-underline-offset: 0.25em;
}

.tag-link .count {
  color: var(--text-muted);
  margin-left: 4px;
}

/* === Post lists (home, tag pages, search results) === */
.posts-list {
  list-style: none;
  padding: 0;
}

.posts-list .post {
  padding: 24px 0;
  border-bottom: 1px solid var(--border);
}

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

.posts-list .post:last-child {
  border-bottom: none;
}

.post-link {
  display: inline-block;
  font-size: var(--text-lg);
  font-weight: 500;
  line-height: 1.3;
  color: var(--text-primary);
  text-decoration: none;
  text-wrap: balance;
  margin-bottom: 6px;
  transition: color 0.2s ease;
}

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

.post-description {
  color: var(--text-secondary);
  font-size: 1.0625rem;
  line-height: 1.5;
  text-wrap: pretty;
  margin-bottom: 12px;
  transition: color var(--theme-fade);
}

.metadata {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px 24px;
}

.date {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.06em;
  color: var(--text-muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  transition: color var(--theme-fade);
}

/* === Search form: a terminal-style prompt line === */
.search-form {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--text-muted);
  margin-bottom: 28px;
  transition: border-color 0.2s ease;
}

.search-form:focus-within {
  border-color: var(--accent);
}

.search-form::before {
  content: ">";
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--accent);
}

.search-form input {
  flex: 1;
  min-width: 0;
  padding: 4px 0;
  border: none;
  background: transparent;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  letter-spacing: 0.02em;
  color: var(--text-primary);
}

.search-form input::placeholder {
  color: var(--text-muted);
}

.search-form input:focus-visible {
  outline: none;
}

.search-form button {
  padding: 4px 0;
  border: none;
  background: none;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: lowercase;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s ease;
}

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

/* === Back link === */
.back-link {
  display: inline-block;
  margin-top: 48px;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  letter-spacing: 0.04em;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.back-link:hover {
  color: var(--accent);
}

/* === Footer === */
footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 4px 16px;
  padding: 14px 0 28px;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.06em;
  color: var(--text-muted);
  transition: color var(--theme-fade);
}

footer p {
  margin: 0;
}

footer a {
  color: var(--text-secondary);
  text-decoration: none;
}

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

.pr-time time {
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
}

/* === Responsive === */
@media (max-width: 520px) {
  :root {
    --gutter: 20px;
    --text-lg: 1.25rem;
    --text-md: 1.125rem;
  }

  .site-header {
    margin-bottom: 40px;
  }

  .metadata {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  footer {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  /* Theme changes snap instead of crossfading */
  *,
  *::before,
  *::after {
    transition: none !important;
  }
}
