/* Shared Travers OS design tokens and surface primitives. */
:root {
  --os-menu-height: 38px;
  --os-chrome-height: 52px;
  --os-radius: 12px;
  --os-inner-radius: 8px;
  --os-frame: #ffffff24;
  --os-frame-top: #ffffff40;
  --os-chrome: var(--os-surface);
  --os-surface: #202020;
  --os-surface-raised: #282828;
  --os-surface-reading: var(--os-surface);
  --os-surface-sidebar: #1d1d1d;
  --os-surface-alternate: #252525;
  --os-field: #303131;
  --os-hover: #ffffff0d;
  --os-accent: #0a9fff;
  --os-sidebar: var(--os-surface-sidebar);
  --os-text: #e8e8e8;
  --os-muted: #a0a0a0;
  --os-subtle: #808282;
  --os-selection: #0050c0;
  --os-selection-text: #fff;
  --os-line: #363838;
  --os-link: #70b4ff;
  --os-focus: #80bfff;
  --os-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  --os-glass-blur: 28px;
  --os-menu-surface: linear-gradient(165deg, #a9b6c61c, transparent 42%, #0c0e121c), #32363cd1;
  --os-bar-surface: #18181860;
  --os-shadow: 0 0 0 1px #0005, 0 14px 32px -8px #0009, 0 3px 8px #0005;
  --os-control-fill: #ffffff08;
  --os-control-stroke: #ffffff1f;
  --os-control-pressed: #ffffff18;
  --os-glass-rim: inset 0 1px 0 #ffffff14, inset 0 -1px 0 #0003;
  --os-shadow-inactive: 0 8px 20px 4px #0005;
  --os-control-size: 14px;
  --os-control-gap: 9px;
  --os-control-close: #ff5f57;
  --os-control-minimize: #febc2e;
  --os-control-maximize: #28c840;
  --os-control-inactive: #4a4b4b;
  /* Document-window materials are shared without changing menu/control curves. */
  --os-window-radius: 30px;
  --os-window-inner-radius: calc(var(--os-window-radius) - 1px);
  --os-window-frame: #ffffff2b;
  --os-window-material: linear-gradient(155deg, #ffffff05, #ffffff00 38%), #202020;
  --os-window-chrome: transparent;
  --os-window-content: var(--os-surface);
  --os-window-sidebar: transparent;
  --os-window-divider: #151616;
  --os-window-rule: var(--os-line);
  --os-window-shadow: 0 12px 32px -8px #0005, 0 2px 8px -2px #0003;
  --os-window-shadow-inactive: 0 8px 24px -8px #0004, 0 1px 6px -2px #0002;
  /* Finder's retained CSS consumes aliases of these same tokens. */
  --dark-background: var(--os-surface);
  --light-navbar-2: var(--os-chrome);
  --offwhite-lettering: var(--os-text);
  --blue-link: var(--os-selection);
  --light-line: var(--os-line);
  --menu-background: var(--os-surface-raised);
  --mobile-dropdown: var(--os-field);

  --os-menu-trigger-fill: #354052;
  --os-menu-highlight: #0874dc;
  --os-menu-divider: #ffffff29;

  /* Durations follow the interaction so unrelated surfaces can evolve independently. */
  --os-motion-window-placement: 300ms;
  --os-motion-window-drop: 225ms;
  --os-motion-snap-fade: 120ms;
  --os-motion-snap-move: 100ms;
  --os-motion-control-feedback: 100ms;
  --os-motion-splash-exit: 240ms;
  --os-motion-search-width: 240ms;
  --os-motion-finder-search-fill: 140ms;
  --os-motion-finder-search-ring: 180ms;
  --os-motion-finder-search-text: 150ms;
  --os-motion-spotlight-position: 200ms;
  --os-motion-spotlight-stagger: 16ms;
  --os-motion-spotlight-shortcut-fade: 240ms;
  --os-motion-spotlight-shortcut-move: 280ms;
  --os-motion-spotlight-panel-fade: 130ms;
  --os-motion-spotlight-panel-grow: 360ms;
  --os-motion-dialog: 180ms;
  --os-motion-pane: 260ms;
  --os-ease-search: cubic-bezier(.2, .8, .3, 1);
  --os-ease-spotlight-dialog: cubic-bezier(.2, .75, .25, 1);
  --os-ease-spotlight-panel: cubic-bezier(.25, .6, .35, 1);
}

.os-focus-ring:focus-visible {
  outline: 2px solid var(--os-focus);
  outline-offset: var(--os-focus-offset, -2px);
}
html .os-focus-on-open:focus-visible { outline: none; }

.os-control-feedback {
  background-color: var(--os-control-rest, transparent);
  color: var(--os-control-ink, var(--os-text));
}
@media (hover: hover) {
  .os-control-feedback:where(:not(:disabled)):hover {
    background-color: var(--os-control-hover, var(--os-hover));
  }
}
.os-control-feedback:where(:not(:disabled)):active,
.os-pane-toggle[aria-expanded="true"] {
  background-color: var(--os-control-active, var(--os-control-pressed));
}
.os-control-feedback[aria-pressed="true"] {
  background-color: var(--os-selection);
  color: var(--os-selection-text);
}
.os-control-feedback:disabled { color: var(--os-subtle); }
@media (prefers-reduced-motion: no-preference) {
  .os-control-feedback {
    transition: background-color var(--os-motion-control-feedback) ease,
      color var(--os-motion-control-feedback) ease;
  }
}

.os-search-clear, .os-secondary-button {
  --os-control-rest: var(--os-field);
  --os-control-hover: color-mix(in srgb, var(--os-field), white 8%);
  --os-control-active: color-mix(in srgb, var(--os-field), white 13%);
}
.os-search-clear {
  display: grid;
  place-items: center;
  flex: none;
  width: var(--os-clear-size, 20px);
  height: var(--os-clear-size, 20px);
  padding: 0;
  border: 0;
  border-radius: 50%;
}
.os-search-clear::before, .os-search-clear::after {
  content: "";
  grid-area: 1 / 1;
  width: 50%;
  height: 1.5px;
  border-radius: 1px;
  background-color: currentColor;
  transform: rotate(45deg);
}
.os-search-clear::after { transform: rotate(-45deg); }
.os-secondary-button {
  padding: 6px 16px;
  border: 1px solid var(--os-frame);
  border-radius: var(--os-inner-radius);
  font: 600 13px/1.2 var(--os-font);
  cursor: pointer;
}

.os-list-row {
  --os-list-title: var(--os-text);
  --os-list-meta: var(--os-muted);
  color: var(--os-list-title);
}
.os-list-row:is(.w--current, [aria-selected="true"]) {
  --os-list-title: var(--os-selection-text);
  --os-list-meta: var(--os-selection-text);
  background-color: var(--os-selection);
}

.os-menu-surface {
  box-sizing: border-box;
  padding: 5px;
  border: 1px solid #ffffff26;
  border-top-color: #ffffff48;
  border-radius: 13px;
  color: var(--os-text);
  background: var(--os-menu-surface);
  box-shadow: inset 0 1px 0 #ffffff12, 0 0 0 1px #0007, 0 12px 30px #0007;
  -webkit-backdrop-filter: blur(24px) saturate(145%);
  backdrop-filter: blur(24px) saturate(145%);
  font: 500 13.5px/1.2 var(--os-font);
  letter-spacing: -.12px;
  color-scheme: dark;
}
.os-menu-popover {
  position: fixed;
  inset: calc(var(--os-menu-height) + 2px) auto auto var(--os-menu-left, 6px);
  width: var(--os-menu-width);
  max-width: calc(100vw - 12px);
  max-height: calc(100dvh - var(--os-menu-height) - 10px);
  margin: 0;
  overflow: auto;
}
.os-menu-popover::backdrop { background: transparent; }
.os-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 28px;
  border: 0;
  border-radius: 8px;
  color: inherit;
  background: transparent;
  font: inherit;
  text-align: left;
}
.os-menu-item.is-current,
.os-menu-hover > .os-menu-item:is(:hover, :focus-visible) {
  color: #fff;
  background: var(--os-menu-highlight);
}
.os-menu-separator {
  height: 1px;
  margin: 5px 10px;
  background: var(--os-menu-divider);
}
@supports (corner-shape: squircle) {
  .os-menu-surface { corner-shape: squircle; }
}
@media (prefers-reduced-transparency: reduce) {
  :root {
    --os-menu-surface: #323438;
    --os-bar-surface: #1d1d1d;
  }
  .os-menu-surface {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}
@media (prefers-contrast: more) {
  :root { --os-menu-divider: #ffffff66; }
  .os-menu-surface { border-color: #d4d4d4; color: #fff; }
}

@keyframes os-fade-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: no-preference) {
  .os-dialog-transition {
    /* Keep the closing dialog in the top layer while its content animates. */
    transition: display var(--os-motion-dialog) allow-discrete,
      overlay var(--os-motion-dialog) allow-discrete;
  }
  .os-dialog-transition:not([open]),
  .os-dialog-transition:not([open])::backdrop { pointer-events: none; }

  .os-pane {
    transition: margin-right var(--os-motion-pane) cubic-bezier(.32, .08, .24, 1),
      display var(--os-motion-pane) allow-discrete;
  }
  .os-pane[hidden] {
    margin-right: calc(-1 * var(--os-pane-width));
    pointer-events: none;
  }
  @starting-style {
    .os-pane:not([hidden]) {
      margin-right: calc(-1 * var(--os-pane-width));
    }
  }
}
