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

/* tokens.css */
@layer nbc.theme {
/* ============================================================
   CLASSIC — "This decision is final."
   Brutalism comes from béton brut: the page is raw concrete,
   surfaces are white slabs with 3px ink edges, and every slab
   casts a double-stack shadow — ink core, cobalt offset.
   Sun-yellow primary. Bricolage Grotesque everywhere, leaning
   on its optical sizes (tight display, open text).
   Dark: night concrete, chalk edges, the stack stays.
   ============================================================ */
[data-theme="classic"] {
  --nbc-scheme: light;

  --nbc-font-sans: 'Bricolage Grotesque', 'Inter', system-ui, sans-serif;
  --nbc-font-display: 'Bricolage Grotesque', 'Inter', system-ui, sans-serif;
  --nbc-font-mono: 'Geist Mono', ui-monospace, 'SFMono-Regular', monospace;
  --nbc-weight-body: 400;
  --nbc-weight-label: 700;
  --nbc-weight-display: 800;
  --nbc-label-transform: none;
  --nbc-label-spacing: -0.01em;
  --nbc-display-transform: none;
  --nbc-display-spacing: -0.035em;

  --nbc-bg: light-dark(#e7e6e1, #191817);
  --nbc-fg: light-dark(#14110f, #f3f1ea);
  --nbc-fg-muted: light-dark(#524d47, #b3ada3);
  --nbc-surface: light-dark(#ffffff, #24221f);
  --nbc-surface-alt: light-dark(#f3f1ea, #302d29);
  --nbc-border-color: light-dark(#14110f, #f3f1ea);

  --nbc-primary: #ffd23f;
  --nbc-primary-fg: #14110f;
  --nbc-accent: light-dark(#2b59ff, #7d9bff);
  --nbc-accent-fg: light-dark(#ffffff, #14110f);

  --nbc-info: light-dark(#2b59ff, #7d9bff);
  --nbc-info-fg: light-dark(#ffffff, #14110f);
  --nbc-success: light-dark(#17733f, #5fd68f);
  --nbc-success-fg: light-dark(#ffffff, #14110f);
  --nbc-warning: #ffb020;
  --nbc-warning-fg: #14110f;
  --nbc-danger: light-dark(#d1241c, #ff7a6b);
  --nbc-danger-fg: light-dark(#ffffff, #14110f);
  --nbc-focus: light-dark(#2b59ff, #7d9bff);

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

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

  /* Double stack: the ink core sits 5px out, the cobalt edge 7px.
     Pressing translates by --nbc-press and shrinks both layers by
     the same amount, so the outer silhouette never moves. */
  --nbc-shadow: 5px 5px 0 light-dark(#14110f, #000000), 7px 7px 0 var(--nbc-accent);
  --nbc-shadow-lg: 8px 8px 0 light-dark(#14110f, #000000), 11px 11px 0 var(--nbc-accent);
  --nbc-shadow-press: 2px 2px 0 light-dark(#14110f, #000000), 4px 4px 0 var(--nbc-accent);
  --nbc-press: 3px;
  --nbc-press-active: 5px;
  --nbc-rotate: 0deg;
  --nbc-focus-width: 3px;
  --nbc-focus-offset: 3px;

  --nbc-duration: 110ms;
  --nbc-duration-slow: 220ms;
  --nbc-ease: cubic-bezier(0.2, 0.9, 0.25, 1);
}
}

/* Button.css */
@layer nbc.flourish {
/* Classic: the primary slab sits a half-degree off — a deliberate, final gesture. */

@scope ([data-theme="classic"]) to ([data-theme]:not([data-theme="classic"])) {
  .nbc-button--primary {
    --nbc-rotate: -0.5deg;
  }

  .nbc-button__spinner {
    border-inline-end-color: var(--nbc-accent);
    animation-duration: 900ms;
  }
}
}

/* Card.css */
@layer nbc.flourish {
/* Classic: card titles use Bricolage's display optical size — tight and chunky. */

@scope ([data-theme="classic"]) to ([data-theme]:not([data-theme="classic"])) {
  .nbc-card__title {
    font-variation-settings: 'opsz' 96;
  }
}
}

/* Checkbox.css */
@layer nbc.flourish {
/* Classic: a chunky slab — ink tick on sun-yellow, set a few degrees off once it is decided. */

@scope ([data-theme="classic"]) to ([data-theme]:not([data-theme="classic"])) {
  .nbc-checkbox__box {
    transition-property: transform, rotate, box-shadow, background-color, border-color;
  }

  .nbc-checkbox__box:has(.nbc-checkbox__control:checked, .nbc-checkbox__control:indeterminate) {
    rotate: -4deg;
  }

  .nbc-checkbox__check,
  .nbc-checkbox__dash {
    stroke-width: 4;
  }

  .nbc-checkbox__label {
    font-weight: 500;
  }
}
}

/* Select.css */
@layer nbc.flourish {
/* Classic: the chevron is its own slab — a separated cell behind a 3px rule,
   a button stuck to the end of the field. Open or hovered, it turns cobalt. */

@scope ([data-theme="classic"]) to ([data-theme]:not([data-theme="classic"])) {
  .nbc-select__control {
    padding-inline-end: calc(2.75em + var(--nbc-space-sm));
  }

  .nbc-select__chevron {
    inset-block: 0;
    inset-inline-end: 0;
    box-sizing: border-box;
    inline-size: 2.75em;
    block-size: 100%;
    padding-inline: 0.7em;
    translate: none;
    stroke-width: 3;
    color: var(--nbc-primary-fg);
    background: var(--nbc-primary-fill);
    border-inline-start: var(--nbc-border-width) var(--nbc-border-style) var(--nbc-border-color);
    transition-property: color, background-color;
  }

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

  /* Rotating would flip the cell's rule to the wrong side; the cell changes ink instead. */

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

  @supports (appearance: base-select) {
    .nbc-select__control option {
      font-weight: 800;
    }
    .nbc-select__control option:checked:not(:disabled) {
      box-shadow: inset 0 0 0 var(--nbc-border-width) var(--nbc-border-color);
    }
  }
}
}

/* RadioGroup.css */
@layer nbc.flourish {
/* Classic: a thick ring around an ink dot on sun-yellow; once chosen, the dot is stamped
   with a double stack — ink core, cobalt edge — as if the decision were final. */

@scope ([data-theme="classic"]) to ([data-theme]:not([data-theme="classic"])) {
  .nbc-radio__box {
    --_bw: calc(var(--nbc-border-width) + 1px);

    border-width: var(--_bw);
  }

  /* The invisible control still covers the whole (thicker) ring. */

  .nbc-radio__control {
    inset: calc(-1 * var(--_bw));
    inline-size: calc(100% + 2 * var(--_bw));
    block-size: calc(100% + 2 * var(--_bw));
  }

  .nbc-radio:not(.nbc-radio--disabled) .nbc-radio__box:has(.nbc-radio__control:checked:not(:active)) {
    box-shadow:
      var(--_ring),
      3px 3px 0 light-dark(#14110f, #000000),
      5px 5px 0 var(--nbc-accent);
  }
}
}

/* Badge.css */
@layer nbc.flourish {
/* Classic: a sticker slapped on the slab — it carries its own small stack,
   and the "New" one went on slightly crooked. */

@scope ([data-theme="classic"]) to ([data-theme]:not([data-theme="classic"])) {
  .nbc-badge {
    box-shadow: var(--nbc-shadow-press);
    font-variation-settings: 'opsz' 14;
  }

  .nbc-badge--primary {
    rotate: -1deg;
  }
}
}

/* Switch.css */
@layer nbc.flourish {
/* Classic: a chunky slab. The thumb is an ink block that casts its own small cobalt edge,
   and once the switch is on the slab sits a couple of degrees off, as if it were decided. */

@scope ([data-theme="classic"]) to ([data-theme]:not([data-theme="classic"])) {
  .nbc-switch__track {
    transition-property: transform, rotate, box-shadow, background-color, border-color;
  }

  .nbc-switch__track:has(.nbc-switch__control:checked) {
    rotate: -2deg;
  }

  .nbc-switch__thumb {
    background: var(--nbc-border-color);
    box-shadow: 1px 1px 0 var(--nbc-border-color), 2px 2px 0 var(--nbc-accent);
  }

  .nbc-switch__label {
    font-weight: 500;
  }

  @media (forced-colors: active) {
    .nbc-switch__thumb {
      background: ButtonText;
    }
    .nbc-switch__control:checked ~ .nbc-switch__thumb {
      background: HighlightText;
    }
  }
}
}

/* Alert.css */
@layer nbc.flourish {
/* Classic: the status stripe is a slab, and a warning is a solid amber warning
   slab with ink text (the whole message switches to --nbc-warning-fg so it
   stays readable in light and dark). */

@scope ([data-theme="classic"]) to ([data-theme]:not([data-theme="classic"])) {
  .nbc-alert {
    --_stripe: 12px;
  }

  .nbc-alert__title {
    font-variation-settings: 'opsz' 96;
  }

  .nbc-alert--warning {
    color: var(--nbc-warning-fg);
    background: var(--nbc-warning);
    border-inline-start-color: var(--nbc-warning-fg);
  }

  .nbc-alert--warning .nbc-alert__title,
  .nbc-alert--warning .nbc-alert__description {
    color: var(--nbc-warning-fg);
  }

  .nbc-alert--warning .nbc-alert__icon {
    color: var(--nbc-warning);
    background: var(--nbc-warning-fg);
  }

  .nbc-alert--warning .nbc-alert__dismiss {
    color: var(--nbc-warning-fg);
  }

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

/* Progress.css */
@layer nbc.flourish {
/* Classic: a poured slab. The track casts the double stack like any other
   slab, and the bar is cut with diagonal formwork hatching. */

@scope ([data-theme="classic"]) to ([data-theme]:not([data-theme="classic"])) {
  .nbc-progress__track {
    box-shadow: var(--nbc-shadow-press);
  }

  .nbc-progress--sm .nbc-progress__track {
    box-shadow: 2px 2px 0 var(--nbc-border-color);
  }

  .nbc-progress__bar {
    background:
      repeating-linear-gradient(-45deg, #14110f33 0 5px, transparent 5px 10px),
      var(--_bar);
  }

  .nbc-progress__value {
    font-weight: 800;
    color: var(--nbc-fg);
  }

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

/* Table.css */
@layer nbc.flourish {
/* Classic: a slab of a header rule, and the hovered row goes sun-yellow with a cobalt edge. */

@scope ([data-theme="classic"]) to ([data-theme]:not([data-theme="classic"])) {
  .nbc-table__head .nbc-table__header-cell {
    border-block-end-width: calc(var(--nbc-border-width) + 2px);
  }

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

    .nbc-table__body > .nbc-table__row:hover > :first-child {
      box-shadow: inset 5px 0 0 var(--nbc-accent);
    }
  }
}
}

/* Kbd.css */
@layer nbc.flourish {
/* Classic: a chunky slab key with the cobalt offset. */
@scope ([data-theme="classic"]) to ([data-theme]:not([data-theme="classic"])) {
  .nbc-kbd {
    border-width: 2px;
    font-weight: 800;
    box-shadow: 2px 2px 0 var(--nbc-border-color), 3px 3px 0 #1d4ed8;
  }
}
}

/* Dialog.css */
@layer nbc.flourish {
/* Classic: a sun-yellow header band over the concrete slab. */
@scope ([data-theme="classic"]) to ([data-theme]:not([data-theme="classic"])) {
  .nbc-dialog__header {
    background: var(--nbc-primary);
    color: var(--nbc-primary-fg);
    border-block-end: var(--nbc-border-width) var(--nbc-border-style) var(--nbc-border-color);
    border-start-start-radius: inherit;
    border-start-end-radius: inherit;
  }
  .nbc-dialog__header .nbc-dialog__description,
  .nbc-dialog__close {
    color: var(--nbc-primary-fg);
  }
  .nbc-dialog__title {
    font-variation-settings: 'opsz' 96;
  }
}
}

/* Tabs.css */
@layer nbc.flourish {
/* Classic: chunky slab tabs; the active one is yellow and lifts on the double-stack shadow. */
@scope ([data-theme="classic"]) to ([data-theme]:not([data-theme="classic"])) {
  .nbc-tabs__tab {
    font-weight: 800;
  }
  .nbc-tabs__tab--active {
    background: var(--nbc-primary-fill);
    color: var(--nbc-primary-fg);
    border-block-end-color: var(--nbc-border-color);
    box-shadow: var(--nbc-shadow);
    transform: translateY(-2px);
    position: relative;
    z-index: 1;
  }
}
}

/* Tooltip.css */
@layer nbc.flourish {
/* Classic: a sun-yellow sticky note with an ink edge. */
@scope ([data-theme="classic"]) to ([data-theme]:not([data-theme="classic"])) {
  .nbc-tooltip {
    color: var(--nbc-primary-fg);
    background: var(--nbc-primary);
    border-color: var(--nbc-border-color);
  }
}
}
