/* Site-wide "Tools" menu (docs/tools-v2-plan.md §1). Linked from partials/site-header*.html,
   so it must work on every CSS stack those pages carry: everything is scoped tm-*, and the
   only rules that reach outside are the few that seat the trigger inside .top-cta. */

.tm-trigger {
  display: inline-flex; align-items: center; gap: 6px; min-height: 42px; padding: 0 12px;
  border: 0; border-radius: 10px; background: transparent; color: #fff; cursor: pointer;
  font: 700 15px/1 var(--so-font, Montserrat, system-ui, sans-serif); white-space: nowrap; flex: none;
}
.tm-trigger:hover, .tm-trigger[aria-expanded="true"] { background: rgba(255,255,255,.10); }
.tm-trigger:focus-visible { outline: 2px solid var(--so-gold-400, #d4ba7a); outline-offset: 2px; }
.tm-trigger .tm-grid { display: none; }
.tm-chev { transition: transform .18s var(--so-ease, ease); }
.tm-trigger[aria-expanded="true"] .tm-chev { transform: rotate(180deg); }

/* Pages on site.css hide the whole .top-cta under 640px; keep the trigger there. */
@media (max-width: 640px) {
  body:not([data-np2]) .site-top:not(.intl) .top-cta { display: flex; margin-left: 0; gap: 0; }
  body:not([data-np2]) .site-top:not(.intl) .top-cta > :not(.tm-trigger) { display: none; }
}
@media (max-width: 899px) {
  .tm-trigger { min-height: 40px; padding: 0 9px; gap: 5px; font-size: 14px; }
  .tm-trigger .tm-grid { display: block; }
  .tm-trigger .tm-chev { display: none; }
}
/* Phone: the trigger stacks its label under the icon. On the np2 pages (logo + tagline + Pricing)
   there is still no room at 390, so the tagline yields there: wrapping it grew the header 12px. */
@media (max-width: 520px) {
  .tm-trigger { flex-direction: column; justify-content: center; gap: 1px; min-width: 44px; padding: 0 6px; font-size: 10.5px; letter-spacing: .02em; }
  body[data-np2] .site-top:has(.tm-trigger) .so-tag { white-space: normal !important; max-width: 150px; font-size: 11px; line-height: 1.15; }
}
@media (max-width: 420px) {
  .tm-trigger { min-width: 40px; padding: 0 8px; }
  .tm-trigger > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .tm-trigger .tm-grid { width: 22px; height: 22px; }
}
/* At the narrowest widths the "Powered by" label yields so nothing overflows. */
@media (max-width: 420px) {
  .site-top:has(.tm-trigger) .so-by span { display: none; }
  .site-top:has(.tm-trigger) .so-by b { font-size: 13px; }
}

/* ---- backdrop (desktop): dims the page under the panel; a click on it closes (tools-menu.js) ---- */
.tm-scrim { position: fixed; left: 0; right: 0; bottom: 0; top: var(--tm-top, 72px); z-index: 899; background: rgba(11,29,50,.42); }
.tm-scrim[hidden] { display: none; }
.tm-scrim.tm-anim { animation: tm-fade .18s ease both; }
@keyframes tm-fade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .tm-scrim.tm-anim { animation: none; } }

/* ---- panel: desktop ---- */
.tm-panel {
  /* One tint per group, all from the brand family: navy, gold, slate ink and a warm stone. */
  --tm-org: var(--so-navy-500, #1b4b7a); --tm-opt: var(--so-gold-600, #a8893e); --tm-to: var(--so-navy-700, #133353);
  --tm-from: var(--so-gold-800, #7a601c); --tm-edit: var(--so-ink-600, #3f4a56); --tm-sec: light-dark(#6f6450, #c9bfa8);
  position: fixed; left: 0; right: 0; top: var(--tm-top, 72px); z-index: 900;
  max-height: calc(100vh - var(--tm-top, 72px)); overflow: auto; overscroll-behavior: contain;
  background: var(--so-paper-000, #fff); color: var(--so-ink-900, #0e0e0e);
  border-bottom: 1px solid var(--so-stone-200, #e3ddd0); box-shadow: var(--so-shadow-dialog, 0 24px 64px rgba(20,33,61,.22));
  font-family: var(--so-font, Montserrat, system-ui, sans-serif); text-align: left;
}
.tm-panel[hidden] { display: none; }
.tm-panel.tm-anim { animation: tm-in .18s var(--so-ease, ease) both; }
@keyframes tm-in { from { opacity: 0; transform: translateY(-6px); } }
@media (prefers-reduced-motion: reduce) { .tm-panel.tm-anim { animation: none; } .tm-chev { transition: none; } }

.tm-in { max-width: 1280px; margin: 0 auto; padding: 28px 32px 0; box-sizing: border-box; }
.tm-top { display: none; }
.tm-cols { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 20px; }
.tm-h { margin: 0 0 10px; padding: 0 8px; font: 700 12px/1.3 var(--so-font, sans-serif); letter-spacing: .06em; text-transform: uppercase; color: var(--so-ink-500, #55606c); }
.tm-col ul { list-style: none; margin: 0; padding: 0; }
.tm-col a {
  display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 4px 8px; border-radius: 8px;
  color: var(--so-ink-900, #0e0e0e); font: 600 14.5px/1.25 var(--so-font, sans-serif); text-decoration: none;
}
.tm-col a:hover { background: var(--so-navy-050, #ebedef); text-decoration: none; }
.tm-col a:focus-visible { outline: 2px solid var(--so-navy-500, #1b4b7a); outline-offset: 0; }
.tm-ic {
  display: grid; place-items: center; flex: none; width: 30px; height: 30px; border-radius: 8px;
  color: var(--tm-c); background: color-mix(in srgb, var(--tm-c) 12%, transparent);
}
.tm-org { --tm-c: var(--tm-org); } .tm-opt { --tm-c: var(--tm-opt); } .tm-to { --tm-c: var(--tm-to); }
.tm-from { --tm-c: var(--tm-from); } .tm-edit { --tm-c: var(--tm-edit); } .tm-sec { --tm-c: var(--tm-sec); }

.tm-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  margin-top: 22px; padding: 16px 8px 20px; border-top: 1px solid var(--so-stone-200, #e3ddd0);
  font: 600 14px/1.4 var(--so-font, sans-serif);
}
.tm-foot a { color: var(--so-navy-500, #1b4b7a); text-decoration: none; display: inline-flex; align-items: center; min-height: 36px; gap: 6px; }
.tm-foot a:hover { text-decoration: underline; }
.tm-foot a:focus-visible { outline: 2px solid var(--so-navy-500, #1b4b7a); outline-offset: 2px; border-radius: 4px; }
.tm-so { color: var(--so-ink-600, #3f4a56) !important; }
.tm-so b { color: var(--so-gold-600, #a8893e); font-weight: 700; }

@media (max-width: 1100px) and (min-width: 900px) {
  .tm-in { padding-inline: 20px; } .tm-cols { gap: 12px; } .tm-col a { font-size: 13.5px; gap: 8px; }
}

/* ---- panel: phone sheet ---- */
@media (max-width: 899px) {
  .tm-panel { inset: 0; top: 0; max-height: none; height: 100%; z-index: 1000; border: 0; box-shadow: none; }
  .tm-in { padding: 0 16px; min-height: 100%; display: flex; flex-direction: column; box-sizing: border-box; }
  .tm-cols { flex: 1 0 auto; }
  .tm-top {
    display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 1;
    margin: 0 -16px 8px; padding: 10px 8px 10px 16px; background: var(--so-navy, #0b1d32); color: #fff;
  }
  .tm-title { margin: 0; font: 700 17px/1.2 var(--so-font, sans-serif); color: #fff; }
  .tm-close { display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 10px; background: transparent; color: #fff; cursor: pointer; }
  .tm-close:hover { background: rgba(255,255,255,.10); }
  .tm-close:focus-visible { outline: 2px solid var(--so-gold-400, #d4ba7a); outline-offset: 0; }
  .tm-cols { grid-template-columns: 1fr; gap: 4px; }
  .tm-col { padding-top: 14px; }
  .tm-col ul { display: grid; grid-template-columns: 1fr 1fr; column-gap: 12px; }
  .tm-h { padding: 0 4px; margin-bottom: 4px; }
  .tm-col a { min-height: 48px; padding: 4px; font-size: 14.5px; }
  .tm-scrim { display: none !important; }
  /* Sticky bottom bar: the way to all tools and the SuperOffice line are visible without scrolling. */
  .tm-foot {
    position: sticky; bottom: 0; z-index: 1; flex-direction: column; align-items: flex-start; gap: 0;
    margin: 16px -16px 0; padding: 6px 20px calc(8px + env(safe-area-inset-bottom));
    background: var(--so-paper-050, #fcfbf9); box-shadow: 0 -8px 20px -14px rgba(11,29,50,.35);
  }
  .tm-foot a { min-height: 44px; }
  .tm-foot .tm-so { display: block; min-height: 0; padding: 4px 0 8px; line-height: 1.45; }
}
@media (max-width: 360px) {
  .tm-col ul { grid-template-columns: 1fr; }
}
html.tm-lock, html.tm-lock body { overflow: hidden !important; }
/* Tablet: logo + tagline + "Powered by" + Tools + Pricing + CTA overflowed 768px by 10px (jerry qc);
   the "Powered by" credit yields between phone and desktop. */
@media (min-width: 421px) and (max-width: 1080px) { .site-top:has(.tm-trigger) .so-by { display: none !important; } .site-top:has(.tm-trigger) .rule { display: none !important; } }

/* ---- ONE header, one size, everywhere (Amit 13 Nov: "I really like that standard header … just the
   size increase"). The pages load different stylesheets (home np2, pricing, contact, tools, lp), which
   had drifted to 67–95px bars and 32–50px logos; these rules pin one scale, a step up from /tools-v2. */
header.site-top { padding-block: 6px !important; }
header.site-top .site-top-in { min-height: 72px !important; padding-block: 6px !important; }
header.site-top .so-mark { gap: 12px !important; }
header.site-top .so-mark img { width: 46px !important; height: 46px !important; }
header.site-top .so-wm > span { font-size: 23px !important; line-height: 1.1 !important; }
header.site-top .so-tag { display: block; font-size: 13px !important; line-height: 1.3 !important; }
header.site-top .so-by { font-size: 14.5px !important; }
header.site-top .top-cta { gap: 10px !important; }
header.site-top .top-cta > .tm-trigger, header.site-top .top-cta > .top-link, header.site-top .top-cta > .top-trial { min-height: 46px !important; font-size: 15.5px !important; }
header.site-top .top-cta > .top-trial { padding-inline: 22px !important; }
@media (max-width: 899px) {
  header.site-top { padding-block: 4px !important; }
  header.site-top .site-top-in { min-height: 64px !important; padding-block: 4px !important; }
  header.site-top .so-by, header.site-top .rule { display: none !important; }
  header.site-top .so-mark img { width: 40px !important; height: 40px !important; }
  header.site-top .so-wm > span { font-size: 20px !important; }
  header.site-top .so-tag { font-size: 11.5px !important; }
  header.site-top .top-cta > .tm-trigger, header.site-top .top-cta > .top-link { min-height: 44px !important; font-size: 14px !important; }
}
@media (max-width: 420px) {
  header.site-top .so-mark { gap: 9px !important; }
  header.site-top .so-mark img { width: 36px !important; height: 36px !important; }
  header.site-top .so-wm > span { font-size: 18px !important; }
  header.site-top .so-tag { font-size: 10.5px !important; }
  header.site-top .top-cta > .tm-trigger { font-size: 10.5px !important; }
}
@media (max-width: 640px) { header.site-top .top-cta > .top-trial { display: none !important; } header.site-top .top-cta { margin-left: auto; } }
/* Pricing is the same outlined pill on every page (home, pricing, contact had three looks). */
@media (min-width: 641px) { header.site-top .top-cta > .top-link { display: inline-flex !important; align-items: center; padding-inline: 18px !important; border: 1px solid rgba(255,255,255,.6) !important; border-radius: 10px !important; color: #fff !important; background: transparent !important; } }
/* Same container and tagline colour on every page (contact sat in a narrower box with a grey tagline). */
header.site-top .site-top-in { max-width: 1240px !important; margin-inline: auto !important; padding-inline: 20px !important; box-sizing: border-box; width: 100%; }
header.site-top .so-tag { color: rgba(255,255,255,.88) !important; }
/* Phone sheet: a fade above the pinned footer says "more below" (QC loop 1: Protect looked cut off). */
@media (max-width: 899px) { .tm-foot::before { content: ""; position: absolute; left: 0; right: 0; top: -28px; height: 28px; pointer-events: none; background: linear-gradient(to bottom, rgba(252,251,249,0), var(--so-paper-050, #fcfbf9)); } }
/* Phone: one header on every page — tagline on one line, Tools icon, Pricing as text (QC loop 1: /pricing
   hid its Pricing link and the tagline wrapped on some pages and not others). */
@media (max-width: 640px) {
  header.site-top .so-tag { white-space: nowrap !important; max-width: none !important; }
  header.site-top .so-wm { max-width: none !important; }
  header.site-top .top-cta > .top-link { display: inline-flex !important; align-items: center; padding-inline: 8px !important; border: 0 !important; background: none !important; color: #fff !important; font-weight: 600; }
  header.site-top .top-cta { gap: 2px !important; }
}
@media (max-width: 384px) {
  header.site-top .so-mark img { width: 32px !important; height: 32px !important; }
  header.site-top .so-mark { gap: 7px !important; }
  header.site-top .so-wm > span { font-size: 17px !important; }
  header.site-top .so-tag { font-size: 9.5px !important; }
  header.site-top .top-cta > .top-link { padding-inline: 6px !important; font-size: 13.5px !important; }
}
/* Phone sheet (QC loop 2): all 17 tools must fit above the fold — tighter rows, footer back in flow. */
@media (max-width: 899px) {
  .tm-col { padding-top: 8px !important; }
  .tm-col a { min-height: 44px !important; }
  .tm-foot { position: static !important; box-shadow: none !important; margin-top: 8px !important; }
  .tm-foot::before { display: none !important; }
}
header.site-top { padding-inline: 0 !important; }
header.site-top .top-cta { padding: 0 !important; margin-right: 0 !important; margin-left: auto !important; }
header.site-top .so-tag { font-weight: 500 !important; opacity: 1 !important; letter-spacing: 0 !important; }

/* ---- ONE footer width and look (final QC: home/pricing/contact footers sat 80px further in than the
   header and the other pages, and the intl footer's headings were white, not gold). The header's own
   stylesheet loads on every public page, so the footer's alignment is pinned here too. ---- */
footer.site-foot .foot-in { max-width: 1240px !important; padding-inline: 20px !important; margin-inline: auto !important; box-sizing: border-box; width: 100%; }
footer.site-foot .foot-col h3, footer.site-foot .foot-col h4, footer.site-foot .foot-col > b, footer.site-foot .foot-col > strong, footer.site-foot .foot-say { color: var(--so-gold-400, #d4ba7a) !important; }
footer.site-foot .foot-col h2, footer.site-foot .foot-tag { color: var(--so-gold-400, #d4ba7a) !important; }
