/* ==========================================================================
   The Little Rebellion — design system
   A paper planner kept in public. See DESIGN.md.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Fonts — Sherman Serif & Sherman Sans (self-hosted, Field Notes voice)
   -------------------------------------------------------------------------- */
@font-face {
  font-family: "ShermanSerif";
  src: url("/fonts/shermanserif-book.woff2") format("woff2"), url("/fonts/shermanserif-book.woff") format("woff");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "ShermanSerif";
  src: url("/fonts/shermanserif-bold.woff2") format("woff2"), url("/fonts/shermanserif-bold.woff") format("woff");
  font-weight: bold;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "ShermanSerif";
  src: url("/fonts/shermanserif-bookitalic.woff2") format("woff2"), url("/fonts/shermanserif-bookitalic.woff") format("woff");
  font-weight: normal;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "ShermanSerif";
  src: url("/fonts/shermanserif-bolditalic.woff2") format("woff2"), url("/fonts/shermanserif-bolditalic.woff") format("woff");
  font-weight: bold;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "ShermanSans";
  src: url("/fonts/shermansans-book.woff2") format("woff2"), url("/fonts/shermansans-book.woff") format("woff");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "ShermanSans";
  src: url("/fonts/shermansans-bookitalic.woff2") format("woff2"), url("/fonts/shermansans-bookitalic.woff") format("woff");
  font-weight: normal;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "ShermanSans";
  src: url("/fonts/shermansans-bold.woff2") format("woff2"), url("/fonts/shermansans-bold.woff") format("woff");
  font-weight: bold;
  font-style: normal;
  font-display: swap;
}

/* --------------------------------------------------------------------------
   Tokens
   -------------------------------------------------------------------------- */
:root {
  /* The refill-sheet palette */
  --orange: oklch(0.63 0.19 38);
  --orange-deep: oklch(0.55 0.18 38);
  --mustard: oklch(0.72 0.13 75);
  --sage: oklch(0.57 0.06 135);
  --graphite: oklch(0.45 0.01 80);
  --paper: oklch(0.955 0.012 95);
  --paper-bright: oklch(0.985 0.005 95);
  --ink: oklch(0.25 0.01 80);

  /* The five Master Areas (journal mindsweep colors) */
  --area-red: oklch(0.58 0.19 20);          /* professionally — pink/red */
  --area-periwinkle: oklch(0.58 0.12 270);  /* personally — blue/periwinkle */
  --area-green: oklch(0.55 0.12 150);       /* socially — green */
  --area-gold: oklch(0.68 0.14 75);         /* spiritually — orange/yellow */
  --area-indigo: oklch(0.5 0.15 290);       /* neurotically — purple/indigo */

  /* Theme: Paper (light) */
  --bg: var(--paper);
  --surface: var(--paper-bright);
  --text: var(--ink);
  --text-muted: oklch(0.45 0.012 80);
  --accent: var(--orange);
  --accent-hover: var(--orange-deep);
  --rule-line: oklch(0.87 0.015 95);
  --rule-strong: oklch(0.35 0.012 80);
  --margin-rule: color-mix(in oklch, var(--orange) 60%, var(--bg));
  --selection: color-mix(in oklch, var(--orange) 22%, var(--bg));
  --code-bg: oklch(0.92 0.012 95);

  /* Type */
  --font-serif: "ShermanSerif", Georgia, serif;
  --font-sans: "ShermanSans", "Trebuchet MS", Tahoma, sans-serif;
  --font-display: "Oswald", "ShermanSans", "Arial Narrow", sans-serif;
  --font-mono: "Courier Prime", ui-monospace, "SF Mono", monospace;
  --font-hand: "Caveat", "Comic Sans MS", cursive;
  --size-meta: 0.9375rem;
  --size-body: 1.3125rem;
  --size-h3: 1.55rem;
  --size-h2: 2.05rem;
  --size-h1: clamp(2.4rem, 4.5vw, 3.1rem);

  /* Layout */
  --measure: 46rem;
  --wide: 76rem;
  --margin-col: 10rem;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);

  /* z-index scale */
  --z-nav: 10;
  --z-lightbox: 50;
  --z-edit-toolbar: 60;
  --z-toast: 70;
}

