/* BEagent's front page (Uhan3, 2026-10-19): what bioequivalence is, the traditional way of doing a BE study and why
   BEagent, then Enter BEagent. A modal dialog over the whole window that beagent-front.js opens on every load, in
   beagent.css's black and gold on the warm paper ground, its serif and its lining figures; this file comes after
   beagent.css and uses its tokens and buttons. On a desktop window: the opening, then the three parts side by side
   with the button under the third; a shorter window scrolls inside the dialog, a narrower one stacks the parts. The pictures are inline SVG in beagent.html, styled here, with no gradient over them (Uhan3's rule). The
   one move is the confidence interval settling into the 80.00-125.00% band as the page opens. Every class here starts
   with front- or fr-, so nothing reaches the app under the page. */

/* ------------------------------------------------------------------ the dialog */

/* Styled only while open: a closed dialog keeps the browser's display: none. The dialog scrolls itself, and its
   scrolling stops at its ends instead of moving the page under it. */
dialog.front[open] {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: none;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-variant-numeric: lining-nums;
  line-height: 1.5;
}
dialog.front::backdrop { background: var(--bg); }
/* The fade out, as the intro's (0.32 s); the backdrop fades with it, so the app shows through as the page goes. */
dialog.front.is-leaving { animation: fr-hide 0.32s var(--ease-out) forwards; }
dialog.front.is-leaving::backdrop { animation: fr-hide 0.32s var(--ease-out) forwards; }
@keyframes fr-hide { to { opacity: 0; } }

/* The page's column, and its grid: the opening and the parts share the same three columns, so the lead line starts
   where the second part does. The first column is the widest: it holds the pictures. */
.front-page {
  --fr-cols: minmax(0, 1.36fr) minmax(0, 1fr) minmax(0, 1.14fr);
  --fr-gap: clamp(32px, 3.2vw, 52px);
  display: flex;
  flex-direction: column;
  min-height: 100%;
  max-width: 1360px;
  margin: 0 auto;
  padding: 32px clamp(var(--gutter), 3.6vw, 56px);
}

/* The button shows the keyboard's focus plainly; the dialog, which takes the first focus, shows none. */
.front-enter:focus-visible { outline: 2px solid var(--accent-dark); outline-offset: 3px; }
dialog.front:focus-visible { outline: none; }

/* ------------------------------------------------------------------ the opening */

/* The wordmark in Home's two weights, larger, and the lead beside it on the second and third columns (its claim, then
   the line under it), the two starting at the same height (Uhan3, 2026-10-20; they shared a last baseline, which
   left the lead starting above the wordmark). The opening and the parts sit in the middle of the window's
   height (the auto margins here and on the parts), so a tall window has air above and below them rather than all at
   the bottom. */
.front-head {
  flex: none;
  margin-top: auto;
  display: grid;
  grid-template-columns: var(--fr-cols);
  column-gap: var(--fr-gap);
  align-items: start;
  padding: clamp(8px, 2.4vh, 28px) 0 clamp(22px, 4vh, 40px);
}
.front-wordmark {
  margin: 0;
  font-size: 76px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.015em;
  white-space: nowrap;
}
.front-lead {
  grid-column: 2 / 4;
  color: var(--ink-2);
  font-size: 19.5px;
  line-height: 1.45;
}
.front-claim, .front-sub {
  margin: 0;
  /* Even lines, no word left alone on the last. */
  text-wrap: balance;
}
/* The claim on one line (Uhan3, 2026-10-19): it takes the two columns' whole width, its size following the window's so
   it fits from about 1100 px wide up; narrower, it wraps. */
.front-claim { color: var(--ink); font-size: clamp(24px, 2.15vw, 31px); line-height: 1.2; }
.front-sub { max-width: 31em; margin-top: 10px; }

/* ------------------------------------------------------------------ the three parts */

/* The first two parts span both rows; the second row is flexible, so it alone grows to fit them, and the button in it
   sits right under the third part, where the reader ends, rather than under the tallest. */
.front-parts {
  flex: none;
  margin-bottom: auto;
  display: grid;
  grid-template-columns: var(--fr-cols);
  grid-template-rows: auto 1fr;
  column-gap: var(--fr-gap);
  align-content: start;
}
.front-part { min-width: 0; }
.fr-part-be, .fr-part-old { grid-row: 1 / span 2; }
.front-h2 {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 24px;
  font-weight: 400;
  line-height: 1.2;
}
.front-part p {
  max-width: 34em;
  margin: 0;
  color: var(--ink-2);
  font-size: 15.5px;
  line-height: 1.55;
}
.front-part p, .fr-track li { text-wrap: pretty; }
/* Each track's last line, the sum of its steps: weeks there, hours here. */
.front-part .fr-sum { margin-top: 14px; color: var(--ink); font-style: italic; }

