/* ==========================================================================
   Appwire theme for Bulma 1
   Dark navy surfaces, cyan primary, copper accent, Inter + JetBrains Mono.
   Mirrors the appwire.io marketing site (.design/appwire-site).

   Load order: bulma.min.css -> theme.css -> app.css
   Requires <html data-theme="dark"> so Bulma uses its dark scheme, which this
   file then re-tunes.
   ========================================================================== */

/* ---------- Brand tokens (also read by ts/theme.ts) ---------- */
:root {
    --aw-bg: #06080d;
    --aw-bg-2: #0a0e16;
    --aw-surface: #0e131d;
    --aw-surface-2: #131a27;
    --aw-code-bg: #070a10;
    --aw-border: rgba(255, 255, 255, 0.08);
    --aw-border-strong: rgba(255, 255, 255, 0.15);
    --aw-text: #e8ecf3;
    --aw-muted: #98a2b8;
    --aw-dim: #687187;
    --aw-cyan: #2ee6ff;
    --aw-cyan-hover: #63efff;
    --aw-copper: #f0a35e;
    --aw-green: #4ade80;
    --aw-red: #fb7185;
    --aw-violet: #8b8cff;
    --aw-ink: #04141a;
    /* text on cyan */
    /* "… Variable" are the self-hosted variable fonts (wwwroot/lib/fonts). */
    --aw-font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --aw-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    --aw-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* ---------- Bulma variables ---------- */
/* :root[data-theme=dark] (0,2,0) beats Bulma's own [data-theme=dark] block. */
:root[data-theme="dark"] {
    color-scheme: dark;

    /* Typography */
    --bulma-family-primary: var(--aw-font);
    --bulma-family-secondary: var(--aw-font);
    --bulma-family-code: var(--aw-mono);

    /* Radii: 6 / 10 / 12 / 14px as on the site */
    --bulma-radius-small: 6px;
    --bulma-radius: 10px;
    --bulma-radius-medium: 12px;
    --bulma-radius-large: 14px;

    /* Scheme: navy surfaces */
    --bulma-scheme-h: 222deg;
    --bulma-scheme-s: 36%;
    --bulma-scheme-main-l: 3.7%;
    /* #06080d */
    --bulma-scheme-main-bis-l: 6.3%;
    /* #0a0e16 */
    --bulma-scheme-main-ter-l: 8.4%;
    /* #0e131d */
    --bulma-background-l: 11.4%;
    /* #131a27 */
    --bulma-border-weak-l: 10%;
    --bulma-border-l: 16%;
    --bulma-hover-border-l-delta: 8%;
    --bulma-active-border-l-delta: 14%;
    --bulma-hover-background-l-delta: 4%;
    --bulma-active-background-l-delta: 7%;

    /* Text: --text / --muted / --dim */
    --bulma-text-h: 220deg;
    --bulma-text-s: 22%;
    --bulma-text-weak-l: 47%;
    /* dim */
    --bulma-text-l: 72%;
    /* between muted and text */
    --bulma-text-strong-l: 93%;
    /* text */
    --bulma-text-title-l: 95%;

    /* Shadows are near-black, never white glows */
    --bulma-shadow-h: 222deg;
    --bulma-shadow-s: 40%;
    --bulma-shadow-l: 1%;
    --bulma-shadow: 0 24px 50px -30px rgba(0, 0, 0, 0.9);

    /* Primary + link: cyan #2ee6ff */
    --bulma-primary-h: 187deg;
    --bulma-primary-s: 100%;
    --bulma-primary-l: 59%;
    --bulma-primary-rgb: 46, 230, 255;
    --bulma-primary-invert-l: 6%;
    --bulma-primary-on-scheme-l: 59%;
    --bulma-link-h: 187deg;
    --bulma-link-s: 100%;
    --bulma-link-l: 59%;
    --bulma-link-rgb: 46, 230, 255;
    --bulma-link-invert-l: 6%;
    --bulma-link-on-scheme-l: 62%;

    /* Info: violet #8b8cff */
    --bulma-info-h: 239deg;
    --bulma-info-s: 100%;
    --bulma-info-l: 77%;
    --bulma-info-rgb: 139, 140, 255;
    --bulma-info-invert-l: 10%;
    --bulma-info-on-scheme-l: 77%;

    /* Success: green #4ade80 */
    --bulma-success-h: 142deg;
    --bulma-success-s: 69%;
    --bulma-success-l: 58%;
    --bulma-success-rgb: 74, 222, 128;
    --bulma-success-invert-l: 8%;
    --bulma-success-on-scheme-l: 58%;

    /* Warning: copper #f0a35e */
    --bulma-warning-h: 28deg;
    --bulma-warning-s: 83%;
    --bulma-warning-l: 65%;
    --bulma-warning-rgb: 240, 163, 94;
    --bulma-warning-invert-l: 10%;
    --bulma-warning-on-scheme-l: 65%;

    /* Danger: red #fb7185 */
    --bulma-danger-h: 351deg;
    --bulma-danger-s: 95%;
    --bulma-danger-l: 71%;
    --bulma-danger-rgb: 251, 113, 133;
    --bulma-danger-invert-l: 8%;
    --bulma-danger-on-scheme-l: 71%;

    /* Focus ring: cyan, soft */
    --bulma-focus-shadow-alpha: 0.18;

    /* Code */
    --bulma-code: #c9d1df;
    --bulma-code-background: rgba(255, 255, 255, 0.06);
    --bulma-code-padding: 0.1em 0.4em;
    --bulma-pre: #c9d1df;
    --bulma-pre-background: var(--aw-code-bg);

    --bulma-label-color: var(--aw-muted);
    --bulma-hr-background-color: var(--aw-border);
    --bulma-hr-height: 1px;
}

/* ---------- Component variables ---------- */
/* Bulma 1 declares these on the component selector itself (e.g. `.table {
   --bulma-table-... }`), so setting them on :root has no effect. Re-declare
   them on the same selectors; this file loads after Bulma, so it wins. */
.title {
    --bulma-title-weight: 700;
    --bulma-title-color: var(--aw-text);
}

.subtitle {
    --bulma-subtitle-color: var(--aw-muted);
}

.box {
    --bulma-box-background-color: var(--aw-bg-2);
    --bulma-box-shadow: none;
}

.card {
    --bulma-card-background-color: var(--aw-bg-2);
    --bulma-card-shadow: none;
    --bulma-card-radius: var(--bulma-radius-large);
    --bulma-card-header-shadow: none;
    --bulma-card-footer-border-top: 1px solid var(--aw-border);
}

.input,
.textarea,
.select select,
.select {
    --bulma-input-shadow: none;
    --bulma-input-placeholder-color: var(--aw-dim);
    --bulma-input-icon-color: var(--aw-dim);
}

.control.has-icons-left .icon,
.control.has-icons-right .icon {
    color: var(--aw-dim);
}

.table {
    --bulma-table-background-color: transparent;
    --bulma-table-color: var(--aw-muted);
    --bulma-table-cell-border-color: rgba(255, 255, 255, 0.05);
    --bulma-table-cell-heading-color: var(--aw-text);
    --bulma-table-head-cell-color: var(--aw-dim);
    --bulma-table-head-cell-border-width: 0 0 1px;
    --bulma-table-cell-padding: 0.7em 1em;
    --bulma-table-row-hover-background-color: rgba(46, 230, 255, 0.04);
    --bulma-table-striped-row-even-background-color: rgba(255, 255, 255, 0.015);
    --bulma-table-striped-row-even-hover-background-color: rgba(46, 230, 255, 0.04);
}

.tag {
    --bulma-tag-radius: var(--bulma-radius-rounded);
}

.notification {
    --bulma-notification-radius: 12px;
}

.tabs {
    --bulma-tabs-border-bottom-color: var(--aw-border);
}

.menu {
    --bulma-menu-label-color: var(--aw-dim);
    --bulma-menu-label-letter-spacing: 0.16em;
    --bulma-menu-item-radius: 8px;
}

.footer {
    --bulma-footer-background-color: transparent;
}

/* ---------- Base ---------- */
html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::selection {
    background: rgba(46, 230, 255, 0.28);
    color: #fff;
}

:focus-visible {
    outline: 2px solid var(--aw-cyan);
    outline-offset: 2px;
}

input[type="checkbox"],
input[type="radio"] {
    accent-color: var(--aw-cyan);
}

/* Ambient glow + faint grid at the top, as on the site. Fixed pseudo-elements
   are out of flow, so they don't take a cell in the body grid. */
body::before,
body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
}

