@import url("./tokens.css");

:where(.gl-root),
:where(.gl-root) *,
:where(.gl-root) *::before,
:where(.gl-root) *::after {
  box-sizing: border-box;
}

:where(.gl-root) {
  color: var(--gl-text-primary);
  font-family: var(--gl-font-product);
  font-size: var(--gl-type-body);
  line-height: var(--gl-leading-body);
  letter-spacing: 0;
}

:where(.gl-root) button,
:where(.gl-root) input,
:where(.gl-root) select,
:where(.gl-root) textarea {
  color: inherit;
  font: inherit;
  letter-spacing: 0;
}

:where(.gl-root) button,
:where(.gl-root) a {
  -webkit-tap-highlight-color: transparent;
}

:where(.gl-root) :focus-visible {
  outline: 3px solid var(--gl-focus-ring);
  outline-offset: 3px;
}

.gl-logo {
  display: block;
  width: 168px;
  height: auto;
}

.gl-logo--inverse {
  filter: invert(1);
}

.gl-editorial {
  font-family: var(--gl-font-editorial);
  font-style: italic;
  font-weight: 500;
  font-optical-sizing: auto;
}

.gl-eyebrow {
  margin: 0;
  font-size: var(--gl-type-label);
  font-weight: var(--gl-font-weight-semibold);
  line-height: 1.2;
  text-transform: uppercase;
}

.gl-button {
  min-height: var(--gl-control-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--gl-space-2);
  padding: 0 var(--gl-space-5);
  border: var(--gl-stroke-thin) solid transparent;
  border-radius: var(--gl-radius-r3);
  background: transparent;
  cursor: pointer;
  font-size: var(--gl-type-body-sm);
  font-weight: var(--gl-font-weight-semibold);
  line-height: 1;
  text-decoration: none;
  transition:
    color var(--gl-duration-fast) var(--gl-ease-standard),
    background var(--gl-duration-fast) var(--gl-ease-standard),
    border-color var(--gl-duration-fast) var(--gl-ease-standard),
    transform var(--gl-duration-fast) var(--gl-ease-standard);
}

.gl-button svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  stroke-width: var(--gl-stroke-icon);
}

.gl-button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.gl-button:active:not(:disabled) {
  transform: translateY(0) scale(0.98);
}

.gl-button:disabled,
.gl-button[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.42;
}

.gl-button--primary {
  color: var(--gl-text-inverse);
  background: var(--gl-bg-inverse);
}

.gl-button--primary:hover:not(:disabled) {
  background: var(--gl-color-gray-700);
}

.gl-button--signal {
  color: var(--gl-text-on-signal);
  background: var(--gl-bg-signal);
}

.gl-button--signal:hover:not(:disabled) {
  background: #b9ed00;
}

.gl-button--secondary {
  border-color: var(--gl-border-strong);
  color: var(--gl-text-primary);
  background: var(--gl-bg-canvas);
}

.gl-button--secondary:hover:not(:disabled) {
  background: var(--gl-color-gray-100);
}

.gl-button--ghost {
  color: var(--gl-text-primary);
}

.gl-button--ghost:hover:not(:disabled) {
  background: var(--gl-color-gray-100);
}

.gl-button--danger {
  color: var(--gl-color-danger);
  border-color: rgba(201, 54, 43, 0.28);
  background: var(--gl-color-danger-soft);
}

.gl-button--sm {
  min-height: var(--gl-control-sm);
  padding-inline: var(--gl-space-4);
  font-size: 12px;
}

.gl-button--lg {
  min-height: var(--gl-control-lg);
  padding-inline: var(--gl-space-6);
  font-size: var(--gl-type-body);
}

.gl-icon-button {
  width: var(--gl-control-md);
  height: var(--gl-control-md);
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: var(--gl-stroke-thin) solid var(--gl-border-default);
  border-radius: 50%;
  color: var(--gl-text-primary);
  background: var(--gl-bg-canvas);
  cursor: pointer;
  transition: transform var(--gl-duration-fast) var(--gl-ease-standard), background var(--gl-duration-fast) var(--gl-ease-standard);
}

.gl-icon-button:hover {
  background: var(--gl-color-gray-100);
  transform: translateY(-1px);
}

.gl-icon-button svg {
  width: 19px;
  height: 19px;
  stroke-width: var(--gl-stroke-icon);
}