[data-theme="dark"] {
  --bg: oklch(0.22 0.008 80);
  --surface: oklch(0.26 0.008 80);
  --text: oklch(0.93 0.012 95);
  --text-muted: oklch(0.72 0.012 90);
  --accent: oklch(0.7 0.19 42);
  --accent-hover: oklch(0.76 0.17 48);
  --rule-line: oklch(0.34 0.008 80);
  --rule-strong: oklch(0.82 0.012 90);
  --margin-rule: color-mix(in oklch, var(--accent) 55%, var(--bg));
  --selection: color-mix(in oklch, var(--accent) 30%, var(--bg));
  --code-bg: oklch(0.29 0.008 80);

  /* Area colors lifted for dark ground */
  --area-red: oklch(0.7 0.17 20);
  --area-periwinkle: oklch(0.72 0.11 270);
  --area-green: oklch(0.7 0.12 150);
  --area-gold: oklch(0.78 0.13 80);
  --area-indigo: oklch(0.68 0.13 290);
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

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

/* The page scales with the desk it sits on: larger displays get a larger
   root, so the whole rem-based system (type, measure, margins) grows with
   them instead of floating tiny in whitespace. */
@media (min-width: 1600px) {
  html { font-size: 112.5%; }
}

@media (min-width: 2000px) {
  html { font-size: 125%; }
}

@media (min-width: 2600px) {
  html { font-size: 137.5%; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-serif);
  font-size: var(--size-body);
  line-height: 1.65;
  font-feature-settings: "liga", "kern";
}

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

img,
video,
iframe {
  max-width: 100%;
  height: auto;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-sans);
  font-weight: bold;
  line-height: 1.2;
  text-wrap: balance;
  margin: 2.5rem 0 0.75rem;
}

h1 { font-size: var(--size-h1); }
h2 { font-size: var(--size-h2); }
h3 { font-size: var(--size-h3); }

p {
  margin: 0 0 1.25rem;
}

a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.16em;
  transition: color 120ms ease-out, text-decoration-color 120ms ease-out;
}

