/* SuiteWebTools shared layout and theme.
   Loaded after each page's own <style>, so these rules win where they overlap.
   Everything here is scoped to body.swt and swt- class names. */

:root {
    --swt-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --swt-bg: #f3f4f6;
    --swt-card: #ffffff;
    --swt-soft: #f9fafb;
    --swt-text: #1f2937;
    --swt-muted: #6b7280;
    --swt-border: #e5e7eb;
    --swt-input-border: #d1d5db;
    --swt-radius: 8px;
    --swt-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --swt-rail: 300px;
    --swt-gap: 24px;

    /* Category palette: light card tone + accent (AA contrast with white text). */
    --cat-social-bg: #fdf2f8;  --cat-social: #be185d;  --cat-social-hover: #9d174d;
    --cat-home-bg: #fff7ed;    --cat-home: #c2410c;    --cat-home-hover: #9a3412;
    --cat-finance-bg: #f0fdf4; --cat-finance: #15803d; --cat-finance-hover: #166534;
    --cat-health-bg: #fef2f2;  --cat-health: #b91c1c;  --cat-health-hover: #991b1b;
    --cat-travel-bg: #f0f9ff;  --cat-travel: #0369a1;  --cat-travel-hover: #075985;
    --cat-other-bg: #fefce8;   --cat-other: #a16207;   --cat-other-hover: #854d0e;
    --cat-print3d-bg: #f0fdfa; --cat-print3d: #0f766e; --cat-print3d-hover: #115e59;
    --cat-coding-bg: #f5f3ff;  --cat-coding: #6d28d9;  --cat-coding-hover: #5b21b6;

    --cat-bg: #eff6ff;
    --cat-accent: #2563eb;
    --cat-accent-hover: #1d4ed8;
    --cat-on-accent: #ffffff;
    --cat-link: var(--cat-accent);
}

.cat-social  { --cat-bg: var(--cat-social-bg);  --cat-accent: var(--cat-social);  --cat-accent-hover: var(--cat-social-hover); }
.cat-home    { --cat-bg: var(--cat-home-bg);    --cat-accent: var(--cat-home);    --cat-accent-hover: var(--cat-home-hover); }
.cat-finance { --cat-bg: var(--cat-finance-bg); --cat-accent: var(--cat-finance); --cat-accent-hover: var(--cat-finance-hover); }
.cat-health  { --cat-bg: var(--cat-health-bg);  --cat-accent: var(--cat-health);  --cat-accent-hover: var(--cat-health-hover); }
.cat-travel  { --cat-bg: var(--cat-travel-bg);  --cat-accent: var(--cat-travel);  --cat-accent-hover: var(--cat-travel-hover); }
.cat-other   { --cat-bg: var(--cat-other-bg);   --cat-accent: var(--cat-other);   --cat-accent-hover: var(--cat-other-hover); }
.cat-print3d { --cat-bg: var(--cat-print3d-bg); --cat-accent: var(--cat-print3d); --cat-accent-hover: var(--cat-print3d-hover); }
.cat-coding  { --cat-bg: var(--cat-coding-bg);  --cat-accent: var(--cat-coding);  --cat-accent-hover: var(--cat-coding-hover); }
.cat-social, .cat-home, .cat-finance, .cat-health, .cat-travel, .cat-other, .cat-print3d, .cat-coding { --cat-link: var(--cat-accent); }

/* Coding & Dev tools keep a dark theme (class on <html>, next to the category class). */
.swt-dark {
    --swt-bg: #0f172a;
    --swt-card: #1e293b;
    --swt-soft: #172033;
    --swt-text: #e2e8f0;
    --swt-muted: #94a3b8;
    --swt-border: #334155;
    --swt-input-border: #475569;
    --swt-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --cat-bg: #1e1b4b;
    --cat-accent: #7c3aed;
    --cat-accent-hover: #6d28d9;
    --cat-link: #c4b5fd;
}

/* Form fields that never set a background would show the browser's white on dark pages.
   Zero specificity: any rule a tool sets on its own fields still wins. */
