/* Shared article layer — loaded by the public site and the Filament editor.
   Must never style page chrome (no `body`, header, nav or footer rules): the
   panel loads this file directly. See CLAUDE.md → "Admin panel: the editor is a
   live preview". */

/* ---- Fonts (self-hosted, as before) ------------------------------------- */

@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/roboto-v51-latin-regular.woff2') format('woff2');
}
@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/fonts/roboto-v51-latin-500.woff2') format('woff2');
}
@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/fonts/roboto-v51-latin-700.woff2') format('woff2');
}
@font-face {
  font-family: 'PT Serif';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/pt-serif-v19-latin-regular.woff2') format('woff2');
}
@font-face {
  font-family: 'PT Serif';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/pt-serif-v19-latin-italic.woff2') format('woff2');
}
@font-face {
  font-family: 'PT Serif';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/fonts/pt-serif-v19-latin-700.woff2') format('woff2');
}

/* ---- Tokens ------------------------------------------------------------- */

:root {
  /* Brand — blues (carried over verbatim) */
  --color-primary:        #334a9d;   /* = main site --color-primary-500 */
  --color-primary-600:    #253673;   /* = main site --color-accent-content */
  --color-primary-dark:   #2a3d7c;
  --color-primary-darker: #182975;
  --color-primary-tint:   #eef1f9;

  /* --color-accent reaches only 3.22:1 on white: decorative fills only.
     Anything carrying text uses --color-accent-strong (4.59:1). */
  --color-accent:         #ea6740;
  --color-accent-strong:  #c05434;
  --color-accent-dark:    #a8461f;
  --color-accent-light:   #f4a767;

  /* --color-muted replaces the source theme's slategray (3.5:1) to clear
     4.5:1 on white. */
  --color-white:   #ffffff;
  --color-text:    #505050;
  --color-ink:     #262626;
  --color-muted:   #5f6b7a;
  --color-border:  #eeeeee;
  --color-bg:      #ffffff;
  --color-bg-soft: #f5f7fb;

  /* Footer. --color-footer-link is 8.0:1 on the primary blue; it sits here
     rather than as a literal because its sibling heading colour is a token. */
  --footer-heading:     #a5d0ef;
  --color-footer-link:  #c7d2ea;

  /* Nav hover wash, mirroring the main site's hover:bg-zinc-800/5. The soft
     variant is the mobile current-page tint. */
  --color-nav-hover:      rgba(39, 39, 42, 0.05);
  --color-nav-hover-soft: rgba(39, 39, 42, 0.04);

  /* Type */
  --font-sans:  'Roboto', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  --font-serif: 'PT Serif', Georgia, 'Times New Roman', serif;

  /* The ramp DESIGN.md documents. --text-secondary had no documented role at
     all despite carrying card excerpts, table cells, pagination and archive
     counts. --text-body appears twice rather than three times; a ramp missing
     its own centre just invites the next literal. */
  --text-body:      1.0625rem;   /* 17px */
  --text-secondary: 0.9375rem;   /* 15px */
  --text-label:     0.875rem;    /* 14px */
  --text-small:     0.8125rem;   /* 13px */

  /* Layout */
  --header-height:         96px;
  --header-height-desktop: 128px;
  --max-width:  1536px;
  --content-width: 1200px;
  --prose-width:   40.625rem;   /* rem, never ch — see CLAUDE.md */

  /* Radii */
  --radius-sm:   8px;
  --radius-md:  12px;
  --radius-lg:  16px;
  --radius-xl:  20px;
  --radius-pill: 999px;

  /* Shadows */
  --shadow-dropdown: 0 4px 12px rgba(0, 0, 0, 0.15);
  --shadow-card:     0 0 5px -3px rgba(0, 0, 0, 0.43);
  --shadow-raised:   0 10px 40px rgba(0, 0, 0, 0.1);

  /* Motion — ease-out-quart */
  --ease: cubic-bezier(0.25, 1, 0.5, 1);
  --transition: 240ms var(--ease);

  /* Semantic z-index scale */
  --z-dropdown: 100;
  --z-sticky:   200;
  --z-header:  1000;
}

/* ---- Article (single post) ---------------------------------------------- */

.article { padding-block: clamp(2rem, 5vw, 3.5rem); }

