/* neobrutalistcomponents v1.3.0 — theme: swiss */
@layer nbc.tokens, nbc.theme, nbc.base, nbc.components, nbc.flourish;

/* tokens.css */
@layer nbc.theme {
/* ============================================================
   SWISS — precision, not plainness.
   Pure white, pure black, one oxblood accent. Every edge is a
   1px hairline; nothing casts a shadow. Focus and error are
   drawn as 2px lines inside the hairline (negative outline
   offset), so the grid never shifts. Tabular figures.
   Dark: true black, white hairlines, oxblood brightened.
   ============================================================ */
[data-theme="swiss"] {
  --nbc-scheme: light;

  --nbc-font-sans: 'Inter Tight', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --nbc-font-display: 'Inter Tight', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --nbc-font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', monospace;
  --nbc-weight-body: 400;
  --nbc-weight-label: 500;
  --nbc-weight-display: 600;
  --nbc-label-transform: uppercase;
  --nbc-label-spacing: 0.12em;
  --nbc-display-transform: none;
  --nbc-display-spacing: -0.03em;

  --nbc-bg: light-dark(#ffffff, #000000);
  --nbc-fg: light-dark(#000000, #ffffff);
  --nbc-fg-muted: light-dark(#5c5c5c, #a3a3a3);
  --nbc-surface: light-dark(#ffffff, #000000);
  --nbc-surface-alt: light-dark(#f2f2f2, #161616);
  --nbc-border-color: light-dark(#000000, #ffffff);

  --nbc-primary: light-dark(#000000, #ffffff);
  --nbc-primary-fg: light-dark(#ffffff, #000000);
  --nbc-accent: light-dark(#a3131f, #ff4757);
  --nbc-accent-fg: light-dark(#ffffff, #000000);

  --nbc-info: light-dark(#1d3fbb, #7b9cff);
  --nbc-info-fg: light-dark(#ffffff, #000000);
  --nbc-success: light-dark(#14713b, #46c97a);
  --nbc-success-fg: light-dark(#ffffff, #000000);
  --nbc-warning: light-dark(#f2b705, #f2b705);
  --nbc-warning-fg: #000000;
  --nbc-danger: light-dark(#a3131f, #ff4757);
  --nbc-danger-fg: light-dark(#ffffff, #000000);
  --nbc-focus: light-dark(#a3131f, #ff4757);

  --nbc-primary-fill: var(--nbc-primary);
  --nbc-danger-fill: var(--nbc-danger);
  --nbc-surface-fill: var(--nbc-surface);
  --nbc-texture: none;

  --nbc-border-width: 1px;
  --nbc-border-style: solid;
  --nbc-radius: 0px;
  --nbc-radius-control: 0px;
  --nbc-radius-button: 0px;
  --nbc-radius-small: 0px;

  --nbc-shadow: none;
  --nbc-shadow-lg: none;
  --nbc-shadow-press: none;
  --nbc-press: 0px;
  --nbc-press-active: 0px;
  --nbc-rotate: 0deg;
  --nbc-focus-width: 2px;
  --nbc-focus-offset: -2px;

  --nbc-duration: 80ms;
  --nbc-duration-slow: 160ms;
  --nbc-ease: cubic-bezier(0.25, 0.1, 0.25, 1);
}
}

/* Button.css */
@layer nbc.flourish {
/* Swiss: nothing moves. Hover inverts — black to oxblood, white to black. */

@scope ([data-theme="swiss"]) to ([data-theme]:not([data-theme="swiss"])) {
  /* Focus is oxblood, like the danger fill and the hovered primary: draw it
     outside the slab so it never disappears into the fill. */
  .nbc-button--danger:focus-visible,
  .nbc-button--primary:focus-visible {
    outline-offset: 2px;
  }

  .nbc-button {
    font-variant-numeric: tabular-nums;
  }

  @media (hover: hover) {
    .nbc-button--primary:hover:not(:disabled, [aria-disabled="true"]) {
      background: var(--nbc-accent);
      border-color: var(--nbc-accent);
      color: var(--nbc-accent-fg);
    }
    .nbc-button--secondary:hover:not(:disabled, [aria-disabled="true"]),
    .nbc-button--danger:hover:not(:disabled, [aria-disabled="true"]) {
      background: var(--nbc-fg);
      border-color: var(--nbc-fg);
      color: var(--nbc-bg);
    }
    .nbc-button--ghost:hover:not(:disabled, [aria-disabled="true"]) {
      background: transparent;
      color: var(--nbc-accent);
      text-decoration: underline;
      text-decoration-thickness: 1px;
      text-underline-offset: 0.3em;
    }
  }

  .nbc-button__spinner {
    border-width: 1px;
    animation-duration: 1200ms;
  }
}
}

/* Field.css */
@layer nbc.flourish {
/* Swiss: a small oxblood square marks every label. */

@scope ([data-theme="swiss"]) to ([data-theme]:not([data-theme="swiss"])) {
  .nbc-field__label::before {
    content: '';
    display: inline-block;
    inline-size: 0.5em;
    block-size: 0.5em;
    margin-inline-end: 0.6em;
    vertical-align: 0.1em;
    background: var(--nbc-accent);
  }

  .nbc-field__message {
    font-variant-numeric: tabular-nums;
  }
}
}

/* Card.css */
@layer nbc.flourish {
/* Swiss: an engineered header — description becomes a tracked caption under a hairline. */

@scope ([data-theme="swiss"]) to ([data-theme]:not([data-theme="swiss"])) {
  .nbc-card__description {
    margin-block-start: var(--nbc-space-sm);
    padding-block-start: var(--nbc-space-sm);
    border-block-start: 1px solid var(--nbc-border-color);
    font-size: var(--nbc-fs-xs);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--nbc-fg);
  }

  .nbc-card__footer {
    justify-content: space-between;
    background: transparent;
  }
}
}

/* Checkbox.css */
@layer nbc.flourish {
/* Swiss: a hairline square that fills with the one oxblood accent. Nothing moves. */

@scope ([data-theme="swiss"]) to ([data-theme]:not([data-theme="swiss"])) {
  /* The focus line and the checked fill are both oxblood: draw focus outside
     the box so it never vanishes into the fill. */
  .nbc-checkbox__box:has(.nbc-checkbox__control:focus-visible) {
    outline-offset: 2px;
  }

  .nbc-checkbox__box:has(.nbc-checkbox__control:checked, .nbc-checkbox__control:indeterminate) {
    color: var(--nbc-accent-fg);
    background: var(--nbc-accent);
    border-color: var(--nbc-accent);
  }

  .nbc-checkbox__check,
  .nbc-checkbox__dash {
    stroke-width: 3;
    scale: 1;
    transition-property: opacity;
  }

  @media (hover: hover) {
    .nbc-checkbox:not(.nbc-checkbox--disabled) .nbc-checkbox__box:has(.nbc-checkbox__control:not(:checked, :indeterminate)):hover {
      background: color-mix(in srgb, var(--nbc-accent) 14%, var(--nbc-surface));
      border-color: var(--nbc-accent);
    }
  }

  .nbc-checkbox--invalid .nbc-checkbox__box {
    border-color: var(--nbc-danger);
  }

  .nbc-checkbox__message {
    font-variant-numeric: tabular-nums;
  }

  @media (forced-colors: active) {
    .nbc-checkbox__box:has(.nbc-checkbox__control:checked, .nbc-checkbox__control:indeterminate) {
      background: Highlight;
      border-color: Highlight;
    }
  }
}
}

/* Select.css */
@layer nbc.flourish {
/* Swiss: nothing moves. The chevron is a hairline that turns oxblood on hover
   and while open; the open list is a ruled column with the current value
   marked by an oxblood bar. */

@scope ([data-theme="swiss"]) to ([data-theme]:not([data-theme="swiss"])) {
  .nbc-select__control {
    font-variant-numeric: tabular-nums;
  }

  .nbc-select__chevron {
    stroke-width: 1.5;
  }

  @media (hover: hover) {
    .nbc-select:hover:not(.nbc-select--disabled) .nbc-select__chevron {
      color: var(--nbc-accent);
    }
  }

  .nbc-select__control:open ~ .nbc-select__chevron {
    rotate: none;
    color: var(--nbc-accent);
  }

  @supports (appearance: base-select) {
    .nbc-select__control option {
      font-variant-numeric: tabular-nums;
    }
    .nbc-select__control option:checked:not(:disabled) {
      box-shadow: inset 3px 0 0 var(--nbc-accent);
    }
    .nbc-select__control option::checkmark {
      display: none;
    }
  }
}
}

/* RadioGroup.css */
@layer nbc.flourish {
/* Swiss: a hairline circle holding one solid oxblood dot. Nothing moves. */

@scope ([data-theme="swiss"]) to ([data-theme]:not([data-theme="swiss"])) {
  /* The focus line and the checked fill are both oxblood: draw focus outside
     the box so it never vanishes into the fill. */
  .nbc-radio__box:has(.nbc-radio__control:focus-visible) {
    outline-offset: 2px;
  }

  .nbc-radio__box:has(.nbc-radio__control:checked) {
    background: var(--nbc-surface-fill);
  }

  .nbc-radio__dot {
    inline-size: calc(var(--_box) * 0.5);
    block-size: calc(var(--_box) * 0.5);
    background: var(--nbc-accent);
    scale: 1;
    transition-property: opacity;
  }

  @media (hover: hover) {
    .nbc-radio:not(.nbc-radio--disabled) .nbc-radio__box:has(.nbc-radio__control:not(:checked)):hover,
    .nbc-radio:not(.nbc-radio--disabled):has(.nbc-radio__label:hover)
      .nbc-radio__box:has(.nbc-radio__control:not(:checked)) {
      background: color-mix(in srgb, var(--nbc-accent) 14%, var(--nbc-surface));
      border-color: var(--nbc-accent);
    }
  }

  /* No shadows in this theme, so the base invalid ring has nothing to ride on:
     a second 1px danger line outside the hairline does the job. */

  .nbc-radio-group--invalid .nbc-radio__box {
    box-shadow: 0 0 0 1px var(--nbc-danger);
  }

  /* A small oxblood square marks the legend, like every field label. */

  .nbc-radio-group__label::before {
    content: '';
    display: inline-block;
    inline-size: 0.5em;
    block-size: 0.5em;
    margin-inline-end: 0.6em;
    vertical-align: 0.1em;
    background: var(--nbc-accent);
  }

  .nbc-radio__description,
  .nbc-radio-group__message {
    font-variant-numeric: tabular-nums;
  }

  @media (forced-colors: active) {
    .nbc-radio__dot {
      background: Highlight;
    }
  }
}
}

/* Badge.css */
@layer nbc.flourish {
/* Swiss: a caption, not a sticker. The hairline goes quiet, the tint is a
   flat grey, and status is one small accent square before the word. */

@scope ([data-theme="swiss"]) to ([data-theme]:not([data-theme="swiss"])) {
  .nbc-badge {
    font-variant-numeric: tabular-nums;
    border-color: transparent; /* keeps a visible edge in forced-colors mode */
  }

  .nbc-badge--neutral,
  .nbc-badge--accent,
  .nbc-badge--info,
  .nbc-badge--success,
  .nbc-badge--warning,
  .nbc-badge--danger {
    background: var(--nbc-surface-alt);
    color: var(--nbc-fg);
  }

  .nbc-badge--accent {
    --_status: var(--nbc-accent);
  }

  .nbc-badge--info {
    --_status: var(--nbc-info);
  }

  .nbc-badge--success {
    --_status: var(--nbc-success);
  }

  .nbc-badge--warning {
    --_status: var(--nbc-warning);
  }

  .nbc-badge--danger {
    --_status: var(--nbc-danger);
  }

  .nbc-badge--accent::before,
  .nbc-badge--info::before,
  .nbc-badge--success::before,
  .nbc-badge--warning::before,
  .nbc-badge--danger::before {
    content: '';
    flex: none;
    inline-size: 6px;
    block-size: 6px;
    background: var(--_status);
  }

  @media (forced-colors: active) {
    .nbc-badge::before {
      background: CanvasText;
    }
  }
}
}

/* Switch.css */
@layer nbc.flourish {
/* Swiss: a hairline rectangle with a black block. The one oxblood accent floods the track when
   on and the block flips to white for contrast. Nothing bounces; the slide is brisk. */

@scope ([data-theme="swiss"]) to ([data-theme]:not([data-theme="swiss"])) {
  .nbc-switch__track {
    background: var(--nbc-surface);
  }

  .nbc-switch__track:has(.nbc-switch__control:checked) {
    background: var(--nbc-accent);
    border-color: var(--nbc-accent);
  }

  .nbc-switch__thumb {
    background: var(--nbc-fg);
    border-color: var(--nbc-fg);
    transition-duration: var(--nbc-duration);
  }

  .nbc-switch__control:checked ~ .nbc-switch__thumb {
    background: var(--nbc-accent-fg);
    border-color: var(--nbc-accent-fg);
  }

  @media (hover: hover) {
    .nbc-switch:not(.nbc-switch--disabled) .nbc-switch__track:has(.nbc-switch__control:not(:checked)):hover {
      background: color-mix(in srgb, var(--nbc-accent) 14%, var(--nbc-surface));
      border-color: var(--nbc-accent);
    }
  }

  /* The focus line is oxblood and so is the lit track: draw it outside the hairline so it never disappears. */

  .nbc-switch__track:has(.nbc-switch__control:focus-visible) {
    outline-offset: 2px;
  }

  .nbc-switch__description {
    font-variant-numeric: tabular-nums;
  }

  @media (forced-colors: active) {
    .nbc-switch__track {
      background: Canvas;
    }
    .nbc-switch__track:has(.nbc-switch__control:checked) {
      background: Highlight;
      border-color: Highlight;
    }
    .nbc-switch__thumb {
      background: ButtonText;
      border-color: ButtonText;
    }
    .nbc-switch__control:checked ~ .nbc-switch__thumb {
      background: HighlightText;
      border-color: HighlightText;
    }
  }
}
}

/* Alert.css */
@layer nbc.flourish {
/* Swiss: a hairline box on plain paper. No tint, no stripe — the status lives
   in the solid square chip, and the title becomes a tracked uppercase caption. */

@scope ([data-theme="swiss"]) to ([data-theme]:not([data-theme="swiss"])) {
  .nbc-alert {
    background: var(--nbc-surface);
    border-inline-start: var(--nbc-border-width) var(--nbc-border-style) var(--nbc-border-color);
  }

  .nbc-alert__title {
    font-size: var(--nbc-fs-xs);
    letter-spacing: 0.12em;
    text-transform: uppercase;
  }

  .nbc-alert__description {
    font-variant-numeric: tabular-nums;
  }

  @media (hover: hover) {
    .nbc-alert__dismiss:hover {
      color: var(--nbc-bg);
      background: var(--nbc-fg);
    }
  }
}
}

/* Progress.css */
@layer nbc.flourish {
/* Swiss: a rule, not a tube. The track thins to a flat grey strip (2 / 4 / 8px),
   the bar is a flat fill with a hairline end-cap, and the figure is tabular and
   flush right. Danger earns the one accent square before its label. */

@scope ([data-theme="swiss"]) to ([data-theme]:not([data-theme="swiss"])) {
  .nbc-progress--sm {
    --_h: 2px;
  }

  .nbc-progress--md {
    --_h: 4px;
  }

  .nbc-progress--lg {
    --_h: 8px;
  }

  .nbc-progress__track {
    border: 0;
    border-radius: 0;
  }

  .nbc-progress__value {
    font-family: var(--nbc-font-sans);
    letter-spacing: var(--nbc-label-spacing);
    color: var(--nbc-fg);
  }

  .nbc-progress--danger .nbc-progress__label::before {
    content: '' / '';
    display: inline-block;
    inline-size: 6px;
    block-size: 6px;
    margin-inline-end: 8px;
    vertical-align: 0.08em;
    background: var(--nbc-danger);
  }

  @media (forced-colors: active) {
    .nbc-progress__track {
      outline: 1px solid CanvasText;
    }

    .nbc-progress--danger .nbc-progress__label::before {
      background: CanvasText;
    }
  }
}
}

/* Table.css */
@layer nbc.flourish {
/* Swiss: no shadow, ink hairlines between rows, a bare header over a 2px rule
   with one oxblood square, wider gutters, and an inverted row on hover. */

@scope ([data-theme="swiss"]) to ([data-theme]:not([data-theme="swiss"])) {
  .nbc-table__cell,
  .nbc-table__header-cell {
    padding-inline: var(--nbc-space-lg);
  }

  .nbc-table__cell,
  .nbc-table__header-cell[scope='row'] {
    border-block-end-color: var(--nbc-border-color);
  }

  .nbc-table__head .nbc-table__header-cell {
    background: transparent;
    border-block-end-width: 2px;
  }

  .nbc-table__head .nbc-table__header-cell:first-child::before {
    content: '' / '';
    display: inline-block;
    inline-size: 6px;
    block-size: 6px;
    margin-inline-end: var(--nbc-space-sm);
    vertical-align: 0.05em;
    background: var(--nbc-accent);
  }

  .nbc-table__foot .nbc-table__cell,
  .nbc-table__foot .nbc-table__header-cell {
    background: transparent;
    border-block-start-width: 2px;
  }

  @media (hover: hover) {
    .nbc-table__body > .nbc-table__row:hover {
      background: var(--nbc-fg);
      color: var(--nbc-surface);
    }
  }

  @media (forced-colors: active) {
    .nbc-table__head .nbc-table__header-cell:first-child::before {
      background: CanvasText;
    }
  }
}
}

/* Kbd.css */
@layer nbc.flourish {
/* Swiss: a flat hairline key with tabular figures. */
@scope ([data-theme="swiss"]) to ([data-theme]:not([data-theme="swiss"])) {
  .nbc-kbd {
    box-shadow: none;
    background: transparent;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.04em;
  }
}
}

/* Dialog.css */
@layer nbc.flourish {
/* Swiss: hairline frame, no shadow, tracked title, footer actions spread across the rule. */
@scope ([data-theme="swiss"]) to ([data-theme]:not([data-theme="swiss"])) {
  .nbc-dialog {
    box-shadow: none;
    transition-duration: 0ms;
  }
  .nbc-dialog__title {
    font-size: var(--nbc-fs-lg);
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }
  .nbc-dialog__title::before {
    content: '' / '';
    display: inline-block;
    inline-size: 0.5em;
    block-size: 0.5em;
    margin-inline-end: 0.6em;
    background: var(--nbc-accent);
  }
  .nbc-dialog__footer {
    justify-content: space-between;
    background: transparent;
  }
}
}

/* Tabs.css */
@layer nbc.flourish {
/* Swiss: no folders, just text with a hairline rule and a 2px oxblood underline. */
@scope ([data-theme="swiss"]) to ([data-theme]:not([data-theme="swiss"])) {
  .nbc-tabs__tab {
    font-variant-numeric: tabular-nums;
    border-color: transparent;
    background: transparent;
  }
  .nbc-tabs__tab--active {
    background: transparent;
    border-color: transparent;
    box-shadow: inset 0 -2px 0 var(--nbc-accent);
  }
}
}

/* Tooltip.css */
@layer nbc.flourish {
/* Swiss: black box, no shadow, tabular figures. */
@scope ([data-theme="swiss"]) to ([data-theme]:not([data-theme="swiss"])) {
  .nbc-tooltip {
    box-shadow: none;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
  }
}
}