a:hover {
  color: var(--accent-hover);
  text-decoration-color: var(--accent-hover);
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

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

blockquote {
  margin: 1.75rem 0;
  padding: 0.75rem 0 0.25rem;
  border-top: 1px solid var(--rule-line);
  border-bottom: 1px solid var(--rule-line);
  font-style: italic;
}

blockquote cite,
.quote-attribution {
  display: block;
  font-family: var(--font-sans);
  font-size: var(--size-meta);
  font-style: normal;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.85em;
  background: var(--code-bg);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}

pre {
  background: var(--code-bg);
  padding: 1rem 1.25rem;
  border-radius: 4px;
  overflow-x: auto;
  line-height: 1.5;
}

pre code {
  background: none;
  padding: 0;
}

/* Meta text: dates, labels, nav, captions */
.meta {
  font-family: var(--font-sans);
  font-size: var(--size-meta);
  color: var(--text-muted);
  line-height: 1.4;
}

.meta a {
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   Page frame
   -------------------------------------------------------------------------- */
.frame {
  max-width: calc(var(--margin-col) + 2rem + var(--measure));
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.frame--wide {
  max-width: var(--wide);
}

/* --------------------------------------------------------------------------
   Masthead — title as the orange tab, nav as index tabs on one baseline
   -------------------------------------------------------------------------- */
.masthead {
  padding-top: clamp(1.5rem, 4vh, 3rem);
}

.masthead-row {
  display: flex;
  align-items: flex-end;
  gap: 0.375rem;
  border-bottom: 2px solid var(--rule-strong);
  flex-wrap: wrap;
}

.site-title {
  font-family: var(--font-sans);
  font-weight: bold;
  font-size: clamp(1.2rem, 2.5vw, 1.5rem);
  letter-spacing: -0.01em;
  background: var(--orange);
  color: oklch(0.985 0.005 95);
  text-decoration: none;
  padding: 0.55rem 0.9rem 0.45rem;
  border-radius: 6px 6px 0 0;
  margin-right: 0.75rem;
  white-space: nowrap;
}

.site-title:hover {
  color: oklch(0.985 0.005 95);
  background: var(--orange-deep);
  text-decoration: none;
}

.tabs {
  display: flex;
  align-items: flex-end;
  gap: 0.125rem;
  flex-wrap: wrap;
}

.tab {
  --tab-color: var(--orange);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.65rem 0.85rem 0.6rem;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  transition: color 120ms ease-out, box-shadow 120ms ease-out, background 120ms ease-out;
}

.tab:hover {
  color: var(--text);
  text-decoration: none;
  box-shadow: inset 0 3px 0 var(--tab-color);
}

.tab[aria-current="page"],
.tab[aria-current="true"] {
  color: var(--text);
  font-weight: bold;
  background: var(--bg);
  border-color: var(--rule-strong);
  margin-bottom: -2px;
  padding-bottom: calc(0.6rem + 2px);
  box-shadow: inset 0 3px 0 var(--tab-color);
}

.masthead-spacer {
  flex: 1;
}

/* Utility row — secondary navigation under the baseline */
.utility-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.4rem;
  padding: 0.6rem 0 0;
  font-family: var(--font-sans);
  font-size: var(--size-meta);
}

.utility-row a {
  color: var(--text-muted);
  text-decoration: none;
}

.utility-row a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
  text-decoration-color: var(--accent-hover);
}

.utility-row a[aria-current="page"] {
  color: var(--text);
  font-weight: bold;
}

/* Area marks: blog posts get the colored word, social posts color only */
.area-chip,
.meta .area-chip,
.meta a.area-chip {
  font-family: var(--font-sans);
  font-weight: bold;
  color: var(--area-color, var(--accent));
  text-decoration: none;
}

.meta a.area-chip:hover {
  color: var(--area-color, var(--accent));
  text-decoration: underline;
  text-decoration-color: var(--area-color, var(--accent));
}

.area-dot {
  display: inline-block;
  width: 0.65em;
  height: 0.65em;
  border-radius: 50%;
  background: var(--area-color, transparent);
  vertical-align: baseline;
}

/* If streaming live, the stream takes over the top of the blog */
.stream-takeover {
  margin-bottom: clamp(2rem, 5vh, 3.5rem);
}

.stream-takeover .video-embed {
  margin: 0.75rem 0 0;
}

.stream-live-flag {
  font-family: var(--font-sans);
  font-weight: bold;
  font-size: var(--size-meta);
  color: oklch(0.985 0.005 95);
  background: var(--area-red);
  border-radius: 4px;
  padding: 0.2rem 0.55rem;
  display: inline-block;
}

.theme-toggle {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 0.4rem 0.5rem 0.5rem;
  cursor: pointer;
  border-radius: 4px;
  line-height: 0;
}

.theme-toggle:hover {
  color: var(--accent-hover);
}

.theme-toggle svg {
  width: 17px;
  height: 17px;
}

[data-theme="light"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: none; }

.site-tagline {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: var(--size-meta);
  color: var(--text-muted);
  margin: 0.6rem 0 0;
}

/* --------------------------------------------------------------------------
   The ruled feed — margin dates, one continuous margin rule
   -------------------------------------------------------------------------- */
.page-content {
  padding: clamp(2rem, 6vh, 4rem) 0 4rem;
}

.feed {
  position: relative;
  list-style: none;
  margin: 0;
  padding: 0;
}

.entry {
  padding: clamp(1.75rem, 4vh, 2.75rem) 0;
  border-bottom: 1px solid var(--rule-line);
}

.entry:first-child {
  padding-top: 0.5rem;
}

.entry:last-child {
  border-bottom: none;
}

.entry-meta {
  margin-bottom: 0.6rem;
}

.entry-meta a {
  text-decoration: none;
}

.entry-meta a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
  text-decoration-color: var(--accent-hover);
}

