/*
 * Incubase pages outside the admin: the founder portal, sign-in, the test-copy page and
 * the help and legal pages: the ground, granite ink, spruce, hairlines, 0.85rem cards,
 * 10px buttons, Geist throughout (Geist Mono for big figures). Colours and type come
 * from partials/ib-tokens (config/incubase.php); nothing here picks its own colour.
 *
 * Build-free, like the admin theme: a plain stylesheet, no Node on the server. The class
 * names are the ones the views already use, so restyling them changed no markup.
 */

* { box-sizing: border-box; }

html {
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body {
    margin: 0;
    font: 16px/1.6 var(--ib-text);
    color: var(--ib-ink);
    background: var(--ib-ground);
}

::selection { background: var(--ib-teal); color: #fff; }

:focus-visible { outline: 2px solid var(--ib-teal); outline-offset: 2px; }

a { color: var(--ib-teal-text); text-underline-offset: 3px; }

img { max-width: 100%; }

/* ---------- Header: the incubator's mark, "Startup portal", the menu ---------- */

header.ib-head {
    position: sticky;
    top: 0;
    z-index: 30;
    background: rgb(238 243 239 / 0.9);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--ib-line);
    padding: 0.75rem 1.25rem;
}

header.ib-head .wrap {
    max-width: 960px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

header.ib-head img.ib-logo { height: 40px; width: auto; display: block; }
header.ib-head img.ib-logo.ib-logo-stacked { height: 56px; }
header.ib-head .ib-name { font: 600 1.35rem/1.1 var(--ib-display); letter-spacing: -0.01em; color: var(--ib-ink); }
header.ib-head .sub { color: var(--ib-ink-soft); font-size: 0.8125rem; font-weight: 600; letter-spacing: 0; text-transform: none; }

.ib-nav { margin-left: auto; display: flex; gap: 0.25rem; }

.ib-nav a {
    color: var(--ib-ink-soft);
    font-weight: 500;
    text-decoration: none;
    padding: 0.5rem 0.75rem;
    box-shadow: inset 0 -2px 0 transparent;
    transition: color 0.2s var(--ib-ease), box-shadow 0.2s var(--ib-ease);
}

.ib-nav a:hover { color: var(--ib-ink); }

.ib-nav a[aria-current] {
    color: var(--ib-ink);
    box-shadow: inset 0 -2px 0 var(--ib-teal);
}

/* Sign out: a quiet pill at the end of the header, never louder than the menu. */
.ib-signout {
    margin: 0 0 0 0.4rem;
}

.ib-signout-btn {
    padding: 0.42rem 0.95rem;
    border-radius: 999px;
    background: transparent;
    box-shadow: inset 0 0 0 1px var(--ib-line);
    color: var(--ib-ink-soft);
    font-size: 0.82rem;
    font-weight: 500;
    white-space: nowrap;
}

.ib-signout-btn:hover {
    background: transparent;
    color: var(--ib-teal-text);
    box-shadow: inset 0 0 0 1px var(--ib-teal);
}

.ib-count {
    display: inline-block;
    min-width: 1.3rem;
    margin-left: 0.3rem;
    padding: 0 0.4rem;
    border-radius: 999px;
    background: var(--ib-ember);
    color: var(--ib-ink-deep);
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.3rem;
    text-align: center;
}

/* ---------- Page ---------- */

main { max-width: calc(960px + 2.5rem); margin: 0 auto; padding: 2rem 1.25rem 4rem; }

h1 {
    font: 600 clamp(2rem, 4.2vw, 2.6rem)/1.1 var(--ib-display);
    letter-spacing: -0.015em;
    margin: 0 0 0.4rem;
    color: var(--ib-ink);
    text-wrap: balance;
}

h2 {
    font: 600 1.3rem/1.25 var(--ib-display);
    letter-spacing: -0.005em;
    margin: 2.2rem 0 0.8rem;
    color: var(--ib-ink);
}

h3 { font-weight: 600; color: var(--ib-ink); }

p { line-height: 1.65; }

.muted { color: var(--ib-ink-soft); }

.prev { font-size: 0.82rem; color: var(--ib-ink-soft); }

/* A small label above a heading: sentence case, quiet. */
.ib-eyebrow {
    margin: 0 0 0.6rem;
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
    color: var(--ib-teal-text);
}

/* ---------- Cards and notices ---------- */

.card {
    background: var(--ib-paper);
    border-radius: var(--ib-radius);
    box-shadow: var(--ib-card-shadow);
    padding: 1.15rem 1.3rem;
    margin-bottom: 1rem;
}

.flash {
    background: var(--ib-teal-soft);
    box-shadow: inset 0 0 0 1px rgb(15 90 69 / 0.25);
    color: var(--ib-teal-deep);
    padding: 0.7rem 1rem;
    border-radius: var(--ib-radius-sm);
    margin-bottom: 1rem;
}

/* A standing note (demo data, staff preview): ember, so it never reads as a success message. */
.flash.note {
    background: var(--ib-ember-soft);
    box-shadow: inset 3px 0 0 var(--ib-ember);
    color: var(--ib-ink);
}

.errors {
    background: var(--ib-danger-soft);
    box-shadow: inset 0 0 0 1px rgb(180 35 24 / 0.25);
    color: var(--ib-danger);
    padding: 0.7rem 1rem;
    border-radius: var(--ib-radius-sm);
    margin-bottom: 1rem;
}

/* ---------- Pills ---------- */

.pill {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.18rem 0.6rem;
    border-radius: 999px;
    background: var(--ib-sand);
    color: var(--ib-ink-soft);
}

.pill.ok { background: var(--ib-teal-soft); color: var(--ib-teal-deep); }
.pill.warn { background: var(--ib-ember-soft); color: var(--ib-ember-text); }
.pill.late { background: var(--ib-danger-soft); color: var(--ib-danger); }

/* ---------- Forms and buttons ---------- */

label { display: block; font-size: 0.88rem; font-weight: 500; color: var(--ib-ink); margin-bottom: 0.3rem; }

input, select, textarea {
    width: 100%;
    padding: 0.62rem 0.75rem;
    border: 1px solid var(--ib-line);
    border-radius: var(--ib-radius-sm);
    font: inherit;
    color: var(--ib-ink);
    background: var(--ib-paper);
    transition: border-color 0.2s var(--ib-ease), box-shadow 0.2s var(--ib-ease);
}

input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--ib-teal); }

