/* Unframed reading surface: index, topic and post pages, plus the shared text-led card.
   Static (no JavaScript) states first, then the enhanced gloss states unframed.js switches on;
   tokens come from styles.css. Four type sizes (14px, 18px, 24px, var(--h2)), two weights
   (400, 700), spacing on the 4px scale. The shared cream-page header and main spacing for
   .site-page live in 00-base.css; the homepage block (.unframed-home) reuses the card styles. */

.unframed-page { background: var(--cream); color: var(--text); }
.unframed-main { padding-bottom: 64px; }

.unframed-page h1,
.unframed-page h2,
.unframed-page h3 { text-wrap: balance; }

/* ---- list page head and topics ---- */

.unframed-head { margin-bottom: 64px; }
.unframed-head h1,
.unframed-head__lede,
.unframed-head__page { max-width: 68ch; }
.unframed-head h1 {
  font-family: var(--serif);
  font-size: var(--h2);
  font-weight: 400;
  line-height: 1.15;
  color: var(--ink-2);
  overflow-wrap: anywhere;
}
.unframed-head__lede { margin-top: 16px; font-size: 18px; line-height: 1.65; color: var(--muted); }
.unframed-head__page { margin-top: 8px; font-size: 14px; line-height: 1.5; color: var(--muted); }

.unframed-topics { margin-top: 24px; }
.unframed-topics ul,
.unframed-tags ul,
.unframed-pagination ul {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.unframed-chip {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  min-width: 44px;
  padding: 0 16px;
  border: 1px solid var(--chip);
  background: transparent;
  color: var(--olive);
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
  text-decoration: none;
}
.unframed-chip:hover { border-color: var(--olive); }
/* Both values: "page" on the current page and index chips, "location" on a list's chip from its archive pages 2 and later */
.unframed-chip[aria-current] { background: var(--olive); color: var(--cream); border-color: var(--olive); }

/* ---- date groups and the card grid ---- */

.unframed-day { margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--line-2); }
.unframed-day:first-of-type { margin-top: 0; }
.unframed-day__title {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 400;
  line-height: 1.25;
  color: var(--ink-2);
}
.unframed-day .unframed-grid { margin-top: 24px; }

.unframed-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}
@media (max-width: 1024px) {
  .unframed-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .unframed-grid { grid-template-columns: minmax(0, 1fr); }
}

.unframed-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  padding: 24px;
  background: var(--paper);
  border: 1px solid var(--line);
  transition: border-color .2s var(--ease-out);
}
.unframed-card:hover { border-color: var(--chip); }
.unframed-card__topic,
.unframed-post__topic {
  color: var(--olive);
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: .12em;
  text-transform: uppercase;
  text-decoration: none;
}
.unframed-card__topic { align-self: flex-start; }
.unframed-card__topic:hover,
.unframed-post__topic:hover { text-decoration: underline; text-underline-offset: 4px; }
.unframed-card__title {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 400;
  line-height: 1.25;
  color: var(--ink-2);
  overflow-wrap: anywhere;
}
.unframed-card__title a { color: inherit; text-decoration: none; }
.unframed-card:hover .unframed-card__title a,
.unframed-card__title a:hover { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
.unframed-card:has(.unframed-share:hover) .unframed-card__title a { text-decoration: none; }
.unframed-card__standfirst { font-size: 18px; line-height: 1.65; color: var(--text); }
.unframed-card__meta,
.unframed-post__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--muted);
}
.unframed-card__meta { margin-top: auto; }

.unframed-time__relative { margin-left: 4px; font-size: 14px; color: var(--muted); }
/* Inside the 8px-gap meta rows, pull the relative label back so it sits 4px from its time. */
.unframed-card__meta .unframed-time__relative,
.unframed-post__meta .unframed-time__relative { margin-left: -4px; }

/* ---- pagination (used from Plan 02) ---- */

.unframed-pagination { margin-top: 48px; }
.unframed-pagination ul { justify-content: center; }
/* Archive pages 2 and later: a Meta-tier link to the About note on page 1 of the index (UI-SPEC 15). */
.unframed-about-link { margin-top: 24px; text-align: center; font-size: 14px; line-height: 1.5; color: var(--muted); }

/* ---- post page ---- */

.unframed-post { max-width: 960px; margin-inline: auto; }
.unframed-post > * { max-width: 68ch; margin-inline: auto; }
.unframed-post > .unframed-hero,
.unframed-post > .unframed-related { max-width: none; }

.unframed-post__topic {
  display: block;
  width: fit-content;
  margin-left: max(0px, calc((100% - 68ch) / 2));
}
.unframed-post__title {
  margin-top: 16px;
  font-family: var(--serif);
  font-size: var(--h2);
  font-weight: 400;
  line-height: 1.15;
  color: var(--ink-2);
  overflow-wrap: anywhere;
}
.unframed-post__standfirst { margin-top: 16px; font-size: 18px; line-height: 1.65; color: var(--ink-2); }

