/*
 * The Static Dev — shared components.
 *
 * Load after tokens.css. Covers what every page of the suite has in common:
 * reset, page layout, brand header, buttons, banners, settings card,
 * form controls, the "?" tooltip, spinner, empty state, footer.
 * Tool-specific components stay in each tool's own stylesheet.
 */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--ink);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  transition: background-color .3s, color .3s;
}

/* ── Layout ──────────────────────────────────────────────────────────── */

.container { max-width: 64rem; margin: 0 auto; }
/* For tools that need the room (side-by-side editors). Header and footer
   stay on .container so the page rhythm matches across the suite. */
.container-wide { max-width: 88rem; margin: 0 auto; }
.site-header { padding: 48px 16px; text-align: center; }
.main { padding: 24px 16px 96px; }
@media (min-width: 640px) {
  .site-header { padding: 64px 24px; }
  .main { padding: 24px 24px 96px; }
}
@media (min-width: 1024px) {
  .site-header { padding: 64px 32px; }
  .main { padding: 24px 32px 96px; }
}

/* ── Brand ───────────────────────────────────────────────────────────── */

.brand { display: inline-flex; align-items: center; gap: 14px; text-decoration: none; color: var(--text); transition: opacity .15s; }
.brand:hover { opacity: 0.82; }
.brand-logo { width: 44px; height: 44px; display: block; flex-shrink: 0; }
.brand-title { font-size: 36px; font-weight: 300; letter-spacing: -0.02em; line-height: 1; }
@media (min-width: 640px) { .brand-title { font-size: 44px; } }
.brand-subtitle { margin-top: 12px; font-size: 13px; color: var(--muted); letter-spacing: 0.01em; }
@media (min-width: 640px) { .brand-subtitle { font-size: 15px; } }

