/* ========== Design tokens ========== */
:root{
  --bg: #34373b;          /* cool slate */
  --surface: #3c4045;
  --text: #ece6dc;        /* warm off-white — warm type on a cool ground */
  --muted: #b4afa6;       /* warm grey (AA on the slate ground) */
  --rule: rgba(255,255,255,.11);
  --accent: #ff7d5c;      /* warm coral */
  --mark-bg: rgba(255,255,255,.06);   /* tile behind the list glyphs */

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

  --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;
}

/* Single universal warm-on-slate look — no prefers-color-scheme switch by design. */

/* ========== 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: var(--measure);
  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; }
.nav a[href="/feed"]{ color: var(--accent); display: inline-flex; align-items: center; }

/* 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.photo .mark::before{ content: "\25C9"; font-size: 34px; }                            /* ◉ — fisheye/lens */
.card.book  .mark::before{ content: "\2767"; font-size: 34px; }                            /* ❧ — fleuron (book review) */

.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); }

/* ========== Blogroll (reuses the homepage .card / .mark / .body layout) ========== */
.blogroll{ list-style: none; margin: 1.6rem 0 0 0; padding: 0; }
.blogroll .card:hover{ opacity: 1; }   /* the card isn't a link here — the name + RSS icon are */

/* Each site's favicon sits in the glyph tile, hotlinked from their site */
.blogroll .mark .favicon{
  width: 48px; height: 48px;
  border: 0; border-radius: 10px;
  object-fit: contain;
}

/* Title row: site name + RSS icon side by side */
.blogroll .body h3{
  display: flex; align-items: center; gap: .5rem;
  margin: 0 0 .15rem 0;
}
.blogroll .body h3 a.p-name{ color: var(--text); font-weight: 700; }
.blogroll .body h3 a.p-name:hover{ color: var(--accent); opacity: 1; }
.blogroll .body .p-note{
  margin: 0; color: var(--muted); font-size: 1rem; line-height: 1.5;
  display: block; -webkit-line-clamp: unset; overflow: visible;   /* let descriptions wrap, unlike feed cards */
}

/* Greyscale RSS icon (Lucide “rss”); tints to accent on hover */
.blogroll .feed{ display: inline-flex; align-items: center; color: var(--muted); }
.blogroll .feed:hover{ color: var(--accent); opacity: 1; }
.rss-icon{
  width: 15px; height: 15px;
  fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

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

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

/* The post date is now a permalink and is followed by the author byline; keep
   both looking like the muted meta line rather than accent-coloured links. */
.h-entry > header a{ color: inherit; }
.h-entry > header a:hover{ color: var(--accent); }

h1{
  font-size: clamp(1.6rem, 2.2vw, 2rem);
  line-height: 1.18;
  letter-spacing: -0.015em;
  margin: 0 0 .5rem 0;
  font-weight: 700;
}
.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) 12%, transparent);
}
.warning p{ margin: 0; }

.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;
}
/* Icons sitting inline in About prose — opt out of the global img frame */
.inline-icon{
  border: 0;
  border-radius: 0;
  vertical-align: middle;   /* center on the line so different-height glyphs align */
  margin: 0 .1rem;
}

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

/* ========== Gutter rail (page-title eyebrow + optional links) ==========
   Every page's <h1> rides in the left gutter as a small uppercase eyebrow; home
   and now add links beneath it. Home's links are a pure-CSS filter: empty
   #notes/#quotes/#essays/#photos targets sit before .rail and .cards, and :target
   drives both the active state and the card filtering. #essays is kept so /#essays
   still deep-links to the essays view. */
.with-rail{ position: relative; }
/* The big scroll-margin stops fragment navigation from scrolling the header off
   screen: the targets sit just below the header, so without this, filtering to a
   tall result set (e.g. Notes) snaps them to the viewport top. It clamps to top. */
.ftgt{ display: block; height: 0; scroll-margin-top: 100vh; }