textarea { min-height: 72px; }

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--ib-teal);
    box-shadow: 0 0 0 3px rgb(15 90 69 / 0.18);
}

/* Buttons as everywhere else: radius 10px, 44px tall, Geist 500 15px, solid spruce with a faint
   top highlight; secondary is white with a hairline. The shadow, the lift and the press belong to
   these two only: an icon or text button with a class of its own (the password toggle, the menu,
   sign out) keeps its own look. */
button {
    background: var(--ib-spruce);
    color: #fff;
    border: 0;
    border-radius: var(--ib-btn-radius);
    padding: 0.8125rem 1.15rem;
    font: 500 15px/1.2 var(--ib-text);
    cursor: pointer;
    transition: background-color 0.2s var(--ib-ease), box-shadow 0.2s var(--ib-ease), color 0.2s var(--ib-ease), transform 0.2s var(--ib-ease);
}

button:hover { background: var(--ib-spruce-hover); }

button:not([class]) { box-shadow: var(--ib-btn-shadow); }

button:not([class]):hover { box-shadow: var(--ib-btn-shadow-hover); transform: translateY(-1px); }

button.secondary:hover { transform: translateY(-1px); }

button:not([class]):active,
button.secondary:active { transform: scale(0.98); }

button:focus-visible { outline: 2px solid var(--ib-spruce); outline-offset: 2px; }

button.secondary {
    background: var(--ib-paper);
    color: var(--ib-granite);
    box-shadow: inset 0 0 0 1px var(--ib-btn-line);
}

button.secondary:hover { background: var(--ib-ground); color: var(--ib-granite); box-shadow: inset 0 0 0 1px var(--ib-scree); }

.row { display: grid; grid-template-columns: 1fr 140px 130px; gap: 0.75rem; align-items: end; }

/* ---------- Standing and spotlight: the two dark panels ---------- */

.standing, .spot {
    background: var(--ib-teal-deep);
    color: #fff;
    box-shadow: none;
}

.standing .score {
    font: 500 3rem/1 var(--ib-mono);
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
}

.standing .band, .spot .eyebrow {
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
    color: var(--ib-teal-bright);
}

