/* ---------------------------------------------------------------------------
   TrendWatching customer surfaces: shared foundation.

   Loaded first by both the public MCP site (mcp.trendwatching.com) and the
   Developer API portal. Holds the tokens, base typography and the components
   both sites use (brand switcher, buttons, inputs, code). Each site layers its
   own layout stylesheet on top; nothing site-specific belongs here.
   --------------------------------------------------------------------------- */

:root {
    --tw-bg: #ffffff;
    --tw-bg-2: #f5f5f7;
    --tw-bg-3: #ebebef;
    --tw-line: rgba(0, 0, 0, 0.08);
    --tw-line-2: rgba(0, 0, 0, 0.14);
    --tw-text: #1d1d1f;
    --tw-text-2: #3a3a3c;
    --tw-muted: #6e6e73;
    /* #86868b fails 4.5:1 on white; keep it for non-essential meta only. */
    --tw-faint: #86868b;

    --tw-graphite: #1d1d1f;
    --tw-graphite-2: #2c2c2e;
    --tw-graphite-3: #3a3a3c;
    --tw-on-dark: #f5f5f7;
    --tw-on-dark-muted: #a1a1a6;
    --tw-line-dark: rgba(255, 255, 255, 0.1);

    --tw-signal: #0ad78f;
    --tw-signal-ink: #04281b;
    /* Dark green panel fill; carries --tw-on-dark text at ~7:1. */
    --tw-signal-deep: #0a5c3e;
    /* Green tuned for 4.5:1 body-text contrast on white and #f5f5f7. */
    --tw-link: #067a52;
    --tw-code-string: #7ee2b8;
    --tw-danger: #c4001a;
    --tw-danger-bg: #fff1f2;
    --tw-success-bg: #ecfdf5;

    --tw-radius-sm: 8px;
    --tw-radius: 12px;
    --tw-radius-md: 14px;
    --tw-radius-lg: 18px;
    --tw-radius-xl: 24px;
    --tw-radius-2xl: 28px;
    --tw-pill: 999px;

    --tw-shadow-card: 0 1px 2px rgba(0, 0, 0, 0.04), 0 12px 32px -16px rgba(0, 0, 0, 0.14);
    --tw-shadow-pop: 0 12px 32px -8px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.05);
    --tw-shadow-shot: 0 50px 100px -40px rgba(0, 0, 0, 0.45);

    --tw-target: 44px;
    --tw-font: 'Urbanist', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --tw-mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, monospace;
    --tw-tracking-tight: -0.025em;
    --tw-ease: 160ms ease;
}