/* Base (narrow): the rail folds to a horizontal row above the list */
.rail{
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .35rem .7rem;
  margin-bottom: 1.4rem;
}
.rail-title{
  flex-basis: 100%;
  margin: 0 0 .15rem;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.4;
}
.rail a{
  position: relative;
  color: var(--muted);
  text-decoration: none;
  font-size: .98rem;
  line-height: 1.3;
  padding: .15rem .9rem .15rem 0;   /* right pad reserves the dot lane → text never shifts */
}
.rail a:hover{ color: var(--text); opacity: 1; }
.rail a .star{ color: inherit; }

/* Active dot — absolutely placed in the reserved right lane, so toggling never moves text */
.rail a::after{
  content: "";
  position: absolute;
  right: .1rem;
  top: 50%;
  width: 5px; height: 5px; margin-top: -2.5px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0;
}

/* "All posts" is the default active filter */
.rail a[href="#"]{ color: var(--text); }
.rail a[href="#"]::after{ opacity: 1; }

/* Generic active state for non-filter rails (e.g. the now-page version switcher) */
.rail a[aria-current]{ color: var(--text); }
.rail a[aria-current]::after{ opacity: 1; }

/* Selecting a type deactivates "All posts" ... */
.ftgt:target ~ .rail a[href="#"]{ color: var(--muted); }
.ftgt:target ~ .rail a[href="#"]::after{ opacity: 0; }

/* ... and activates the matching filter */
#notes:target  ~ .rail a[href="#notes"],
#quotes:target ~ .rail a[href="#quotes"],
#essays:target ~ .rail a[href="#essays"],
#photos:target ~ .rail a[href="#photos"]{ color: var(--text); }
#notes:target  ~ .rail a[href="#notes"]::after,
#quotes:target ~ .rail a[href="#quotes"]::after,
#essays:target ~ .rail a[href="#essays"]::after,
#photos:target ~ .rail a[href="#photos"]::after{ opacity: 1; }
#essays:target ~ .rail a[href="#essays"] .star{ color: var(--accent); }

/* Card filtering: hide everything that isn't the targeted type */
#notes:target  ~ .cards .card:not(.note){ display: none; }
#quotes:target ~ .cards .card:not(.quote){ display: none; }
#essays:target ~ .cards .card:not(.essay){ display: none; }
#photos:target ~ .cards .card:not(.photo){ display: none; }

/* The first surviving card otherwise keeps a between-card border-top (it's preceded
   in the DOM by now-hidden cards), showing a stray rule at the very top. Strip it
   from the first card of the active type — the one with no earlier sibling of its type. */
/* The first visible card aligns its title to the eyebrow: drop the between-card
   top border AND trim the top padding so it starts level with a prose first line. */
.cards > .card:first-child{ padding-top: .14rem; }
#notes:target  ~ .cards .card.note:not(.note ~ .note){ border-top: 0; padding-top: .14rem; }
#quotes:target ~ .cards .card.quote:not(.quote ~ .quote){ border-top: 0; padding-top: .14rem; }
#essays:target ~ .cards .card.essay:not(.essay ~ .essay){ border-top: 0; padding-top: .14rem; }
#photos:target ~ .cards .card.photo:not(.photo ~ .photo){ border-top: 0; padding-top: .14rem; }

/* Wide screens: lift the rail into the left gutter, right-aligned against the column */
@media (min-width: 1024px){
  .rail{
    position: absolute;
    top: 0;
    right: calc(100% + 2.4rem);
    width: 9rem;
    display: block;
    text-align: right;
    margin: 0;
  }
  .rail-title{ margin: 0 0 .65rem; padding-right: .9rem; }   /* align to the labels, not the dot lane */
  .rail a{ display: block; padding: .22rem .9rem .22rem 0; }

  /* The eyebrow aligns to the first line of column content (the first paragraph,
     or the first card's title on the home page). One shared nudge for every page. */
  .with-rail .rail{ top: .28rem; }
}

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