/* ------------------------------------------------------------------ the pictures */

/* Drawn in their own units at about the size they show at, so their words stay near the text's size. */
.fr-fig { margin: 14px 0 12px; }
.fr-fig svg { display: block; width: 100%; max-width: 480px; height: auto; overflow: visible; }
.fr-fig text { fill: var(--muted); font-family: var(--serif); font-size: 12.5px; font-variant-numeric: lining-nums; }

/* The curves: the Test solid in black, the Reference dashed in the deeper gold, the area under the Test a flat gold
   tint, the Test's peak a dot with a dotted line back to the axis. */
.fr-axis { fill: none; stroke: var(--faint); stroke-width: 1; }
.fr-auc { fill: var(--gold); fill-opacity: 0.24; }
.fr-test { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.fr-ref { fill: none; stroke: var(--gold-deep); stroke-width: 2; stroke-dasharray: 5 4; stroke-linejoin: round; }
.fr-guide { fill: none; stroke: var(--muted); stroke-width: 1; stroke-dasharray: 1.5 3; }
.fr-peak { fill: var(--ink); }
.fr-fig .fr-mark { fill: var(--ink); font-size: 14px; }
.fr-fig .fr-mark-auc { fill: var(--accent-dark); }
.fr-fig .fr-key { fill: var(--ink-2); font-size: 13px; }

/* The band: 80.00% to 125.00% in a flat gold tint with deeper gold edges, 100% dashed in its middle; the interval and
   its point estimate in black. */
.fr-band-fill { fill: var(--gold); fill-opacity: 0.26; }
.fr-band-axis { fill: none; stroke: var(--faint); stroke-width: 1; }
.fr-band-edge { fill: none; stroke: var(--gold-deep); stroke-width: 1.6; }
.fr-band-mid { fill: none; stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.fr-fig .fr-band-label { fill: var(--ink-2); font-size: 13px; }
.fr-ci-line {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2.4;
  stroke-linecap: round;
  /* The bar narrows as it settles: its strokes keep their width. */
  vector-effect: non-scaling-stroke;
}
.fr-ci-est { fill: var(--ink); }
.fr-fig .fr-ci-label { fill: var(--ink); font-size: 13px; font-style: italic; }

/* The page's one move (Uhan3, 2026-10-19): the page opens with the interval wide and off to the right, over the
   band's 125% edge; a beat later it narrows and slides into place inside the band, the point estimate with it, and its
   label fades in. A closed dialog draws nothing, so each opening plays it again. Transform and opacity only, once.
   While the intro lies over the page (a first visit, Menu's Tour) it waits, and plays as the intro fades; a browser
   without :has() plays it under the intro instead. */
.fr-ci-bar, .fr-ci-est { transform-box: fill-box; transform-origin: center; }
.fr-ci-bar { animation: fr-settle-bar 0.95s var(--ease-out) 0.3s both; }
.fr-ci-est { animation: fr-settle-est 0.95s var(--ease-out) 0.3s both; }
.fr-ci-label { animation: fr-in 0.3s var(--ease-out) 0.75s both; }
body:has(> dialog.intro[open]:not(.is-leaving)) :is(.fr-ci-bar, .fr-ci-est, .fr-ci-label) { animation-play-state: paused; }
@keyframes fr-settle-bar { from { transform: translateX(84px) scaleX(1.75); } }
@keyframes fr-settle-est { from { transform: translateX(84px); } }
@keyframes fr-in { from { opacity: 0; } }

/* ------------------------------------------------------------------ the two tracks */

/* Each sequence is drawn as a track under its heading, and its steps are that track's stops. The two tracks space
   their stops alike, so their lengths compare honestly: the traditional one long and quiet (seven small hollow stops
   on a hairline, in muted ink), BEagent's short and gold (five filled stops on a heavier line). Each step in the list
   below wears its track's stop. */
.fr-line { display: block; max-width: 100%; height: auto; margin: 2px 0 12px; overflow: visible; }
.fr-line-rail { fill: none; }
.fr-line-old .fr-line-rail { stroke: var(--faint); stroke-width: 1; }
.fr-line-old circle { fill: var(--bg); stroke: var(--muted); stroke-width: 1.5; }
.fr-line-new .fr-line-rail { stroke: var(--gold); stroke-width: 3; stroke-linecap: round; }
.fr-line-new circle { fill: var(--gold); stroke: var(--gold-deep); stroke-width: 2; }

.fr-track { margin: 16px 0 0; padding: 0; color: var(--ink-2); list-style: none; }
.fr-track li { position: relative; padding-left: 26px; font-size: 15px; line-height: 1.5; }
.fr-track li::before {
  content: "";
  position: absolute;
  left: calc(7px - var(--fr-stop) / 2);
  top: calc(0.75em - var(--fr-stop) / 2);
  box-sizing: border-box;
  width: var(--fr-stop);
  height: var(--fr-stop);
  border-radius: 50%;
}
.fr-track li + li { margin-top: var(--fr-step-gap); }

.fr-track-old { --fr-stop: 9px; --fr-step-gap: 8px; }
.fr-track-old li::before { border: 1.5px solid var(--muted); background: var(--bg); }

.fr-track-new { --fr-stop: 13px; --fr-step-gap: 12px; }
.fr-track-new li::before { border: 2px solid var(--gold-deep); background: var(--gold); }
.fr-track-new strong { color: var(--ink); font-weight: 700; }

/* ------------------------------------------------------------------ the end */

/* Under the parts, in the third column (Uhan3, 2026-10-19): the reader ends on Why BEagent, and the button is under
   it. The page ends with it (2026-10-20: the evidence under the parts went). */
.front-end { grid-column: 3; grid-row: 2; align-self: start; padding-top: 26px; }
.front-enter-end { padding: 12px 30px; font-size: 16px; }
/* Under the button, one line to the Claude Code install page (Uhan3, 2026-11-20; launch fixes, ticket 09), shown only
   where the public MCP route is on: the page ships it hidden and the server shows it. A link in the login dialog's
   size and colour for its small links, not a second button. A line of its own, as wide as its words, so the space
   beside it takes no click; beagent.css's [hidden] rule still hides it. */
.front-mcp {
  display: block;
  width: fit-content;
  max-width: 100%;
  margin-top: 14px;
  color: var(--accent-dark);
  font-size: 14px;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.front-mcp:hover { color: var(--ink); }
/* On a desktop window the page sits in the middle of the window's height, and the third column, with the button, is
   often its tallest: there the line hangs under the button out of the flow, so the page is as tall and sits where it
   did, with the line or without it (headless Chrome, 2026-11-20). Stacked, the line ends the page. */
@media (min-width: 1001px) {
  .front-end { position: relative; }
  .front-mcp { position: absolute; top: 100%; left: 0; }
}

/* ------------------------------------------------------------------ narrower windows */

/* Below about 1000 px the parts stack, one under another, and the lead line goes under the wordmark. No phone layout
   beyond that (Uhan3 declined phone layouts twice): the page only must not break or scroll sideways. */
@media (max-width: 1000px) {
  .front-head, .front-parts { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; }
  .front-head { row-gap: 14px; align-items: start; }
  .front-lead { grid-column: 1; }
  .front-parts { row-gap: 40px; }
  .fr-part-be, .fr-part-old, .front-end { grid-row: auto; }
  .front-end { grid-column: 1; padding-top: 0; }
}

/* Three narrow columns (about 1000 to 1180 px wide) draw the pictures smaller: their words grow in the pictures'
   units to stay near the text's size. */
@media (min-width: 1001px) and (max-width: 1180px) {
  .fr-fig text, .fr-fig .fr-key, .fr-fig .fr-band-label, .fr-fig .fr-ci-label { font-size: 15.5px; }
  .fr-fig .fr-mark { font-size: 16.5px; }
}

/* A shorter desktop window (1280 x 800, 1366 x 768): the same page with less air, so the button stays in view or
   nearly. */
@media (min-width: 1001px) and (max-height: 840px) {
  .front-page { padding-top: 24px; }
  .front-head { padding-top: 0; }
  .front-wordmark { font-size: 68px; }
  .fr-fig { margin: 10px 0 8px; }
  .front-h2 { margin-bottom: 8px; }
  .fr-track { margin-top: 12px; }
}
@media (min-width: 1001px) and (max-height: 790px) {
  .front-head { padding-bottom: 16px; }
  .fr-track-new { --fr-step-gap: 9px; }
  .front-end { padding-top: 16px; }
}
@media (max-width: 640px) {
  .front-wordmark { font-size: 56px; }
  .front-lead { font-size: 17.5px; }
}

/* Reduced motion: the interval is in place from the start. */
@media (prefers-reduced-motion: reduce) {
  .fr-ci-bar, .fr-ci-est, .fr-ci-label { animation: none; }
}
