/* ========== Design tokens ========== */
:root{
  --bg: #faf7f1;          /* warm off-white */
  --surface: #ffffff;
  --text: #2b2b2b;        /* soft black */
  --muted: #6b6b6b;
  --rule: rgba(0,0,0,.08);
  --accent: #d45a41;      /* warm orange/red */
  --mark-bg: #f1ebdf;     /* tile behind the list glyphs */

  --measure: 68ch;        /* comfortable reading line length */
  --radius: 14px;
  --code-bg: rgba(0,0,0,.03);

  --font-sans: ui-sans-serif, -apple-system, system-ui, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", monospace;

  --lh: 1.65;
}

/* Dark mode */
@media (prefers-color-scheme: dark){
  :root{
    --bg: #121211;
    --surface: #191917;
    --text: rgba(255,255,255,.88);
    --muted: rgba(255,255,255,.60);
    --rule: rgba(255,255,255,.10);
    --accent: #ff7a59;
    --mark-bg: rgba(255,255,255,.06);
    --code-bg: rgba(255,255,255,.06);
  }
}

/* ========== Base ========== */
html { -webkit-text-size-adjust: 100%; }
body{
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: var(--lh);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

a{ color: var(--accent); text-decoration: none; }
a:hover{ opacity: 0.7; }

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

/* ========== Layout “chrome” (classes ok) ========== */
.container{
  max-width: calc(var(--measure) + 4rem);
  padding: 2.2rem 1.2rem;
  margin: 0 auto;
}

.site-header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 1.2rem;
}

.brand{
  display: inline-flex;
  align-items: center;
  gap: .65rem;
}
.brand a{ color: var(--text); }
.brand .icon{
  width: 34px; height: 34px;
  border-radius: 10px;
  border: 0;
}
.nav{
  display: flex;
  align-items: center;
}
.nav a{ color: var(--muted); margin-left: .9rem; }

/* Homepage: a typed list — glyph tile + title + one-line summary */
.cards{ display: block; }
.card{
  display: flex;
  flex-direction: row;
  gap: 1.1rem;
  align-items: flex-start;
  padding: 1.15rem 0.15rem;
  color: var(--text);
}
.card + .card{ border-top: 1px solid var(--rule); }
.card:hover{ opacity: 0.7; }

.card .mark{
  flex: 0 0 auto;
  width: 64px; height: 64px;
  border-radius: var(--radius);
  background: var(--mark-bg);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.card .mark::before{
  font-family: Georgia, serif;
  font-size: 38px; line-height: 1;
  color: var(--muted);
}
.card.note  .mark::before{ content: "\00B6"; }                                            /* ¶ */
.card.quote .mark::before{ content: "\201C"; font-size: 58px; transform: translateY(.14em); } /* “ — bigger, sits high */
.card.essay .mark::before{ content: "\2605"; font-size: 34px; color: var(--accent); }      /* ★ */

.card .body{ flex: 1 1 auto; min-width: 0; }
.card .body h3{ margin: 0 0 .15rem 0; padding: 0; font-size: 1.2rem; line-height: 1.3; color: var(--text); }
.card .body p{
  margin: 0 0 .35rem 0; padding: 0;
  color: var(--muted); font-size: 1rem; line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card .meta{ font-size: .72rem; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.card.essay .meta .type{ color: var(--accent); }

/* ========== Article typography (no classes required) ========== */
main{ display: block; }
article{
  max-width: var(--measure);
  margin: 0 auto;
}

article header{
  margin: 1.2rem 0 1.4rem 0;
}

h1{
  font-size: clamp(2rem, 3.5vw, 3rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin: 0 0 .55rem 0;
  font-weight: 800;
}
.meta{
  color: var(--muted);
  font-size: .98rem;
}

h2, h3{
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 2rem 0 .65rem 0;
}
h2{ font-size: 1.55rem; }
h3{ font-size: 1.22rem; }

p{ margin: 0 0 1.05rem 0; font-size: 1.07rem; }
ul, ol{ margin: 0 0 1.2rem 1.2rem; padding: 0; }
li{ margin: .35rem 0; }

blockquote{
  margin: 1.4rem 0;
  padding: .2rem 1rem;
  border-left: 3px solid var(--rule);
  color: var(--muted);
}
blockquote p{ margin: .6rem 0; }

.warning{
  margin: 1.4rem 0;
  padding: 1rem 1.2rem;
  border-radius: var(--radius);
  border: 1px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.warning p{ margin: 0; }
@media (prefers-color-scheme: dark){
  .warning{ background: color-mix(in srgb, var(--accent) 12%, transparent); }
}

.callout{
  margin: 1.4rem 0;
  padding: 1rem 1.2rem;
  border-radius: var(--radius);
  border: 1px solid var(--rule);
  background: var(--code-bg);
}
.callout p{ margin: 0 0 0.8rem 0; }
.callout p:last-child{ margin: 0; }
.callout pre{ margin: 0.8rem 0; }

code{
  font-family: var(--font-mono);
  font-size: .95em;
  padding: .12em .35em;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--code-bg);
}

pre{
  overflow: auto;
  padding: 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--rule);
  background: var(--code-bg);
}
pre code{
  padding: 0;
  border: 0;
  background: transparent;
  font-size: .92rem;
}

img{
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  border: 1px solid var(--rule);
}
.post-cover{
  margin-bottom: 1.05rem;
}

/* Guest post byline */
.guest-byline{
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 1.5rem 0;
  padding: 1rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface);
}
.guest-byline img{
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 0;
  flex-shrink: 0;
}
.guest-byline strong{ display: block; }
.guest-byline span{
  color: var(--muted);
  font-size: 0.9rem;
}
.nav img, .brand img{
  border: 0;
  border-radius: 0;
  display: block;
}

figure{
  margin: 0 0 1.05rem 0;
}
figure img{
  display: block;
}
figcaption{
  margin-top: .5rem;
  font-size: .92rem;
  color: var(--muted);
  text-align: center;
}

/* Filter toggle */
#essays {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.2rem;
}

.filter-toggle a {
  padding: 0.35rem 0.85rem;
  border-radius: 8px;
  cursor: pointer;
  color: var(--muted);
  border: 1px solid var(--rule);
  font-size: 0.95rem;
  text-decoration: none;
}

.filter-toggle a:hover {
  opacity: 0.7;
}

/* Active pill — same neutral fill whichever filter is selected.
   "All posts" is active by default; targeting #essays swaps it to "Essays". */
.filter-toggle a:first-child,
#essays:target a:last-child {
  background: var(--mark-bg);
  color: var(--text);
  border-color: var(--mark-bg);
}

/* When #essays is targeted, "All posts" reverts to the inactive look... */
#essays:target a:first-child {
  background: transparent;
  color: var(--muted);
  border-color: var(--rule);
}

/* ...and the active "Essays" star picks up the accent orange */
#essays:target a:last-child .star {
  color: var(--accent);
}

/* Filter logic: hide non-essays when #essays is targeted */
#essays:target ~ .cards .card:not(.essay) {
  display: none;
}

@media print{
  body{ background: #fff; color: #000; }
  .site-header, .nav{ display: none !important; }
  a{ color: #000; text-decoration: underline; }
}