/* ── Buttons ─────────────────────────────────────────────────────────── */

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: 36px; background: var(--surface); color: var(--muted); border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 6px 11px; font-size: 12px; font-family: var(--mono); cursor: pointer; transition: color .15s, border-color .15s, background-color .15s, opacity .15s; }
.btn:hover:not(:disabled) { color: var(--text); border-color: var(--text); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
/* Fill and text come from --accent-fill / --on-accent, both invariant across
   themes — never var(--ink), which flips with the theme while the fill
   doesn't. */
.btn-p { background: var(--accent-fill); color: var(--on-accent); border-color: transparent; font-weight: 500; }
.btn-p:hover:not(:disabled) { background: var(--accent-fill); color: var(--on-accent); border-color: transparent; opacity: 0.85; }
.btn .ic { width: 13px; height: 13px; display: block; flex-shrink: 0; }
.btn-busy { gap: 8px; }
.btn-busy .spin { gap: 4px; }
.btn-p .sd { background: var(--on-accent); }

/* ── Status banners ──────────────────────────────────────────────────── */

.err { background: var(--danger-bg); border: 1px solid var(--danger-border); border-radius: var(--radius); color: var(--danger); font-size: 12px; padding: 8px 12px; margin-bottom: 12px; line-height: 1.6; }

/* ── Settings / controls card ────────────────────────────────────────── */

.stg { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 18px; margin-bottom: 16px; }
.slbl { font-size: 11px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }

/* ── Form controls ───────────────────────────────────────────────────── */

/* 48px min-height: real touch target, and lines up with the 48×48 .tbtn. */
select,
input[type="text"],
input[type="password"],
input[type="number"],
input[type="search"] {
  appearance: none;
  background-color: var(--ink);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  padding: 7px 10px;
  min-height: 48px;
  width: 100%;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
select {
  /* currentColor isn't available in background-image, so the chevron stroke
     is a fixed grey that reads on both themes. */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px 14px;
  padding-right: 32px;
  cursor: pointer;
}
/* Hover and focus ring only on the boxed fields above. A bare `input`
   selector also caught checkboxes and radios, which ended up with the
   field ring plus their own outline. */
select:hover,
input[type="text"]:hover,
input[type="password"]:hover,
input[type="number"]:hover,
input[type="search"]:hover { border-color: var(--text); }
select:focus-visible,
input[type="text"]:focus-visible,
input[type="password"]:focus-visible,
input[type="number"]:focus-visible,
input[type="search"]:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
input::placeholder { color: var(--muted); }
/* Checkboxes and radios keep the native control and get a plain outline. */
input[type="checkbox"]:focus-visible,
input[type="radio"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── "?" tooltip: 48×48 hit target, 14px visible dot ─────────────────── */

/* `margin: 0` is deliberate. A negative vertical margin (tried in GitPulse,
   later copied into GitDash) shrinks the box back into the layout and makes
   the 48px hit area physically overlap the field below it — Lighthouse
   flags it as an overlapping tap target, and it is a real bug. The button
   takes its real space; only the 14px dot is visible. */
.tip { position: relative; display: inline-flex; }
.tbtn { width: 48px; height: 48px; margin: 0; padding: 0; border: none; background: transparent; cursor: help; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.tbtn-dot { width: 14px; height: 14px; border-radius: 50%; border: 1px solid var(--border-strong); font-size: 9px; font-weight: 500; color: var(--muted); font-family: var(--mono); display: flex; align-items: center; justify-content: center; pointer-events: none; }
.tbtn:focus-visible { outline: 2px solid var(--accent); outline-offset: -14px; border-radius: 50%; }
.tbox { display: none; position: absolute; left: 18px; top: -2px; background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 10px 12px; width: 240px; max-width: calc(100vw - 64px); z-index: 50; font-size: 11px; line-height: 1.65; color: var(--text); box-shadow: 0 8px 24px rgba(0,0,0,0.25); text-transform: none; letter-spacing: normal; font-weight: 400; }
.tbox b { display: block; font-weight: 500; margin-bottom: 5px; }
.tbox p, .tbox li { color: var(--muted); }
.tbox ol { padding-left: 16px; list-style: decimal; }
.tbox li { margin-bottom: 2px; }
.tbox code { font-family: var(--mono); font-size: 10px; background: var(--ink); padding: 1px 4px; border-radius: 3px; }
/* Two modes. Without JS the box shows on hover and keyboard focus. After
   initTooltips() (js/tooltip.js) the .tip has .tip-click: the "?" button
   toggles the box through `hidden`, and Escape, focus or a click outside
   close it. In click mode the box starts right of the dot, so it never
   covers the button that closes it. */
.tip:not(.tip-click):hover .tbox,
.tip:not(.tip-click):focus-within .tbox { display: block; }
.tip-click .tbox { left: 30px; top: 0; }
.tip-click .tbox:not([hidden]) { display: block; }

/* ── Spinner ─────────────────────────────────────────────────────────── */

.spin { display: flex; gap: 5px; justify-content: center; align-items: center; }
.sd { width: 5px; height: 5px; border-radius: 50%; background: var(--muted); animation: sp 1s ease-in-out infinite; }
.sd:nth-child(2) { animation-delay: .15s; }
.sd:nth-child(3) { animation-delay: .3s; }
@keyframes sp { 0%,80%,100% { opacity: .25; transform: scale(.7); } 40% { opacity: 1; transform: scale(1); } }

/* ── Utilities ───────────────────────────────────────────────────────── */

.hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Empty / not-found state (404.html) */
.emp { padding: 28px; text-align: center; color: var(--muted); font-size: 13px; }
.emp-404 { padding-top: 0; }
.emp-title { font-size: 16px; color: var(--text); margin-bottom: 8px; }
.emp-action { margin-top: 16px; }
.emp-action .btn { text-decoration: none; }

/* ── Footer ──────────────────────────────────────────────────────────── */

.site-footer { margin-top: 2rem; padding-top: 2rem; border-top: 1px solid var(--border); text-align: center; color: var(--muted); }
.footer-privacy { display: flex; align-items: center; gap: 8px; margin-bottom: 20px; font-size: 13px; flex-direction: column; }
.privacy-icon { flex-shrink: 0; font-size: 13px; display: inline-flex; }
.privacy-icon .ic-lock { width: 13px; height: 13px; display: block; }
.footer-suite { font-size: 13px; margin-bottom: 8px; }
.footer-suite a { color: var(--text); text-underline-offset: 3px; }
.footer-copy { font-size: 13px; }
.footer-version { font-size: 11px; margin-top: 8px; font-family: var(--mono); }

/* ── Motion ──────────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