.article__header { max-width: var(--prose-width); margin-inline: auto; }

/* Date left, category right. One axis, so flex — and space-between is what
   gives the two ends meaning. Wraps on narrow viewports. */
.article__rail {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 1rem;
}

.article__date {
  color: var(--color-muted);
  font-size: var(--text-label);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.article__categories {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
}

/* The rail binds to the title it introduces; the generous gap goes below the
   header, not inside it. */
.article__title {
  margin: 0 0 clamp(1.75rem, 4vw, 2.5rem);
  color: var(--color-primary-darker);
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  text-align: center;
  text-wrap: balance;
}

.article__featured {
  width: 100%;
  max-width: var(--content-width);
  margin: 0 auto clamp(2rem, 5vw, 2.8125rem);
  border-radius: var(--radius-lg);
}

/* Prose */
:is(.prose, .fi-fo-rich-editor-content [contenteditable='true']) {
  max-width: var(--prose-width);
  margin-inline: auto;
  font-size: var(--text-body);
  line-height: 1.75;
  color: var(--color-text);
  font-family: var(--font-sans);   /* stated, not inherited: the panel body is Inter */
}

/* Reset and rhythm share one specificity so source order decides. */
:is(.prose, .fi-fo-rich-editor-content [contenteditable='true']) > * { margin-block: 0; }
:is(.prose, .fi-fo-rich-editor-content [contenteditable='true']) > * + * { margin-top: 1.5em; }   /* ~1.5 line-heights: comfortable for body copy */

:is(.prose, .fi-fo-rich-editor-content [contenteditable='true']) p { text-wrap: pretty; }

/* Descendant, not child: headings nest inside lists and wrappers. */
:is(.prose, .fi-fo-rich-editor-content [contenteditable='true']) h2 {
  margin-top: 2.5em;
  margin-bottom: 0.6em;
  color: var(--color-primary);
  font-size: clamp(1.375rem, 2.5vw, 1.75rem);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

:is(.prose, .fi-fo-rich-editor-content [contenteditable='true']) h3 {
  margin-top: 2em;
  margin-bottom: 0.5em;
  color: var(--color-primary-dark);
  font-size: clamp(1.125rem, 2vw, 1.375rem);
  font-weight: 700;
  line-height: 1.35;
  text-wrap: balance;
}

:is(.prose, .fi-fo-rich-editor-content [contenteditable='true']) :is(h4, h5) {
  margin-top: 1.75em;
  margin-bottom: 0.4em;
  color: var(--color-ink);
  font-size: var(--text-body);
  font-weight: 700;
  line-height: 1.4;
}

/* h6 carries the OCIF licence disclosure, not a heading — set as a footnote. */
:is(.prose, .fi-fo-rich-editor-content [contenteditable='true']) h6 {
  margin-top: 2.5em;
  color: var(--color-muted);
  font-size: var(--text-small);
  font-weight: 400;
  line-height: 1.6;
}

:is(.prose, .fi-fo-rich-editor-content [contenteditable='true']) a {
  color: var(--color-primary);
  font-weight: inherit;   /* Filament's editor sets links to 600 */
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
:is(.prose, .fi-fo-rich-editor-content [contenteditable='true']) a:hover { color: var(--color-accent-strong); }

:is(.prose, .fi-fo-rich-editor-content [contenteditable='true']) > ul,
:is(.prose, .fi-fo-rich-editor-content [contenteditable='true']) > ol { padding-left: 1.5rem; }
:is(.prose, .fi-fo-rich-editor-content [contenteditable='true']) li + li { margin-top: 0.5rem; }

/* ProseMirror wraps list item content in a paragraph, which reaches the stored
   body on save. */
:is(.prose, .fi-fo-rich-editor-content [contenteditable='true']) li > p { margin-block: 0; }

:is(.prose, .fi-fo-rich-editor-content [contenteditable='true']) img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-lg);
}

:is(.prose, .fi-fo-rich-editor-content [contenteditable='true']) figure { margin: 0; }

:is(.prose, .fi-fo-rich-editor-content [contenteditable='true']) figcaption {
  margin-top: 0.625rem;
  color: var(--color-muted);
  font-size: var(--text-label);
  line-height: 1.5;
}

/* Decorative only, so full-strength accent is fine. */
:is(.prose, .fi-fo-rich-editor-content [contenteditable='true']) hr {
  width: 3rem;
  height: 2px;
  margin: 3em auto;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--color-accent);
}

