/*
 * Third-Party Mock Console — shared components
 *
 * Rounded, layered, tactile. The rules that keep it from becoming decoration:
 *   - Depth is a shadow scale, not a border everywhere.
 *   - Motion on a control is 120ms and on transform only, so pressing a button
 *     feels immediate rather than animated.
 *   - The primary action is the only element allowed a coloured shadow.
 *   - Focus is always visible and never removed, including on gradient fills.
 */

/* ---- Buttons ------------------------------------------------------------- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-height: 40px;
  padding: 0 18px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  background-image: var(--grad-surface);
  color: var(--ink);
  font-size: var(--t-small);
  font-weight: 600;
  letter-spacing: -0.005em;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: var(--shadow-1);
  transition: background-color 120ms var(--ease-standard),
    border-color 120ms var(--ease-standard),
    box-shadow 160ms var(--ease-standard),
    transform 120ms var(--ease-standard);
}

.btn:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--brand) 34%, var(--line-strong));
  box-shadow: var(--shadow-2);
  transform: translateY(-1px);
}

/* Press pushes back to the surface: the lift is undone, not exaggerated. */
.btn:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: var(--shadow-1);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px color-mix(in srgb, var(--brand) 45%, transparent);
}

/* The one accent action on a screen: gradient fill, coloured lift. */
.btn--primary {
  border-color: transparent;
  background-image: var(--grad-brand);
  color: #fff;
  font-weight: 650;
  box-shadow: var(--shadow-brand);
}

.btn--primary:hover:not(:disabled) {
  border-color: transparent;
  background-image: var(--grad-brand-hover);
  box-shadow: var(--shadow-brand-hover);
  transform: translateY(-1px);
}

.btn--primary:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: var(--shadow-brand);
}

.btn--primary:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--surface),
    0 0 0 5px color-mix(in srgb, var(--brand) 55%, transparent), var(--shadow-brand);
}

.btn--quiet {
  border-color: transparent;
  background-image: none;
  background-color: transparent;
  color: var(--ink-2);
  box-shadow: none;
}

.btn--quiet:hover:not(:disabled) {
  background-color: var(--surface-sunken);
  border-color: transparent;
  color: var(--ink);
  box-shadow: none;
}

.btn--danger {
  color: var(--bad);
}

.btn--danger:hover:not(:disabled) {
  background-color: var(--bad-wash);
  background-image: none;
  border-color: color-mix(in srgb, var(--bad) 40%, var(--line-strong));
  box-shadow: 0 4px 12px color-mix(in srgb, var(--bad) 16%, transparent);
}

.btn--sm {
  min-height: 32px;
  padding: 0 12px;
  border-radius: var(--r-sm);
  font-size: var(--t-micro);
}

.btn--icon {
  width: 40px;
  min-width: 40px;
  padding: 0;
  border-radius: var(--r-md);
}

.btn--icon.btn--sm {
  width: 32px;
  min-width: 32px;
}

/* ---- Status marks -------------------------------------------------------- */
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: var(--r-full);
  background: var(--ok-wash);
  color: var(--ok);
  font-size: var(--t-micro);
  font-weight: 650;
  white-space: nowrap;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 18%, transparent);
}

.status::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex: 0 0 5px;
  box-shadow: 0 0 0 2px color-mix(in srgb, currentColor 22%, transparent);
}

.status--off {
  background: var(--surface-sunken);
  color: var(--ink-3);
}

.status--warn {
  background: var(--warn-wash);
  color: var(--warn);
}

.status--bad {
  background: var(--bad-wash);
  color: var(--bad);
}

.status--info {
  background: var(--info-wash);
  color: var(--info);
}

/* ---- Fields -------------------------------------------------------------- */
.field {
  min-width: 0;
}

.field > label {
  display: block;
  margin-bottom: 6px;
  color: var(--ink-2);
  font-size: var(--t-micro);
  font-weight: 650;
  letter-spacing: -0.005em;
}

.field > input,
.field > select,
.field > textarea {
  width: 100%;
  min-height: 40px;
  padding: 9px 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink);
  font-size: var(--t-small);
  box-shadow: inset 0 1px 2px rgb(16 24 40 / 4%);
  transition: border-color 120ms var(--ease-standard),
    box-shadow 160ms var(--ease-standard),
    background-color 120ms var(--ease-standard);
}

.field > input::placeholder,
.field > textarea::placeholder {
  color: var(--ink-3);
}

.field > input:hover,
.field > select:hover,
.field > textarea:hover {
  border-color: color-mix(in srgb, var(--brand) 26%, var(--line-strong));
}

.field > input:focus,
.field > select:focus,
.field > textarea:focus {
  outline: none;
  border-color: var(--brand);
  background: var(--surface);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 16%, transparent);
}

