/* ==========================================================================
   journal.css — the blog: index, post and editor.
   Editorial rather than boxed: one lead story, a grid of covers, and a post
   page set for reading (a narrow measure, generous leading, quiet chrome).
   Loaded after site.css, whose tokens (--fg, --accent, fonts) it uses.
   ========================================================================== */
.journal{ --measure: 700px; --wide: 1040px; }
.journal .container{ width: min(var(--wide), calc(100% - 40px)); }
.j-kicker{ display: block; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted-fg); }
.j-section{ margin: 0 0 20px; font-family: var(--font-display); font-size: 15px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--muted-fg); }

/* ---- index head ---- */
.j-head{ margin-bottom: 34px; }
.j-title{ margin: 10px 0 12px; font-family: var(--font-display); font-weight: 700; font-size: clamp(40px, 6vw, 72px); line-height: 1.02; letter-spacing: .01em; }
.j-intro{ max-width: 620px; margin: 0; font-family: var(--font-serif); font-size: clamp(18px, 2vw, 21px); line-height: 1.55; color: rgba(255,255,255,.74); }
.j-tags{ display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.j-tag{ padding: 7px 14px; border-radius: 999px; font-size: 14px; color: rgba(255,255,255,.78); border: 1px solid rgba(255,255,255,.14); transition: color .15s ease, border-color .15s ease, background .15s ease; }
.j-tag:hover{ color: var(--fg); border-color: rgb(var(--accent-rgb) / .55); }
.j-tag.is-active{ color: #111; background: var(--accent); border-color: var(--accent); font-weight: 600; }

/* ---- generated covers for posts without a photo ---- */
.j-cover{ position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; overflow: hidden;
  font-family: var(--font-display); font-weight: 700; font-size: clamp(64px, 12vw, 132px); line-height: 1; color: rgb(var(--accent-rgb) / .9); }
.j-cover::after{ content: ""; position: absolute; height: 74%; aspect-ratio: 1; border-radius: 50%; border: 1px solid rgb(var(--accent-rgb) / .28); }
.j-cover-a{ background: radial-gradient(120% 120% at 20% 0%, #3a2c12 0%, #17130c 55%, #0d0d10 100%); }
.j-cover-b{ background: radial-gradient(120% 120% at 100% 10%, #1d2a3d 0%, #10141c 55%, #0d0d10 100%); color: rgba(206,221,245,.9); }
.j-cover-b::after{ border-color: rgba(160,190,235,.26); }
.j-cover-c{ background: radial-gradient(120% 120% at 0% 100%, #2c1d33 0%, #15111a 55%, #0d0d10 100%); color: rgba(226,205,240,.9); }
.j-cover-c::after{ border-color: rgba(200,160,230,.26); }

/* ---- lead story ---- */
.j-lead{ display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: clamp(22px, 4vw, 48px); align-items: center; color: var(--fg); margin-bottom: 64px; }
.j-lead-media, .j-card-media{ position: relative; display: block; overflow: hidden; border-radius: 18px; background: #14141a; }
.j-lead-media{ aspect-ratio: 16 / 10; }
.j-lead-media img, .j-card-media img{ position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.j-lead:hover .j-lead-media img, .j-card:hover .j-card-media img{ transform: scale(1.03); }
.j-lead-body{ display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.j-pin{ display: inline-block; margin-right: 10px; padding: 3px 9px; border-radius: 999px; font-weight: 700; letter-spacing: .1em; color: #111; background: var(--accent); }
.j-lead-title{ font-family: var(--font-display); font-weight: 700; font-size: clamp(28px, 3.4vw, 44px); line-height: 1.1; transition: color .15s ease; }
.j-lead:hover .j-lead-title, .j-card:hover .j-card-title{ color: var(--accent); }
.j-lead-summary{ font-family: var(--font-serif); font-size: clamp(17px, 1.6vw, 20px); line-height: 1.6; color: rgba(255,255,255,.74); }
.j-more{ margin-top: 4px; font-weight: 700; color: var(--accent); }
.j-more span{ display: inline-block; transition: transform .2s ease; }
.j-lead:hover .j-more span{ transform: translateX(4px); }
.j-card-tags{ display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; color: var(--muted-fg); }

/* ---- grid ---- */
.j-grid{ display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 40px 28px; }
.j-card{ display: flex; flex-direction: column; gap: 14px; min-width: 0; color: var(--fg); }
.j-card-media{ aspect-ratio: 16 / 10; }
.j-card-media .j-cover{ font-size: clamp(48px, 7vw, 84px); }
.j-card-body{ display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.j-card-title{ font-family: var(--font-display); font-weight: 600; font-size: 21px; line-height: 1.22; transition: color .15s ease; }
.j-card-summary{ font-size: 15.5px; line-height: 1.6; color: rgba(255,255,255,.68); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.j-empty{ padding: 56px 0; text-align: center; color: var(--muted-fg); font-family: var(--font-serif); font-size: 19px; }
.j-pager{ display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 56px; padding-top: 24px; border-top: 1px solid rgba(255,255,255,.08); }

/* ---- post ---- */
.read-progress{ position: fixed; top: 0; left: 0; right: 0; z-index: 70; height: 3px; pointer-events: none; }
.read-progress span{ display: block; height: 100%; background: var(--accent); transform: scaleX(0); transform-origin: 0 50%; }
.journal .j-post-head, .journal .j-prose, .journal .j-post-foot{ width: min(var(--measure), calc(100% - 40px)); }
.j-back{ display: inline-block; margin-bottom: 26px; font-size: 14px; color: var(--muted-fg); }
.j-back:hover{ color: var(--accent); }
.j-draft{ margin-bottom: 18px; padding: 10px 14px; border-radius: 12px; font-size: 14px; color: var(--accent); background: rgb(var(--accent-rgb) / .08); border: 1px dashed rgb(var(--accent-rgb) / .45); }
.j-draft a{ font-weight: 700; text-decoration: underline; }
.j-post-tags{ display: flex; flex-wrap: wrap; gap: 4px 14px; margin-bottom: 14px; font-size: 13px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
.j-post-tags a{ color: var(--accent); }
.j-post-tags a:hover{ text-decoration: underline; }
.j-post-title{ margin: 0 0 18px; font-family: var(--font-display); font-weight: 700; font-size: clamp(32px, 5vw, 54px); line-height: 1.08; }
.j-standfirst{ margin: 0 0 26px; font-family: var(--font-serif); font-style: italic; font-size: clamp(19px, 2.2vw, 23px); line-height: 1.5; color: rgba(255,255,255,.76); }
.j-byline{ display: flex; align-items: center; gap: 12px; padding: 16px 0; border-top: 1px solid rgba(255,255,255,.1); border-bottom: 1px solid rgba(255,255,255,.1); }
.j-avatar{ flex: 0 0 auto; width: 42px; height: 42px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%;
  font-family: var(--font-display); font-size: 14px; color: #111; background: linear-gradient(135deg, #f0dfa8, var(--accent)); }
.j-byline-text{ flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 14px; color: var(--muted-fg); }
.j-byline-text strong{ color: var(--fg); font-size: 15px; }
.j-copy{ flex: 0 0 auto; padding: 8px 14px; border-radius: 999px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--fg); background: none; border: 1px solid rgba(255,255,255,.18); }
.j-copy:hover{ border-color: rgb(var(--accent-rgb) / .6); color: var(--accent); }
.journal .j-hero{ width: min(var(--wide), calc(100% - 40px)); margin: 36px auto 0; }
.j-hero img{ width: 100%; max-height: 620px; object-fit: cover; border-radius: 20px; }

:is(.j-prose, .markdownx-preview){ margin-top: 40px; font-size: 18.5px; line-height: 1.8; color: rgba(255,255,255,.86); overflow-wrap: break-word; }
:is(.j-prose, .markdownx-preview) > *:first-child{ margin-top: 0; }
:is(.j-prose, .markdownx-preview) > p:first-child{ font-size: 1.12em; line-height: 1.7; color: var(--fg); }
:is(.j-prose, .markdownx-preview) p{ margin: 0 0 1.35em; }
:is(.j-prose, .markdownx-preview) h1, :is(.j-prose, .markdownx-preview) h2, :is(.j-prose, .markdownx-preview) h3, :is(.j-prose, .markdownx-preview) h4{ margin: 2.1em 0 .7em; font-family: var(--font-display); font-weight: 600; line-height: 1.2; color: var(--fg); scroll-margin-top: 100px; }
:is(.j-prose, .markdownx-preview) h1, :is(.j-prose, .markdownx-preview) h2{ font-size: 28px; }
:is(.j-prose, .markdownx-preview) h3{ font-size: 21px; }
:is(.j-prose, .markdownx-preview) h4{ font-size: 17px; letter-spacing: .06em; text-transform: uppercase; }
:is(.j-prose, .markdownx-preview) a{ color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
:is(.j-prose, .markdownx-preview) a:hover{ text-decoration-thickness: 2px; }
:is(.j-prose, .markdownx-preview) strong{ color: var(--fg); font-weight: 700; }
:is(.j-prose, .markdownx-preview) ul, :is(.j-prose, .markdownx-preview) ol{ margin: 0 0 1.35em; padding-left: 1.4em; }
:is(.j-prose, .markdownx-preview) li{ margin: .45em 0; padding-left: .2em; }
:is(.j-prose, .markdownx-preview) li::marker{ color: var(--accent); }
:is(.j-prose, .markdownx-preview) blockquote{ margin: 1.9em 0; padding: 4px 0 4px 26px; border-left: 2px solid var(--accent); font-family: var(--font-serif); font-style: italic; font-size: 1.22em; line-height: 1.55; color: var(--fg); }
:is(.j-prose, .markdownx-preview) blockquote p:last-child{ margin-bottom: 0; }
:is(.j-prose, .markdownx-preview) code{ padding: .12em .4em; border-radius: 6px; font-size: .86em; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: rgba(255,255,255,.08); color: #f0dfa8; }
:is(.j-prose, .markdownx-preview) pre{ margin: 1.7em 0; padding: 18px 20px; border-radius: 14px; overflow-x: auto; font-size: 15px; line-height: 1.65; background: #07080c; border: 1px solid rgba(255,255,255,.1); }
:is(.j-prose, .markdownx-preview) pre code{ padding: 0; background: none; color: rgba(230,236,245,.92); font-size: inherit; }
:is(.j-prose, .markdownx-preview) img, :is(.j-prose, .markdownx-preview) video{ display: block; max-width: 100%; height: auto; margin: 2em auto; border-radius: 14px; }
:is(.j-prose, .markdownx-preview) figure{ margin: 2.1em 0; }
:is(.j-prose, .markdownx-preview) figure img, :is(.j-prose, .markdownx-preview) figure video{ margin: 0 auto; }
:is(.j-prose, .markdownx-preview) figcaption{ margin-top: 10px; text-align: center; font-size: 14px; color: var(--muted-fg); }
:is(.j-prose, .markdownx-preview) .embed-frame{ position: relative; padding-top: 56.25%; border-radius: 14px; overflow: hidden; background: #000; }
:is(.j-prose, .markdownx-preview) .embed-frame iframe{ position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
:is(.j-prose, .markdownx-preview) hr{ height: auto; margin: 2.6em 0; border: 0; text-align: center; background: none; }
:is(.j-prose, .markdownx-preview) hr::before{ content: "✦   ✦   ✦"; color: rgb(var(--accent-rgb) / .7); font-size: 12px; letter-spacing: .3em; }
:is(.j-prose, .markdownx-preview) table{ display: block; width: 100%; margin: 1.8em 0; overflow-x: auto; border-collapse: collapse; font-size: 16px; }
:is(.j-prose, .markdownx-preview) th, :is(.j-prose, .markdownx-preview) td{ padding: 10px 14px; border-bottom: 1px solid rgba(255,255,255,.1); text-align: left; }
:is(.j-prose, .markdownx-preview) th{ font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted-fg); }

.j-post-foot{ margin-top: 56px; }
.j-foot-row{ display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 22px; border-top: 1px solid rgba(255,255,255,.1); }
.j-foot-actions{ display: flex; gap: 8px; }
.j-nextprev{ display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 30px; }
.j-np{ display: flex; flex-direction: column; gap: 8px; padding: 18px; border-radius: 16px; color: var(--fg); background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.08); transition: border-color .15s ease; }
.j-np:hover{ border-color: rgb(var(--accent-rgb) / .5); }
.j-np-next{ text-align: right; }
.j-np-title{ font-family: var(--font-display); font-size: 17px; line-height: 1.3; }
.j-related{ margin-top: 84px; padding-top: 40px; border-top: 1px solid rgba(255,255,255,.08); }

@media (max-width: 900px){
  .j-lead{ grid-template-columns: 1fr; margin-bottom: 48px; }
  .j-grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px 20px; }
}
@media (max-width: 600px){
  .journal .container, .journal .j-post-head, .journal .j-prose, .journal .j-post-foot, .journal .j-hero{ width: calc(100% - 36px); }
  .j-head{ margin-bottom: 26px; }
  /* topics: one swipeable row */
  .j-tags{ flex-wrap: nowrap; overflow-x: auto; margin: 20px -18px 0; padding: 0 18px 2px; scrollbar-width: none; }
  .j-tags::-webkit-scrollbar{ display: none; }
  .j-tag{ flex: 0 0 auto; }
  /* grid becomes a tidy list: words left, cover right */
  .j-grid{ grid-template-columns: 1fr; gap: 0; }
  .j-card{ flex-direction: row-reverse; align-items: flex-start; gap: 14px; padding: 18px 0; border-top: 1px solid rgba(255,255,255,.08); }
  .j-card:first-child{ border-top: 0; padding-top: 0; }
  .j-card-media{ flex: 0 0 96px; aspect-ratio: 1; border-radius: 12px; }
  .j-card-media .j-cover{ font-size: 40px; }
  .j-card-title{ font-size: 18px; }
  .j-card-summary{ font-size: 14.5px; -webkit-line-clamp: 2; }
  .j-prose{ margin-top: 30px; font-size: 17.5px; line-height: 1.75; }
  .j-prose h1, .j-prose h2{ font-size: 24px; }
  .j-prose blockquote{ padding-left: 18px; font-size: 1.14em; }
  .j-prose pre{ margin-left: -18px; margin-right: -18px; border-radius: 0; border-left: 0; border-right: 0; }
  .j-hero img{ border-radius: 14px; }
  .j-nextprev{ grid-template-columns: 1fr; }
  .j-np-next{ text-align: left; }
  .j-related{ margin-top: 56px; }
}
@media (prefers-reduced-motion: reduce){
  .j-lead-media img, .j-card-media img, .j-more span{ transition: none; }
}

/* ---- drafts + delete confirmation ---- */
.j-head-row{ display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.j-head-actions{ display: flex; gap: 8px; }
.j-title-sm{ font-size: clamp(34px, 5vw, 54px); }
.j-drafts{ list-style: none; margin: 0; padding: 0; }
.j-draft-row{ display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 22px 0; border-top: 1px solid rgba(255,255,255,.08); }
.j-draft-main{ flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.j-draft-main .j-card-title{ color: var(--fg); }
.j-draft-main .j-card-title:hover{ color: var(--accent); }
.j-draft-main .j-card-summary{ margin: 0; }
.j-draft-actions{ flex: 0 0 auto; display: flex; gap: 8px; }
.journal .j-confirm{ width: min(var(--measure), calc(100% - 40px)); }
.j-confirm .j-post-title{ margin-top: 12px; }
.j-confirm-note{ margin: 0 0 28px; font-size: 17px; line-height: 1.7; color: rgba(255,255,255,.8); }
.j-confirm-note code{ padding: .12em .4em; border-radius: 6px; font-size: .9em; background: rgba(255,255,255,.08); }
.j-confirm-actions{ display: flex; gap: 12px; flex-wrap: wrap; }
.j-danger{ color: #fff; background: #b3372b; border-color: transparent; }
.j-danger:hover{ filter: brightness(1.1); }

/* ---- editor: a writing surface, not a form ---- */
.editor-page{ padding-top: calc(var(--nav-bottom, 72px) + 16px); }
.editor{ width: min(1200px, calc(100% - 40px)); margin: 0 auto; }
.editor .sr-only{ position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.editor-head{ position: sticky; top: var(--nav-bottom, 72px); z-index: 30; margin-bottom: 22px; background: var(--bg); border-bottom: 1px solid rgba(255,255,255,.09); }
.editor-bar{ display: flex; align-items: center; gap: 14px; padding: 12px 0; }
.editor-back{ flex: 0 0 auto; display: inline-flex; align-items: center; gap: 5px; font-size: 14px; color: var(--muted-fg); }
.editor-back:hover{ color: var(--accent); }
.editor-state{ flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; }
.editor-pill{ flex: 0 0 auto; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted-fg); border: 1px solid rgba(255,255,255,.18); }
.editor-pill.is-live{ color: #6ee0ac; border-color: rgba(110,224,172,.45); background: rgba(110,224,172,.08); }
.editor-pill.is-dirty::after{ content: ""; display: inline-block; width: 7px; height: 7px; margin: 0 0 1px 7px; border-radius: 50%; background: var(--accent); vertical-align: middle; }
.editor-saved{ font-size: 13px; color: var(--muted-fg); white-space: nowrap; }
.editor-saved:empty{ display: none; }
.editor-count{ font-size: 13px; color: var(--muted-fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.editor-actions{ flex: 0 0 auto; display: flex; align-items: center; gap: 8px; }
.editor .btn-sm{ padding: 9px 16px; font-size: 14px; border-radius: 10px; }
/* a failed save and the offer to restore unsaved writing live in the sticky head: always in view */
.editor-alert, .editor-restore{ display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 0 0 12px; padding: 12px 14px; border-radius: 12px; }
.editor-alert[hidden], .editor-restore[hidden], .editor-alert-signin[hidden]{ display: none; }
.editor-alert{ color: #ffd6d6; background: #2a1414; border: 1px solid rgba(255,133,133,.5); }
.editor-alert.is-ok{ color: #c9f5df; background: #10261c; border-color: rgba(110,224,172,.5); }
.editor-alert-text, .editor-restore-text{ flex: 1 1 260px; margin: 0; font-size: 15px; line-height: 1.5; }
.editor-alert-text{ font-weight: 600; }
.editor-alert-signin{ color: #fff; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.editor-restore{ margin-bottom: 22px; color: var(--fg); background: #1c1810; border: 1px solid rgb(var(--accent-rgb) / .5); }
.editor-restore-actions{ display: flex; gap: 8px; }
.editor-grid{ display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 44px; align-items: start; }
.editor-main{ min-width: 0; }
.editor-title textarea, .editor-summary textarea{ display: block; width: 100%; min-height: 0; padding: 4px 0; overflow: hidden; resize: none; border: 0; border-radius: 0; background: none; box-shadow: none; color: var(--fg); }
.editor-title textarea:focus, .editor-summary textarea:focus{ border: 0; box-shadow: 0 2px 0 0 rgb(var(--accent-rgb) / .55); outline: none; }
.editor-title textarea{ font-family: var(--font-display); font-weight: 700; font-size: clamp(28px, 4vw, 46px); line-height: 1.15; }
.editor-title textarea.is-missing::placeholder{ color: #ff9b9b; }
.editor .is-missing, .editor .is-missing:focus{ box-shadow: 0 2px 0 0 #ff8585; }
.editor-summary{ margin: 6px 0 20px; }
.editor-summary textarea{ font-family: var(--font-serif); font-style: italic; font-size: clamp(18px, 2vw, 21px); line-height: 1.5; color: rgba(255,255,255,.8); }
.editor-tabs{ display: none; }
.md-dock{ position: sticky; top: calc(var(--nav-bottom, 72px) + var(--editor-head-h, 61px)); z-index: 20; margin-bottom: 14px; }
.md-toolbar{ display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 6px;
  border-radius: 12px; background: #131317; border: 1px solid rgba(255,255,255,.1); }
.md-btn{ min-width: 36px; height: 34px; padding: 0 10px; border: 0; border-radius: 8px; background: none; color: rgba(255,255,255,.85); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.md-btn:hover{ background: rgba(255,255,255,.09); color: var(--fg); }
.md-btn:focus-visible{ outline: 2px solid rgb(var(--accent-rgb) / .8); outline-offset: -2px; }
@media (pointer: coarse){ .editor-keys{ display: none; } }
.md-btn strong, .md-btn em{ color: inherit; font-size: 15px; }
.md-sep{ align-self: stretch; width: 1px; margin: 5px 6px; background: rgba(255,255,255,.14); }
/* the upload status: a full-width line under the toolbar, always in view while writing */
.md-upload-status{ margin: 6px 0 0; padding: 9px 12px; border-radius: 10px; font-size: 14px; line-height: 1.45; color: var(--fg);
  background: #131317; border: 1px solid rgba(255,255,255,.1); }
.md-upload-status:empty{ display: none; }
.md-upload-status[data-state="error"]{ color: #ffb4b4; background: #2a1414; border-color: rgba(255,133,133,.4); }
.md-upload-status[data-state="ok"]{ color: #6ee0ac; }
.editor-content{ margin: 0; }
.editor-content .markdownx{ display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; align-items: start; }
.editor-content textarea{ width: 100%; min-height: 420px; padding: 18px; overflow: hidden; resize: none; border-radius: 14px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 15px; line-height: 1.7; background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.09); }
.editor-content .markdownx-preview{ position: sticky; top: calc(86px + var(--editor-head-h, 61px) + var(--md-dock-h, 48px));
  max-height: calc(100vh - 100px - var(--editor-head-h, 61px) - var(--md-dock-h, 48px)); overflow: auto; margin-top: 0; padding: 2px 6px 2px 26px; font-size: 16.5px; border-left: 1px solid rgba(255,255,255,.09); }
.editor-content .markdownx-preview:empty::before{ content: "The preview appears here as you write."; color: var(--muted-fg); font-style: italic; }
.editor-hint{ margin: 12px 0 0; font-size: 13px; color: var(--muted-fg); }
.editor-hint code{ padding: .1em .35em; border-radius: 5px; background: rgba(255,255,255,.07); }
.editor-side{ position: sticky; top: calc(80px + var(--editor-head-h, 61px)); }
.editor-status-line{ margin: 0 0 10px; font-size: 14px; line-height: 1.5; color: var(--fg); }
.editor-status-actions{ display: none; flex-wrap: wrap; gap: 8px; }
.editor-panel{ padding: 18px 0; border-top: 1px solid rgba(255,255,255,.09); }
.editor-panel:first-child{ padding-top: 0; border-top: 0; }
.editor-panel-title{ margin: 0 0 10px; font-family: var(--font-body); font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted-fg); }
.editor-panel-title label{ margin: 0; color: inherit; font: inherit; letter-spacing: inherit; }
.editor-panel input[type="text"]{ padding: 10px 12px; border-radius: 10px; font-size: 14px; }
.editor-help{ margin: 8px 0 0; font-size: 12.5px; color: var(--muted-fg); }
.editor-cover{ display: flex; align-items: center; justify-content: center; aspect-ratio: 16 / 10; margin-bottom: 10px; overflow: hidden; border-radius: 12px; text-align: center; background: rgba(255,255,255,.04); border: 1px dashed rgba(255,255,255,.14); }
.editor-cover img{ width: 100%; height: 100%; object-fit: cover; }
.editor-cover-empty{ padding: 14px; font-size: 13px; line-height: 1.5; color: var(--muted-fg); }
.editor-file{ display: inline-flex; margin: 0; cursor: pointer; }
.editor-panel:focus-within .editor-file{ outline: 2px solid rgb(var(--accent-rgb) / .6); outline-offset: 2px; }
.editor-check{ display: flex; align-items: flex-start; gap: 10px; margin: 10px 0 0; font-size: 14px; font-weight: 500; cursor: pointer; color: var(--fg); }
.editor-panel > .editor-check:first-child{ margin-top: 0; }
.editor-check input{ flex: 0 0 auto; width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--accent); }
.editor-check small{ display: block; margin-top: 2px; font-size: 12.5px; color: var(--muted-fg); }
.editor-meta{ display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: var(--muted-fg); }
.editor-meta .editor-panel-title{ margin-bottom: 2px; }
.editor-address{ display: flex; align-items: center; gap: 4px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; color: var(--muted-fg); }
.editor-panel .editor-address input{ flex: 1; min-width: 0; padding: 8px 10px; font-family: inherit; }
.editor-meta .editor-help{ margin: 0; }
.editor-field-label{ display: block; margin: 14px 0 6px; font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted-fg); }
.editor-date{ display: flex; align-items: center; gap: 8px; }
.editor-panel input[type="date"]{ flex: 1; min-width: 0; padding: 9px 10px; border-radius: 10px; font-size: 14px; color-scheme: dark; }
.editor-delete{ margin-top: 6px; color: #ff9b9b; }
.editor-delete:hover{ text-decoration: underline; }

/* a laptop: a wider page so the text and its preview each get a readable column */
@media (min-width: 1200px){
  .editor{ width: min(1440px, calc(100% - 48px)); }
  .editor-grid{ grid-template-columns: minmax(0, 1fr) 260px; gap: 36px; }
}
@media (max-width: 1000px){
  .editor-grid{ grid-template-columns: 1fr; gap: 28px; }
  .editor-side{ position: static; }
  .editor-content .markdownx{ grid-template-columns: 1fr; }
  .editor-tabs{ display: flex; gap: 6px; margin-bottom: 10px; }
  .editor-tab{ flex: 1; padding: 10px; border-radius: 10px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; color: var(--muted-fg); background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.09); }
  .editor-tab.is-active{ color: var(--fg); border-color: rgb(var(--accent-rgb) / .5); background: rgb(var(--accent-rgb) / .1); }
  .editor-content .markdownx-preview{ display: none; position: static; max-height: none; padding: 0; border-left: 0; font-size: 17px; }
  .editor-content[data-view="preview"] textarea{ display: none; }
  .editor-content[data-view="preview"] .markdownx-preview{ display: block; min-height: 300px; }
  .is-previewing .md-toolbar, .is-previewing .editor-hint{ display: none; }
}
@media (max-width: 600px){
  .editor{ width: calc(100% - 32px); }
  /* one row on a phone: back, state, View (published) and the save buttons; Preview and Unpublish move to Status below */
  .editor-bar{ gap: 8px; padding: 10px 0; }
  .editor-count, .editor-saved, .editor-wide{ display: none; }
  .editor-status-actions{ display: flex; }
  .editor-actions{ gap: 6px; }
  .editor-alert{ margin-bottom: 10px; padding: 10px 12px; gap: 6px 12px; }
  .editor-alert-text, .editor-restore-text{ font-size: 14.5px; }
  .md-dock{ margin-left: -16px; margin-right: -16px; }
  .md-toolbar{ flex-wrap: nowrap; overflow-x: auto; border-radius: 0; border-left: 0; border-right: 0; scrollbar-width: none; }
  .md-toolbar::-webkit-scrollbar{ display: none; }
  .md-btn{ flex: 0 0 auto; height: 40px; min-width: 42px; font-size: 14px; }
  .md-upload-status{ margin: 0; border-radius: 0; border-left: 0; border-right: 0; border-top: 0; }
  .editor-content textarea{ padding: 14px; font-size: 16px; }   /* 16px: iOS does not zoom the page on focus */
  .j-draft-row{ flex-direction: column; align-items: stretch; gap: 12px; }
  .j-draft-actions .btn{ flex: 1; justify-content: center; }
  .j-head-actions{ width: 100%; }
  .j-head-actions .btn{ flex: 1; justify-content: center; }
}

/* touch audit: tap targets and zoom-free fields */
@media (pointer: coarse){
  .j-back, .editor-back{ padding-block: 10px; }
  .j-post-tags a{ padding-block: 9px; }
  .editor-delete{ display: inline-block; padding-block: 9px; }
  .j-draft-main .j-card-title{ padding-block: 6px; }
  .editor-check input{ width: 24px; height: 24px; }
}
@media (max-width: 820px){ .editor-panel input[type="text"], .editor-panel input[type="date"], .editor-panel .editor-address input{ font-size: 16px; } }
/* a phone on its side: keep the save buttons in view, let the toolbar scroll with the text */
@media (max-height: 500px) and (max-width: 1000px){
  .md-dock{ position: static; }
}
@media (pointer: coarse){
  .editor-back{ display: inline-flex; align-items: center; gap: 5px; min-width: 36px; min-height: 44px; }
}
@media (max-width: 360px){
  .editor{ width: calc(100% - 24px); }
  .editor-back-word{ display: none; }
  .editor .btn-sm{ padding: 9px 12px; }
  .md-dock{ margin-left: -12px; margin-right: -12px; }
}

/* A long unbroken word (a dotted path, a URL) wraps instead of widening the page. */
.j-title, .j-post-title, .j-standfirst, .j-lead-title, .j-lead-summary, .j-card-title, .j-card-summary, .j-np-title, .j-intro{ overflow-wrap: anywhere; }

/* ------------------------------------------------------------ cover framing
   Chosen in the editor (cover_frame.js): the point of the cover that stays in
   view and how far to zoom, as classes (Post.cover_frame) that set custom
   properties, so every cropped cover follows it without an inline style. */
.j-framed{ object-position: var(--fx, 50%) var(--fy, 50%); transform: scale(var(--fz, 1)); transform-origin: var(--fx, 50%) var(--fy, 50%); }
.j-lead:hover .j-lead-media img.j-framed, .j-card:hover .j-card-media img.j-framed{ transform: scale(calc(var(--fz, 1) * 1.03)); }
/* the post's banner keeps the whole photo's width: it follows the focal point, not the zoom */
.j-hero img.j-framed{ transform: none; }
.fx-0{--fx:0%} .fx-5{--fx:5%} .fx-10{--fx:10%} .fx-15{--fx:15%} .fx-20{--fx:20%} .fx-25{--fx:25%} .fx-30{--fx:30%} .fx-35{--fx:35%} .fx-40{--fx:40%} .fx-45{--fx:45%} .fx-50{--fx:50%} .fx-55{--fx:55%} .fx-60{--fx:60%} .fx-65{--fx:65%} .fx-70{--fx:70%} .fx-75{--fx:75%} .fx-80{--fx:80%} .fx-85{--fx:85%} .fx-90{--fx:90%} .fx-95{--fx:95%} .fx-100{--fx:100%}
.fy-0{--fy:0%} .fy-5{--fy:5%} .fy-10{--fy:10%} .fy-15{--fy:15%} .fy-20{--fy:20%} .fy-25{--fy:25%} .fy-30{--fy:30%} .fy-35{--fy:35%} .fy-40{--fy:40%} .fy-45{--fy:45%} .fy-50{--fy:50%} .fy-55{--fy:55%} .fy-60{--fy:60%} .fy-65{--fy:65%} .fy-70{--fy:70%} .fy-75{--fy:75%} .fy-80{--fy:80%} .fy-85{--fy:85%} .fy-90{--fy:90%} .fy-95{--fy:95%} .fy-100{--fy:100%}
.fz-100{--fz:1} .fz-110{--fz:1.1} .fz-120{--fz:1.2} .fz-130{--fz:1.3} .fz-140{--fz:1.4} .fz-150{--fz:1.5} .fz-160{--fz:1.6} .fz-170{--fz:1.7} .fz-180{--fz:1.8} .fz-190{--fz:1.9} .fz-200{--fz:2} .fz-210{--fz:2.1} .fz-220{--fz:2.2} .fz-230{--fz:2.3} .fz-240{--fz:2.4} .fz-250{--fz:2.5} .fz-260{--fz:2.6} .fz-270{--fz:2.7} .fz-280{--fz:2.8} .fz-290{--fz:2.9} .fz-300{--fz:3}
@media (prefers-reduced-motion: reduce){ .j-lead:hover .j-lead-media img.j-framed, .j-card:hover .j-card-media img.j-framed{ transform: scale(var(--fz, 1)); } }
/* the editor's framing tool */
.editor-cover{ position: relative; }
.editor-cover img.j-framed{ display: block; }
.editor-cover.is-framable{ cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.editor-cover.is-dragging{ cursor: grabbing; }
.editor-cover.is-framable::after{ content: "⇕⇔ drag"; position: absolute; right: 8px; bottom: 8px; padding: 3px 8px; border-radius: 999px;
  background: rgba(0,0,0,.6); color: rgba(255,255,255,.85); font-size: 11px; letter-spacing: .04em; pointer-events: none; }
.editor-cover.is-dragging::after{ content: none; }
.editor-cover:focus-visible{ outline: 2px solid var(--accent); outline-offset: 3px; }
.editor-frame[hidden]{ display: none; }
.editor-frame-row{ display: flex; align-items: center; gap: 10px; margin: 6px 0 10px; }
.editor-frame-row .editor-field-label{ margin: 0; }
.editor-frame-row input[type="range"]{ flex: 1 1 auto; min-width: 0; accent-color: var(--accent); }
.editor-frame-previews{ display: flex; align-items: flex-start; gap: 12px; margin: 0 0 12px; }
.editor-thumb-wrap{ display: flex; flex-direction: column; gap: 4px; }
.editor-thumb{ position: relative; display: block; overflow: hidden; border-radius: 10px; background: #14141a; }
.editor-thumb img{ position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.editor-thumb-wide{ width: 128px; aspect-ratio: 16 / 10; }
.editor-thumb-square{ width: 80px; aspect-ratio: 1; }
.editor-thumb-caption{ font-size: 11.5px; color: var(--muted-fg); }
@media (pointer: coarse){ .editor-frame-row input[type="range"]{ min-height: 40px; } .editor-frame-row .btn{ min-height: 44px; } }