.gauge { height: 8px; background: rgb(255 255 255 / 0.14); border-radius: 999px; margin: 0.9rem 0 0.35rem; position: relative; }
.gauge > i { display: block; height: 100%; background: var(--ib-teal-bright); border-radius: 999px; }
.gauge > b { position: absolute; top: -3px; bottom: -3px; width: 2px; background: #fff; opacity: 0.85; }

.cats { display: grid; gap: 0.55rem; margin-top: 1rem; }
.cat { display: grid; grid-template-columns: 1fr 46px; gap: 0.6rem; align-items: center; font-size: 0.86rem; }
.cat .bar { height: 6px; background: rgb(255 255 255 / 0.12); border-radius: 999px; overflow: hidden; margin-top: 0.25rem; }
.cat .bar > i { display: block; height: 100%; background: rgb(255 255 255 / 0.75); border-radius: 999px; }
.cat .pct { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.cat-w { color: rgb(255 255 255 / 0.65); }

.spot h3 { margin: 0.3rem 0 0.2rem; font: 600 1.25rem/1.25 var(--ib-display); color: #fff; }
.spot .meta { color: rgb(255 255 255 / 0.72); font-size: 0.86rem; }
.spot a { color: var(--ib-teal-bright); }

/* ---------- KPIs ---------- */

.kpi { display: grid; grid-template-columns: 1fr 120px 56px; gap: 0.75rem; align-items: center; padding: 0.75rem 0; border-top: 1px solid var(--ib-line); }
.kpi:first-of-type { border-top: 0; }
.kpi .meta { font-size: 0.78rem; color: var(--ib-ink-soft); }
.kpi .bar { height: 6px; background: var(--ib-sand); border-radius: 999px; overflow: hidden; }
.kpi .bar > i { display: block; height: 100%; background: var(--ib-teal); border-radius: 999px; }
.kpi .pct { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

/* ---------- News, dates, activity, library ---------- */

.board { display: grid; gap: 1rem; }
.ann { box-shadow: var(--ib-card-shadow), inset 3px 0 0 var(--ib-ember); }
.ann.pinned { background: linear-gradient(90deg, var(--ib-ember-soft), var(--ib-paper) 65%); }
.ann h3 { margin: 0 0 0.3rem; font: 600 1.1rem/1.3 var(--ib-display); }
.ann .by { font-size: 0.75rem; color: var(--ib-ink-soft); }

.when { display: grid; grid-template-columns: 64px 1fr; gap: 0.9rem; align-items: start; padding: 0.8rem 0; border-top: 1px solid var(--ib-line); }
.when:first-of-type { border-top: 0; }
.when .date { text-align: center; background: var(--ib-ground); box-shadow: inset 0 0 0 1px var(--ib-line); border-radius: var(--ib-radius-sm); padding: 0.4rem 0.2rem; }
.when .date b { display: block; font: 600 1.25rem/1.1 var(--ib-display); font-variant-numeric: tabular-nums; }
.when .date span { font-size: 0.75rem; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--ib-ink-soft); }
.when .meta { font-size: 0.82rem; color: var(--ib-ink-soft); }

.feed { display: grid; gap: 0.5rem; }
.feed .row { display: flex; gap: 0.6rem; align-items: baseline; font-size: 0.9rem; padding: 0.55rem 0; border-top: 1px solid var(--ib-line); }
.feed .row:first-child { border-top: 0; }
.feed .dot { width: 7px; height: 7px; border-radius: 999px; background: var(--ib-teal); flex: 0 0 auto; }
.feed .dot.warn { background: var(--ib-ember); }
.feed time { margin-left: auto; color: var(--ib-ink-soft); font-size: 0.78rem; white-space: nowrap; }

.lib a { display: block; padding: 0.6rem 0; border-top: 1px solid var(--ib-line); font-size: 0.92rem; text-decoration: none; }
.lib a:first-of-type { border-top: 0; }
.lib a:hover { text-decoration: underline; }

/* ---------- Tone: how loud an item is (League of Launchers' colour code) ---------- */

.tone { background: var(--tone-tint); box-shadow: inset 4px 0 0 var(--tone); border-radius: var(--ib-radius-sm); }
.tone-k { display: block; font-size: 0.8125rem; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--tone-ink); margin-bottom: 0.15rem; }
.tone .tone-btn { background: var(--tone-ink); color: #fff; }
.tone .tone-btn:hover { filter: brightness(0.92); background: var(--tone-ink); }

/* ---------- The shared footer, on the same column as the header and the page ---------- */

body > .ib-foot { width: min(960px, 100% - 2.5rem); max-width: none; padding-inline: 0; }

/* ---------- Phones ---------- */

@media (max-width: 640px) {
    header.ib-head .wrap { flex-wrap: wrap; }
    .ib-nav { margin-left: 0; width: 100%; overflow-x: auto; order: 3; }
    .ib-signout { margin-left: auto; }
    .ib-nav a { padding: 0.45rem 0.6rem; white-space: nowrap; }
    main { padding-top: 1.4rem; }
    .row { grid-template-columns: 1fr; }
    .kpi { grid-template-columns: 1fr 56px; }
    .kpi .bar { grid-column: 1 / -1; }
}

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

    /* Nothing lifts or presses in: the colour change carries the feedback. */
    button:not([class]):hover,
    button:not([class]):active,
    button.secondary:hover,
    button.secondary:active { transform: none; }
}
