/* The line: one band under the masthead, on every page, that says one thing to the reader in front of
   it. From the editor's briefing pack of 25 October 2026 (brief: the line, section 3), on the site's own
   tokens from assets/design/v2.css. The shaping rules per role are generated into shape.css by
   admin/build/design.py from assets/design/line/roles.json; this file is the hand-written part.

   The attributes the boot script writes on <html> before the first paint:
     data-role  exec | general | security | engineer | journalist | researcher | everything
     data-depth plain | technical | deep        data-moment  one of the eleven moments
     data-confirmed  present once the reader has answered   data-gate  present on a page for others */

:root{
  --ln-h:52px;                       /* the resting row, reserved before first paint */
  --ln-calm-bg:#e6f2f0; --ln-calm-fg:#0f1b2d; --ln-calm-edge:#c4e0db;
  --ln-ask-bg:#ffffff;  --ln-ask-edge:#0f766e;
  --ln-news-bg:#0f1b2d; --ln-news-fg:#f5f3ee; --ln-news-dot:#7fd6c9;
  --ln-worn-bg:#fdf1e2; --ln-worn-fg:#3d2604; --ln-worn-edge:#ecd9bf;
  --ln-gate-edge:#b45309;
}
@media (prefers-color-scheme:dark){:root:not([data-theme="light"]){
  --ln-calm-bg:#13322f; --ln-calm-fg:#e7ecf3; --ln-calm-edge:#1e4a45;
  --ln-ask-bg:#151b23;
  --ln-worn-bg:#2a2112; --ln-worn-fg:#f0e4d0; --ln-worn-edge:#4a3a1e;
}}
:root[data-theme="dark"]{
  --ln-calm-bg:#13322f; --ln-calm-fg:#e7ecf3; --ln-calm-edge:#1e4a45;
  --ln-ask-bg:#151b23;
  --ln-worn-bg:#2a2112; --ln-worn-fg:#f0e4d0; --ln-worn-edge:#4a3a1e;
}

/* ---------------------------------------------------------------- the line itself */
.ln{position:sticky;top:0;z-index:25;min-height:var(--ln-h);background:var(--ln-calm-bg);color:var(--ln-calm-fg);
  border-bottom:1px solid var(--ln-calm-edge);display:flex;flex-direction:column;gap:.7rem;
  padding:.55rem var(--gut,clamp(16px,2.6vw,48px));font-size:.95rem}
.ln[data-size="open"]{padding-top:.85rem;padding-bottom:.85rem}
.ln[data-size="panel"]{padding-top:1.4rem;padding-bottom:1.4rem}
.ln[data-tone="ask"]{background:var(--ln-ask-bg);border-bottom:3px solid var(--ln-ask-edge)}
.ln[data-tone="news"]{background:var(--ln-news-bg);color:var(--ln-news-fg);border-bottom-color:var(--ln-news-bg)}
.ln[data-tone="borrowed"]{background:var(--ln-worn-bg);color:var(--ln-worn-fg);border-bottom-color:var(--ln-worn-edge)}
.ln[data-tone="gate"]{background:var(--ln-worn-bg);color:var(--ln-worn-fg);border-bottom:3px solid var(--ln-gate-edge)}
.ln .ln-row{display:flex;align-items:center;gap:.9rem;min-height:calc(var(--ln-h) - 1.1rem)}
.ln-msg{flex:1;min-width:0}
.ln-msg b{font-weight:700}
.ln[data-size="panel"] .ln-msg{font-size:1.02rem}
.ln[data-size="panel"] .ln-msg b{font-size:1.3rem;font-family:var(--serif,Georgia,serif);display:block;margin-bottom:.2rem}

