/* BGPer Tools page: the bento layout of the Tools design preview (127.0.0.1:4178), built from the theme's own parts
   (the shared .seg-bar, homepage .ico/.tag/.window/kbd, .btn).
   Jump pills, then a 12-column bento grid: 7/5 (BGPWatch, Looking Glass; 440px tall) then 5/7 (FlowWatch, CGTF RIS).
   Radius: cards and dialog 12px, controls and code 6px. */

.bgper-ui .t-page { padding: 0; }

/* jump links: the shared .seg-bar + .seg-bar-sticky (bgper-home.css) */

/* ---------- grid and cards ---------- */
.bgper-ui .t-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; margin-bottom: 88px; }
.bgper-ui .t-tool {
  position: relative; min-width: 0; overflow: hidden; scroll-margin-top: calc(var(--nav-h) + 72px); /* clears the sticky jump bar */
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
  transition: box-shadow .5s var(--ease), border-color .3s, opacity .8s var(--ease), transform .8s var(--ease);
}
/* cards rise like the homepage .card reveals; the transition list above drops .reveal's stagger, so it is restated */
.bgper-ui .t-tool.reveal { transform: translateY(28px); transition-delay: 0s, 0s, calc(var(--i, 0) * 80ms), calc(var(--i, 0) * 80ms); }
.bgper-ui .t-tool.reveal.in { transform: none; }
.bgper-ui .t-tool:hover { border-color: var(--line-strong); box-shadow: var(--shadow-hover); }
.bgper-ui .t-tool:target { outline: 2px solid var(--accent); outline-offset: 3px; }
.bgper-ui .t-featured { grid-column: span 7; height: 440px; }
.bgper-ui .t-large { grid-column: span 5; height: 440px; }
.bgper-ui .t-flow_watch { grid-column: span 5; height: 276px; }
.bgper-ui .t-cgtf { grid-column: span 7; height: 276px; }