:where(.swt-dark) :where(textarea, select, input:not([type="color"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"])) {
    background-color: var(--swt-soft);
    color: var(--swt-text);
    border-color: var(--swt-input-border);
}

/* --- PAGE BASE --- */
body.swt {
    display: block;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background: var(--swt-bg);
    color: var(--swt-text);
    font-family: var(--swt-font);
    line-height: 1.6;
    overflow-x: hidden;
}

body.swt h1, body.swt h2, body.swt h3, body.swt h4,
body.swt input, body.swt textarea, body.swt select, body.swt button {
    font-family: var(--swt-font);
}

/* --- SITE HEADER --- */
.swt-header {
    background: var(--swt-card);
    border-bottom: 1px solid var(--swt-border);
    margin: 0;
    padding: 0;
    text-align: left;
}

.swt-header-inner {
    max-width: calc(860px + 2 * (var(--swt-rail) + var(--swt-gap)));
    margin: 0 auto;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.swt-logo {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--swt-text);
    text-decoration: none;
    white-space: nowrap;
}

.swt-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 6px;
    margin: 0;
    padding: 0;
}

.swt-nav a {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.85rem;
    color: var(--swt-muted);
    text-decoration: none;
    transition: background-color 0.15s, color 0.15s;
}

.swt-nav a:hover { background: var(--swt-soft); color: var(--swt-text); }
.swt-nav a.active { background: var(--cat-accent); color: var(--cat-on-accent); }

/* --- LAYOUT: rail | main | rail --- */
.swt-layout {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: var(--swt-gap);
    max-width: calc(860px + 2 * (var(--swt-rail) + var(--swt-gap)));
    width: 100%;
    margin: 0 auto;
    padding: 24px 16px;
}

/* Reserved for future ads. Hidden until the screen can fit both rails and a full tool column. */
.swt-rail {
    display: none;
    width: var(--swt-rail);
    flex: 0 0 var(--swt-rail);
}

.swt-main {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
    max-width: 960px;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

@media (min-width: 1440px) {
    .swt-rail { display: block; }
    .swt-main { max-width: 860px; }
}

/* Every top-level block in the column shares its full width. */
.swt-main > * {
    width: 100%;
    max-width: none;
    margin: 0;
}

/* Result boxes that scripts fill later take no space while empty. */
.swt-main > div:empty { display: none; }

/* --- BREADCRUMBS --- */
.swt-crumbs {
    font-size: 0.85rem;
    color: var(--swt-muted);
    margin: 0;
}

.swt-crumbs a { color: var(--swt-muted); text-decoration: none; }
.swt-crumbs a:hover { color: var(--cat-link); text-decoration: underline; }
.swt-crumbs span[aria-current] { color: var(--swt-text); }
.swt-crumbs .sep { margin: 0 6px; }

/* --- TOOL HEADING --- */
.swt-tool-head {
    text-align: center;
    margin: 0;
    padding: 0;
    background: none;
    border: none;
}

.swt-tool-head h1 {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.5px;
    color: var(--swt-text);
    margin: 0 0 8px;
    background: none;
    -webkit-text-fill-color: currentColor;
}

.swt-tool-head p {
    font-size: 1.05rem;
    color: var(--swt-muted);
    margin: 0;
}

/* --- INFO / HELP CONTENT --- */
.swt-info {
    display: block;
    background: var(--swt-card);
    color: var(--swt-text);
    border: 1px solid var(--swt-border);
    border-radius: var(--swt-radius);
    box-shadow: var(--swt-shadow);
    padding: 28px;
    text-align: left;
    line-height: 1.7;
}

.swt-info h2 { font-size: 1.35rem; line-height: 1.3; color: var(--swt-text); margin: 1.6em 0 0.6em; }
.swt-info h3 { font-size: 1.1rem; line-height: 1.35; color: var(--swt-text); margin: 1.4em 0 0.5em; }
.swt-info h4 { font-size: 1rem; color: var(--swt-text); margin: 1.2em 0 0.4em; }
.swt-info > :first-child { margin-top: 0; }
.swt-info > br { display: none; } /* old pages spaced paragraphs with <br>; margins do that now */
.swt-info p { margin: 0 0 1em; color: var(--swt-text); }
.swt-info ul, .swt-info ol { margin: 0 0 1em; padding-left: 1.4em; }
.swt-info ul { list-style: disc; }
.swt-info ol { list-style: decimal; }
.swt-info li { margin: 0 0 0.4em; }
.swt-info > :last-child, .swt-info p:last-child { margin-bottom: 0; }
.swt-info a { color: var(--cat-link); text-decoration: underline; }

/* Help content pieces: formulas, data tables, related tools and sources */
.swt-info .swt-formula {
    font-family: Consolas, "SFMono-Regular", Menlo, monospace;
    font-size: 0.95rem;
    background: var(--swt-soft);
    border: 1px solid var(--swt-border);
    border-left: 4px solid var(--cat-accent);
    border-radius: 4px;
    padding: 10px 14px;
    overflow-x: auto;
}
.swt-info .swt-table { width: 100%; border-collapse: collapse; margin: 0 0 1em; font-size: 0.95rem; }
.swt-info .swt-table th, .swt-info .swt-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--swt-border); }
.swt-info .swt-table th { color: var(--swt-muted); font-weight: 600; }
.swt-info .swt-related, .swt-info .swt-sources { font-size: 0.9rem; }
.swt-info .swt-sources { color: var(--swt-muted); border-top: 1px solid var(--swt-border); padding-top: 1em; }