.entry-kind {
  color: var(--accent);
  font-weight: bold;
}

.entry-title {
  font-size: var(--size-h2);
  margin: 0 0 0.75rem;
}

.entry-title a {
  text-decoration: none;
  color: var(--text);
}

.entry-title a:hover {
  color: var(--accent-hover);
}

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

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

.keep-reading {
  font-family: var(--font-sans);
  font-size: var(--size-meta);
  font-weight: bold;
}

/* Margin layout on wide viewports: dates hang left of one orange rule */
@media (min-width: 900px) {
  .feed::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: calc(var(--margin-col) + 1rem);
    width: 1px;
    background: var(--margin-rule);
  }

  .entry {
    display: grid;
    grid-template-columns: var(--margin-col) minmax(0, 1fr);
    column-gap: 2rem;
  }

  .entry .entry-meta {
    grid-column: 1;
    text-align: right;
    margin-bottom: 0;
    padding-top: 0.35rem;
  }

  .entry .entry-meta > * {
    display: block;
  }

  .entry .entry-meta .entry-kind {
    margin-top: 0.35rem;
  }

  .entry-main {
    grid-column: 2;
    min-width: 0;
  }
}

/* --------------------------------------------------------------------------
   Single post / page
   -------------------------------------------------------------------------- */
/* Single posts share the feed's margin system: meta hangs in the ruled
   margin, the prose sits right of the same orange rule. */
@media (min-width: 900px) {
  .post-frame {
    position: relative;
    padding-left: calc(var(--margin-col) + 3rem);
  }

  .post-frame::before {
    content: "";
    position: absolute;
    top: 0.5rem;
    bottom: 0;
    left: calc(var(--margin-col) + 1rem);
    width: 1px;
    background: var(--margin-rule);
  }

  .post-frame .post-header .entry-meta {
    position: absolute;
    left: 0;
    top: 0.55rem;
    width: var(--margin-col);
    text-align: right;
  }

  .post-frame .post-header .entry-meta > * {
    display: block;
  }

  .post-frame .post-header .entry-meta .entry-kind,
  .post-frame .post-header .entry-meta .area-chip {
    margin-top: 0.35rem;
  }
}

.post-header {
  margin-bottom: 2rem;
}

.post-header .entry-meta {
  margin-bottom: 0.75rem;
}

.post-title {
  margin: 0 0 0.5rem;
  letter-spacing: -0.015em;
}

.post-subtitle {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.4rem;
  line-height: 1.45;
  color: var(--text-muted);
  margin: 0;
  text-wrap: pretty;
}

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

.post-intro-image img {
  width: 100%;
  border-radius: 4px;
  display: block;
}

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

.prose img {
  border-radius: 4px;
  display: block;
  margin: 1.75rem auto;
}

.prose li {
  margin-bottom: 0.4rem;
}

.post-footer {
  max-width: var(--measure);
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule-line);
}

.post-footer .meta {
  margin: 0;
}

/* Footnotes */
.footnotes {
  font-size: 0.95rem;
  color: var(--text-muted);
}

.footnotes hr {
  margin: 2.5rem 0 1rem;
}

sup a.footnote-ref {
  text-decoration: none;
  font-family: var(--font-sans);
  font-size: 0.75em;
  color: var(--accent);
  font-weight: bold;
}

/* --------------------------------------------------------------------------
   Galleries, images, embeds
   -------------------------------------------------------------------------- */
img.lightbox-img {
  cursor: zoom-in;
  border-radius: 4px;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.75rem;
  margin: 1.75rem 0;
}

.gallery figure {
  margin: 0;
}

.gallery img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 4px;
  margin: 0;
}

figcaption {
  font-family: var(--font-sans);
  font-size: var(--size-meta);
  color: var(--text-muted);
  margin-top: 0.45rem;
}

.video-embed {
  margin: 1.75rem 0;
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
}

.video-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 4px;
}

.tweet-embed {
  margin: 1.75rem 0;
}