body::before {
    z-index: -2;
    background:
        radial-gradient(900px 520px at 15% -10%, rgba(46, 230, 255, 0.08), transparent 60%),
        radial-gradient(800px 500px at 90% 0%, rgba(240, 163, 94, 0.05), transparent 60%);
}

body::after {
    z-index: -1;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 64px 64px;
    -webkit-mask-image: radial-gradient(ellipse 70% 40% at 50% 0%, #000 10%, transparent 100%);
    mask-image: radial-gradient(ellipse 70% 40% at 50% 0%, #000 10%, transparent 100%);
}

/* ---------- Typography ---------- */
.title {
    letter-spacing: -0.02em;
}

.title.is-1,
.title.is-2 {
    letter-spacing: -0.03em;
}

.subtitle {
    letter-spacing: -0.005em;
}

strong {
    color: var(--aw-text);
}

a {
    transition: color 0.2s;
}

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

/* Bulma hardcodes these helpers to an Inconsolata stack with !important */
.is-family-code,
.is-family-monospace {
    font-family: var(--aw-mono) !important;
}

code {
    border-radius: 5px;
    font-size: 0.85em;
}

pre {
    border: 1px solid var(--aw-border);
    border-radius: var(--bulma-radius);
    font-size: 0.8rem;
    line-height: 1.7;
}

/* Small mono caps label, like the site's .eyebrow */
.eyebrow {
    font-family: var(--aw-mono);
    font-size: 0.72rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--aw-cyan);
}

/* ---------- Wordmark (Views/Shared/_Wordmark.cshtml) ---------- */
/* "appw" carries a cyan wire across its x-height top; the dotless ı's dot is a
   copper node sitting on that wire. Scales with font-size. */
.wordmark {
    position: relative;
    display: inline-block;
    white-space: nowrap;
    font-family: var(--aw-font);
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.035em;
    line-height: 1;
    color: var(--aw-text);
}

.wordmark .wm-a,
.wordmark .wm-i {
    position: relative;
    display: inline-block;
}

.wordmark .wm-wire {
    position: absolute;
    left: 0;
    right: -0.14em;
    top: 0.1825em;
    height: 0.045em;
    border-radius: 1em;
    background: var(--aw-cyan);
}

.wordmark .wm-node {
    position: absolute;
    left: 50%;
    top: 0.125em;
    width: 0.16em;
    height: 0.16em;
    margin-left: -0.08em;
    border-radius: 50%;
    background: var(--aw-copper);
}

/* ---------- Buttons ---------- */
.button {
    font-weight: 600;
    transition:
        transform 0.15s,
        background-color 0.2s,
        border-color 0.2s,
        box-shadow 0.2s,
        color 0.2s;
}

.button:active {
    transform: translateY(1px);
}

/* Default button = the site's ghost button */
.button:not(
    .is-primary,
    .is-link,
    .is-info,
    .is-success,
    .is-warning,
    .is-danger,
    .is-text,
    .is-ghost,
    .is-white,
    .is-black,
    .is-dark,
    .is-static
) {
    background-color: rgba(255, 255, 255, 0.03);
    border-color: var(--aw-border-strong);
    color: var(--aw-text);
}

.button:not(
    .is-primary,
    .is-link,
    .is-info,
    .is-success,
    .is-warning,
    .is-danger,
    .is-text,
    .is-ghost,
    .is-white,
    .is-black,
    .is-dark,
    .is-static
):hover {
    background-color: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.28);
}

