:root {
  color-scheme: light;
  --bg: #fff3ea;
  --ink: #1f1612;
  --muted: #8a786c;
  --accent: #c94b24;
  --hair: color-mix(in srgb, var(--ink) 14%, transparent);
  --mat: #f0e0d2;
  --selection: #f3c4a8;
  --max: 34rem;
  --page-pad: 1.15rem;
  --photo-radius: 0.95rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #1a1410;
    --ink: #f3e6d8;
    --muted: #b5a194;
    --accent: #e07048;
    --mat: #2c241e;
    --selection: #6b3a28;
  }
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "EB Garamond", Georgia, "Times New Roman", serif;
  font-size: 1.0625rem;
  font-weight: 450;
  line-height: 1.5;
  letter-spacing: -0.011em;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.16em;
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 75%, var(--bg));
  outline-offset: 3px;
}

::selection {
  background: var(--selection);
  color: var(--ink);
}

.page {
  width: min(var(--max), 100%);
  margin: 0 auto;
  padding: 1.35rem var(--page-pad) 3.5rem;
}

/* Quiet profile strip — not a blog masthead, not a tag bar. */
.site-header {
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
  padding-bottom: 1.05rem;
  border-bottom: 1px solid var(--hair);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  min-width: 0;
}

.avatar {
  display: block;
  width: 2.75rem;
  height: 2.75rem;
  flex: none;
  border-radius: 50%;
  object-fit: cover;
  background: var(--mat);
}

.brand-text {
  min-width: 0;
}

.site-header h1 {
  margin: 0;
  font-family: "New Rocker", Georgia, "Times New Roman", serif;
  font-size: 1.45rem;
  font-style: normal;
  font-weight: 400;
  letter-spacing: -0.025em;
  line-height: 1.15;
  text-transform: uppercase;
}

.site-header h1 a {
  color: inherit;
  text-decoration: none;
}

.lede {
  margin: 0.18rem 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 450;
  letter-spacing: -0.01em;
  line-height: 1.35;
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 0.15rem;
  margin: 0 -0.35rem;
}

nav a {
  color: var(--muted);
  padding: 0.2rem 0.35rem;
  font-size: 0.82rem;
  font-weight: 550;
  letter-spacing: -0.012em;
  text-decoration: none;
}

nav a:hover,
nav a[aria-current="page"] {
  color: var(--ink);
}

nav a[aria-current="page"] {
  text-decoration: none;
  box-shadow: inset 0 -1px 0 var(--ink);
}

main {
  padding: 0;
}

/* Tweet-shaped stack: time + tag, copy, then media. */
.post {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  column-gap: 0.85rem;
  padding: 1.2rem 0 1.3rem;
  border-bottom: 1px solid var(--hair);
}

.post time {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.005em;
}

.post time a {
  color: inherit;
  text-decoration: none;
}

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

.post > .tag {
  grid-column: 2;
  grid-row: 1;
}

.post-body {
  grid-column: 1 / -1;
  min-width: 0;
  margin-top: 0.4rem;
}

.post-body > *:first-child {
  margin-top: 0;
}

.post-body > *:last-child {
  margin-bottom: 0;
}

.post-body p,
.post-body h2 {
  margin: 0.55rem 0;
}

.post-body p {
  text-wrap: pretty;
}

.post-body h2 {
  margin-top: 1.15rem;
  font-size: 1.02rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.post-body .row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: start;
  gap: 0.45rem;
  margin: 0.75rem 0 0;
}

.post-body figure {
  margin: 0.75rem 0 0;
}

.post-body .row figure {
  margin: 0;
  min-width: 0;
}

/* Fluid display size. Each <img>/<video> also sets style="aspect-ratio: W / H"
   (the imported-post pattern) so the box is reserved before the file loads. */
.post-body img,
.post-body video {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--photo-radius);
  background: var(--mat);
}

/* Self-link around photos: stay a block so layout matches unwrapped imgs
   (fluid width: 100% children still fill the column / row cell),
   and do not pick up the default <a> underline / accent color. */
.post-body a:has(> img),
.post-body a:has(> img):hover {
  display: block;
  color: inherit;
  text-decoration: none;
}

.permalink .post {
  border-bottom: 0;
}

.post-body figure:has(video) {
  max-width: 22rem;
}

.post-body video {
  background: #1a1410;
}

.tag {
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 550;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.tag:hover {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.16em;
}

.site-footer {
  padding-top: 1.25rem;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
}

.site-footer p {
  margin: 0;
}

.site-footer a {
  color: inherit;
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
}

.not-found {
  padding: 2.75rem 0;
}

.not-found p {
  margin: 0;
  color: var(--muted);
}

@media (min-width: 640px) {
  .page {
    padding-top: 2.25rem;
    padding-bottom: 4.25rem;
  }

  .post {
    padding: 1.35rem 0 1.45rem;
  }

  /* Shrink tall portraits so the feed stays scannable on a laptop.
     height: auto keeps the inline aspect-ratio; do not paint at intrinsic px. */
  .feed .post-body > figure img,
  .feed .post-body > figure video {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 28rem;
  }

  /* Those photos no longer fill the column. Shrink-wrap the self-link so
     the hit target matches the painted image (not the empty block). */
  .feed .post-body > figure a:has(> img) {
    width: fit-content;
    max-width: 100%;
  }
}

@media (max-width: 420px) {
  body {
    font-size: 1.02rem;
  }

  .page {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .avatar {
    width: 2.5rem;
    height: 2.5rem;
  }

  .site-header h1 {
    font-size: 1.32rem;
  }
}