.unframed-why {
  margin-top: 24px;
  padding: 16px 24px;
  background: var(--paper);
  border-left: 4px solid var(--olive);
}
.unframed-why__title {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--olive);
}
.unframed-why p { margin-top: 8px; font-size: 18px; line-height: 1.65; color: var(--text); }

.unframed-hero { margin: 32px 0 0; }
.unframed-hero img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 720px;
  margin-inline: auto;
  background: var(--paper);
}
.unframed-hero__credit {
  margin-top: 8px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
  text-align: left;
  overflow-wrap: anywhere;
}

.unframed-post__meta { margin-top: 24px; }
.unframed-post__byline { font-weight: 700; color: var(--ink-2); }

/* Prose links: body, standfirst, why it matters, sources and the image credit. */
.unframed-prose a,
.unframed-post__standfirst a,
.unframed-why a,
.unframed-sources a,
.unframed-hero__credit a,
.unframed-empty a,
.unframed-about a,
.unframed-about-link a {
  color: var(--olive);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}
.unframed-prose a:hover,
.unframed-post__standfirst a:hover,
.unframed-why a:hover,
.unframed-sources a:hover,
.unframed-hero__credit a:hover,
.unframed-empty a:hover,
.unframed-about a:hover,
.unframed-about-link a:hover { color: var(--ink-2); }

.unframed-prose { margin-top: 32px; }
.unframed-prose p,
.unframed-prose li,
.unframed-prose blockquote p { font-size: 18px; line-height: 1.65; color: var(--text); }
.unframed-prose p + p,
.unframed-prose p + ul,
.unframed-prose p + ol,
.unframed-prose p + blockquote,
.unframed-prose ul + p,
.unframed-prose ol + p,
.unframed-prose blockquote + p { margin-top: 24px; }
.unframed-prose h2 {
  margin-top: 48px;
  margin-bottom: 16px;
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 400;
  line-height: 1.25;
  color: var(--ink-2);
  overflow-wrap: anywhere;
}
.unframed-prose ul,
.unframed-prose ol { padding-left: 24px; }
.unframed-prose ul { list-style: disc; }
.unframed-prose ol { list-style: decimal; }
.unframed-prose li + li { margin-top: 8px; }
.unframed-prose blockquote {
  border-left: 4px solid var(--chip);
  padding-left: 24px;
  font-family: var(--serif);
  color: var(--ink-2);
}
.unframed-prose blockquote p { font-family: var(--serif); color: var(--ink-2); }
.unframed-prose strong { font-weight: 700; color: var(--ink-2); }
.unframed-prose em { font-style: italic; }

/* Preserve direct links to source entries. */
[id^="source-"]:target { background: var(--paper); }

/* Static gloss: the definition reads inline in parentheses. */
.unframed-gloss { position: relative; display: inline; }
.unframed-gloss__term {
  color: inherit;
  text-decoration: underline dotted;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}
.unframed-gloss__definition { transition: opacity .12s var(--ease-out); }

/* Enhanced gloss: unframed.js swaps the term span for a native button, adds
   .unframed-gloss--enhanced to the wrapper and keeps the definition hidden until it opens.
   The open definition is a popup under the term; it holds no focusable content. */
button.unframed-gloss__term {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  margin: 0;
  padding: 0;
  display: inline;
  cursor: pointer;
  text-align: inherit;
}
.unframed-gloss__term[aria-expanded="true"] {
  text-decoration-style: solid;
  text-decoration-color: var(--olive);
  background: var(--paper);
}
.unframed-gloss--enhanced .unframed-gloss__definition:not([hidden]) {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 10;
  width: max-content;
  max-width: min(32ch, calc(100vw - 32px));
  padding: 8px 16px;
  background: var(--warm-white);
  border: 1px solid var(--line-2);
  box-shadow: 0 8px 24px rgba(32,31,29,.12);
  font: 400 14px/1.5 var(--sans);
  color: var(--text);
  transform: translateX(var(--unframed-gloss-shift, 0px));
}
/* A transparent bridge over the 8px gap, so the pointer can travel from the term onto the popup
   without leaving the gloss (WCAG 1.4.13: hover content must itself be hoverable). */
.unframed-gloss--enhanced .unframed-gloss__definition:not([hidden])::before {
  content: "";
  position: absolute;
  top: -9px;
  left: -1px;
  right: -1px;
  height: 9px;
}
/* Set by unframed.js when the popup's right edge would pass the viewport: align it right. If the
   flipped popup would then cross the left edge, unframed.js also sets --unframed-gloss-shift. */
.unframed-gloss--flip .unframed-gloss__definition:not([hidden]) { left: auto; right: 0; }
@starting-style {
  .unframed-gloss--enhanced .unframed-gloss__definition:not([hidden]) { opacity: 0; }
}

