/*
 * Incubase components that every surface shares: the public and portal pages, the admin's
 * sign-in and the error pages. Class selectors only, never bare elements, so the file is as
 * safe inside Filament as on the plain pages. Colours and type come from partials/ib-tokens.
 *
 * Each is a WiseLabs primitive, reproduced from its source (components/ui.jsx,
 * sections/Connect.jsx):
 *   .ib-mast   the masthead: a hairline that draws itself in, an index, a label
 *   .ib-field  the underlined field. WiseLabs: "Boxed inputs make a form look like an admin
 *              panel. A ruled baseline with the label set small above it reads as a
 *              printed form."
 *   .ib-btn    the pill button with its arrow
 *   .ib-row    the full-width row whose fill wipes across from the left on hover
 */

/* ---------- Masthead ---------- */

.ib-mast {
    margin: 0 0 1.75rem;
}

.ib-mast::before {
    content: "";
    display: block;
    height: 1px;
    background: var(--ib-line);
    transform-origin: left;
    animation: ib-rule 0.9s var(--ib-ease) both;
}

.ib-mast-line {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    margin: 0;
    padding-top: 1rem;
    font-size: 0.8125rem;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
    color: var(--ib-ink-soft);
}

.ib-mast-n {
    font-family: var(--ib-mono);
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 0;
    font-variant-numeric: tabular-nums;
    color: var(--ib-teal-text);
}

.ib-mast-right {
    margin-left: auto;
}

@keyframes ib-rule {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
}

/* ---------- Underlined field ---------- */

.ib-field {
    display: block;
    margin: 0 0 1.7rem;
}

.ib-field-label {
    display: block;
    margin: 0 0 0.35rem;
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
    color: var(--ib-ink-soft);
}

.ib-field-input {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0.3rem 0 0.7rem;
    border: 0;
    border-bottom: 1px solid var(--ib-line);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    font: inherit;
    font-size: 1.05rem;
    color: var(--ib-ink);
    outline: none;
    transition: border-color 0.3s var(--ib-ease), box-shadow 0.3s var(--ib-ease);
}

.ib-field-input::placeholder {
    color: var(--ib-ink-faint);
}

.ib-field-input:hover {
    border-bottom-color: var(--ib-ink-faint);
}

/* Focus thickens the rule and turns it teal: visible without a box. */
.ib-field-input:focus,
.ib-field-input:focus-visible {
    border-bottom-color: var(--ib-teal);
    box-shadow: 0 1px 0 0 var(--ib-teal);
    outline: none;
}

.ib-field-input[aria-invalid="true"] {
    border-bottom-color: var(--ib-danger);
    box-shadow: 0 1px 0 0 var(--ib-danger);
}

.ib-field-hint {
    margin: 0.5rem 0 0;
    font-size: 0.82rem;
    color: var(--ib-ink-soft);
}

/* A password field with its show/hide control at the end of the rule. */
.ib-pass-row {
    position: relative;
}

.ib-pass-row .ib-field-input {
    padding-right: 4.2rem;
}

.ib-pass-toggle {
    position: absolute;
    right: 0;
    bottom: 0.55rem;
    margin: 0;
    padding: 0.3rem 0.2rem;
    border: 0;
    border-radius: 0.3rem;
    background: transparent;
    box-shadow: none;
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
    color: var(--ib-teal-text);
    cursor: pointer;
}

.ib-pass-toggle:hover {
    background: transparent;
    color: var(--ib-teal-deep);
}

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

/* The email-a-link form: one field and its button on the same baseline. */
.ib-inline-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.9rem 1.2rem;
}

.ib-inline-form .ib-field {
    flex: 1 1 15rem;
    margin: 0;
}

/* ---------- Buttons ---------- */

/* Radius 10px, 44px tall (40px small), Geist 500 15px. Primary is solid spruce with a faint top
   highlight and a tinted shadow; secondary is white with a hairline. The arrow only on a primary
   link (it goes somewhere), never on a form's submit. */
