/* Signal Brief: card based tab and standalone page (Nov 6, 2026 redesign).
   Shared by the homepage #brief tab and the /brief/ page. Category colours
   are fixed by the design: AI #4F46E5, Quantum #7C3AED, Cloud & DevOps
   #0E7490, Cybersecurity #DC2626, Industry #B45309, Policy #0F766E. */
.brief-ui {
  --b-card: #ffffff;
  --b-ink: var(--ink, #171b24);
  --b-muted: var(--muted, #5a6270);
  --b-line: #e3ddcb;
  --b-soft: #f6f2e7;
  --b-brand: #3F7D20;
  color: var(--b-ink);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  max-width: 1060px;
  margin: 0 auto;
  padding: 8px 4px 30px;
}
:root[data-theme="dark"] .brief-ui {
  --b-card: #1d2019;
  --b-line: #3a3d31;
  --b-soft: #26281e;
  --b-brand: #8CC56A;
}

.brief-ui * { box-sizing: border-box; }

/* Header: the shared heading row (title left, Follow pill right, from
   assets/signal-follow.css) and the one line under it. */
.brief-ui .sg-headrow { padding: 26px 2px 0; }
.brief-ui .sg-pagetitle {
  font-family: Fraunces, Georgia, "Times New Roman", serif;
  font-size: clamp(1.7rem, 4.5vw, 2.5rem); font-weight: 600;
  margin: 0; line-height: 1.15;
}
.bu-desc { color: var(--b-muted); margin: 0 0 6px; padding: 0 2px; max-width: 620px; line-height: 1.5; font-size: .95rem; }

/* Edition bar (Nov 26, 2026): one slim bar under the heading line.
   Previous and next edition day arrows flank the centred date; the
   Calendar link jumps to the Earlier editions section at the bottom. */
.bu-edbar {
  display: flex; align-items: center; gap: 10px;
  max-width: 560px; margin: 10px auto 2px; padding: 0 2px;
}
.bu-ednav {
  width: 40px; height: 40px; border-radius: 50%; flex: 0 0 auto;
  border: 1px solid var(--b-line); background: var(--b-card);
  color: var(--b-ink); font-size: 1.3rem; line-height: 1; cursor: pointer;
  display: grid; place-items: center;
}
.bu-ednav:hover:not([disabled]), .bu-ednav:focus-visible { border-color: var(--b-brand); outline: none; }
.bu-ednav[disabled] { opacity: .35; cursor: default; }
.bu-edmid { flex: 1 1 auto; min-width: 0; text-align: center; }
.bu-eddate {
  font-family: Fraunces, Georgia, serif; font-size: 1.18rem;
  font-weight: 600; line-height: 1.2;
}
.bu-edsub { color: var(--b-muted); font-size: .82rem; margin-top: 2px; }
.bu-callink {
  flex: 0 0 auto; font-size: .85rem; font-weight: 600;
  color: var(--b-brand); text-decoration: none; white-space: nowrap;
}
.bu-callink:hover, .bu-callink:focus-visible { text-decoration: underline; outline: none; }

/* Earlier editions (Nov 26, 2026): the calendar lives at the bottom
   now. A compact strip of the fourteen days ending today (below
   900px only the last seven show), then a card whose expander,
   labelled with the shown month, opens the full month grid only
   when tapped. Edition dates are buttons with a green dot, other
   dates are muted text. */
.bu-earlier { max-width: 640px; margin: 30px auto 0; scroll-margin-top: 120px; }
.bu-earlier-h {
  font-family: Fraunces, Georgia, serif; font-size: 1.05rem;
  font-weight: 600; margin: 0 0 10px;
}
.bu-edstrip { display: grid; grid-template-columns: repeat(14, 1fr); gap: 4px; }
@media (max-width: 899px) {
  .bu-edstrip { grid-template-columns: repeat(7, 1fr); }
  .bu-edstrip > *:nth-child(-n+7) { display: none; }
}
.bu-cal {
  margin: 12px 0 0;
  background: var(--b-card); border: 1px solid var(--b-line);
  border-radius: 16px; padding: 14px 14px 12px;
}
.bu-earlier .bu-strip-exp { width: 100%; }
.bu-cal-full { margin-top: 12px; }
.bu-cal-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.bu-cal-month {
  font-family: Fraunces, Georgia, serif; font-size: 1.12rem; font-weight: 600;
  text-align: center;
}
.bu-cal-arrow {
  width: 40px; height: 40px; border-radius: 50%; flex: 0 0 auto;
  border: 1px solid var(--b-line); background: var(--b-card);
  color: var(--b-ink); font-size: 1.3rem; line-height: 1; cursor: pointer;
  display: grid; place-items: center;
}
.bu-cal-arrow:hover:not([disabled]), .bu-cal-arrow:focus-visible { border-color: var(--b-brand); outline: none; }
.bu-cal-arrow[disabled] { opacity: .35; cursor: default; }
.bu-cal-dow {
  display: grid; grid-template-columns: repeat(7, 1fr);
  text-align: center; color: var(--b-muted);
  font-size: .7rem; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; margin-bottom: 4px;
}
.bu-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.bu-cal-day {
  min-height: 44px; padding: 4px 0; border-radius: 10px;
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 2px;
  font: inherit; font-size: .95rem; color: var(--b-ink);
  background: transparent; border: 1px solid transparent;
}
button.bu-cal-day { cursor: pointer; font-weight: 600; }
button.bu-cal-day:hover, button.bu-cal-day:focus-visible { border-color: var(--b-brand); outline: none; }
.bu-cal-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--b-brand); flex: 0 0 auto;
}
.bu-cal-sel { background: var(--b-ink); color: var(--b-card); }
.bu-cal-today { box-shadow: inset 0 0 0 2px var(--b-brand); }
.bu-cal-off { color: var(--b-muted); opacity: .45; }