/* who: the chip, always first, always tappable */
.ln-chip{flex:none;display:inline-flex;align-items:center;gap:.4rem;font:inherit;font-size:.86rem;font-weight:600;
  padding:.3rem .75rem;border-radius:999px;border:1px solid var(--ln-ask-edge);background:var(--surface,#fff);
  color:inherit;cursor:pointer;white-space:nowrap}
.ln[data-tone="news"] .ln-chip{background:#1a2740;border-color:#3a4a63;color:var(--ln-news-fg)}
.ln[data-tone="borrowed"] .ln-chip,.ln[data-tone="gate"] .ln-chip{border-color:var(--ln-gate-edge)}
.ln-dot{width:7px;height:7px;border-radius:999px;background:var(--brand,var(--accent,#0f766e))}
.ln-dot[data-dot="amber"]{background:#d97706}
.ln-dot[data-dot="orange"]{background:var(--ln-gate-edge)}
.ln[data-tone="news"] .ln-dot{background:var(--ln-news-dot)}

/* the picture of the page's data: one, never wider than 140px */
.ln-pic{flex:none;display:flex;flex-direction:column;gap:.18rem;align-items:flex-end}
.ln-pic .b{display:flex;width:140px;height:10px;border-radius:3px;overflow:hidden}
.ln-pic .l{font-size:.68rem;opacity:.85}

/* do: at most two actions */
.ln-acts{display:flex;gap:.4rem;flex-wrap:wrap;align-items:center}
.ln-act{font:inherit;font-size:.82rem;font-weight:700;padding:.32rem .75rem;border-radius:8px;border:1px solid transparent;
  background:var(--brand,var(--accent,#0f766e));color:#fff;cursor:pointer;white-space:nowrap}
.ln-act[data-second]{background:transparent;border-color:var(--line-2,#c9c3b4);color:inherit}
.ln[data-tone="news"] .ln-act{background:var(--ln-news-dot);color:var(--ln-news-fg2,#0f1b2d)}
.ln[data-tone="news"] .ln-act[data-second]{background:transparent;border-color:#3a4a63;color:#e3e8ef}
.ln[data-tone="borrowed"] .ln-act,.ln[data-tone="gate"] .ln-act{background:var(--ln-gate-edge);color:#fff}
.ln[data-tone="borrowed"] .ln-act[data-second],.ln[data-tone="gate"] .ln-act[data-second]{background:transparent;color:inherit}
.ln-others{font-size:.84rem;display:flex;flex-wrap:wrap;gap:.3rem;align-items:center}
.ln-others .ln-act{background:var(--surface,#fff);border-color:var(--line-2,#c9c3b4);color:inherit;font-weight:600}
.ln-items{display:flex;flex-direction:column;gap:.35rem;font-size:.9rem}
.ln-items .i{display:flex;gap:.6rem;align-items:baseline}
.ln-tag{flex:none;font-size:.66rem;font-weight:700;letter-spacing:.04em;text-transform:uppercase;
  padding:.08rem .45rem;border-radius:6px;background:var(--ln-worn-bg);color:var(--ln-worn-fg)}
.ln-tag[data-t="New"]{background:#e8eef9;color:#1e4fa3}
.ln-tag[data-t="This page"]{background:#e6f2f0;color:#0b5a54}
.ln[data-size="line"] .ln-items,.ln[data-size="line"] .ln-open-acts{display:none}
.ln[data-size="line"] .ln-row .ln-acts{display:flex}

/* ---------------------------------------------------------------- the control, behind the chip */
.ln-sheet{position:fixed;right:var(--gut,clamp(16px,2.6vw,48px));top:calc(var(--ln-h) + 1rem);width:min(430px,calc(100vw - 2*var(--gut,clamp(16px,2.6vw,48px))));
  max-height:calc(100vh - var(--ln-h) - 2rem);overflow:auto;background:var(--surface,var(--panel,#fff));color:var(--ink,var(--fg,#0f1b2d));
  border:1px solid var(--line);border-radius:var(--r,14px);box-shadow:0 18px 50px rgba(15,27,45,.22);padding:1rem 1.1rem;z-index:40}
.ln-sheet[hidden]{display:none}
.ln-sheet h3{font-size:.74rem;letter-spacing:.08em;text-transform:uppercase;color:var(--muted,var(--dim,#64748b));margin:0 0 .35rem}
.ln-sheet section{margin:0 0 .9rem}
.ln-seg{display:flex;flex-wrap:wrap;gap:.3rem}
.ln-seg button{font:inherit;font-size:.86rem;border:1px solid var(--line-2,var(--line2,#d4cfc3));background:var(--surface-2,var(--bg,#fbfaf7));color:var(--ink,var(--fg,#0f1b2d));
  border-radius:9px;padding:.35rem .6rem;cursor:pointer;text-align:left;line-height:1.25}
.ln-seg button small{display:block;color:var(--muted,var(--dim,#64748b));font-size:.72rem}
.ln-seg button[aria-pressed="true"]{background:var(--ink,var(--fg,#0f1b2d));color:var(--surface,var(--panel,#fff));border-color:var(--ink,var(--fg,#0f1b2d))}
.ln-seg button[aria-pressed="true"] small{color:color-mix(in srgb,var(--surface,var(--panel,#fff)) 75%,transparent)}
.ln-seg button[data-role="everything"]{border-style:dashed}
.ln-sheet .ln-foot{font-size:.8rem;color:var(--muted,var(--dim,#64748b));display:flex;flex-wrap:wrap;gap:.3rem .8rem;margin:0}
.ln-sheet .ln-foot button{font:inherit;font-size:.8rem;border:0;background:none;color:var(--brand,var(--accent,#0f766e));text-decoration:underline;cursor:pointer;padding:0}

/* a quiet word after an action, never a second message in the line */
.ln-toast{position:fixed;left:50%;transform:translateX(-50%);bottom:1.2rem;z-index:50;background:var(--ink,var(--fg,#0f1b2d));color:var(--surface,var(--panel,#fff));
  border-radius:12px;padding:.6rem 1rem;font-size:.88rem;box-shadow:0 12px 30px rgba(15,27,45,.3);max-width:min(520px,92vw)}
.ln-toast small{display:block;opacity:.75;font-size:.78rem}
.ln-toast[hidden]{display:none}

/* ---------------------------------------------------------------- the page under the line */
.lnp{display:flex;flex-direction:column;gap:clamp(.9rem,1.4vw,1.3rem);padding-top:clamp(1rem,1.8vw,1.6rem)}
.lnp .lp{display:flex;flex-direction:column;gap:.4rem;min-width:0}
.lnp.dim .lp{opacity:.55}
.lp-badge{align-self:flex-start;font-size:.72rem;font-weight:700;padding:.1rem .5rem;border-radius:6px;
  background:var(--ln-worn-bg);color:var(--ln-worn-fg)}
.lp-badge[data-kind="live"]{background:var(--band,#0f1b2d);color:var(--ln-news-dot)}
.lp-fold{display:flex;align-items:center;gap:.7rem;padding:.6rem .9rem;border-radius:12px;background:var(--surface-2,var(--bg,#fbfaf7));
  border:1px solid var(--line);color:var(--ink-2,var(--fg,#334155));font-size:.88rem}
.lp-fold b{color:var(--ink,var(--fg,#0f1b2d))}
.lp-fold .ln-tag{background:var(--surface,var(--panel,#fff))}
.lp-fold button{font:inherit;font-size:.85rem;margin-left:auto;border:0;background:none;color:var(--brand,var(--accent,#0f766e));font-weight:600;cursor:pointer}
.lnp .lp.is-folded > :not(.lp-fold){display:none}
.lnp .lp:not(.is-folded) > .lp-fold{display:none}
.lp-more{align-self:center;margin:.6rem 0 1.2rem;text-align:center}
.lp-more button{font:inherit;border:0;border-radius:999px;background:var(--brand,var(--accent,#0f766e));color:#fff;padding:.55rem 1.1rem;font-weight:700;cursor:pointer}
html[data-role="everything"] .lp-more{display:none}

/* the depth variants of one fact: the reader sees one */
.lv{display:none}
.lv[data-depth~="plain"]{display:revert}
html[data-depth="technical"] .lv{display:none}
html[data-depth="technical"] .lv[data-depth~="technical"]{display:revert}
html[data-depth="deep"] .lv{display:none}
html[data-depth="deep"] .lv[data-depth~="deep"]{display:revert}

/* the prototype's own masthead and tabs */
.ln-mast{display:flex;align-items:center;gap:1.4rem;min-height:56px;padding:0 var(--gut,clamp(16px,2.6vw,48px));background:var(--surface,var(--panel,#fff));
  border-bottom:1px solid var(--line)}
.ln-mast .lg{font-family:var(--serif,Georgia,serif);font-weight:700;font-size:1.15rem;color:var(--ink,var(--fg,#0f1b2d));text-decoration:none;white-space:nowrap}
.ln-mast .lg b{background:var(--alert,#b3261e);color:#fff;border-radius:6px;padding:.1rem .4rem;margin-right:.4rem;font-family:var(--sans);font-size:.78rem;vertical-align:2px}
.ln-mast nav{display:flex;gap:1rem;overflow-x:auto;scrollbar-width:none;font-size:.92rem}
.ln-mast nav a{color:var(--ink-2,var(--fg,#334155));text-decoration:none;white-space:nowrap;padding:.2rem 0}
.ln-mast nav a[aria-current]{color:var(--ink,var(--fg,#0f1b2d));font-weight:700;box-shadow:inset 0 -2px 0 var(--brand,var(--accent,#0f766e))}
.ln-mast .menu-for{margin-left:auto;font-size:.74rem;color:var(--muted,var(--dim,#64748b));white-space:nowrap}

@media (max-width:860px){
  :root{--ln-h:46px}
  /* on a phone the line never holds the top of the screen: it scrolls away with the page, because locking it
     costs too much of a small screen (the editor, 25 October, on an iPhone). The chip comes back by scrolling up. */
  .ln{position:static;font-size:.88rem}
  .ln-pic{display:none}
  .ln .ln-row{flex-wrap:wrap;gap:.5rem}
  .ln-msg{flex:1 1 100%}
  .ln[data-size="open"],.ln[data-size="panel"]{padding-top:.7rem;padding-bottom:.7rem;gap:.5rem}
  .ln[data-size="panel"] .ln-msg{font-size:.95rem}
  .ln[data-size="panel"] .ln-msg b{font-size:1.1rem;margin-bottom:.1rem}
  .ln-others{font-size:.8rem;gap:.25rem}
  .ln-others .ln-act{font-size:.78rem;padding:.26rem .55rem}
  .ln-sheet{left:0;right:0;top:auto;bottom:0;width:auto;max-height:82vh;border-radius:16px 16px 0 0}
  .ln-mast .menu-for{display:none}
}
@media (prefers-reduced-motion:reduce){::view-transition-group(*),::view-transition-old(*),::view-transition-new(*){animation:none!important}}

/* the catalogue page: every line the rules produce, side by side */
.ln-cat-row{display:grid;grid-template-columns:minmax(0,230px) minmax(0,1fr);gap:1rem;align-items:start;margin:.6rem 0}
.ln-cat-head small{display:block;color:var(--muted,var(--dim,#64748b));font-size:.74rem}
.ln-cat-line{position:static;border:1px solid var(--line);border-radius:10px;padding:.5rem .8rem;min-height:0}
.ln-cat-h{margin:1.8rem 0 .4rem;padding-bottom:.3rem;border-bottom:2px solid var(--ink,var(--fg,#0f1b2d))}
@media (max-width:860px){.ln-cat-row{grid-template-columns:minmax(0,1fr)}}

/* on the live pages (25 October): the site's own bar is the sticky one, so the line sits under it and scrolls with the
   page; and the line's first-visit question replaces the bar that asked the newcomer who they are (never two messages) */
nav.site ~ .ln{position:static}
html[data-role] .pbar-new{display:none}
.ln-views{margin:2rem 0 1rem;padding-top:.8rem;border-top:1px solid var(--line,#e5e1d8);font-size:.88rem;color:var(--dim,#6b6b66)}
.ln-views span{margin-right:.3rem}
/* the older "Reading as ..." bar says who the reader is, which is the line's job now: one message at a time.
   Its reading path ("Next: your briefing") is to come back as one of the line's actions (board). */
html[data-role] .pbar{display:none}

/* the quiet top (26 October, the editor: "a massive salad of links and data; some of it is important, but it should
   not be so much in your face"). The line lines up with the bar and the page, not with the window's edge; asking is
   the page's own background and a thin rule, not a white slab with a thick edge; and outside the front page's first
   visit the question is one row (the chip, the question, the answer, "Change"). */
nav.site ~ .ln{padding-left:max(16px,calc((100% - 1680px)/2 + 16px));padding-right:max(16px,calc((100% - 1680px)/2 + 16px))}
nav.site ~ .ln[data-tone="ask"]{background:var(--bg,#fbfaf7);border-bottom:1px solid var(--line,#e5e1d8)}
nav.site ~ .ln[data-size="open"]{padding-top:.45rem;padding-bottom:.45rem;gap:.3rem}
nav.site ~ .ln[data-size="open"] .ln-row .ln-acts{display:flex;flex:none}
nav.site ~ .ln[data-size="open"] .ln-items{font-size:.84rem;opacity:.85}
nav.site ~ .ln[data-size="panel"]{padding-top:1rem;padding-bottom:1rem}
nav.site ~ .ln .ln-act{font-size:.8rem;padding:.26rem .65rem}
@media (max-width:860px){
  nav.site ~ .ln[data-size="open"] .ln-row .ln-acts{flex:1 1 100%}
}
/* on the live pages the line takes the site's own theme tokens (Newsprint, Paper, Night, Ember), not the prototype's
   fixed light and dark palettes: under Night it was a bright band across a dark page, and under a light theme on a
   computer set to dark it went dark. The news tone keeps its own dark band in every theme. */
nav.site ~ .ln{--ln-calm-bg:color-mix(in srgb,var(--accent) 8%,var(--panel));--ln-calm-fg:var(--fg);--ln-calm-edge:var(--line);
  --ln-ask-bg:var(--bg);--ln-ask-edge:var(--accent);
  --ln-worn-bg:color-mix(in srgb,#b45309 12%,var(--panel));--ln-worn-fg:var(--fg);--ln-worn-edge:var(--line)}
nav.site ~ .ln .ln-chip{background:var(--panel);color:var(--fg)}
nav.site ~ .ln:is([data-tone="calm"],[data-tone="ask"]) .ln-act{background:var(--accent);color:var(--on-accent,#fff)}
nav.site ~ .ln:is([data-tone="calm"],[data-tone="ask"]) .ln-act[data-second]{background:transparent;color:inherit;border-color:var(--line2)}
