/* metrics.css: page-specific styles for metrics.html.
   Everything here is prefixed mt- so it cannot collide with style.css, which is shared and owned by the home page.
   The page also uses the shared inner-page pieces from style.css section 15 (.page-hero, .comp, .float, .hl, .meter,
   .libs, .panel, .sets, .caution, .facts, details.how, .qa). Colours, radii and type come from the style.css tokens.

   The idea of the page: Documents and Research papers are EQUAL and SEPARATE. One switch (like the app's own
   Documents | Research switch) picks a side; each side has the same build: headline band, detail, plain notes,
   drawer. Without JavaScript the switch is hidden and both sides are shown one after the other. */

/* ---------- 1. hero: the two-way choice ---------- */
.mt-go{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;max-width:480px;margin-top:26px}
.mt-go a{display:flex;align-items:center;gap:10px;min-height:58px;padding:10px 16px;border-radius:16px;border:1.5px solid var(--accent);background:var(--accent);color:var(--on-accent);font-size:16.5px;font-weight:720;line-height:1.15;letter-spacing:-.01em;text-decoration:none}
.mt-go a:hover{filter:brightness(1.08)}
.mt-go .ico{width:22px;height:22px}
.mt-go small{display:block;margin-top:2px;font-size:12.5px;font-weight:650;letter-spacing:0}
.page-hero .mt-go+.jump{margin-top:12px}
.page-hero .comp a.float{color:inherit;text-decoration:none;transition:border-color .15s,transform .2s}
.page-hero .comp a.float:hover{border-color:var(--accent);transform:translateY(-3px)}

/* ---------- 2. the switch (tabs) ---------- */
/* The switch rides along under the header while a side is being read. It sits in an opaque band (.mt-bar) so the
   page never shows through the gap between the header and the switch. */
.mt-bar{display:none}
.js .mt-bar{display:block;position:sticky;top:66px;z-index:30;margin:-10px 0 -12px;padding:10px 0 12px;background:var(--bg)}
.mt-switch{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:5px;padding:5px;border-radius:22px;background:var(--surface);border:1px solid var(--line);box-shadow:0 10px 26px rgba(0,0,0,.2)}
.mt-switch button{display:flex;align-items:center;gap:12px;min-height:62px;padding:8px 18px;border:0;border-radius:17px;background:transparent;color:var(--ink-2);font:inherit;text-align:left;cursor:pointer;transition:background-color .18s,color .18s}
.mt-switch button>span{flex:1;min-width:0}
.mt-switch b{display:block;font-size:18.5px;font-weight:740;letter-spacing:-.018em;line-height:1.15;color:var(--ink)}
.mt-switch small{display:block;margin-top:2px;font-size:13px;font-weight:600;line-height:1.25}
.mt-switch .ico{width:24px;height:24px}
.mt-switch .tick{display:none;width:22px;height:22px;stroke-width:2.4}
.mt-switch button:hover{background:var(--hover)}
.mt-switch button[aria-selected="true"]{background:var(--accent);color:var(--on-accent)}
.mt-switch button[aria-selected="true"] b{color:var(--on-accent)}
.mt-switch button[aria-selected="true"] .tick{display:block}
.mt-switch button:focus-visible{outline-offset:2px;border-radius:17px}