/* copy */
.bgper-ui .t-copy { position: relative; z-index: 1; padding: 32px 32px 0; }
/* icon tile + tag, as on the homepage's small tool cards */
.bgper-ui .t-head { display: flex; align-items: center; gap: 12px; }
.bgper-ui .t-head .ico { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 8px; font-size: 17px; background: var(--bone); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); transition: background .2s, color .2s, box-shadow .2s; }
.bgper-ui .t-tool:hover .t-head .ico { background: var(--ink); color: #fff; box-shadow: none; }
.bgper-ui .t-tool h2 { margin: 16px 0 8px; font-size: 28px; font-weight: 600; line-height: 1.1; letter-spacing: -0.035em; color: var(--ink); }
.bgper-ui .t-featured h2 { font-size: 34px; letter-spacing: -0.035em; }
.bgper-ui .t-tool h2 .accent { color: var(--accent); }
.bgper-ui .t-copy p { margin: 0; font-size: 14px; line-height: 1.6; color: var(--muted); }
.bgper-ui .t-featured .t-copy p { font-size: 15px; color: var(--text); }
.bgper-ui .t-tool h2 small { display: block; margin-top: 4px; font-size: 14px; font-weight: 400; letter-spacing: 0; color: var(--muted); }

/* actions */
.bgper-ui .t-actions { display: flex; align-items: center; gap: 20px; margin-top: 20px; }
.bgper-ui .t-actions .btn { position: relative; z-index: 3; }
.bgper-ui .t-actions.t-actions-btns { gap: 12px; flex-wrap: wrap; }
.bgper-ui .t-actions button.btn { cursor: pointer; }
.bgper-ui .t-actions .btn:hover i { transform: translate(2px, -2px); }
.bgper-ui .t-more { position: relative; z-index: 3; display: inline-flex; align-items: center; gap: 7px; padding: 8px 0; border: 0; background: none; font-size: 15px; color: var(--muted); cursor: pointer; white-space: nowrap; transition: color .2s; }
.bgper-ui .t-more i { font-size: 14px; transition: transform .5s var(--ease); }
.bgper-ui .t-more:hover { color: var(--accent); }
.bgper-ui .t-more:hover i { transform: rotate(90deg); }
.bgper-ui .t-link { position: relative; z-index: 3; display: inline-flex; align-items: center; gap: 6px; font-size: 15px; font-weight: 500; color: var(--ink); white-space: nowrap; transition: color .2s; }
.bgper-ui .t-link i { font-size: 15px; transition: transform .3s var(--ease); }
.bgper-ui .t-link:hover { color: var(--accent); }
.bgper-ui .t-link:hover .ph-arrow-up-right { transform: translate(2px, -2px); }
.bgper-ui .t-link:hover .ph-arrow-right { transform: translateX(3px); }

/* screenshot: the homepage's .window frame (bar with dots + address), bleeding off the card's bottom
   edge; it rises a little on hover and the dots light up */
.bgper-ui .t-shot.window {
  position: absolute; display: flex; flex-direction: column; margin: 0; padding: 0;
  border-bottom: 0; border-radius: 12px 12px 0 0; background: var(--bg); text-align: left; cursor: zoom-in;
  box-shadow: var(--shadow-rest);
  transition: transform .6s var(--ease), box-shadow .6s var(--ease);
}
.bgper-ui .t-shot .window-bar { flex: none; height: 30px; }
.bgper-ui .t-shot .window-bar b { transition: background .3s; }
.bgper-ui .t-tool:hover .t-shot .window-bar b:nth-child(1) { background: #ff5f57; }
.bgper-ui .t-tool:hover .t-shot .window-bar b:nth-child(2) { background: #febc2e; }
.bgper-ui .t-tool:hover .t-shot .window-bar b:nth-child(3) { background: #28c840; }
.bgper-ui .t-shot img { display: block; max-width: none; transition: transform .8s var(--ease); }
.bgper-ui .t-tool:hover .t-shot { transform: translateY(-6px); box-shadow: var(--shadow-hover); }
.bgper-ui .t-shot:hover img { transform: translateY(-8px); }

.bgper-ui .t-featured .t-shot, .bgper-ui .t-large .t-shot { top: 260px; left: 32px; right: 32px; bottom: 0; }
.bgper-ui .t-featured .t-shot img, .bgper-ui .t-large .t-shot img { width: 100%; height: auto; }

.bgper-ui .t-compact .t-copy { width: 62%; padding: 32px; pointer-events: none; }
.bgper-ui .t-compact .t-copy a, .bgper-ui .t-compact .t-copy button { pointer-events: auto; }
.bgper-ui .t-compact .t-copy p { font-size: 14px; }
.bgper-ui .t-compact .t-actions { flex-wrap: wrap; gap: 16px; }
/* 14px here: at the site's 15px the two links no longer fit on one line in the narrow FlowWatch card */
.bgper-ui .t-compact .t-link, .bgper-ui .t-compact .t-more { font-size: 14px; }
.bgper-ui .t-compact .t-shot { top: 38px; bottom: 0; right: auto; border-right: 0; border-radius: 12px 0 0 0; }
.bgper-ui .t-compact:hover .t-shot { transform: translate(-8px, -4px); }
/* FlowWatch's card is the narrowest: the copy runs to 68% with a 20px right pad so "Open FlowWatch" and
   "Learn More" stay on one line at desktop widths; the screenshot starts where the copy ends */
.bgper-ui .t-flow_watch .t-copy { width: 68%; padding-right: 20px; }
.bgper-ui .t-flow_watch .t-shot { left: 68%; width: 240px; }
.bgper-ui .t-flow_watch .t-shot img { width: 440px; height: auto; }
.bgper-ui .t-cgtf .t-copy { width: 58%; }
.bgper-ui .t-cgtf .t-shot { left: 59%; width: 330px; }
/* FlowWatch and CGTF RIS sit side by side at the same height, but CGTF RIS has a subtitle line: the copy
   fills the card and the links sit on its bottom edge, so both rows of links line up */
@media (min-width: 768px) {
  .bgper-ui .t-flow_watch .t-copy, .bgper-ui .t-cgtf .t-copy { display: flex; flex-direction: column; height: 100%; box-sizing: border-box; }
  .bgper-ui .t-tool.t-flow_watch .t-actions, .bgper-ui .t-tool.t-cgtf .t-actions { margin-top: auto; }
}
.bgper-ui .t-cgtf .t-shot img { width: 510px; height: auto; }

/* ---------- details dialog ---------- */
.bgper-ui .t-dialog {
  width: min(880px, calc(100% - 32px)); max-height: calc(100dvh - 48px); padding: 0;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-float); font-family: var(--sans);
}
.bgper-ui .t-dialog::backdrop { background: rgba(17, 17, 17, .45); backdrop-filter: blur(4px); }
.bgper-ui .t-dialog[open] { animation: t-pop .5s var(--ease); }
.bgper-ui .t-dialog[open]::backdrop { animation: t-fade .3s ease; }
@keyframes t-pop { from { opacity: 0; transform: translateY(16px) scale(.98); } }
@keyframes t-fade { from { opacity: 0; } }
.bgper-ui:has(.t-dialog[open]) { overflow: hidden; }
.bgper-ui .t-dialog-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 14px 32px; border-bottom: 1px solid var(--line); background: var(--surface); }
.bgper-ui .t-dialog-body { padding: 24px 32px 32px; }
.bgper-ui .t-dialog-cat { font-size: 13px; color: var(--accent); }
/* one vertical rhythm whichever blocks a tool has: 16px inside a group (title, text, url),
   24px between groups (bullets, button), 32px before the screenshot */
.bgper-ui .t-dialog-body > * { margin: 0; }
.bgper-ui .t-dialog-body > * + * { margin-top: 24px; }
.bgper-ui .t-dialog-body > h2 + p, .bgper-ui .t-dialog-body > p + .t-url { margin-top: 16px; }
.bgper-ui .t-dialog-body > .btn { display: flex; width: fit-content; }
.bgper-ui .t-dialog-body > figure { margin-top: 32px; }
.bgper-ui .t-dialog-body h2 { font-size: 34px; font-weight: 600; line-height: 1.15; letter-spacing: -0.035em; color: var(--ink); }
.bgper-ui .t-dialog-body p { max-width: 70ch; font-size: 15px; line-height: 1.75; color: var(--muted); }
.bgper-ui .t-dialog-body ul { display: grid; gap: 8px; padding-left: 20px; font-size: 15px; line-height: 1.6; list-style: disc; }
.bgper-ui .t-dialog-body li::marker { color: var(--accent); }
.bgper-ui .t-dialog-body li a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.bgper-ui .t-dialog-body .t-url a, .bgper-ui .t-dialog-body p a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; overflow-wrap: anywhere; }
.bgper-ui .t-dialog-body figure img { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: 6px; background: #fff; }

/* ---------- laptop ---------- */
@media (min-width: 768px) and (max-width: 1100px) {
  .bgper-ui .t-copy { padding-left: 24px; padding-right: 24px; }
  .bgper-ui .t-tool h2 { font-size: 24px; }
  .bgper-ui .t-featured h2 { font-size: 30px; }
  .bgper-ui .t-featured .t-copy p { font-size: 14px; }
  .bgper-ui .t-large .t-copy p { font-size: 13px; }
  .bgper-ui .t-featured .t-shot, .bgper-ui .t-large .t-shot { left: 24px; right: 24px; }
  .bgper-ui .t-compact .t-copy { padding: 24px; }
  .bgper-ui .t-compact .t-actions { flex-direction: column; align-items: flex-start; gap: 8px; margin-top: 20px; }
  .bgper-ui .t-compact .t-more { padding: 0; }
  .bgper-ui .t-compact .t-copy p { font-size: 12px; }
}

/* ---------- phone ---------- */
@media (max-width: 767px) {
  .bgper-ui .t-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; margin-bottom: 64px; }
  .bgper-ui .t-tool { grid-column: 1; }
  .bgper-ui .t-copy { padding: 24px 24px 0; }
  .bgper-ui .t-featured h2 { font-size: 30px; }
  .bgper-ui .t-large h2 { font-size: 28px; }
  .bgper-ui .t-copy p { font-size: 13px; }
  .bgper-ui .t-featured .t-copy p { font-size: 14px; }
  .bgper-ui .t-actions { gap: 18px; }

  /* large cards stack: copy, then the screenshot running off the bottom edge */
  .bgper-ui .t-featured, .bgper-ui .t-large { display: flex; flex-direction: column; height: auto; }
  .bgper-ui .t-featured .t-shot, .bgper-ui .t-large .t-shot { position: relative; inset: auto; width: calc(100% - 48px); height: 220px; margin: 24px 24px 0; flex: none; overflow: hidden; }
  .bgper-ui .t-large .t-shot { height: 190px; }

  .bgper-ui .t-flow_watch, .bgper-ui .t-cgtf { height: auto; min-height: 290px; }
  .bgper-ui .t-compact .t-copy, .bgper-ui .t-cgtf .t-copy { width: 72%; padding: 24px; }
  .bgper-ui .t-compact .t-actions { flex-direction: column; align-items: flex-start; gap: 0; margin-top: 20px; }
  .bgper-ui .t-compact .t-link { font-size: 12px; }
  .bgper-ui .t-compact .t-more { min-height: 36px; font-size: 12px; }
  .bgper-ui .t-flow_watch .t-shot { left: 70%; top: 40px; width: 230px; }
  .bgper-ui .t-cgtf .t-shot { left: 72%; top: 40px; width: 270px; }

  .bgper-ui .t-dialog-head { padding: 12px 20px; }
  .bgper-ui .t-dialog-body { padding: 24px 20px; }
  .bgper-ui .t-dialog-body h2 { font-size: 28px; }
  .bgper-ui .t-dialog-body p, .bgper-ui .t-dialog-body ul { font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .bgper-ui .t-tool, .bgper-ui .t-shot, .bgper-ui .t-shot img, .bgper-ui .t-head .ico { transition: none; }
  .bgper-ui .t-tool:hover .t-shot, .bgper-ui .t-shot:hover img, .bgper-ui .t-compact:hover .t-shot { transform: none; }
  .bgper-ui .t-dialog[open], .bgper-ui .t-dialog[open]::backdrop { animation: none; }
}

/* desktop, where the two links sit side by side: a 40px tall hit area */
@media (min-width: 1101px) and (pointer: fine) {
  .bgper-ui .t-more::after, .bgper-ui .t-link::after { content: ""; position: absolute; left: -6px; right: -6px; top: 50%; height: 40px; transform: translateY(-50%); }
}
/* touch screens: Learn More and the card links get a 44px hit area */
@media (pointer: coarse) {
  .bgper-ui .t-more::after, .bgper-ui .t-link::after { content: ""; position: absolute; left: -6px; right: -6px; top: 50%; height: 44px; transform: translateY(-50%); }
}
