/* synced from the-clowder @ 35feed13b513fa83edd3b750e4ea9a7ceed066a3 2026-10-18; standards release v1.11.0; manifest shell */

    /* ─── PALETTE TOKENS ──────────────────────────────────────
       Production palette is fixed at "ink". The token sets for
       slate and newsprint are kept so a future issue can switch
       by changing body[data-palette] without restyling. The
       palette switch in the header offers Auto (default, follows
       system), Light, and Dark.
    ─────────────────────────────────────────────────────────── */

    /* SHARED */
    :root {
      --clowder: #3D3966;      /* logo purple — never changes */
      --clowder-mid: #5954A0;
      --clowder-light: #C4C2E0;
      --white: #FFFFFF;
      --rule: 1px solid var(--accent);
      --prose-measure: 42rem;  /* 65-75 chars/line at 17px — body prose stays constrained */
      /* Status-color token group (standards/components.md). Light values are the
         default; [data-palette="dark"] overrides for dark mode. The portal maps
         its lifecycle states onto these five semantics (received / intake-cleaning /
         fact-checking / needs-info → warn, approved / published → good, researching →
         brand, drafting → info, rejected → bad). */
      --status-warn: #92400e;
      --status-good: #065f46;
      --status-brand: var(--clowder);
      --status-info: #1e40af;
      --status-bad: #991b1b;
      /* standards/typography.md defines the 16px floor for text content and its qualifying secondary-metadata exception. */
    }

    /* LIGHT — The Printed Dossier. Warm paper tones, layered surfaces,
       ink text, and purple as editorial ink. The "Light" switcher option. */
    [data-palette="light"] {
      --bg:       #F3F0E8;      /* warm paper page ground */
      --bg-2:     #E9E4D8;      /* secondary panels */
      --reading-surface: #FBF9F4;  /* main reading column — warmer than page */
      --fg:       #25232A;      /* ink */
      --fg-muted: #69646D;      /* muted text */
      --accent:   #9D7939;      /* aged gold — borders/markers only */
      --eyebrow-fg: #735A20;     /* darkened gold — mono eyebrows */
      --link-fg:    #735A20;      /* same darkened gold for in-body links */
      --strong-fg:  #25232A;      /* ink; strong-but-not-linked emphasis, not a link */
      --header-bg: var(--clowder);
      --header-fg: var(--white);
      --header-rule: var(--clowder-light);  /* 3px header bottom border */
      --takeaway-bar: var(--clowder-mid);   /* .takeaway paraphrase bar */
      --tag-bg:    var(--clowder-light);
      --tag-fg:    var(--clowder);
      --quote-target: var(--clowder);  /* deep logo purple on warm paper, 3:1+ non-text contrast (WCAG 1.4.11) */
      --status-warn: #92400e;
      --status-good: #065f46;
      --status-brand: var(--clowder);
      --status-info: #1e40af;
      --status-bad: #991b1b;
    }

    /* DARK — The Night Desk. Warm charcoal, not pure black. Dimensional
       elevation through edge contrast and background shifts. The "Dark"
       switcher option. */
    [data-palette="dark"] {
      --bg:       #17161C;      /* warm charcoal outer background */
      --bg-2:     #292733;      /* raised sections */
      --reading-surface: #201F27;  /* reading column — lighter than page */
      --fg:       #ECE8DF;      /* warm cream text */
      --fg-muted: #AAA4B0;      /* muted text */
      --accent:   #38C9B4;
      --accent-fg:#111018;
      --eyebrow-fg: #A9A2D2;      /* light purple — editorial markers */
      --link-fg:    #A9A2D2;       /* soft lavender for links */
      --strong-fg:  #ECE8DF;      /* warm cream ink; strong-but-not-linked emphasis, not a link */
      --header-bg: #1E1C2A;
      --header-fg: var(--white);
      --header-rule: var(--accent);         /* 3px header bottom border */
      --takeaway-bar: var(--clowder-light); /* .takeaway paraphrase bar */
      --tag-bg:    #2B2948;
      --tag-fg:    var(--clowder-light);
      --quote-target: var(--clowder-light);  /* light purple on charcoal, 3:1+ non-text contrast (WCAG 1.4.11) */
      --status-warn: #fbbf24;
      --status-good: #34d399;
      --status-brand: #c4c2e0;
      --status-info: #60a5fa;
      --status-bad: #f87171;
    }

    /* ─── BASE ────────────────────────────────────────────── */
    *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

    body {
      font-family: 'DM Sans', system-ui, sans-serif;
      background: var(--bg);
      color: var(--fg);
      font-size: 17px;          /* Prose baseline. standards/typography.md defines the 16px floor for text content and its qualifying secondary-metadata exception. */
      line-height: 1.65;
    }

    a { color: var(--link-fg); text-decoration: none; }
    a:hover { text-decoration: underline; }
    /* Links in running text carry an underline. --link-fg cannot mark a link
       by color alone against the text around it (WCAG 1.4.1), so the
       underline does it. A link that stands alone, such as a nav item, needs
       none. Class rules below that set text-decoration: none are standalone
       links and keep winning on specificity. */
    p a, li a, dd a { text-decoration: underline; text-underline-offset: 2px; }
    header a, nav a { text-decoration: none; }

    /* Section label — the small mono eyebrow over each titled block.
       Hierarchy comes from family (mono), color (accent), and letter
       spacing — NOT from uppercase transforms and NOT from sub-16px
       sizing. */
    .section-title {
      font-family: 'DM Mono', monospace;
      font-size: 1rem;
      font-weight: 500;
      letter-spacing: .14em;
      color: var(--eyebrow-fg);
      margin-bottom: 1rem;
    }

    /* ─── PALETTE FLYOUT (header) ──────────────────────────────────
       A compact dropdown in the header bar. The trigger is a small
       pill showing the current scheme's icon + label + a chevron;
       opening the native <details> drops a three-option panel
       (Auto / Light / Dark) below it. Auto (default) follows the
       system color-scheme via prefers-color-scheme; Light and Dark
       are explicit overrides. setPalette() resolves 'auto', sets
       body[data-palette], updates the trigger label, and marks the
       active option. A matchMedia listener re-resolves auto when
       the system preference flips. Compact on every viewport so it
       never forces horizontal overflow on mobile.
    ─────────────────────────────────────────────────────────── */
    .palette-flyout {
      margin-left: auto;
      position: relative;
      flex-shrink: 0;
    }
    .palette-flyout-trigger {
      font-family: 'DM Mono', monospace;
      font-size: 1rem;
      letter-spacing: .04em;
      color: white;
      background: rgba(255,255,255,.14);
      border: 0;
      border-radius: 1.5rem;
      padding: .4rem .75rem;
      cursor: pointer;
      list-style: none;
      display: inline-flex;
      align-items: center;
      gap: .5rem;
      white-space: nowrap;
    }
    .palette-flyout-trigger::-webkit-details-marker { display: none; }
    .palette-flyout-trigger .pf-icon { width: 1em; text-align: center; }
    .palette-flyout-trigger .pf-chevron { opacity: .7; font-size: .8em; }
    .palette-flyout[open] .palette-flyout-trigger .pf-chevron { transform: rotate(180deg); }
    .palette-flyout-panel {
      position: absolute;
      top: 100%;
      right: 0;
      margin-top: .4rem;
      background: var(--clowder);
      padding: .4rem;
      border-radius: 6px;
      box-shadow: 0 4px 16px rgba(0,0,0,.3);
      display: flex;
      flex-direction: column;
      gap: .15rem;
      min-width: 8rem;
      z-index: 80;
    }
    .palette-flyout-panel button {
      font-family: 'DM Mono', monospace;
      font-size: 1rem;
      letter-spacing: .04em;
      color: rgba(255,255,255,.8);
      background: transparent;
      border: 0;
      border-radius: 4px;
      padding: .45rem .6rem;
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: .5rem;
      text-align: left;
      transition: background .15s, color .15s;
    }
    .palette-flyout-panel button:hover { background: rgba(255,255,255,.12); color: white; }
    .palette-flyout-panel button.active { background: rgba(255,255,255,.2); color: white; }
    .palette-flyout-panel button .pf-icon { width: 1.2em; text-align: center; }

    /* ─── HEADER ──────────────────────────────────────────── */
    /* Scoped to the site header, a direct child of body. A header inside
       main, an article, or a section is content and keeps its own style. */
    body > header {
      background: var(--header-bg);
      color: var(--header-fg);
      border-bottom: 3px solid var(--header-rule);
    }

    .header-inner {
      max-width: 1160px;
      margin: 0 auto;
      padding: 1.25rem 2rem;
      display: flex;
      align-items: center;
      gap: 1.25rem;
    }
    /* The palette switch sits at the right end of the header bar.
       margin-left:auto pushes it right of the masthead. */

    .logo-wrap {
      position: relative;
      flex-shrink: 0;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      /* Lift the logo up so it clears the header's bottom border line.
         margin-top: -25% would resolve against the container's WIDTH
         (~1160px -> -290px) and throw the logo off-screen. translateY
         is relative to the element's own height (64px -> -16px), the
         real intent. The spotlight travels with the logo. */
      align-self: flex-start;
      transform: translateY(-15%);
    }
    /* Spotlight behind the logo. A soft radial-gradient glow sits
       behind the cat so the purple-on-purple logo reads against the
       purple header ground. Subtle: a light-tinted radial that fades
       to transparent before the wrap edge, so the header stays one
       calm field and the logo just lifts off it. */
    .logo-wrap::before {
      content: "";
      position: absolute;
      inset: -18px -22px;
      background: radial-gradient(
        ellipse 55% 75% at 50% 50%,
        color-mix(in srgb, var(--header-bg) 0%, #fff 0%) 0%,
        transparent 70%);
      pointer-events: none;
      z-index: 0;
    }
    /* The glow color is a per-palette token so the spotlight reads on
       both the light (purple header) and dark (slate header) palettes. */
    [data-palette="light"] .logo-wrap::before,
    [data-palette="dark"] .logo-wrap::before {
      background: radial-gradient(
        ellipse 58% 52% at 58% 62%,
        rgba(255, 255, 255, 1) 0%,
        rgba(255, 255, 255, 0.5) 45%,
        transparent 72%);
    }

    .logo-img {
      height: 64px;
      width: auto;
      flex-shrink: 0;
      position: relative;
      z-index: 1;
    }

    .masthead { display: flex; flex-direction: column; }

    .masthead-name {
      font-family: 'Playfair Display', Georgia, serif;
      font-size: 2rem;
      font-weight: 700;
      letter-spacing: -.5px;
      line-height: 1;
    }

    .masthead-tagline {
      font-family: 'DM Mono', monospace;
      font-size: 1rem;
      letter-spacing: .12em;
      opacity: .7;
      margin-top: .35rem;
    }

    /* ─── RESPONSIVE ──────────────────────────────────────── */
    @media (max-width: 860px) {
      /* ── Mobile header: palette upper-right, logo + masthead centered ──
         Desktop lifts the logo with translateY(-15%) + align-self
         flex-start so the cat clears the header border. On a phone
         that lift reads as a wonky float — the masthead sits
         centered while the logo pokes up. Pin the palette flyout to
         the upper-right corner of the header and let the logo +
         masthead row re-center vertically. */
      body > header { position: relative; }
      .header-inner {
        padding: 1rem 1rem 1.1rem;
        gap: 1rem;
        align-items: center;
      }
      /* drop the desktop lift on mobile so the logo re-centers */
      .logo-wrap {
        align-self: center;
        transform: none;
      }
      /* the spotlight can shrink a touch on a small header */
      .logo-img { height: 52px; }
      /* pin the palette flyout to the header's upper-right corner */
      .palette-flyout {
        position: absolute;
        top: .65rem;
        right: .75rem;
        margin-left: 0;
      }
      /* keep the open panel anchored under the trigger, not the header */
      .palette-flyout-panel {
        right: 0;
        top: 100%;
      }
    }