/* Content blocks (essay galleries from the Statamic-era body format) */
.content-block--gallery {
  margin: 2rem 0;
}

.content-block--gallery figure {
  margin: 0;
}

.content-block--gallery img {
  width: 100%;
  border-radius: 4px;
  display: block;
  margin: 0;
}

.image-gallery-justify {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.image-gallery-justify figure,
.image-gallery-justify img {
  flex: 1 1 240px;
  min-width: 0;
  object-fit: cover;
}

.gallery-caption {
  font-family: var(--font-sans);
  font-size: var(--size-meta);
  color: var(--text-muted);
  margin-top: 0.5rem;
}

/* Bigfoot footnote popovers, dressed in paper */
.bigfoot-footnote__button {
  background-color: color-mix(in oklch, var(--text-muted) 28%, transparent);
}

.bigfoot-footnote__button:hover,
.bigfoot-footnote__button.is-active {
  background-color: var(--accent);
}

.bigfoot-footnote__content {
  background-color: var(--surface);
  color: var(--text);
  font-family: var(--font-serif);
  font-size: 0.95rem;
}

.bigfoot-footnote__wrapper,
.bigfoot-footnote__tooltip {
  background-color: var(--surface);
}

[data-theme="dark"] .bigfoot-footnote__content a {
  color: var(--text);
}

/* GLightbox adjustments */
.glightbox-clean .gslide-description { display: none; }
.glightbox-clean .gclose,
.glightbox-clean .gprev,
.glightbox-clean .gnext { color: #fff; }

.lightbox-download-link {
  position: absolute;
  top: 20px;
  right: 60px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  padding: 8px 12px;
  border-radius: 4px;
  text-decoration: none;
  font-family: var(--font-sans);
  font-size: 12px;
  z-index: var(--z-lightbox);
}

.lightbox-download-link:hover {
  background: rgba(0, 0, 0, 0.9);
  color: #fff;
}

/* --------------------------------------------------------------------------
   Photography
   -------------------------------------------------------------------------- */
.collections {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
}

.collection-card {
  margin: 0;
}

.collection-card a {
  text-decoration: none;
  display: block;
}

.collection-cover {
  aspect-ratio: 3 / 2;
  overflow: hidden;
  border-radius: 4px;
  background: var(--code-bg);
}

.collection-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity 120ms ease-out;
}

.collection-card a:hover .collection-cover img {
  opacity: 0.92;
}

.collection-title {
  font-size: var(--size-h3);
  margin: 0.85rem 0 0.15rem;
}

.collection-card a:hover .collection-title {
  color: var(--sage);
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 2rem;
}

.photo-grid figure {
  margin: 0;
}

.photo-grid img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 4px;
}

/* --------------------------------------------------------------------------
   Elsewhere
   -------------------------------------------------------------------------- */
.elsewhere-images {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.5rem;
  margin: 1rem 0;
  max-width: var(--measure);
}

.elsewhere-images:has(img:only-child) {
  grid-template-columns: minmax(0, 28rem);
}

.elsewhere-images img {
  width: 100%;
  border-radius: 4px;
  margin: 0;
}

.year-divider {
  font-family: var(--font-sans);
  font-weight: bold;
  font-size: 1rem;
  color: var(--text-muted);
  padding: 2.5rem 0 0;
  margin: 0;
}

@media (min-width: 900px) {
  .year-divider {
    display: grid;
    grid-template-columns: var(--margin-col) minmax(0, 1fr);
    column-gap: 2rem;
  }

  .year-divider span {
    grid-column: 1;
    text-align: right;
  }
}

/* --------------------------------------------------------------------------
   Pagination
   -------------------------------------------------------------------------- */
.pagination {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule-line);
  font-family: var(--font-sans);
  font-size: var(--size-meta);
}

.pagination a {
  font-weight: bold;
}