.ib-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: var(--ib-btn-h);
    margin: 0;
    padding: 0 1.15rem;
    border: 0;
    border-radius: var(--ib-btn-radius);
    font: 500 15px/1.2 var(--ib-text);
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s var(--ib-ease), color 0.2s var(--ib-ease), box-shadow 0.2s var(--ib-ease), transform 0.2s var(--ib-ease), opacity 0.2s var(--ib-ease);
}

/* The arrow is drawn, not read: the empty alternative keeps it out of the link's name. */
a.ib-btn-solid::after {
    content: "\2192";
    content: "\2192" / "";
    transition: transform 0.2s var(--ib-ease);
}

a.ib-btn-solid:hover::after {
    transform: translateX(2px);
}

.ib-btn:active {
    transform: scale(0.98);
}

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

.ib-btn-solid,
.ib-btn-solid:visited {
    background: var(--ib-spruce);
    color: #fff;
    box-shadow: var(--ib-btn-shadow);
}

.ib-btn-solid:hover {
    background: var(--ib-spruce-hover);
    color: #fff;
    box-shadow: var(--ib-btn-shadow-hover);
    transform: translateY(-1px);
}

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

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

.ib-btn-sm {
    min-height: var(--ib-btn-h-sm);
    padding: 0 0.9rem;
    font-size: 14px;
}

/* While a form is on its way: the arrow becomes a spinner and the button cannot be pressed twice. */
.ib-btn[aria-busy="true"] {
    opacity: 0.8;
    cursor: progress;
}

.ib-btn[aria-busy="true"]::after {
    content: "";
    width: 0.85em;
    height: 0.85em;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: ib-spin 0.8s linear infinite;
}

@keyframes ib-spin {
    to { transform: rotate(360deg); }
}

/* ---------- Rows ---------- */

.ib-rows {
    margin: 0;
    border-bottom: 1px solid var(--ib-line);
}

.ib-row {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    display: grid;
    grid-template-columns: 3.2rem minmax(0, 13rem) minmax(0, 1fr) auto;
    align-items: center;
    gap: 1rem 1.75rem;
    padding: 1.45rem 0.5rem;
    border-top: 1px solid var(--ib-line);
    color: var(--ib-ink);
    text-decoration: none;
}

/* The wipe: a teal fill that scales in from the left, behind the text. */
a.ib-row::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: var(--ib-teal);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.7s var(--ib-ease);
}

a.ib-row:hover::before,
a.ib-row:focus-visible::before {
    transform: scaleX(1);
}

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

.ib-row-n {
    font-family: var(--ib-display);
    font-size: 0.9rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--ib-teal-text);
}

.ib-row-title {
    font-family: var(--ib-display);
    font-size: clamp(1.25rem, 2.4vw, 1.8rem);
    font-weight: 600;
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: var(--ib-ink);
}

.ib-row-body {
    font-size: 0.92rem;
    line-height: 1.65;
    color: var(--ib-ink-soft);
}

.ib-row-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.74rem;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
    white-space: nowrap;
    color: var(--ib-teal-text);
}

a.ib-row .ib-row-cta::after {
    content: "\2192";
    transition: transform 0.5s var(--ib-ease);
}

.ib-row-n,
.ib-row-title,
.ib-row-body,
.ib-row-cta {
    transition: color 0.5s var(--ib-ease);
}

a.ib-row:hover .ib-row-n,
a.ib-row:hover .ib-row-title,
a.ib-row:hover .ib-row-body,
a.ib-row:hover .ib-row-cta,
a.ib-row:focus-visible .ib-row-n,
a.ib-row:focus-visible .ib-row-title,
a.ib-row:focus-visible .ib-row-body,
a.ib-row:focus-visible .ib-row-cta {
    color: #fff;
}

a.ib-row:hover .ib-row-cta::after {
    transform: translateX(5px);
}