/* The month expander: a full width pill in the calendar card; the
   grid under it is rendered only while the calendar is open. */
.bu-strip-exp {
  flex: 1 1 auto; padding: 9px 12px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--b-line); border-radius: 999px;
  background: transparent; color: var(--b-ink); cursor: pointer;
  font: inherit; font-size: .9rem; font-weight: 600;
}
.bu-strip-exp:hover, .bu-strip-exp:focus-visible { border-color: var(--b-brand); outline: none; }
.bu-strip-month { font-family: Fraunces, Georgia, serif; font-size: 1.02rem; }
.bu-strip-chev { color: var(--b-brand); font-size: .8rem; }
.bu-breaking {
  color: #b00020; font-weight: 700; letter-spacing: .08em; font-size: .72rem;
  text-transform: uppercase; display: block; font-family: Inter, sans-serif;
}
/* Category chips */
.bu-chips {
  display: flex; gap: 8px; overflow-x: auto; padding: 16px 26px 6px 2px;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
  /* Soft fade at the right edge while the row can scroll sideways,
     so the cut off chips read as "more this way". The fade covers
     only the last 24px and the 26px right padding keeps the final
     chip clear of it once the row is scrolled fully right. The mask
     fades to transparent, so it works on both themes unchanged. */
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent);
  mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent);
}
.bu-chips::-webkit-scrollbar { display: none; }
.bu-chip {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 13px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--b-line); background: var(--b-card);
  color: var(--b-ink); font: inherit; font-size: .85rem; font-weight: 600;
}
.bu-chip .bu-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.bu-chip .bu-count { color: var(--b-muted); font-weight: 500; font-size: .8rem; }
.bu-chip[aria-pressed="true"] { border-color: var(--b-ink); box-shadow: inset 0 0 0 1px var(--b-ink); }
.bu-chip:focus-visible { outline: 2px solid var(--b-brand); outline-offset: 2px; }