.pagination-info {
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.site-footer {
  border-top: 2px solid var(--rule-strong);
  padding: 1.5rem 0 3rem;
}

.site-footer .frame {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 2rem;
  justify-content: space-between;
  align-items: baseline;
}

.footer-note {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: var(--size-meta);
  color: var(--text-muted);
  margin: 0;
}

.footer-links {
  display: flex;
  gap: 1.25rem;
}

/* --------------------------------------------------------------------------
   Edit mode — the pen, uncapped
   -------------------------------------------------------------------------- */
[data-edit-field] {
  border-radius: 2px;
  transition: background 120ms ease-out, box-shadow 120ms ease-out;
}

body.edit-on [data-edit-field] {
  cursor: text;
}

body.edit-on [data-edit-field]:hover {
  box-shadow: 0 0 0 1px color-mix(in oklch, var(--accent) 35%, transparent);
}

body.edit-on [data-edit-field]:focus {
  outline: none;
  background: color-mix(in oklch, var(--accent) 6%, var(--bg));
  box-shadow: 0 0 0 1.5px color-mix(in oklch, var(--accent) 50%, transparent);
}

.edit-toolbar {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: var(--z-edit-toolbar);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  font-family: var(--font-sans);
  font-size: var(--size-meta);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.edit-toolbar button {
  font-family: var(--font-sans);
  font-size: var(--size-meta);
  font-weight: bold;
  background: none;
  color: var(--text);
  border: 1px solid var(--rule-strong);
  border-radius: 6px;
  padding: 0.3rem 0.7rem;
  cursor: pointer;
}

.edit-toolbar button:hover {
  border-color: var(--accent);
  color: var(--accent-hover);
}

/* .edit-primary also styles the sign-in <a>, so cover anchors too. */
.edit-toolbar a.edit-primary {
  font-family: var(--font-sans);
  font-size: var(--size-meta);
  font-weight: bold;
  border: 1px solid var(--rule-strong);
  border-radius: 6px;
  padding: 0.3rem 0.7rem;
  text-decoration: none;
}

.edit-toolbar .edit-primary {
  background: var(--orange);
  border-color: var(--orange);
  color: oklch(0.985 0.005 95);
}

.edit-toolbar .edit-primary:hover {
  background: var(--orange-deep);
  border-color: var(--orange-deep);
  color: oklch(0.985 0.005 95);
}

.edit-who {
  color: var(--text-muted);
  font-style: italic;
  max-width: 16ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.edit-who:empty { display: none; }

.edit-toolbar button.edit-signout {
  font-weight: normal;
  color: var(--text-muted);
}

.edit-status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-muted);
}

.edit-status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--rule-line);
}

.edit-status[data-state="dirty"]::before { background: var(--mustard); }
.edit-status[data-state="saved"]::before {
  background: var(--sage);
  animation: save-pulse 600ms cubic-bezier(0.25, 1, 0.5, 1);
}
.edit-status[data-state="error"]::before { background: var(--orange); }

@keyframes save-pulse {
  0% { transform: scale(1.8); }
  100% { transform: scale(1); }
}

/* --------------------------------------------------------------------------
   Shared chrome for the five designs: ticker, chooser, stamp
   -------------------------------------------------------------------------- */
/* Ticker tape — hidden by default; Guest Check and Paste-Up run it */
.ticker {
  display: none;
  overflow: hidden;
  white-space: nowrap;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
}

.ticker-track {
  display: inline-block;
  animation: ticker-roll 70s linear infinite;
}

.ticker-track span {
  display: inline-block;
  padding: 0.45rem 1.6rem 0.4rem 0;
}

.ticker-track span::after {
  content: "×";
  margin-left: 1.6rem;
  opacity: 0.55;
}

@keyframes ticker-roll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

@media (prefers-reduced-motion: reduce) {
  .ticker-track { animation: none; }
}

/* Design chooser */
.design-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.3rem;
  padding: 0.45rem var(--gutter);
  border-bottom: 1px solid var(--rule-line);
  background: var(--surface);
  font-family: var(--font-sans);
  font-size: 0.8rem;
}

.design-bar-label {
  color: var(--text-muted);
  margin-right: 0.4rem;
}

