/* OpenPetro "Cite this tool" button and dropdown panel (rendered by /tools/cite.js).
   Uses each page's own design tokens (--surface, --surface-2, --line, --text,
   --text-2, --text-3, --accent, --mono), so it follows the page's light and
   dark themes. The page's .btn style applies to the buttons; the :where()
   fallback at the end has zero specificity and only matters if a page lacks it. */

/* Title row: the tool name, then the "Cite this tool" tab on the same line. */
.cite-titlerow{display:flex;align-items:center;flex-wrap:wrap;column-gap:14px;row-gap:8px;min-width:0}
.cite-titlerow > h1{min-width:0}
.cite-bar{position:relative;display:flex;flex:none}
.cite-bar .cite-trigger{
  display:inline-flex;align-items:center;gap:6px;white-space:nowrap;
  font-family:inherit;font-size:12.5px;font-weight:500;line-height:1.2;color:var(--text);
  padding:5px 11px;border-radius:999px;background:var(--surface);border:1px solid var(--line)
}
.cite-bar .cite-trigger:hover{border-color:var(--text-3);background:var(--surface-2)}
.cite-trigger .cite-chev{transition:transform .15s ease;opacity:.75}
.cite-trigger[aria-expanded="true"]{border-color:var(--text-3)}
.cite-trigger[aria-expanded="true"] .cite-chev{transform:rotate(180deg)}

.cite-pop{
  position:absolute;top:calc(100% + 8px);left:0;z-index:900;
  width:min(600px, calc(100vw - 32px));max-width:none;box-sizing:border-box;
  background:var(--surface);color:var(--text);
  border:1px solid var(--line);border-radius:12px;
  box-shadow:0 12px 32px rgba(0,0,0,.14),0 2px 6px rgba(0,0,0,.06);
  padding:14px 16px 16px;text-align:left;font-size:14px;line-height:1.5
}
.cite-pop[hidden]{display:none}
.cite-pop:focus{outline:none}
.cite-pop:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.cite-pop-head{display:flex;align-items:center;justify-content:space-between;gap:12px}
.cite-pop h2{margin:0;font-size:16px;font-weight:600;letter-spacing:normal;color:var(--text);text-transform:none}
.cite-close{display:inline-grid;place-items:center;width:28px;height:28px;border:0;border-radius:6px;background:none;color:var(--text-2);cursor:pointer}
.cite-close:hover{background:var(--surface-2);color:var(--text)}
/* Muted text uses --text-2: on some pages --text-3 is below WCAG AA contrast at 12 px. */
.cite-lead{margin:4px 0 12px;font-size:13px;color:var(--text-2)}
.cite-fmt{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.cite-fmt label{font-size:13px;font-weight:600;color:var(--text-2)}
.cite-fmt select{
  font:inherit;font-size:13px;color:var(--text);background:var(--surface-2);
  border:1px solid var(--line);border-radius:8px;padding:5px 28px 5px 10px;cursor:pointer;
  appearance:none;-webkit-appearance:none;max-width:100%;
  background-image:linear-gradient(45deg,transparent 50%,currentColor 50%),linear-gradient(135deg,currentColor 50%,transparent 50%);
  background-position:calc(100% - 15px) 52%,calc(100% - 10px) 52%;background-size:5px 5px;background-repeat:no-repeat
}
.cite-head{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:8px;margin:12px 0 6px}
.cite-label{margin:0;font-size:13px;font-weight:600;color:var(--text-2);letter-spacing:.01em;text-transform:none}
.cite-pop .cite-pre{
  font-family:var(--mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
  font-size:12px;line-height:1.55;color:var(--text);
  background:var(--surface-2);border:1px solid var(--line);border-radius:8px;
  padding:10px 12px;margin:0;
  white-space:pre-wrap;word-break:break-word;overflow-wrap:anywhere;
  max-width:100%;max-height:220px;box-sizing:border-box;overflow:auto;tab-size:2
}
.cite-pop .cite-pre i{font-style:italic}
.cite-actions{margin:12px 0 0;font-size:13px}
.cite-bib{color:var(--text);font-weight:500;text-decoration:underline;text-decoration-color:var(--accent);text-decoration-thickness:1.5px;text-underline-offset:3px}
.cite-bib:hover{color:var(--accent)}
.cite-trigger:focus-visible,.cite-bib:focus-visible,.cite-copy:focus-visible,.cite-close:focus-visible,.cite-fmt select:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.cite-copy{white-space:nowrap}
.cite-ver{font-size:11.5px;color:var(--text-2);white-space:nowrap}
.cite-sr{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}

@media (prefers-color-scheme: dark){
  :root:where(:not([data-theme="light"])) .cite-pop{box-shadow:0 12px 32px rgba(0,0,0,.5),0 2px 6px rgba(0,0,0,.3)}
}
:root[data-theme="dark"] .cite-pop{box-shadow:0 12px 32px rgba(0,0,0,.5),0 2px 6px rgba(0,0,0,.3)}

/* Fallback for pages without their own button style. */
:where(.cite-bar .btn){border:1px solid var(--line);background:var(--surface-2);color:var(--text);border-radius:8px;padding:5px 12px;cursor:pointer;font:inherit;font-size:13px}

@media (max-width:599px){
  .cite-pop{padding:12px 12px 14px}
  .cite-pop .cite-pre{font-size:11.5px;padding:9px 10px}
}
