/* ==========================================================================
   moat_app.css: page-wide rules for Moat's own app pages (profile, company,
   service), loaded after profile/assets/css/style.css by the standalone chrome
   only (common/header.php, profile/tools/header.php, the profile editor frame).
   style.css also ships inside club ?embed=1 fragments, so it keeps its global
   rules as they were; anything that would reach a host page lives here instead.
   ========================================================================== */

/* style.css's variable names, aliased to assets/moat/tokens.css (DS-01, DS-03). */
:root {
    --primary: var(--twc-accent-fill, #0062CC);
    --primary-dark: var(--twc-accent-fill-hover, #0052AD);
    --primary-light: var(--moat-accent-line, rgba(0, 122, 255, 0.3));
    --secondary: var(--twc-secondary-text, #595F69);
    --success: var(--twc-success-fill, #15803D);
    --warning: var(--twc-warning-fill, #B45309);
    --danger: var(--twc-error-fill, #DC2626);
    --dark: var(--twc-text, #18181B);
    --light: var(--twc-bg, #FAFAF8);
    --border: var(--twc-border, rgba(20, 20, 19, 0.14));
    --shadow-sm: var(--twc-shadow-sm, 0 1px 2px rgba(20, 40, 70, 0.06));
    --shadow-lg: var(--twc-shadow-lg, 0 2px 4px rgba(20, 40, 70, 0.05), 0 18px 48px rgba(20, 40, 70, 0.09));
    --radius-lg: var(--twc-radius-card, 16px);
}

* {
    font-family: var(--twc-font, "Inter", "Inter Fallback", system-ui, -apple-system, "Segoe UI", sans-serif);
}

/* 1rem: 15px made iOS zoom form fields (DS-16). */
body { font-size: var(--twc-font-size-body, 1rem); }

/* Weights 400 to 600 only (font_best 5.2): Bootstrap's bold utilities and
   b/strong ("bolder") would otherwise ask for 700. */
b, strong { font-weight: var(--twc-weight-semibold, 600); }
.fw-bold, .fw-bolder { font-weight: var(--twc-weight-semibold, 600) !important; }

/* DS-06/DS-07 for the app navbar (style.css scopes its own block to #moat-main). */
.navbar :focus-visible { outline: var(--twc-focus-ring, 2px solid #0062CC); outline-offset: var(--twc-focus-offset, 2px); }
@media (prefers-reduced-motion: reduce) {
    .navbar *, .navbar *::before, .navbar *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ==========================================================================
   AA values for the Bootstrap-named and generic class rules in style.css.
   style.css also ships inside club ?embed=1 fragments and partners link it
   directly, where these class names style the host's own Bootstrap chrome, so
   it keeps their pre-Task-9 declarations (test/embed_components.test.php pins
   them). Moat's own pages get the accessible values here instead. This file
   sits right after style.css in every standalone head, so each override takes
   effect where style.css's own rule would, before the page CSS.
   Only the declarations that differ from style.css are repeated.
   ========================================================================== */
.navbar-brand { font-weight: 600; }
.nav-link { color: var(--twc-secondary-text, #595F69) !important; }
.nav-link:hover { color: var(--twc-accent-fill, #0062CC) !important; }
.search-box .form-control:focus { border-color: var(--twc-accent-fill, #0062CC); }
.search-box .btn { color: var(--twc-secondary-text, #595F69); }
.btn-primary { background: var(--twc-accent-fill, #0062CC); border-color: var(--twc-accent-fill, #0062CC); }
.btn-primary:hover { background: var(--twc-accent-fill-hover, #0052AD); border-color: var(--twc-accent-fill-hover, #0052AD); }
.btn-outline-primary { color: var(--twc-accent-fill, #0062CC); border-color: var(--twc-accent-fill, #0062CC); }
.btn-outline-primary:hover { background: var(--twc-accent-fill, #0062CC); border-color: var(--twc-accent-fill, #0062CC); }
.btn-light { color: var(--twc-secondary-text, #595F69); }
.btn-outline-secondary { color: var(--twc-secondary-text, #595F69); }
.btn-outline-danger { color: var(--twc-error-text, #991B1B); border-color: var(--twc-error-fill, #DC2626); }
.btn-outline-danger:hover { background: var(--twc-error-fill, #DC2626); }
.section-title i { color: var(--twc-accent-fill, #0062CC); }
.form-control:focus, .form-select:focus { border-color: var(--twc-accent-fill, #0062CC); }
.form-control::placeholder { color: var(--twc-secondary-text, #595F69); }
.form-text { color: var(--twc-secondary-text, #595F69); }
.form-check-input:checked { background-color: var(--twc-accent-fill, #0062CC); border-color: var(--twc-accent-fill, #0062CC); }
.accordion-button:not(.collapsed) { color: var(--twc-accent-fill, #0062CC); }
.progress-bar { background: var(--twc-accent-fill, #0062CC); }
.empty-state p { color: var(--twc-secondary-text, #595F69); }
.alert-success { color: var(--twc-success-text, #14532D); }
.alert-danger { color: var(--twc-error-text, #991B1B); }
.alert-warning { color: var(--twc-warning-text, #713F12); }
.alert-info { color: var(--twc-accent-fill, #0062CC); }
.page-link { color: var(--twc-secondary-text, #595F69); }
.page-link:hover { color: var(--twc-accent-fill, #0062CC); }
.page-item.active .page-link { background: var(--twc-accent-fill, #0062CC); border-color: var(--twc-accent-fill, #0062CC); }
.text-primary { color: var(--twc-accent-fill, #0062CC) !important; }
.bg-primary { background: var(--twc-accent-fill, #0062CC) !important; }
.border-primary { border-color: var(--twc-accent-fill, #0062CC) !important; }
.text-secondary { color: var(--twc-secondary-text, #595F69) !important; }
.text-success { color: var(--twc-success-text, #14532D) !important; }
.text-danger { color: var(--twc-error-text, #991B1B) !important; }

/* ---------- Former style="" attributes of the standalone app pages (CON-12) ----------
   Each rule carries the declarations the attribute had, with a selector that
   outranks the rules the attribute used to beat. */
/* Both app chromes (common/header.php, profile/tools/header.php): the sticky top bar */
.navbar.moat-nav-sticky { position: sticky; top: 0; z-index: var(--twc-z-sticky, 100); }
/* The sign-in pages (common/login_page.php, profile/tools/login_page.php): centred box */
.moat-login-box { max-width: 400px; margin: auto; }
/* profile/post.php: section label, page title and subtitle */
h6.moat-post-kicker { font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
h1.moat-post-title { font-size: 1.5rem; font-weight: 600; color: var(--dark); margin-bottom: var(--twc-space-1, 0.25rem); }
p.moat-post-sub { color: var(--secondary); margin: 0; font-size: 14px; }
/* profile/dash.php: content preview box and the SEO table's key column */
.moat-dash-preview { max-height: 300px; overflow-y: auto; }
.table th.moat-dash-th-key { width: 150px; }

/* ---------- AA on the standalone app pages, both schemes (DS-05, Task 15) ----------
   Measured failures of the page stylesheets, which also ship in club fragments and so
   keep their values; Moat's own pages get these instead. Each rule reads a token, so it
   holds in the dark scheme too, and carries one more element than the page rule it
   corrects (this file loads before the page CSS). Scoped to body.moat-app-page (Moat's own
   pages only, head.php), so the ?embed=1 documents partners frame keep HEAD's look; the
   :where() adds no weight. */
/* One visible focus ring everywhere on the page (DS-06): the browser's default ring is
   near-black (#101010), lost on the dark scheme's grounds. A component's own
   :focus-visible rule is more specific and keeps its ring. */
:where(.moat-app-page) :focus-visible { outline: var(--twc-focus-ring, 2px solid #0062CC); outline-offset: var(--twc-focus-offset, 2px); }
/* Text on the accent fill reads --twc-on-accent (white in light, near-black on the light
   dark-scheme fill). Bootstrap paints it white already; this keeps it right without
   Bootstrap. Scoped: on a dark partner host the ?embed=1 documents keep HEAD's text. */
body:where(.moat-app-page) .btn-primary { color: var(--twc-on-accent, #FFFFFF); }
/* Bootstrap fields: the 14% hairline was 1.34:1; a control's boundary needs 3:1. */
:where(.moat-app-page) .form-control, :where(.moat-app-page) .form-select, body:where(.moat-app-page) .search-box .form-control { border-color: var(--twc-border-strong, #858B94); }
/* company/service view: small labels on #9CA3AF were 2.54:1 */
body:where(.moat-app-page) .id-stat-label, body:where(.moat-app-page) .block-label, body:where(.moat-app-page) .side-panel-label,
body:where(.moat-app-page) .fact-key, body:where(.moat-app-page) .f-role, body:where(.moat-app-page) .connect-handle { color: var(--twc-secondary-text, #595F69); }
body:where(.moat-app-page) .id-tag.green { color: var(--twc-success-text, #14532D); }
body:where(.moat-app-page) .id-tag.amber { color: var(--twc-warning-text, #713F12); }
body:where(.moat-app-page) .product-url { opacity: 1; }
/* Owner-only score breakdown (company/service view): its colours are inline styles in
   markup club fragments share. The score line reads --moat-ink-4 (#9CA3AF, 2.54:1 when
   unset), so own pages set it; the ticks are literal, so only !important reaches them
   (the filled one was #059669, 3.77:1; the open circle #D1D5DB). */
body:where(.moat-app-page) { --moat-ink-4: var(--twc-secondary-text, #595F69); }
body:where(.moat-app-page) .side-panel span[style*="#059669"] { color: var(--twc-success-fill, #15803D) !important; }
body:where(.moat-app-page) .side-panel span[style*="#d1d5db"] { color: var(--twc-secondary-text, #595F69) !important; }
:where(.moat-app-page) .moat-item .moat-n { color: var(--twc-secondary-text, #595F69); opacity: 1; }
/* Founder initials: white on the light end of each gradient was 1.7 to 2.7:1; one deep
   fill per position keeps the variety (white 5.0 to 7.1:1). */
:where(.moat-app-page) .founder:nth-child(4n+1) .f-av { background: #1D4ED8 !important; }
:where(.moat-app-page) .founder:nth-child(4n+2) .f-av { background: #6D28D9 !important; }
:where(.moat-app-page) .founder:nth-child(4n+3) .f-av { background: #047857 !important; }
:where(.moat-app-page) .founder:nth-child(4n+4) .f-av { background: #B45309 !important; }
/* company/service publish and "my" pages */
body:where(.moat-app-page) .input, body:where(.moat-app-page) .textarea, body:where(.moat-app-page) .select { border-color: var(--twc-border-strong, #858B94); }
body:where(.moat-app-page) .req-pill, body:where(.moat-app-page) .step-tag.req, body:where(.moat-app-page) .co-row-btn.del, body:where(.moat-app-page) .sv-row-btn.del { color: var(--twc-error-text, #991B1B); }
body:where(.moat-app-page) .shell .wbtn-success { background: var(--twc-success-fill, #15803D); border-color: var(--twc-success-fill, #15803D); }
/* profile editor: the mini card's gradient ended on indigo-500 (white 4.47:1) */
body:where(.moat-app-page) .wiz-profile-card { background: linear-gradient(135deg, var(--twc-accent-fill, #0062CC) 0%, #4F46E5 100%); }
body:where(.moat-app-page) .wpc-sub { opacity: 1; }
body:where(.moat-app-page) .wpc-type { background: rgba(0, 0, 0, 0.2); opacity: 1; }
body:where(.moat-app-page) .wiz-profile-card :focus-visible { outline-color: #FFFFFF; }
/* Profile cards: the Follow button sits on the accent cover, where the accent focus ring
   vanished (1:1 at HEAD). Inverse ink reads on the cover in both schemes. */
body:where(.moat-app-page) .follow-btn:focus-visible, body:where(.moat-app-page) #moat-main .follow-btn:focus-visible { outline-color: var(--twc-text-inverse, #FAFAF8); }
/* Profile view analytics: the stat links faded to 80% on hover, secondary text 3.91:1. */
body:where(.moat-app-page) a.analytic-stat-link:hover { opacity: 1; background-color: var(--twc-surface-hover, #F3F2EF); border-radius: var(--twc-radius-sm, 6px); }