.design-choice {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: bold;
  color: var(--text-muted);
  background: none;
  border: 1px solid var(--rule-line);
  border-radius: 999px;
  padding: 0.2rem 0.75rem 0.25rem;
  cursor: pointer;
  transition: color 120ms ease-out, border-color 120ms ease-out, background 120ms ease-out;
}

.design-choice:hover {
  color: var(--text);
  border-color: var(--rule-strong);
}

.design-choice[aria-pressed="true"] {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

/* Page stamp — hidden by default; ticket-ish designs show it */
.page-stamp {
  display: none;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.72rem;
  line-height: 1.45;
  text-align: left;
}

.page-stamp .stamp-label {
  opacity: 0.6;
}

.page-stamp .stamp-row {
  display: block;
}

.page-stamp .stamp-no {
  font-weight: bold;
}

/* Footer extensions */
.footer-main {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.footer-colophon {
  margin: 0;
}

.footer-areas {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  margin: 0;
}

.footer-areas .area-dot {
  width: 0.6rem;
  height: 0.6rem;
}

/* --------------------------------------------------------------------------
   Plotter, pushed harder: binder holes, ruled sheet, deckled top edge
   -------------------------------------------------------------------------- */
html[data-design="plotter"] .page-content .frame {
  position: relative;
}

@media (min-width: 1100px) {
  /* The binder-ring rail on the left edge of the sheet */
  html[data-design="plotter"] .page-content .frame::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: calc(-1 * clamp(1.5rem, 3vw, 3rem));
    width: 14px;
    background-image: radial-gradient(circle at 7px 7px, color-mix(in oklch, var(--rule-strong) 38%, var(--bg)) 5.5px, color-mix(in oklch, var(--rule-strong) 18%, var(--bg)) 6.5px, transparent 7.5px);
    background-size: 14px 96px;
    background-repeat: repeat-y;
    background-position: 0 24px;
  }
}

/* Ruled-sheet background behind the feed: line-height-locked ruling */
html[data-design="plotter"] .feed .entry-body,
html[data-design="plotter"] .prose {
  background-image: linear-gradient(to bottom, transparent calc(100% - 1px), color-mix(in oklch, var(--rule-line) 55%, transparent) calc(100% - 1px));
  background-size: 100% calc(1.65 * var(--size-body));
  background-origin: content-box;
}

html[data-design="plotter"] .masthead {
  position: relative;
}

html[data-design="plotter"] .page-stamp {
  display: block;
  margin-right: 1rem;
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   Utility & a11y
   -------------------------------------------------------------------------- */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--surface);
  padding: 0.5rem 1rem;
  z-index: var(--z-toast);
}

.skip-link:focus {
  left: 0.5rem;
  top: 0.5rem;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  .masthead .tabs,
  .theme-toggle,
  .edit-toolbar,
  .pagination,
  .site-footer .footer-links {
    display: none;
  }

  body {
    background: #fff;
    color: #000;
  }

  .feed::before {
    display: none;
  }
}

/* Bigfoot fallback for modern Python-Markdown footnote markup */
.footnote-fallback-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.35em;
  height: 1.35em;
  margin: 0 .08em;
  border: 1px solid currentColor;
  border-radius: 999px;
  background: var(--paper, #fffaf0);
  color: inherit;
  font: inherit;
  font-size: .72em;
  line-height: 1;
  cursor: pointer;
  vertical-align: super;
}
.footnote-fallback-button.is-active { background: currentColor; color: var(--paper, #fffaf0); }
.footnote-fallback-popover {
  display: block;
  position: relative;
  margin: .75rem 0 1rem;
  padding: .9rem 2.25rem .9rem 1rem;
  border: 1px solid currentColor;
  background: var(--paper, #fffaf0);
  box-shadow: .25rem .25rem 0 rgba(0,0,0,.12);
  font-size: .92rem;
}
.footnote-fallback-popover[hidden] { display: none; }
.footnote-fallback-close {
  position: absolute;
  top: .35rem;
  right: .55rem;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 1.2rem;
  cursor: pointer;
}
.footnotes.bigfoot-processed { display: none; }