@font-face {
    font-family: 'Urbanist';
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
    src: url('fonts/urbanist-latin.woff2') format('woff2');
}

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

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--tw-font);
    font-size: 16px;
    line-height: 1.5;
    color: var(--tw-text);
    background: var(--tw-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 {
    font-weight: 600;
    letter-spacing: var(--tw-tracking-tight);
    line-height: 1.1;
    margin: 0;
}

p { margin: 0; }
/* Component display rules must never beat the hidden attribute. */
[hidden] { display: none !important; }
img, svg { max-width: 100%; }
a { color: var(--tw-link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 0.2em; }

code, pre, kbd { font-family: var(--tw-mono); }

:focus-visible {
    outline: 2px solid var(--tw-link);
    outline-offset: 2px;
    border-radius: 4px;
}

.tw-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;
}

.skip-link {
    position: absolute;
    top: -48px;
    left: 8px;
    z-index: 200;
    background: var(--tw-bg);
    color: var(--tw-text);
    border-radius: var(--tw-radius-sm);
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    transition: top var(--tw-ease);
}
.skip-link:focus { top: 8px; box-shadow: var(--tw-shadow-pop); }

/* ----------------------------- Brand switcher ----------------------------- */
.tw-brandswitch { position: relative; flex-shrink: 0; }
.tw-brandswitch-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 36px;
    padding: 4px 8px;
    margin: -4px -8px;
    background: transparent;
    border: 0;
    border-radius: var(--tw-radius-sm);
    color: var(--tw-text);
    font: inherit;
    cursor: pointer;
}
.tw-brandswitch-trigger:hover { background: var(--tw-bg-2); }
.tw-brandswitch-logo { display: block; height: 26px; width: auto; }
.tw-brandswitch-divider { width: 1px; height: 16px; background: var(--tw-line-2); }
.tw-brandswitch-label { font-size: 14px; font-weight: 600; white-space: nowrap; }
.tw-brandswitch-caret {
    color: var(--tw-faint);
    margin-left: -4px;
    transition: transform var(--tw-ease);
}
.tw-brandswitch-trigger[aria-expanded="true"] .tw-brandswitch-caret { transform: rotate(180deg); }
.tw-brandswitch-menu {
    position: absolute;
    top: calc(100% + 10px);
    left: -8px;
    min-width: 240px;
    padding: 6px;
    background: var(--tw-bg);
    border-radius: var(--tw-radius-md);
    box-shadow: var(--tw-shadow-pop);
    z-index: 50;
}
.tw-brandswitch-menu[hidden] { display: none; }
.tw-brandswitch-item {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 9px 12px;
    border-radius: var(--tw-radius-sm);
    color: var(--tw-text);
}
.tw-brandswitch-item:hover { background: var(--tw-bg-2); text-decoration: none; }
.tw-brandswitch-item-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
}
.tw-brandswitch-item.is-active .tw-brandswitch-item-name::after {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--tw-signal);
}
.tw-brandswitch-item-desc { font-size: 12.5px; color: var(--tw-muted); }
.tw-brandswitch-item.is-disabled { color: var(--tw-muted); cursor: default; }
.tw-brandswitch-item.is-disabled:hover { background: transparent; }
.tw-brandswitch-item-tag {
    padding: 1px 7px;
    border-radius: var(--tw-pill);
    background: var(--tw-bg-3);
    color: var(--tw-text-2);
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

/* ----------------------------- Buttons ----------------------------- */
.tw-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 20px;
    border: 0;
    border-radius: var(--tw-pill);
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color var(--tw-ease), color var(--tw-ease), opacity var(--tw-ease);
}
.tw-btn:hover { text-decoration: none; }
.tw-btn:disabled { opacity: 0.5; cursor: default; }
.tw-btn--primary { background: var(--tw-graphite); color: #fff; }
.tw-btn--primary:hover:not(:disabled) { background: #000; }
.tw-btn--quiet { background: var(--tw-bg-2); color: var(--tw-text); }
.tw-btn--quiet:hover:not(:disabled) { background: var(--tw-bg-3); }
.tw-btn--signal { background: var(--tw-signal); color: var(--tw-signal-ink); }
.tw-btn--danger { background: transparent; color: var(--tw-danger); }
.tw-btn--danger:hover:not(:disabled) { background: var(--tw-danger-bg); }
.tw-btn--sm { min-height: 32px; padding: 0 14px; font-size: 13.5px; }
.tw-btn--block { width: 100%; min-height: 46px; }

.tw-more { font-weight: 600; color: var(--tw-link); }
.tw-more::after { content: " ›"; }

/* ----------------------------- Inputs ----------------------------- */
.tw-input {
    width: 100%;
    min-height: 48px;
    padding: 0 14px;
    background: var(--tw-bg);
    border: 1px solid var(--tw-line-2);
    border-radius: var(--tw-radius);
    color: var(--tw-text);
    font: inherit;
    font-size: 16px;
    transition: border-color var(--tw-ease), box-shadow var(--tw-ease);
}
.tw-input::placeholder { color: var(--tw-faint); }
.tw-input:focus {
    outline: none;
    border-color: var(--tw-text);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.07);
}
.tw-label { display: block; font-size: 13.5px; font-weight: 600; margin: 0 0 6px; }

/* ----------------------------- Code ----------------------------- */
.tw-code {
    position: relative;
    margin: 0;
    padding: 16px 18px;
    background: var(--tw-graphite);
    color: #e5e5ea;
    border-radius: var(--tw-radius-md);
    font-family: var(--tw-mono);
    font-size: 13px;
    line-height: 1.7;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.tw-code code { font: inherit; color: inherit; background: none; border: 0; padding: 0; }

.tw-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--tw-signal);
    flex-shrink: 0;
}
.tw-dot--off { background: #c7c7cc; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
}
