:root {
  --paper: #ffffff;
  --ink: #000000;
  --muted-ink: #8a857c;

  /* Type scale */
  --fs-body: 1.25rem;   /* body copy, section headings, links, titles */
  --fs-foot: 0.9rem;    /* footer + captions — intentionally smaller than body */

  --logo-h: 4rem;            /* height of the animated wordmark */
  --logo-nudge-x: -17px;     /* offsets the transparent buffer on the image's left */
  --logo-nudge-top: -17px;   /* gap below the top edge (negative pulls up) */
  --logo-nudge-bottom: -17px;/* gap above the body (negative tightens) */

  /* Mobile (<=560px) equivalents. The logo scales down there, so its baked-in
     transparent buffer is smaller and needs smaller offsets than the desktop ones.
     x: negative moves left · top: positive pushes down · bottom: negative tightens gap to body */
  --logo-nudge-x-mobile: -12px;
  --logo-nudge-top-mobile: 0px;
  --logo-nudge-bottom-mobile: -12px;

  --measure: 820px;          /* text column width */
  --pad: 2.5rem;
}

* { box-sizing: border-box; }
html, body { margin: 0; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-weight: 300;               /* BODY = light */
  font-size: var(--fs-body);
  line-height: 1.35;
  padding: var(--pad);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.wrap { max-width: var(--measure); }

/* ---- Masthead / logo lockup -------------------------------------------- */
.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;   /* logo left, optional Share right */
  gap: 0.4rem;
  margin-bottom: 2.6rem;
}

.logo-stage {
  display: inline-flex;
  cursor: pointer;
  outline: none;
  border: 0;
  background: none;
  padding: 0;
  color: inherit;
  border-radius: 3px;
  -webkit-tap-highlight-color: transparent;
  margin-left: var(--logo-nudge-x);
  margin-top: var(--logo-nudge-top);
  margin-bottom: var(--logo-nudge-bottom);
  min-width: 0;              /* allow the logo to shrink on narrow screens */
}
.logo-stage:focus-visible {
  box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--ink);
}
.logo {
  height: var(--logo-h);
  width: auto;
  max-width: 100%;           /* never spill past its container */
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

/* Narrow screens: scale the wordmark down to fit and drop the pixel nudges,
   which are tuned for the full-size logo and over-pull once it shrinks. */
@media (max-width: 560px) {
  :root { --pad: 1.5rem; }
  .logo-stage {
    /* margin: top right bottom left */
    margin: var(--logo-nudge-top-mobile) 0 var(--logo-nudge-bottom-mobile) var(--logo-nudge-x-mobile);
    flex: 0 1 auto;
  }
  .logo { height: auto; width: auto; max-height: var(--logo-h); }
}

.masthead-right { display: flex; align-items: center; }
.share {
  font: inherit;
  font-weight: 400;           /* regular, like the section headings */
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
  cursor: pointer;
}
.share:hover { opacity: 0.6; }

/* ---- Homepage intro + sections ----------------------------------------- */
.intro { display: flex; flex-direction: column; gap: 1.35rem; }
.intro p { margin: 0; }

.section { margin-top: 3.4rem; }
.section h2 {
  font-size: var(--fs-body);
  font-weight: 400;           /* HEADINGS = regular */
  margin: 0 0 1.3rem;
}
.links { display: flex; flex-direction: column; gap: 1.1rem; }
.muted { color: var(--muted-ink); font-style: italic; }

/* ---- Links = light oblique, underlined --------------------------------- */
a {
  color: inherit;
  font-weight: 300;
  font-style: italic;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
}
a:hover { opacity: 0.6; }
.logo-stage:hover { opacity: 1; }

/* ---- Writing page ------------------------------------------------------- */
.writing { max-width: var(--measure); }
.w-title {
  font-size: var(--fs-body);
  font-weight: 400;           /* Title = regular */
  margin: 0 0 0.6rem;
}
.w-subtitle {
  font-size: var(--fs-body);
  font-weight: 300;
  font-style: italic;         /* Subtitle = light oblique */
  margin: 0 0 1.7rem;
}
.w-body > *:first-child { margin-top: 0; }
.w-body > *:last-child { margin-bottom: 0; }
.w-body p { margin: 0 0 1.35rem; }
.w-body h2, .w-body h3 { font-weight: 400; margin: 2rem 0 1rem; }
.w-body ul, .w-body ol { margin: 0 0 1.35rem; padding-left: 1.4rem; }
.w-body li { margin: 0 0 0.5rem; }
.w-body blockquote {
  margin: 0 0 1.35rem;
  padding-left: 1.1rem;
  border-left: 2px solid var(--ink);
  font-style: italic;
}

/* Full-width images with caption from alt text */
.full-bleed { margin: 2rem 0; }
.full-bleed img { width: 100%; height: auto; display: block; }
.full-bleed figcaption {
  margin-top: 0.5rem;
  font-size: var(--fs-foot);  /* Caption = small, light, oblique */
  font-weight: 300;
  font-style: italic;
}

/* ---- Footer / colophon -------------------------------------------------- */
.colophon {
  margin-top: 3.6rem;
  font-size: var(--fs-foot);
  font-weight: 300;
  line-height: 1.4;
}

/* ---- Admin -------------------------------------------------------------- */
.is-admin { color: var(--ink); }
.admin { max-width: var(--measure); }
.admin a { font-style: normal; text-decoration: none; }
.admin a:hover { text-decoration: underline; }

.admin-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 1.8rem;
}
.admin-head h1 { font-size: 1.6rem; font-weight: 400; margin: 0; }

.admin-list { list-style: none; margin: 0; padding: 0; }
.admin-row {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 0.9rem 0;
  border-top: 1px solid #ececec;
}
.admin-row:last-child { border-bottom: 1px solid #ececec; }
.admin-title { flex: 1; font-weight: 400; }
.admin-meta { color: var(--muted-ink); font-size: var(--fs-foot); font-variant-numeric: tabular-nums; }
.admin-foot { margin-top: 2rem; }
.inline { margin: 0; }

.field { display: block; margin: 0 0 1.2rem; }
.field > span { display: block; font-size: 0.95rem; margin-bottom: 0.4rem; }
.field > span em { color: var(--muted-ink); font-style: italic; }
.field input,
.field textarea {
  width: 100%;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 300;
  color: var(--ink);
  background: #fff;
  border: 1px solid #d7d5d0;
  border-radius: 4px;
  padding: 0.6rem 0.7rem;
}
.field textarea {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  line-height: 1.5;
  resize: vertical;
}
.field input:focus,
.field textarea:focus { outline: 2px solid var(--ink); outline-offset: 0; border-color: var(--ink); }

.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin: 0 0 0.8rem;
  flex-wrap: wrap;
}
.hint { color: var(--muted-ink); font-size: var(--fs-foot); }

.editor-actions { display: flex; gap: 0.7rem; margin-top: 0.4rem; }

.btn {
  display: inline-block;
  font: inherit;
  font-weight: 400;
  font-style: normal;
  background: var(--ink);
  color: #fff;
  border: 1px solid var(--ink);
  border-radius: 4px;
  padding: 0.5rem 1rem;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { opacity: 0.85; text-decoration: none; }
.btn.ghost { background: #fff; color: var(--ink); }
.danger {
  font: inherit;
  font-weight: 400;
  background: none;
  border: 0;
  padding: 0;
  color: #b00020;
  cursor: pointer;
}
.danger:hover { text-decoration: underline; }

/* ---- Motion preference -------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  a, .btn, .share { transition: none; }
}
