/* Algorithm v2 — skin for tool pages that still use the style.css markup.
   Load order on such pages:
     tokens.css → style.css → components.css → auth.css → v2-chrome.css →
     v2.css → v2-tool.css → v2-legacy.css → page CSS
   v2.css maps every legacy token (--primary-rgb, --bg-surface, --font-body …)
   to v2 values, so most legacy rules recolour by themselves. This file fixes
   the shapes that tokens can't reach: the hero, panels, form controls,
   buttons and tables. Page CSS loads after it and has the last word. */

body { background: var(--bg); color: var(--text); font-family: var(--font); font-size: 16px; }
.ambient-light { display: none !important; }
.app-container { max-width: var(--wrap); padding-left: var(--gutter); padding-right: var(--gutter); }
.app-container img { display: inline-block; }

/* ── Hero: v2 tool hero inside .app-container (no .wrap needed) ── */
.app-container .tool-hero { padding: 72px 0 0; text-align: left; display: block; }
.app-container .tool-hero .hero-title { margin: 0; text-align: left; }
.app-container .tool-hero .hero-sub { margin: 0; text-align: left; }
.app-container .tool-hero .gradient-text { color: inherit; }
.app-container .tool-hero + .search-interface,
.app-container .tool-hero + section,
.app-container .tool-hero + div { margin-top: 56px; }
@media (max-width: 860px) {
    .app-container .tool-hero { padding-top: 40px; }
    .app-container .tool-hero + .search-interface,
    .app-container .tool-hero + section,
    .app-container .tool-hero + div { margin-top: 36px; }
}

/* ── Headings ── */
main h2, main h3, main h4 { font-family: var(--font); letter-spacing: -0.012em; }
main h2 { font-weight: 540; }
main h3, main h4 { font-weight: 500; }

/* ── Panels ── */
.glass-panel {
    background: var(--bg-raised); border: 1px solid var(--line); border-radius: var(--r-lg);
    box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none;
}
.search-interface.glass-panel { border-color: var(--line-strong); box-shadow: 0 30px 80px -30px rgba(var(--shadow-rgb), calc(0.7 * var(--shadow-k))); }

/* ── Form controls (text-like inputs only; toggles and radios keep their own look) ── */
main textarea,
main input[type="text"], main input[type="url"], main input[type="search"],
main input[type="email"], main input[type="number"], main input:not([type]),
main select {
    background-color: var(--bg); border: 1px solid var(--line-strong); border-radius: var(--r);
    color: var(--text); font-family: inherit;
}
main textarea::placeholder, main input::placeholder { color: var(--text-3); }
main textarea:focus, main input:focus, main select:focus {
    outline: none; border-color: rgba(var(--accent-rgb), 0.6); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.15);
}
main input[type="checkbox"], main input[type="radio"] { accent-color: var(--accent); }

/* ── Buttons ── */
.btn-export {
    background: transparent; border: 1px solid var(--line-strong); border-radius: var(--r);
    color: var(--text); font-family: inherit; font-weight: 500; box-shadow: none;
}
.btn-export:hover { background: var(--bg-hover); border-color: rgba(var(--fg-rgb), 0.2); color: var(--text); }

/* ── Tables ── */
main table { font-variant-numeric: tabular-nums; }
main th { font-family: inherit; font-weight: 500; color: var(--text-3); text-transform: none; letter-spacing: 0; }
main td { border-color: var(--line); }

/* ── Loading ── */
.loading-spinner { border-color: var(--line-strong); border-top-color: var(--accent); }

/* ── Dropdown menus (Filter/Sort, Export) ── */
.filter-dropdown-menu {
    background: var(--bg-overlay); border: 1px solid var(--line-strong); border-radius: var(--r);
    padding: 4px; box-shadow: 0 20px 50px -12px rgba(var(--shadow-rgb), calc(0.7 * var(--shadow-k)));
}
.filter-option { padding: 7px 10px; border-radius: var(--r-xs); font-size: 14px; color: var(--text-2); }
.filter-option:hover { background: var(--bg-hover); color: var(--text); }
.filter-option.active { background: var(--bg-hover); color: var(--text); font-weight: 500; }

/* ── Form that lived inside the legacy hero (moved out by the migration) ── */
.app-container .hero-section--form { display: block; padding: 0; text-align: left; align-items: stretch; }
.app-container .hero-section--form > .search-interface:first-child,
.app-container .hero-section--form > :first-child { margin-top: 0; }

/* ── Main run button (.run-btn): white v2 primary; in the form it is sized to
   its label and sits at the right edge ── */
.run-btn { border-color: transparent; font-family: inherit; font-weight: 500; letter-spacing: -0.005em; }
.run-btn:hover { transform: none; box-shadow: none; border-color: transparent; }
.search-interface .run-btn { display: block; width: auto !important; min-width: 200px; height: 42px; padding: 0 24px; margin-left: auto; font-size: 15px; }
@media (max-width: 600px) { .search-interface .run-btn { width: 100% !important; } }

/* ── Table headers in sentence case (legacy pages set them uppercase) ── */
main th { text-transform: none !important; letter-spacing: 0 !important; font-size: 13px; }

/* Gap above the footer. The footer sits right after .app-container, and the
   bottom margin of whatever ends <main> collapses into this one, so the gap is
   max(96px, that margin): results or a form that end the page no longer touch
   the footer, and blocks that already had a bigger margin keep it. */
.app-container + .site-footer { margin-top: 96px; }
@media (max-width: 860px) { .app-container + .site-footer { margin-top: 64px; } }

/* ── Results control rows on phones: let buttons and the search field wrap
   instead of pushing the page sideways ── */
@media (max-width: 768px) {
    .results-controls-row, .results-actions, .results-header-left { flex-wrap: wrap; min-width: 0; max-width: 100%; }
    .results-header-left input[type="text"], .results-header-left input[type="search"], .results-header-left input:not([type]) { flex: 1 1 100%; min-width: 0; width: 100%; }
}

/* ── Legal pages: text in the second column, in line with the subtitle (like About) ── */
.app-container .legal-content { max-width: none; margin: 56px 0 0 calc(50% + 24px); padding: 0 0 96px; }
@media (max-width: 860px) { .app-container .legal-content { margin-left: 0; } }