.unframed-sources {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--line-2);
}
.unframed-sources h2,
.unframed-related h2,
.unframed-join h2,
.unframed-about h2,
.unframed-empty h2 {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 400;
  line-height: 1.25;
  color: var(--ink-2);
}
.unframed-sources ul { margin-top: 16px; padding-left: 24px; list-style: disc; }
.unframed-sources li {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  overflow-wrap: anywhere;
}
.unframed-sources li + li { margin-top: 8px; }

.unframed-tags { margin-top: 48px; }

.unframed-related { margin-top: 48px; }
.unframed-related .unframed-grid { margin-top: 24px; }

.unframed-join {
  margin-top: 48px;
  padding: 32px;
  background: var(--paper);
  border: 1px solid var(--line);
}
.unframed-join p { margin-top: 8px; font-size: 18px; line-height: 1.65; color: var(--text); }
.unframed-join .btn { margin-top: 24px; }

/* ---- index extras ---- */

.unframed-about {
  max-width: 68ch;
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--line-2);
}
.unframed-about p { margin-top: 16px; font-size: 18px; line-height: 1.65; color: var(--text); }

.unframed-empty {
  max-width: 68ch;
  padding: 48px 24px;
  border: 1px dashed var(--chip);
  text-align: center;
}
.unframed-empty p { margin-top: 16px; font-size: 18px; line-height: 1.65; color: var(--muted); }

/* ---- homepage block (UI-SPEC component 16): eyebrow, title, up to three cards, Read all ---- */

.unframed-home { padding-block: var(--section-y); }
.unframed-home__title {
  margin-top: 16px;
  font-family: var(--serif);
  font-size: var(--h2);
  font-weight: 400;
  line-height: 1.15;
  color: var(--ink-2);
  text-wrap: balance;
}
.unframed-home .unframed-grid { margin-top: 32px; }
.unframed-home__empty { margin-top: 32px; font-size: 18px; line-height: 1.65; color: var(--muted); }
.unframed-home .link-arrow { margin-top: 32px; }

@media (prefers-reduced-motion: reduce) {
  .unframed-card,
  .unframed-gloss__definition { transition: none; }
}

/* Share and feed icons: path data from Bootstrap Icons 1.13.2 (MIT), full notice in scripts/unframed/icons.mjs */
.unframed-share [hidden] { display: none; }
.unframed-share--post { margin-top: 48px; }
.unframed-share__title {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.5;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--ink-2);
}
.unframed-share__row { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px; }
.unframed-share--post .unframed-share__row { margin-top: 16px; }
.unframed-share__more { flex: 1 1 200px; min-width: 0; }
.unframed-share__control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  min-width: 44px;
  padding: 8px 16px;
  border: 1px solid var(--chip);
  background: transparent;
  font: 400 14px/1.5 var(--sans);
  color: var(--olive);
  text-decoration: none;
  text-align: left;
  cursor: pointer;
}
.unframed-share__control:hover,
.unframed-share__more[open] > .unframed-share__summary { border-color: var(--olive); }
.unframed-share__summary { list-style: none; }
.unframed-share__summary::-webkit-details-marker { display: none; }
.unframed-share__summary::after {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  margin-top: -4px;
}
.unframed-share__more[open] > .unframed-share__summary::after { transform: rotate(-135deg); margin-top: 4px; }
.unframed-share__panel { margin-top: 16px; }
.unframed-share__links { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.unframed-share__copy { margin-top: 16px; }
.unframed-share__label { display: block; font: 700 14px/1.5 var(--sans); color: var(--ink-2); }
.unframed-share__field { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; align-items: stretch; }
.unframed-share__url {
  flex: 1 1 200px;
  min-width: 0;
  min-height: 44px;
  padding: 0 16px;
  font: 400 18px/1.65 var(--sans);
  color: var(--text);
  background: var(--warm-white);
  border: 1px solid var(--muted);
  border-radius: 0;
}
.unframed-share__copy-button { flex: none; }
.unframed-share__status { font: 400 14px/1.5 var(--sans); color: var(--text); margin: 0; }
.unframed-share__status:not(:empty) { margin-top: 8px; }
.unframed-icon { width: 16px; height: 16px; flex: none; fill: currentColor; }
/* Feed subscription landmark (UI-SPEC component 25). */
.unframed-feed { background: var(--paper); border-top: 1px solid var(--line); }
.unframed-feed__inner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding-block: 16px; }
.unframed-feed__text { margin: 0; font: 400 14px/1.5 var(--sans); color: var(--text); }
.unframed-feed__link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font: 400 14px/1.5 var(--sans);
  color: var(--olive);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}
.unframed-feed__link:hover { color: var(--ink-2); }
@media print { .unframed-share, .unframed-feed { display: none; } }