/* Card rail: phones swipe one card per screen; desktop 3 column grid */
.bu-rail {
  display: flex; gap: 14px; overflow-x: auto; padding: 12px 2px 8px;
  scroll-snap-type: x mandatory; scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.bu-rail::-webkit-scrollbar { display: none; }
.bu-card {
  flex: 0 0 100%; scroll-snap-align: center; scroll-snap-stop: always;
  background: var(--b-card); border: 1px solid var(--b-line);
  border-radius: 16px; overflow: hidden; cursor: pointer;
  display: flex; flex-direction: column; text-align: left;
}
.bu-card:focus-visible { outline: 2px solid var(--b-brand); outline-offset: 2px; }
.bu-band { height: 7px; flex: 0 0 auto; }
.bu-card-in { padding: 16px 18px 14px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.bu-card-meta { display: flex; align-items: center; gap: 10px; margin: 0; flex-wrap: wrap; }
.bu-pill {
  color: #fff; border-radius: 999px; padding: 3px 11px;
  font-size: .72rem; font-weight: 700; letter-spacing: .04em;
}
.bu-card-date { color: var(--b-muted); font-size: .78rem; }
.bu-card-h {
  font-family: Fraunces, Georgia, serif; font-weight: 600;
  font-size: 1.28rem; line-height: 1.3; margin: 0;
}
.bu-card-sum {
  margin: 0; line-height: 1.55; font-size: .93rem; color: var(--b-ink);
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical;
  overflow: hidden;
}
.bu-why {
  border-radius: 10px; padding: 10px 12px; margin-top: auto;
  background: var(--b-soft);
}
.bu-why-label {
  display: block; font-size: .66rem; font-weight: 800;
  letter-spacing: .16em; margin-bottom: 4px;
}
.bu-why p { margin: 0; font-size: .88rem; line-height: 1.5; }
.bu-card-foot {
  display: flex; align-items: center; gap: 10px;
  border-top: 1px solid var(--b-line); padding-top: 11px;
}
.bu-counter { font-size: .8rem; color: var(--b-muted); font-weight: 600; }
.bu-src {
  flex: 1; min-width: 0; font-size: .8rem; color: var(--b-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bu-railbar {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  padding: 6px 0 2px;
}
.bu-rbtn {
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--b-line); background: var(--b-card);
  color: var(--b-ink); font-size: 1.15rem; cursor: pointer; display: grid; place-items: center;
}
.bu-rbtn[disabled] { opacity: .35; cursor: default; }
.bu-dots { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; max-width: 60%; }
.bu-dots button {
  width: 8px; height: 8px; border-radius: 50%; border: 0; padding: 0;
  background: var(--b-line); cursor: pointer;
}
.bu-dots button.on { background: var(--b-brand); }
.bu-railcount { font-size: .8rem; color: var(--b-muted); min-width: 44px; text-align: center; }
@media (min-width: 900px) {
  .bu-rail {
    display: grid; grid-template-columns: repeat(3, 1fr);
    overflow: visible; scroll-snap-type: none;
  }
  .bu-card { flex: none; }
  .bu-railbar { display: none; }
}

.bu-empty { color: var(--b-muted); text-align: center; padding: 30px 10px; }

/* Story sheet: bottom sheet on phones, centred dialog up */
.bu-overlay {
  position: fixed; inset: 0; z-index: 9998;
  background: rgba(7, 9, 13, .58);
  display: flex; align-items: flex-end; justify-content: center;
}
.bu-overlay[hidden] { display: none; }
.bu-sheet {
  background: var(--b-card, #fff); color: var(--b-ink, #171b24);
  width: 100%; max-width: 560px; max-height: 92vh; overflow: auto;
  border-radius: 18px 18px 0 0; padding: 20px 20px 22px;
  font-family: Inter, system-ui, sans-serif;
  --b-card: #ffffff; --b-ink: #171b24; --b-muted: #5a6270;
  --b-line: #e3ddcb; --b-soft: #f6f2e7; --b-brand: #3F7D20;
}
:root[data-theme="dark"] .bu-sheet {
  --b-card: #1d2019; --b-ink: #ecede4; --b-muted: #9aa08d;
  --b-line: #3a3d31; --b-soft: #26281e; --b-brand: #8CC56A;
}

@media (min-width: 641px) {
  .bu-overlay { align-items: center; padding: 18px; }
  .bu-sheet { border-radius: 18px; }
}
.bu-sheet-top { display: flex; align-items: flex-start; gap: 10px; }
.bu-sheet-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.bu-sheet-dates { color: var(--b-muted); font-size: .8rem; margin: 0; }
.bu-close {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--b-line); background: transparent;
  color: var(--b-ink); font-size: 19px; line-height: 1; cursor: pointer;
}
.bu-sheet h3 {
  font-family: Fraunces, Georgia, serif; font-size: 1.45rem; font-weight: 600;
  line-height: 1.3; margin: 12px 0 10px;
}
.bu-sheet-sum { line-height: 1.65; margin: 0 0 14px; font-size: .97rem; }
.bu-sheet .bu-why { margin: 0 0 16px; }
.bu-srcs-label {
  font-size: .7rem; font-weight: 800; letter-spacing: .16em;
  color: var(--b-muted); margin: 0 0 7px; text-transform: uppercase;
}
.bu-srcs { list-style: none; margin: 0 0 18px; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.bu-srcs a { color: #0b5cad; font-size: .92rem; }
:root[data-theme="dark"] .bu-srcs a { color: #7db8f0; }
.bu-sheet-share { display: flex; align-items: center; gap: 12px; }
.bu-sheet-page { font-size: .85rem; color: var(--b-muted); }

/* Homepage tab NEW badge */
.tab-new {
  display: inline-block; margin-left: 7px; padding: 1px 7px;
  border-radius: 999px; background: #3F7D20; color: #fff;
  font-size: .6rem; font-weight: 800; letter-spacing: .1em; vertical-align: 2px;
}
.tab-new[hidden] { display: none; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .brief-ui *, .bu-overlay *, .bu-sheet * {
    transition: none !important; animation: none !important;
    scroll-behavior: auto !important;
  }
  .bu-rail { scroll-behavior: auto !important; }
}

/* Share buttons inside Brief cards and the story sheet. These rules live
   in the homepage style.css as well; brief.css is the only stylesheet the
   standalone /brief/ page loads, so they must live here too or the mounted
   buttons render unstyled with an unsized icon (Nov 9, 2026). */
.bu-share-slot { display: inline-flex; margin-left: auto; }
.ss-share-btn{display:inline-flex;align-items:center;gap:7px;padding:8px 15px;border-radius:999px;border:1px solid rgba(135,135,135,.5);background:rgba(135,135,135,.10);color:inherit;font:inherit;font-size:13.5px;font-weight:600;cursor:pointer;white-space:nowrap}
.ss-share-btn svg{width:15px;height:15px;flex:0 0 auto}
.ss-share-btn:hover{border-color:var(--b-brand,#3F7D20)}

/* Themes step 2 (preview): Rose values for the Brief tab and the story
   sheet; Dark fixes for the breaking label and the NEW badge. */
:root[data-tone="rose"] .brief-ui {
  --b-card: #F9E7EC; --b-line: #E2B9C5; --b-soft: #EDCBD5; --b-brand: #2F6A18;
}
:root[data-tone="rose"] .bu-sheet {
  --b-card: #F9E7EC; --b-ink: #2A1A1F; --b-muted: #6F545E;
  --b-line: #E2B9C5; --b-soft: #EDCBD5; --b-brand: #2F6A18;
}
:root[data-theme="dark"] .bu-sheet { --b-pill-ink: #171B24; }
:root[data-tone="rose"] .bu-breaking { color: #9A2620; }
:root[data-theme="dark"] .bu-breaking { color: #E58A80; }
:root[data-tone="rose"] .bu-srcs a { color: #225D96; }
:root[data-tone="rose"] .tab-new { background: #2F6A18; }
:root[data-theme="dark"] .tab-new { background: #8CC56A; color: #171B24; }
:root[data-tone="rose"] .ss-share-btn:hover { border-color: #2F6A18; }

/* Brief phone margin (Nov 26, 2026): the heading block (the heading
   row, the line under it, the edition bar and the chips) takes the
   standard 20px page side margin on phones, the same as the other
   tabs and pages (.sg-in and the front masthead use 20px; the front
   page view sections use 1.25rem at this width). Before: on /brief/
   the block sat 6px from the edge (.brief-ui padding 4px plus the
   elements' own 2px); on the front page tab it sat 26px in (the view
   section's 20px plus the same 6px). Now both surfaces total 20px.
   Laptop layout is unchanged, and the story rail keeps its own
   padding. brief.js marks the surface: bu-on-page for /brief/,
   bu-on-tab for the front page tab. */
@media (max-width: 780px) {
  .brief-ui.bu-on-page .sg-headrow { padding-left: 16px; padding-right: 16px; }
  .brief-ui.bu-on-page .bu-desc { padding-left: 16px; padding-right: 16px; }
  .brief-ui.bu-on-page .bu-edbar { padding-left: 16px; padding-right: 16px; }
  .brief-ui.bu-on-page .bu-chips { padding-left: 16px; }
  .brief-ui.bu-on-tab .sg-headrow { margin-left: -4px; margin-right: -4px; padding-left: 0; padding-right: 0; }
  .brief-ui.bu-on-tab .bu-desc { margin-left: -4px; margin-right: -4px; padding-left: 0; padding-right: 0; }
  .brief-ui.bu-on-tab .bu-edbar { margin-left: -4px; margin-right: -4px; padding-left: 0; padding-right: 0; }
  .brief-ui.bu-on-tab .bu-chips { margin-left: -4px; padding-left: 0; }
}