/* ---------- 3. one side's results ---------- */
.mt-panel{display:flex;flex-direction:column;gap:16px;margin-top:22px;scroll-margin-top:170px}
.mt-panel+.mt-panel{margin-top:64px;padding-top:56px;border-top:1px solid var(--line-2)}
.js .mt-panel+.mt-panel{margin-top:22px;padding-top:0;border-top:0}
.js .mt-panel:not(.is-on){display:none}
.js .mt-panel.is-on{animation:mt-in .32s ease both}
@keyframes mt-in{from{opacity:0;transform:translateY(10px)}}
.mt-panel:focus{outline:none}
.mt-head{display:flex;align-items:center;gap:10px 14px;flex-wrap:wrap;margin-bottom:2px}
.mt-head h3{display:flex;align-items:center;gap:10px;font-size:clamp(25px,2.9vw,32px)}
.mt-head h3 .ico{width:27px;height:27px;color:var(--accent)}
.mt-head .facts{margin-left:auto}
.mt-duo{display:grid;grid-template-columns:minmax(0,1.55fr) minmax(0,1fr);gap:14px}
.mt-panel .hl .bar{max-width:420px;margin-top:14px;background:rgba(255,255,255,.2)}
.mt-panel .hl .bar i{background:#fff}
.mt-panel .hl .bignum small{font-size:.5em}
.mt-panel .hl .fine{font-size:14.5px;line-height:1.5}
.mt-panel .hl p:first-child:not(.bignum),.mt-panel .hl div>p:first-child{font-size:clamp(19px,2vw,23px);font-weight:700;letter-spacing:-.012em;line-height:1.3}
.mt-second{justify-content:center;padding:24px;border-radius:var(--r);background:var(--surface)}
.mt-second .num{font-size:clamp(40px,5vw,60px)}
.mt-second .lab{font-size:16px;color:var(--ink);font-weight:700}
.mt-second .bar{height:10px}
.mt-sub{display:flex;align-items:baseline;flex-wrap:wrap;gap:4px 12px;margin:16px 0 -2px;font-size:22px;font-weight:720;letter-spacing:-.02em;line-height:1.15}
.mt-sub span{font-size:14.5px;font-weight:600;letter-spacing:0;color:var(--ink-2)}
.mt-panel .libs{margin-top:0;padding:18px 24px;border-radius:var(--r);background:var(--surface);border:1px solid var(--line-2)}
/* the things to keep in mind, right under the research headline */
.mt-cav{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}
.mt-cav li{display:flex;flex-direction:column;gap:6px;padding:16px 16px 18px;border-radius:var(--r-in);background:var(--surface);border:1px solid var(--line-2);border-top:3px solid var(--warn-line);font-size:14px;line-height:1.42;color:var(--ink-2)}
.mt-cav strong{font-size:15.5px;line-height:1.25;color:var(--ink);letter-spacing:-.01em}
.mt-cav .ico{width:21px;height:21px;margin-bottom:2px;color:var(--warn-ink)}
:root[data-theme="light"] .mt-cav .ico{color:#8A6400}
/* plain notes: how to read the number */
.mt-notes{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}
.mt-notes li{display:flex;gap:12px;align-items:flex-start;padding:16px 18px;border-radius:var(--r-in);border:1px solid var(--line-2);font-size:14.5px;line-height:1.45;color:var(--ink-2)}
.mt-notes strong{display:block;margin-bottom:3px;font-size:16px;line-height:1.25;color:var(--ink);letter-spacing:-.01em}
.mt-notes .ib{width:38px;height:38px;border-radius:11px}
.mt-notes .ib .ico{width:20px;height:20px}
.mt-panel .panel{margin-top:6px}
.mt-panel .panel-h h3,.mt-panel .panel-h h4{display:flex;align-items:center;gap:10px;margin:0;font-size:22px;font-weight:720;letter-spacing:-.02em;line-height:1.15}
.mt-panel .drawers{margin-top:0}
.mt-next{display:flex;justify-content:flex-end;margin-top:2px}
.mt-next button{display:inline-flex;align-items:center;gap:8px;min-height:44px;padding:0;border:0;background:none;color:var(--accent);font:inherit;font-size:16px;font-weight:680;cursor:pointer}
.mt-next button:hover{text-decoration:underline}
.mt-next .ico{width:18px;height:18px}
html:not(.js) .mt-next{display:none}
/* bars grow once, when first seen (metrics.js adds .mt-grow only when motion is allowed) */
.mt-grow .bar i{transform:scaleX(0);transform-origin:0 50%;transition:transform .9s cubic-bezier(.2,.7,.2,1)}
.mt-grow.in .bar i{transform:none}
.mt-grow.libs li:nth-child(n) .bar i{transition-delay:calc(var(--n,0) * 35ms)}

/* ---------- 4. method strip: the same four steps, one column per side ---------- */
.mt-method{width:100%;table-layout:fixed;border-collapse:separate;border-spacing:0;border-radius:var(--r);overflow:hidden;border:1px solid var(--line-2);background:var(--surface)}
.mt-method th,.mt-method td{padding:17px 20px;border-top:1px solid var(--line-2);text-align:left;vertical-align:top;font-size:15px;font-weight:400;line-height:1.45;color:var(--ink-2)}
.mt-method td+td,.mt-method thead th+th{border-left:1px solid var(--line-2)}
.mt-method thead th{border-top:0;padding:13px 20px;background:var(--bg-2);font-size:13.5px;font-weight:740;letter-spacing:.09em;text-transform:uppercase;color:var(--ink)}
.mt-method thead .ico{width:18px;height:18px;margin-right:8px;vertical-align:-4px;color:var(--accent)}
.mt-method thead th:first-child,.mt-method tbody th{width:230px}
.mt-step{display:flex;align-items:center;gap:12px;font-size:17.5px;font-weight:720;letter-spacing:-.015em;line-height:1.2;color:var(--ink)}
.mt-step i{font-family:var(--mono);font-style:normal;font-size:12.5px;font-weight:700;color:var(--ink-2)}
.mt-step .ib{width:40px;height:40px}
.mt-method-note{margin-top:14px}

/* ---------- 5. limits, each with a calm amber "Do this" ---------- */
.mt-lims{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}
.mt-lims>li{display:flex;flex-direction:column;gap:10px;padding:22px;border-radius:var(--r);background:var(--surface);border:1px solid var(--line-2);min-width:0}
.mt-lims>li:last-child:nth-child(odd){grid-column:1 / -1}
.mt-lim-h{display:flex;justify-content:space-between;align-items:center;gap:10px}
.mt-lim-h strong{font-size:18.5px;letter-spacing:-.015em;line-height:1.2;color:var(--ink)}
.mt-lims p{font-size:15px;line-height:1.5;color:var(--ink-2)}
.mt-tag{flex:none;padding:4px 10px;border-radius:99px;border:1px solid var(--line);font-size:11.5px;font-weight:720;line-height:1.3;color:var(--ink-2);white-space:nowrap}
.mt-do{display:flex;gap:12px;align-items:baseline;margin-top:auto;padding:11px 14px;border-radius:12px;background:var(--warn-bg);color:var(--warn-ink);box-shadow:inset 0 0 0 1px var(--warn-line);font-size:14.5px;font-weight:620;line-height:1.42}
.mt-do b{flex:none;font-size:11.5px;font-weight:780;letter-spacing:.08em;text-transform:uppercase}

/* ---------- 6. responsive ---------- */
.mt-side{display:none}
@media (max-width:980px){
  .mt-cav{grid-template-columns:repeat(2,minmax(0,1fr))}
  .mt-notes{grid-template-columns:minmax(0,1fr)}
  .mt-head .facts{margin-left:0;flex-basis:100%}
  .mt-method thead th:first-child,.mt-method tbody th{width:170px}
}
@media (max-width:880px){
  .mt-duo{grid-template-columns:minmax(0,1fr)}
  .mt-lims{grid-template-columns:minmax(0,1fr)}
}
@media (max-width:760px){
  .mt-panel .libs{padding:14px 16px}
  /* the method table becomes one card per step */
  .mt-method,.mt-method tbody,.mt-method tr,.mt-method th,.mt-method td{display:block}
  .mt-method{border:0;background:none;border-radius:0;overflow:visible}
  .mt-method thead{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
  .mt-method tr{padding:18px;border-radius:var(--r);background:var(--surface);border:1px solid var(--line-2)}
  .mt-method tr+tr{margin-top:12px}
  .mt-method th,.mt-method td,.mt-method td+td{padding:0;border:0}
  .mt-method thead th:first-child,.mt-method tbody th{width:auto}
  .mt-method tbody th{margin-bottom:6px}
  .mt-method td{margin-top:12px}
  .mt-method .mt-side{display:block;margin-bottom:3px;font-size:12px;font-weight:740;letter-spacing:.09em;text-transform:uppercase;color:var(--accent)}
}
@media (max-width:560px){
  .mt-go{gap:8px}
  .mt-go a{padding:10px 12px;font-size:15.5px}
  .js .mt-bar{top:60px}
  .mt-switch{border-radius:18px;margin:0 -6px}
  .mt-switch button{min-height:52px;padding:6px 10px;gap:8px;border-radius:14px}
  .mt-switch b{font-size:15.5px}
  .mt-switch small{display:none}
  .mt-switch .ico{width:20px;height:20px}
  .mt-switch .tick{display:none!important}
  .mt-cav{grid-template-columns:minmax(0,1fr)}
  .mt-cav li{flex-direction:row;flex-wrap:wrap;align-items:center;gap:4px 10px;padding:14px 16px}
  .mt-cav li span{flex-basis:100%}
  .mt-cav .ico{margin:0}
  .mt-lims>li{padding:20px 18px}
  .mt-do{flex-direction:column;gap:3px}
  .mt-second{padding:20px 18px}
}
