/* ========================================================================
   XSC Market Hub v2 — Design System
   Modern dark SaaS. One token layer, one typography scale, one spacing scale.
   ======================================================================== */

/* --- Fonts: Inter for UI, Instrument Serif for display ----------------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Instrument+Serif:ital@0;1&family=JetBrains+Mono:wght@400;500&display=swap');

/* NOTE: chrome.css is loaded via a separate <link> tag from header.php.
   Previously it was @imported here, but that failed silently on some installs. */

:root {
    /* --- Color: Caribbean dark with warm aqua accent -------------------- */
    --bg:          #0b0e13;      /* page */
    --surface:     #141821;      /* cards */
    --surface-2:   #1a1f2a;      /* nested */
    --surface-3:   #232935;      /* hover */
    --line:        #2a3140;      /* borders */
    --line-soft:   #1e2330;

    --text:        #ebeef4;      /* primary */
    --text-dim:    #a8b1c2;      /* secondary */
    --text-mute:   #6b7488;      /* tertiary */

    --accent:      #2dd4bf;      /* primary action (aqua) */
    --accent-hi:   #5eead4;
    --accent-lo:   rgba(45,212,191,.12);
    --accent-ink:  #002922;      /* text on accent bg */

    --gold:        #f0b429;      /* premium/featured */
    --gold-lo:     rgba(240,180,41,.12);

    --danger:      #ff5d6c;
    --danger-lo:   rgba(255,93,108,.10);

    --success:     #4ade80;
    --warn:        #ffb547;

    /* --- Typography scale --------------------------------------------- */
    --sans:  'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --serif: 'Instrument Serif', Georgia, serif;
    --mono:  'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace;

    --fs-xs:   .75rem;
    --fs-sm:   .86rem;
    --fs-base: .95rem;
    --fs-md:   1.05rem;
    --fs-lg:   1.25rem;
    --fs-xl:   1.6rem;
    --fs-2xl:  2.2rem;
    --fs-3xl:  3rem;
    --fs-4xl:  4.2rem;

    /* --- Spacing -------------------------------------------------------- */
    --s-1: 4px;  --s-2: 8px;  --s-3: 12px;  --s-4: 16px;
    --s-5: 24px; --s-6: 32px; --s-7: 48px;  --s-8: 64px;

    /* --- Radius / shadow ------------------------------------------------ */
    --r-sm: 6px;  --r-md: 10px;  --r-lg: 16px;  --r-xl: 22px;  --r-pill: 999px;
    --sh-sm:  0 1px 2px rgba(0,0,0,.3);
    --sh-md:  0 4px 16px rgba(0,0,0,.35);
    --sh-lg:  0 18px 50px rgba(0,0,0,.5);
    --ring:   0 0 0 3px var(--accent-lo);
}

/* --- Reset ------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: var(--sans);
    font-size: var(--fs-base);
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;         /* belt-and-suspenders against stray overflow */
    min-width: 320px;
}

/* Soft dot grid as page background — subtle, Caribbean mood */
body {
    background-image:
        radial-gradient(1200px 600px at 10% -10%, rgba(45,212,191,.06), transparent 60%),
        radial-gradient(900px 500px at 100% 110%, rgba(240,180,41,.04), transparent 55%);
    background-attachment: fixed;
}

a { color: var(--accent-hi); text-decoration: none; }
a:hover { color: var(--accent); text-decoration: underline; }

h1, h2, h3, h4 { margin: 0 0 var(--s-3); font-weight: 500; line-height: 1.2; letter-spacing: -.01em; }
h1 { font-family: var(--serif); font-size: var(--fs-3xl); font-weight: 400; letter-spacing: -.015em; }
h2 { font-family: var(--serif); font-size: var(--fs-2xl); font-weight: 400; }
h3 { font-size: var(--fs-lg); font-weight: 600; }
h4 { font-size: var(--fs-md); font-weight: 600; color: var(--text-dim); }
p  { margin: 0 0 var(--s-3); }

code, pre { font-family: var(--mono); font-size: .9em; }
code { background: var(--surface-2); padding: 2px 6px; border-radius: var(--r-sm); color: var(--accent-hi); }
pre { background: var(--surface); padding: var(--s-4); border-radius: var(--r-md); overflow-x: auto; border: 1px solid var(--line); }

hr { border: 0; border-top: 1px solid var(--line); margin: var(--s-5) 0; }

/* --- Layout ------------------------------------------------------------ */
.container { max-width: 1200px; margin: 0 auto; padding: 0 var(--s-5); }
.narrow    { max-width: 720px; margin: 0 auto; padding: 0 var(--s-5); }