/* Plain is-light: borderless quiet button */
.button.is-light:not(.is-primary, .is-link, .is-info, .is-success, .is-warning, .is-danger) {
    border-color: transparent;
    background-color: rgba(255, 255, 255, 0.06);
    color: var(--aw-muted);
}

.button.is-light:not(.is-primary, .is-link, .is-info, .is-success, .is-warning, .is-danger):hover {
    background-color: rgba(255, 255, 255, 0.11);
    color: var(--aw-text);
}

.button.is-primary:not(.is-light, .is-outlined, .is-inverted),
.button.is-link:not(.is-light, .is-outlined, .is-inverted) {
    color: var(--aw-ink);
}

.button.is-primary:not(.is-light, .is-outlined, .is-inverted):hover,
.button.is-link:not(.is-light, .is-outlined, .is-inverted):hover {
    background-color: var(--aw-cyan-hover);
    box-shadow: 0 10px 34px -10px rgba(46, 230, 255, 0.6);
}

.button.is-text {
    text-decoration: none;
    color: var(--aw-muted);
}

.button.is-text:hover {
    color: var(--aw-text);
    background-color: rgba(255, 255, 255, 0.05);
}

/* ---------- Tinted "is-light" variants ---------- */
/* Bulma's light variants are pastel slabs (90% lightness) that glare on a dark
   UI. Replace them with the site's translucent tints. */