/* Contact form */
.swt-form { display: flex; flex-direction: column; gap: 6px; margin: 0 0 1.5em; max-width: 560px; }
.swt-form label { font-weight: 600; font-size: 0.9rem; margin-top: 8px; color: var(--swt-text); }
.swt-form .swt-hint { font-weight: 400; color: var(--swt-muted); }
.swt-form input, .swt-form select, .swt-form textarea {
    width: 100%; padding: 10px; font-size: 0.95rem; font-family: var(--swt-font);
    border: 1px solid var(--swt-input-border); border-radius: 4px; background: var(--swt-card); color: var(--swt-text);
}
.swt-form textarea { resize: vertical; }
.swt-form button {
    margin-top: 12px; padding: 10px 24px; align-self: flex-start; border: none; border-radius: 4px;
    background: var(--cat-accent); color: var(--cat-on-accent); font-weight: 600; font-size: 0.95rem; cursor: pointer;
}
.swt-form button:hover { background: var(--cat-accent-hover); }

/* --- SUGGESTION BOX (homepage design) --- */
.swt-suggest {
    background: var(--swt-soft);
    border: 1px solid var(--swt-border);
    border-radius: var(--swt-radius);
    padding: 20px;
    margin: 0;
    text-align: left;
    color: var(--swt-text);
}

.swt-suggest h2, .swt-suggest h3 {
    font-size: 1.05rem;
    margin: 0 0 8px;
    color: var(--cat-link);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: left;
}

.swt-suggest p {
    font-size: 0.95rem;
    color: var(--swt-muted);
    margin: 0 0 16px;
    line-height: 1.5;
    text-align: left;
}

.swt-suggest form { margin: 0; padding: 0; }

.swt-suggest .swt-form-row {
    display: flex;
    gap: 10px;
    margin: 0 0 10px;
}

.swt-suggest input[type="email"],
.swt-suggest textarea {
    display: block;
    width: auto;
    min-width: 0;
    margin: 0;
    padding: 10px;
    border: 1px solid var(--swt-input-border);
    border-radius: 4px;
    background: var(--swt-card);
    color: var(--swt-text);
    font-size: 0.9rem;
    line-height: 1.4;
    box-shadow: none;
}

.swt-suggest input[type="email"] { flex: 1; }
.swt-suggest textarea { flex: 2; resize: vertical; height: 42px; min-height: 42px; }

.swt-suggest button {
    display: block;
    width: 100%;
    margin: 0;
    padding: 10px;
    border: none;
    border-radius: 4px;
    background: var(--cat-accent);
    color: var(--cat-on-accent);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
    box-shadow: none;
    text-transform: none;
}

.swt-suggest button:hover { background: var(--cat-accent-hover); }

/* --- FOOTER --- */
.swt-footer {
    text-align: center;
    margin: 36px 0 0;
    padding: 32px 16px 40px;
    color: var(--swt-muted);
    font-size: 0.9rem;
    border-top: 1px solid var(--swt-border);
    background: none;
}

.swt-footer p { margin: 0; color: var(--swt-muted); }
.swt-footer .swt-footer-note { font-size: 0.8rem; margin: 0 0 10px; }
.swt-footer-links { margin-top: 10px; }

.swt-footer-links a {
    display: inline-block;
    margin: 0 10px;
    color: var(--swt-muted);
    text-decoration: underline;
    cursor: pointer;
}

.swt-footer-links a:hover { color: var(--swt-text); }

/* --- SMALL SCREENS --- */
@media (max-width: 640px) {
    .swt-header-inner { flex-direction: column; align-items: flex-start; gap: 8px; }
    .swt-nav { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; padding-bottom: 2px; }
    .swt-nav a { white-space: nowrap; }
    .swt-layout { padding: 16px; }
    .swt-tool-head h1 { font-size: 1.6rem; }
    .swt-info { padding: 20px; }
    .swt-suggest .swt-form-row { flex-direction: column; }
    .swt-suggest textarea { height: 80px; }
}