.gl-chip {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 var(--gl-space-3);
  border: var(--gl-stroke-thin) solid var(--gl-border-default);
  border-radius: var(--gl-radius-r3);
  color: var(--gl-text-primary);
  background: var(--gl-bg-canvas);
  font-size: 12px;
  font-weight: var(--gl-font-weight-medium);
  line-height: 1;
  white-space: nowrap;
}

.gl-chip svg {
  width: 15px;
  height: 15px;
  stroke-width: var(--gl-stroke-icon);
}

.gl-chip--selected {
  border-color: var(--gl-color-black);
  color: var(--gl-color-white);
  background: var(--gl-color-black);
}

.gl-chip--signal {
  border-color: var(--gl-color-lime);
  color: var(--gl-color-black);
  background: var(--gl-color-lime);
}

.gl-field {
  display: grid;
  gap: var(--gl-space-2);
}

.gl-field__label {
  font-size: var(--gl-type-label);
  font-weight: var(--gl-font-weight-semibold);
  line-height: 1.25;
}

.gl-field__control {
  min-height: var(--gl-control-md);
  width: 100%;
  padding: 0 var(--gl-space-4);
  border: var(--gl-stroke-thin) solid var(--gl-border-default);
  border-radius: var(--gl-radius-r1);
  color: var(--gl-text-primary);
  background: var(--gl-bg-canvas);
  font-size: var(--gl-type-body-sm);
  transition: border-color var(--gl-duration-fast) var(--gl-ease-standard), box-shadow var(--gl-duration-fast) var(--gl-ease-standard);
}

.gl-field__control:hover {
  border-color: var(--gl-color-gray-500);
}

.gl-field__control:focus {
  border-color: var(--gl-color-black);
  box-shadow: 0 0 0 3px rgba(200, 255, 0, 0.42);
  outline: 0;
}

.gl-field__control[aria-invalid="true"] {
  border-color: var(--gl-color-danger);
}

.gl-field__hint {
  margin: 0;
  color: var(--gl-text-secondary);
  font-size: 11px;
  line-height: 1.4;
}

.gl-field__error {
  margin: 0;
  color: var(--gl-color-danger);
  font-size: 11px;
  line-height: 1.4;
}

.gl-switch {
  width: 44px;
  height: 26px;
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  border-radius: var(--gl-radius-r3);
  background: var(--gl-color-gray-300);
  cursor: pointer;
  transition: background var(--gl-duration-base) var(--gl-ease-standard);
}

.gl-switch::after {
  content: "";
  width: 20px;
  height: 20px;
  position: absolute;
  top: 3px;
  left: 3px;
  border-radius: 50%;
  background: var(--gl-color-white);
  box-shadow: var(--gl-shadow-1);
  transition: transform var(--gl-duration-base) var(--gl-ease-expressive);
}

.gl-switch[aria-checked="true"] {
  background: var(--gl-color-lime);
}

.gl-switch[aria-checked="true"]::after {
  transform: translateX(18px);
}

.gl-status {
  display: inline-flex;
  align-items: center;
  gap: var(--gl-space-2);
  color: var(--gl-text-secondary);
  font-size: 11px;
  font-weight: var(--gl-font-weight-medium);
}

.gl-status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.gl-status--success { color: var(--gl-color-success); }
.gl-status--warning { color: var(--gl-color-warning); }
.gl-status--danger { color: var(--gl-color-danger); }
.gl-status--info { color: var(--gl-color-info); }

.gl-card {
  overflow: hidden;
  border: var(--gl-stroke-thin) solid var(--gl-border-subtle);
  border-radius: var(--gl-radius-r2);
  background: var(--gl-bg-canvas);
}

.gl-card__body {
  padding: var(--gl-space-5);
}

.gl-card__media {
  width: 100%;
  display: block;
  object-fit: cover;
}

.gl-list-row {
  min-height: 56px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--gl-space-3);
  padding: var(--gl-space-3) 0;
  border-bottom: var(--gl-stroke-thin) solid var(--gl-border-subtle);
}

.gl-list-row:last-child {
  border-bottom: 0;
}

.gl-list-row__icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--gl-color-gray-100);
}

.gl-list-row__copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.gl-list-row__copy strong,
.gl-list-row__copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gl-list-row__copy strong {
  font-size: var(--gl-type-body-sm);
}

.gl-list-row__copy small {
  color: var(--gl-text-secondary);
  font-size: 11px;
}

.gl-tab-list {
  display: inline-flex;
  align-items: center;
  gap: var(--gl-space-1);
  padding: var(--gl-space-1);
  border: var(--gl-stroke-thin) solid var(--gl-border-subtle);
  border-radius: var(--gl-radius-r3);
  background: var(--gl-color-gray-100);
}