.is-primary {
    --aw-tint: var(--bulma-primary-rgb);
}

.is-link {
    --aw-tint: var(--bulma-link-rgb);
}

.is-info {
    --aw-tint: var(--bulma-info-rgb);
}

.is-success {
    --aw-tint: var(--bulma-success-rgb);
}

.is-warning {
    --aw-tint: var(--bulma-warning-rgb);
}

.is-danger {
    --aw-tint: var(--bulma-danger-rgb);
}

/* Tags are always tinted pills on the site (status badges), never solid. */
:is(.button, .tag, .notification).is-light:is(.is-primary, .is-link, .is-info, .is-success, .is-warning, .is-danger),
.tag:is(.is-primary, .is-link, .is-info, .is-success, .is-warning, .is-danger) {
    background-color: rgba(var(--aw-tint), 0.14);
    border-color: rgba(var(--aw-tint), 0.22);
    color: rgb(var(--aw-tint));
}

.button.is-light:is(.is-primary, .is-link, .is-info, .is-success, .is-warning, .is-danger):hover {
    background-color: rgba(var(--aw-tint), 0.22);
    border-color: rgba(var(--aw-tint), 0.4);
}

.notification.is-light:is(.is-primary, .is-link, .is-info, .is-success, .is-warning, .is-danger) {
    border-width: 1px;
    border-style: solid;
}

.notification.is-light :is(strong, a:not(.button)) {
    color: inherit;
}

/* ---------- Tags ---------- */
.tag {
    font-weight: 600;
    letter-spacing: 0.01em;
}

.tag:not(.is-primary, .is-link, .is-info, .is-success, .is-warning, .is-danger) {
    background-color: rgba(255, 255, 255, 0.07);
    color: var(--aw-muted);
}

/* ---------- Boxes & cards ---------- */
.box,
.card {
    border: 1px solid var(--aw-border);
    background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.015));
}

.card-header {
    border-bottom: 1px solid var(--aw-border);
}

.card-header-title {
    letter-spacing: -0.015em;
}

/* ---------- Forms ---------- */
.input,
.textarea,
.select select {
    background-color: rgba(6, 8, 13, 0.7);
    border-color: var(--aw-border-strong);
    transition:
        border-color 0.2s,
        box-shadow 0.2s;
}

.input:hover,
.textarea:hover,
.select select:hover {
    border-color: rgba(255, 255, 255, 0.28);
}

.input:focus,
.textarea:focus,
.select select:focus {
    border-color: var(--aw-cyan);
    box-shadow: 0 0 0 3px rgba(46, 230, 255, 0.18);
    outline: none;
}