/* A row in a narrow column (beside a form): number at the left, then title, words and link stacked. */
.ib-row.ib-row-stack {
    grid-template-columns: 2.6rem minmax(0, 1fr);
    gap: 0.3rem 1rem;
}

.ib-row-stack .ib-row-n {
    grid-row: span 3;
    align-self: start;
    padding-top: 0.45rem;
}

.ib-row-stack .ib-row-body,
.ib-row-stack .ib-row-cta {
    grid-column: 2;
}

.ib-row-stack .ib-row-cta {
    margin-top: 0.45rem;
    white-space: normal;
}

/* ---------- Sign-in notices and the emailed-link help ---------- */

.ib-auth-status {
    margin: 0 0 1.3rem;
    padding: 0.8rem 1rem;
    border-radius: var(--ib-radius-sm);
    background: var(--ib-teal-soft);
    color: var(--ib-teal-deep);
    font-size: 0.92rem;
    line-height: 1.55;
}

.ib-auth-alert {
    margin: 0 0 1.5rem;
    padding: 0.8rem 1rem 0.8rem 1.15rem;
    border-radius: var(--ib-radius-sm);
    background: var(--ib-danger-soft);
    box-shadow: inset 3px 0 0 var(--ib-danger);
    color: var(--ib-danger);
    font-size: 0.92rem;
    line-height: 1.55;
}

.ib-auth-help {
    margin-top: 1.6rem;
    padding-top: 1.1rem;
    border-top: 1px solid var(--ib-line);
}

.ib-auth-help > summary {
    cursor: pointer;
    list-style: none;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--ib-teal-text);
}

.ib-auth-help > summary::-webkit-details-marker {
    display: none;
}

.ib-auth-help > summary::after {
    content: "\2192";
    display: inline-block;
    margin-left: 0.5rem;
    transition: transform 0.3s var(--ib-ease);
}

.ib-auth-help[open] > summary::after {
    transform: rotate(90deg);
}

.ib-auth-help > summary:focus-visible {
    outline: 2px solid var(--ib-teal);
    outline-offset: 3px;
    border-radius: 0.3rem;
}

.ib-auth-help .ib-inline-form {
    margin-top: 1.2rem;
}

.ib-auth-note {
    margin: 0.8rem 0 0;
    font-size: 0.84rem;
    line-height: 1.6;
    color: var(--ib-ink-soft);
}

.ib-auth-after .ib-rows {
    margin-top: 2.2rem;
}

/* ---------- Phones and motion ---------- */

@media (max-width: 720px) {
    .ib-row {
        grid-template-columns: 2.2rem minmax(0, 1fr);
        gap: 0.35rem 0.9rem;
        padding: 1.2rem 0.25rem;
    }

    .ib-row-n {
        grid-row: span 3;
        align-self: start;
        padding-top: 0.35rem;
    }

    .ib-row-body,
    .ib-row-cta {
        grid-column: 2;
    }

    .ib-inline-form .ib-btn {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ib-mast::before,
    .ib-btn[aria-busy="true"]::after {
        animation: none;
    }

    a.ib-row::before,
    .ib-btn,
    .ib-btn::after {
        transition: none;
    }

    /* Nothing lifts or presses in: the colour change carries the feedback. */
    .ib-btn:hover,
    .ib-btn:active,
    .ib-btn-solid:hover,
    .ib-btn-ghost:hover,
    a.ib-btn-solid:hover::after {
        transform: none;
    }
}

/* ---------- Who makes Incubase (components/ib/credit): Change Mechanics, and Spark Lab ---------- */

.ib-credit {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 1.1rem;
}

.ib-credit-part {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.ib-credit img {
    display: block;
    width: auto;
}

.ib-credit-cm {
    height: 28px;
}

.ib-credit-sl {
    height: 22px;
}

/* The incubase pyramid before "Incubase by" (Umayr, 28 Oct 2026). */
.ib-credit-mark {
    height: 16px;
    margin-right: -0.15rem;
}