.gl-tab {
  min-height: 34px;
  padding: 0 var(--gl-space-4);
  border: 0;
  border-radius: var(--gl-radius-r3);
  color: var(--gl-text-secondary);
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  font-weight: var(--gl-font-weight-medium);
}

.gl-tab[aria-selected="true"] {
  color: var(--gl-text-primary);
  background: var(--gl-bg-canvas);
  box-shadow: var(--gl-shadow-1);
}

.gl-progress {
  width: 100%;
  height: 6px;
  overflow: hidden;
  border-radius: var(--gl-radius-r3);
  background: var(--gl-color-gray-200);
}

.gl-progress > span {
  width: var(--gl-progress, 0%);
  height: 100%;
  display: block;
  border-radius: inherit;
  background: var(--gl-color-lime);
  transform-origin: left;
  animation: gl-progress-in var(--gl-duration-slow) var(--gl-ease-expressive) both;
}

.gl-gesture {
  width: var(--gl-gesture-width, 72px);
  height: calc(var(--gl-gesture-width, 72px) * 0.36);
  display: inline-block;
  overflow: visible;
}

.gl-gesture path {
  fill: none;
  stroke: var(--gl-gesture-color, currentColor);
  stroke-width: var(--gl-gesture-stroke, 8);
  stroke-linecap: round;
}

.gl-gesture--draw path {
  stroke-dasharray: 120;
  stroke-dashoffset: 120;
  animation: gl-gesture-draw var(--gl-duration-slow) var(--gl-ease-expressive) forwards;
}

.gl-avatar {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  color: var(--gl-text-primary);
  background: var(--gl-color-beige);
  font-size: 12px;
  font-weight: var(--gl-font-weight-semibold);
}

.gl-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gl-toast {
  min-height: 60px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--gl-space-3);
  padding: var(--gl-space-3) var(--gl-space-4);
  border-radius: var(--gl-radius-r1);
  color: var(--gl-text-inverse);
  background: var(--gl-bg-inverse);
  box-shadow: var(--gl-shadow-2);
}

.gl-toast__signal {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--gl-text-on-signal);
  background: var(--gl-bg-signal);
}

.gl-toast__copy {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.gl-toast__copy strong { font-size: 12px; }
.gl-toast__copy small { color: rgba(255, 255, 255, 0.7); font-size: 10px; }

.gl-empty-state {
  min-height: 220px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: var(--gl-space-3);
  padding: var(--gl-space-8);
  text-align: center;
}

.gl-empty-state__symbol {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--gl-color-lime);
}

.gl-empty-state h3,
.gl-empty-state p {
  margin: 0;
}

.gl-empty-state p {
  max-width: 34ch;
  color: var(--gl-text-secondary);
  font-size: var(--gl-type-body-sm);
}

.gl-metric {
  min-width: 0;
  display: grid;
  gap: var(--gl-space-1);
}

.gl-metric small {
  color: var(--gl-text-secondary);
  font-size: var(--gl-type-label);
}

.gl-metric strong {
  font-size: var(--gl-type-h2);
  line-height: 1.1;
}

.gl-data-bar {
  display: grid;
  grid-template-columns: minmax(72px, auto) minmax(80px, 1fr) 36px;
  align-items: center;
  gap: var(--gl-space-3);
  font-size: 11px;
}

.gl-data-bar__track {
  height: 4px;
  overflow: hidden;
  background: var(--gl-color-gray-200);
}

.gl-data-bar__track > span {
  width: var(--gl-value, 0%);
  height: 100%;
  display: block;
  background: var(--gl-color-lime);
}

.gl-data-bar > strong {
  text-align: right;
}

.gl-skeleton {
  position: relative;
  overflow: hidden;
  border-radius: var(--gl-radius-r1);
  background: var(--gl-color-gray-200);
}

.gl-skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.65), transparent);
  transform: translateX(-100%);
  animation: gl-skeleton 1.4s linear infinite;
}

@keyframes gl-progress-in {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

@keyframes gl-gesture-draw {
  to { stroke-dashoffset: 0; }
}

@keyframes gl-skeleton {
  to { transform: translateX(100%); }
}

@media (prefers-reduced-motion: reduce) {
  :where(.gl-root) *,
  :where(.gl-root) *::before,
  :where(.gl-root) *::after {
    scroll-behavior: auto !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}
