/* =========================================================================
   Tech Peeps Diaspora — "paper screen" design system
   Light = warm reading paper. Dark = dim warm e-ink. Auto via prefers-color-scheme.
   Type: a book serif for reading, a system sans for small UI labels.
   ========================================================================= */

:root {
  color-scheme: light dark;

  /* Type families */
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua",
    Charter, Georgia, Cambria, "Times New Roman", serif;
  --sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Light "paper" palette */
  --bg: #f5f1e8;
  --bg-tint: #efe9db;
  --surface: #fffdf8;
  --ink: #23201a;
  --ink-soft: #423d34;
  --muted: #6d665a;
  --rule: #e3ddce;
  --accent: #b3431f;
  --accent-ink: #9a3817; /* accent tuned for link contrast on paper */
  --shadow: 0 1px 2px rgba(40, 33, 22, 0.05), 0 12px 32px rgba(40, 33, 22, 0.08);
  --clip-bg: #e9e3d5;

  --measure: 39rem;
  --radius: 12px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15130e;
    --bg-tint: #1b180f;
    --surface: #1e1b14;
    --ink: #ece4d4;
    --ink-soft: #d4ccba;
    --muted: #a79d8a;
    --rule: #322d22;
    --accent: #e2915f;
    --accent-ink: #e6a577;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 14px 36px rgba(0, 0, 0, 0.45);
    --clip-bg: #241f17;
  }
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background-color: var(--bg);
  /* Faint paper grain — subtle, governed by CSP img-src 'self' data: */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.025'/%3E%3C/svg%3E");
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.18rem;
  line-height: 1.7;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent-ink);
  text-decoration: none;
  text-underline-offset: 0.18em;
  text-decoration-thickness: 0.06em;
}
a:hover {
  text-decoration: underline;
}

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

/* Small caps utility used by kicker / labels */
.label {
  font-family: var(--sans);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  font-weight: 700;
}

/* ---------- Post page ---------- */
.post {
  max-width: 50rem;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 6rem;
}

.post-header {
  margin: 2.25rem auto 0;
  max-width: var(--measure);
}

.kicker {
  font-family: var(--sans);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  font-weight: 700;
  margin: 0 0 0.9rem;
}
.kicker a {
  color: var(--accent);
}

.post-header h1 {
  font-size: clamp(2.1rem, 5.2vw, 3.3rem);
  line-height: 1.08;
  letter-spacing: -0.012em;
  font-weight: 700;
  margin: 0 0 1rem;
  text-wrap: balance;
}

.byline {
  font-size: 1.24rem;
  font-style: italic;
  color: var(--ink-soft);
  margin: 0 0 0.5rem;
}
.byline strong {
  font-style: normal;
}

.meta {
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0 0 1rem;
}

/* ---------- Article body ---------- */
.prose {
  max-width: var(--measure);
  margin: 2.5rem auto 0;
  color: var(--ink);
}

.prose h2 {
  font-size: 1.65rem;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 2.75rem 0 0.75rem;
}
.prose h3 {
  font-size: 1.28rem;
  margin: 2rem 0 0.5rem;
}

.prose p {
  margin: 0 0 1.3rem;
}

/* Magazine drop cap on the opening paragraph */
.prose > p:first-of-type::first-letter {
  float: left;
  font-size: 3.4em;
  line-height: 0.78;
  padding: 0.06em 0.09em 0 0;
  color: var(--accent);
  font-weight: 700;
}

.prose blockquote {
  border-left: 3px solid var(--accent);
  margin: 1.9rem 0;
  padding: 0.3rem 0 0.3rem 1.3rem;
  font-style: italic;
  font-size: 1.22rem;
  color: var(--ink-soft);
}

.prose hr {
  border: 0;
  height: 1px;
  background: var(--rule);
  margin: 2.5rem auto;
  width: 40%;
}

.prose a {
  color: var(--accent-ink);
}
.prose img {
  max-width: 100%;
  border-radius: 8px;
}
.prose code {
  font-family: var(--mono);
  font-size: 0.9em;
  background: var(--bg-tint);
  padding: 0.1em 0.35em;
  border-radius: 5px;
}

/* ---------- Footer ---------- */
.post-footer {
  max-width: var(--measure);
  margin: 3.5rem auto 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.95rem;
  color: var(--ink-soft);
}

.tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0;
  margin: 0 0 1.5rem;
}
.tags li {
  font-family: var(--sans);
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: var(--bg-tint);
  border: 1px solid var(--rule);
  padding: 0.28em 0.7em;
  border-radius: 999px;
}

/* ---------- Index / home ---------- */
.home {
  max-width: 64rem;
  margin: 0 auto;
  padding: 4rem 1.25rem 6rem;
}

.home-header {
  text-align: center;
  margin-bottom: 3.5rem;
}
.home-header h1 {
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  letter-spacing: -0.015em;
  margin: 0 0 0.6rem;
}
.home-header p {
  color: var(--muted);
  font-family: var(--sans);
  font-size: 1rem;
  margin: 0;
}

.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr));
  gap: 2.75rem 2.25rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 2px 4px rgba(40, 33, 22, 0.06), 0 20px 44px rgba(40, 33, 22, 0.14);
}
.card a {
  color: inherit;
  display: block;
}
.card a:hover {
  text-decoration: none;
}
.card .thumb {
  aspect-ratio: 16 / 9;
  width: 100%;
  object-fit: cover;
  background: var(--clip-bg);
  display: block;
}
.card-body {
  padding: 1.1rem 1.25rem 1.4rem;
}
.card .card-guest {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  margin: 0 0 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.card h2 {
  font-size: 1.4rem;
  line-height: 1.18;
  letter-spacing: -0.01em;
  margin: 0 0 0.45rem;
}
.card .card-desc {
  color: var(--muted);
  font-size: 1.02rem;
  margin: 0;
}

@media (max-width: 34rem) {
  body {
    font-size: 1.1rem;
  }
}