:is(.prose, .fi-fo-rich-editor-content [contenteditable='true']) table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-secondary);
  line-height: 1.6;
}

:is(.prose, .fi-fo-rich-editor-content [contenteditable='true']) :is(th, td) {
  padding: 0.75rem 0.875rem;
  border: 1px solid var(--color-border);
  text-align: left;
  vertical-align: top;
}

:is(.prose, .fi-fo-rich-editor-content [contenteditable='true']) th,
:is(.prose, .fi-fo-rich-editor-content [contenteditable='true']) tr:first-child td {
  background: var(--color-bg-soft);
  color: var(--color-ink);
  font-weight: 700;
}

/* Scroll the table rather than the page. */
@media (max-width: 40rem) {
  :is(.prose, .fi-fo-rich-editor-content [contenteditable='true']) table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
  }
}

:is(.prose, .fi-fo-rich-editor-content [contenteditable='true']) blockquote {
  position: relative;
  margin: 2.5rem 0;
  padding: 0 0 0 2.75rem;
  color: var(--color-ink);
  font-family: var(--font-serif);
  font-size: clamp(1.125rem, 2vw, 1.3125rem);
  font-style: italic;
  line-height: 1.55;
  text-wrap: pretty;
}

:is(.prose, .fi-fo-rich-editor-content [contenteditable='true']) blockquote::before {
  content: '\201C';
  position: absolute;
  top: -0.35em;
  left: 0;
  color: var(--color-accent);
  font-family: var(--font-serif);
  font-size: 3.5rem;
  font-style: normal;
  line-height: 1;
}

:is(.prose, .fi-fo-rich-editor-content [contenteditable='true']) blockquote cite {
  display: block;
  margin-top: 0.75rem;
  color: var(--color-muted);
  font-family: var(--font-sans);
  font-size: var(--text-label);
  font-style: normal;
  letter-spacing: 0.5px;
}

/* Always the pair, never `strong` alone — see CLAUDE.md. */
:is(.prose, .fi-fo-rich-editor-content [contenteditable='true']) :is(b, strong) { color: var(--color-ink); font-weight: 700; }

/* A heading is already bold and coloured: the emphasis tag is a no-op. */
:is(.prose, .fi-fo-rich-editor-content [contenteditable='true']) :is(h1, h2, h3, h4, h5) :is(b, strong) {
  color: inherit;
  font-weight: inherit;
}

/* h6 is the footnote, so emphasis inside it is real: keep it bold. */
:is(.prose, .fi-fo-rich-editor-content [contenteditable='true']) h6 :is(b, strong) {
  color: inherit;
  font-weight: 700;
}

/* Centred to echo the centred title: the article opens and closes on the
   centre line with the prose left-aligned between them. Safe here because no
   post carries more than three tags, so the row does not wrap on desktop. */
.article__tags {
  max-width: var(--prose-width);
  margin: clamp(2rem, 5vw, 3rem) auto 0;
  /* Explicitly zero on the sides: `list-style: none` drops the markers but not
     the UA's 40px indent, which held the row off the prose edge. */
  padding: 1.5rem 0 0;
  border-top: 1px solid var(--color-border);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  list-style: none;
}

.tag {
  padding: 0.3125rem 0.75rem;
  border-radius: var(--radius-pill);
  background: var(--color-bg-soft);
  color: var(--color-primary-dark);
  font-size: var(--text-small);
  font-weight: 500;
  text-decoration: none;
}

.tag:hover { background: var(--color-primary-tint); }

/* Category badge. Deliberately not a .tag: filled, squared-off and uppercase,
   where tags are outlined capsules in sentence case. 8.07:1 on white. */
.badge {
  display: inline-block;
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-sm);
  background: var(--color-primary);
  color: var(--color-white);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.5;
  text-transform: uppercase;
  text-decoration: none;
  transition: background var(--transition);
}

.badge:hover { background: var(--color-primary-600); }

@media (prefers-reduced-motion: reduce) {
  .badge { transition: none; }
}