.input.is-danger,
.textarea.is-danger,
.select.is-danger select {
    border-color: var(--aw-red);
}

.select:not(.is-multiple):not(.is-loading)::after {
    border-color: var(--aw-muted);
}

.select select option {
    background: var(--aw-surface);
    color: var(--aw-text);
}

.label {
    font-size: 0.85rem;
    font-weight: 500;
}

.help {
    color: var(--aw-dim);
}

.help.is-danger {
    color: var(--aw-red);
}

.checkbox:hover,
.radio:hover {
    color: var(--aw-text);
}

/* ---------- Tables ---------- */
.table {
    font-size: 0.92rem;
}

.table thead th {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.table tbody tr:last-child td,
.table tbody tr:last-child th {
    border-bottom-width: 0;
}

/* Sort links in headers: drop button chrome so labels line up with cells */
.table thead th > .button.is-text {
    height: auto;
    padding: 0;
    gap: 0.35em;
    font: inherit;
    letter-spacing: inherit;
    text-transform: inherit;
    color: inherit;
}

.table thead th > .button.is-text:hover {
    background: none;
    color: var(--aw-text);
}

.table td,
.table th {
    vertical-align: middle;
}

.table td:first-child {
    color: var(--aw-text);
}

.table code {
    color: var(--aw-text);
}

/* ---------- Menu (sidebar) ---------- */
.menu-label {
    font-family: var(--aw-mono);
    font-size: 0.66rem;
    font-weight: 500;
}

.menu-list a {
    background-color: transparent;
    /* Bulma paints items with opaque scheme-main */
    color: var(--aw-muted);
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.5em 0.75em;
    transition:
        color 0.2s,
        background-color 0.2s;
}

.menu-list a:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--aw-text);
}

.menu-list a.is-active {
    background-color: rgba(46, 230, 255, 0.08);
    color: var(--aw-text);
    box-shadow: inset 2px 0 0 var(--aw-cyan);
}

/* ---------- Tabs ---------- */
.tabs a {
    color: var(--aw-dim);
    font-weight: 500;
    border-bottom-color: var(--aw-border);
    transition:
        color 0.2s,
        border-color 0.2s;
}

.tabs a:hover {
    color: var(--aw-text);
    border-bottom-color: var(--aw-border-strong);
}

.tabs li.is-active a {
    color: var(--aw-text);
    border-bottom-color: var(--aw-cyan);
}

.tabs.is-boxed a {
    border-radius: var(--bulma-radius) var(--bulma-radius) 0 0;
}

.tabs.is-boxed a:hover {
    background-color: rgba(255, 255, 255, 0.03);
    border-bottom-color: var(--aw-border);
}

.tabs.is-boxed li.is-active a {
    background-color: rgba(46, 230, 255, 0.05);
    border-color: var(--aw-border);
    border-bottom-color: transparent !important;
    box-shadow: inset 0 2px 0 var(--aw-cyan);
}

/* ---------- Notifications ---------- */
.notification:not(.is-light) .delete {
    background-color: rgba(0, 0, 0, 0.25);
}

/* ---------- Pagination ---------- */
.pagination-link,
.pagination-previous,
.pagination-next {
    background-color: rgba(255, 255, 255, 0.03);
    border-color: var(--aw-border-strong);
    color: var(--aw-muted);
}

.pagination-link:hover,
.pagination-previous:hover,
.pagination-next:hover {
    border-color: rgba(255, 255, 255, 0.28);
    color: var(--aw-text);
}

.pagination-link.is-current {
    background-color: rgba(46, 230, 255, 0.12);
    border-color: rgba(46, 230, 255, 0.45);
    color: var(--aw-cyan);
}

/* ---------- Misc ---------- */
.delete {
    background-color: rgba(255, 255, 255, 0.1);
}

.delete:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.loader {
    border-color: var(--aw-border-strong);
    border-right-color: transparent;
    border-top-color: transparent;
}

hr {
    margin: 1.5rem 0;
}

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