.field > textarea {
  min-height: 82px;
  resize: vertical;
  line-height: 1.7;
  box-shadow: inset 0 1px 2px rgb(16 24 40 / 4%);
}

.field-hint {
  margin-top: 6px;
  color: var(--ink-3);
  font-size: var(--t-micro);
  line-height: 1.7;
}

/* ---- Surfaces ------------------------------------------------------------ */
/* A card is a surface with a hairline and one ambient shadow step. */
.card {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background-color: var(--surface);
  background-image: var(--grad-surface);
  box-shadow: var(--shadow-1);
}

.card--raised {
  box-shadow: var(--shadow-2);
}

.card--interactive {
  transition: box-shadow 200ms var(--ease-standard),
    transform 200ms var(--ease-standard),
    border-color 200ms var(--ease-standard);
}

.card--interactive:hover {
  border-color: color-mix(in srgb, var(--brand) 24%, var(--line));
  box-shadow: var(--shadow-3);
  transform: translateY(-2px);
}

.floating {
  box-shadow: var(--shadow-4);
}

/* ---- Empty / error ------------------------------------------------------- */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-height: 240px;
  padding: var(--s-6) var(--s-5);
  text-align: center;
  color: var(--ink-2);
  font-size: var(--t-small);
}

.empty__icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: var(--s-1);
  border-radius: var(--r-md);
  background: var(--brand-wash);
  color: var(--brand);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 14%, transparent);
}

.empty strong {
  color: var(--ink);
  font-size: var(--t-body);
  font-weight: 650;
}

.empty p {
  max-width: 34ch;
  color: var(--ink-3);
  font-size: var(--t-small);
  line-height: 1.7;
}

.notice-error {
  margin: 0;
  padding: var(--s-3) var(--gutter);
  background: var(--bad-wash);
  color: var(--bad);
  font-size: var(--t-small);
}

/* ---- Toast --------------------------------------------------------------- */
.toast {
  position: fixed;
  bottom: var(--s-5);
  left: 50%;
  z-index: 60;
  max-width: calc(100vw - 32px);
  padding: 11px 20px;
  border: 1px solid rgb(255 255 255 / 10%);
  border-radius: var(--r-md);
  background: #1f2937;
  color: #f3f4f6;
  font-size: var(--t-small);
  font-weight: 550;
  transform: translateX(-50%);
  box-shadow: var(--shadow-4);
}

/* ---- Scroll regions ------------------------------------------------------ */
.scroll-y {
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.scroll-y::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.scroll-y::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: var(--r-full);
  background-clip: content-box;
  background-color: var(--line-strong);
}

/* ---- Motion: section entrance, applied by design/motion.js ---------------- */
/* Content is visible by default. The script only ever adds the travel, so a
   page with script blocked still reads completely. */
[data-enter] {
  will-change: transform, opacity;
}

.js-motion [data-enter] {
  opacity: 0;
}

@media (prefers-reduced-motion: reduce) {
  .js-motion [data-enter] {
    opacity: 1;
  }

  .btn:hover:not(:disabled),
  .card--interactive:hover {
    transform: none;
  }
}
/* ---- Motion surfaces used by design/motion.js and bg-field.js ------------- */

/* The animated field sits behind the shell and never receives a pointer. */
.bg-field {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Everything the user reads or clicks sits above the field.
   `isolation` on the shell is what actually makes this true: it creates a
   stacking context so no descendant can end up painted under the canvas. */
.rail,
.shell,
.rail-scrim,
.lock-screen {
  position: relative;
  z-index: 1;
}

.shell {
  isolation: isolate;
}

.rail {
  z-index: 30;
}

/* A hairline progress bar pinned under the header, filled by scroll. */
.scroll-progress {
  position: absolute;
  inset: auto 0 0 0;
  height: 2px;
  background: var(--grad-brand);
  transform: scaleX(0);
  transform-origin: 0 50%;
  pointer-events: none;
}

/* Words produced by the heading splitter. Inline-block is required for the
   transform; the parent keeps its accessible name via aria-label.
   Chinese runs split per glyph, so each span must not add its own spacing or
   the heading would look letter-spaced. */
.reveal-word {
  display: inline-block;
  will-change: transform, opacity;
}

/* Opt-in tilt surface. The perspective has to live on the container, otherwise
   a 1-2 degree rotation collapses to nothing: without it the transform is
   orthographic and the card only appears to shift a few pixels.
   The angle stays small — this is a working surface, not a showreel. */
.scenarios,
.tilt-stage {
  perspective: 1400px;
}

[data-lift] {
  transform-style: preserve-3d;
  will-change: transform;
}

@media (prefers-reduced-motion: reduce) {
  [data-lift] {
    transform: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .scroll-progress {
    transform: scaleX(1);
  }
}