/* --- Buttons ----------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
    padding: 10px 18px;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    background: var(--surface-2);
    color: var(--text);
    font-family: inherit;
    font-size: var(--fs-sm);
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background .14s ease, border-color .14s ease, transform .06s ease;
    line-height: 1.2;
}
.btn:hover { background: var(--surface-3); border-color: var(--line); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }

.btn-primary {
    background: var(--accent); color: var(--accent-ink); border-color: transparent;
    font-weight: 600;
}
.btn-primary:hover { background: var(--accent-hi); color: var(--accent-ink); }

.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }

.btn-danger { color: var(--danger); border-color: rgba(255,93,108,.3); background: var(--danger-lo); }
.btn-danger:hover { background: rgba(255,93,108,.18); }

.btn-sm { padding: 6px 12px; font-size: var(--fs-xs); }
.btn-lg { padding: 14px 24px; font-size: var(--fs-md); }

/* --- Forms ------------------------------------------------------------- */
.field { margin-bottom: var(--s-4); }
.label {
    display: block;
    font-size: var(--fs-xs);
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-mute);
    margin-bottom: var(--s-2);
    font-weight: 500;
}
.input, .select, textarea.input {
    width: 100%;
    padding: 11px 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    color: var(--text);
    font-family: inherit;
    font-size: var(--fs-base);
    transition: border-color .14s ease, box-shadow .14s ease;
}
.input:focus, .select:focus, textarea.input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: var(--ring);
}
.input::placeholder { color: var(--text-mute); }

/* --- Cards / panels ---------------------------------------------------- */
.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: var(--s-5);
    margin-bottom: var(--s-4);
}

.panel-tight { padding: var(--s-4); }

/* --- Alerts ------------------------------------------------------------ */
.alert {
    padding: var(--s-3) var(--s-4);
    border-radius: var(--r-md);
    margin-bottom: var(--s-4);
    border: 1px solid var(--line);
    font-size: var(--fs-sm);
}
.alert-success { background: rgba(74,222,128,.08); border-color: rgba(74,222,128,.25); color: #86efac; }
.alert-error   { background: var(--danger-lo); border-color: rgba(255,93,108,.3); color: #ffb5bd; }
.alert-info    { background: var(--accent-lo); border-color: rgba(45,212,191,.3); color: var(--accent-hi); }

/* --- Utility ----------------------------------------------------------- */
.muted      { color: var(--text-mute); }
.dim        { color: var(--text-dim); }
.accent     { color: var(--accent); }
.serif      { font-family: var(--serif); }
.mono       { font-family: var(--mono); }
.center     { text-align: center; }

.badge {
    display: inline-flex; align-items: center;
    padding: 3px 10px;
    border-radius: var(--r-pill);
    font-size: var(--fs-xs);
    font-weight: 500;
    letter-spacing: .02em;
    background: var(--surface-3);
    color: var(--text-dim);
}
.badge-accent { background: var(--accent-lo); color: var(--accent-hi); }
.badge-gold   { background: var(--gold-lo); color: var(--gold); }

.tag {
    display: inline-block;
    padding: 2px 10px;
    border-radius: var(--r-pill);
    background: var(--surface-2);
    color: var(--text-dim);
    font-size: var(--fs-xs);
    border: 1px solid var(--line-soft);
}

/* --- Landing-specific (holding page) ---------------------------------- */
.hero {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: var(--s-7) var(--s-5);
    position: relative;
}
.hero-inner { max-width: 740px; text-align: center; }
.hero h1 {
    font-size: clamp(2.6rem, 7vw, var(--fs-4xl));
    line-height: 1.05;
    margin-bottom: var(--s-4);
}
.hero h1 em { color: var(--accent); font-style: italic; }
.hero .lead {
    font-size: var(--fs-lg);
    color: var(--text-dim);
    max-width: 560px;
    margin: 0 auto var(--s-6);
    line-height: 1.5;
}
.brand-lock {
    display: inline-flex; align-items: center; gap: var(--s-2);
    padding: 6px 14px 6px 10px;
    border-radius: var(--r-pill);
    border: 1px solid var(--line);
    background: var(--surface);
    font-size: var(--fs-xs);
    text-transform: uppercase;
    letter-spacing: .14em;
    color: var(--text-dim);
    margin-bottom: var(--s-5);
}
.brand-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 12px var(--accent);
}

/* Status pills on the landing page */
.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--s-3);
    max-width: 720px;
    margin: var(--s-7) auto 0;
    text-align: left;
}
.status-pill {
    padding: var(--s-4);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    font-size: var(--fs-sm);
}
.status-pill strong { display: block; color: var(--text); margin-bottom: 2px; font-weight: 600; }
.status-pill span   { color: var(--text-mute); font-size: var(--fs-xs); }

/* --- Schema check page ------------------------------------------------ */
.diag-section {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    margin-bottom: var(--s-3);
    overflow: hidden;
}
.diag-head {
    padding: var(--s-3) var(--s-4);
    background: var(--surface-2);
    border-bottom: 1px solid var(--line);
    font-family: var(--mono);
    font-size: var(--fs-sm);
    color: var(--accent-hi);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.diag-table { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: var(--fs-xs); }
.diag-table th, .diag-table td { padding: 6px var(--s-4); text-align: left; border-bottom: 1px solid var(--line-soft); }
.diag-table th { color: var(--text-mute); font-weight: 500; text-transform: uppercase; letter-spacing: .06em; font-size: 10px; }
.diag-table td { color: var(--text-dim); }
.diag-table td.name { color: var(--text); font-weight: 500; }
.diag-table td.key { color: var(--accent); }
.diag-ok { color: var(--success); }
.diag-bad { color: var(--danger); }
