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

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: var(--space-0);
  color: var(--color-text);
  background: var(--color-bg);
  font-family: var(--font-sans);
  font-size: var(--text-md);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
}

button:focus-visible {
  outline: var(--space-1) solid var(--color-focus);
  outline-offset: calc(var(--space-1) * -1);
}

[hidden] {
  display: none !important;
}

.shell-preview-layout {
  min-height: 100dvh;
  padding: var(--space-4);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--shell-width)), 1fr));
  gap: var(--space-6);
  align-items: start;
  background: var(--color-surface);
}

.shell-preview-device {
  width: min(100%, var(--shell-width));
  height: min(var(--shell-height), calc(100dvh - var(--space-8)));
  min-height: calc(var(--shell-height) / 2);
  justify-self: center;
  padding: var(--space-2);
  border: thin solid var(--color-border-strong);
  border-radius: calc(var(--radius-lg) + var(--space-5));
  background: var(--color-text);
  box-shadow: var(--shadow-md);
}

.shell-preview-specimens {
  width: min(100%, var(--shell-width));
  padding: var(--space-5);
  justify-self: center;
  display: grid;
  gap: var(--space-5);
  border: thin solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface-raised);
  box-shadow: var(--shadow-sm);
}

.shell-preview-specimens h2,
.shell-preview-specimens p {
  margin: var(--space-0);
}

.shell-preview-specimens h2 {
  font-size: var(--text-lg);
  line-height: var(--leading-tight);
  font-weight: var(--weight-bold);
}

.shell-preview-specimens p {
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
}

.shell-state-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(var(--space-0), 1fr));
  border: thin solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  overflow: hidden;
}

.shell-state-item {
  min-width: var(--space-0);
  padding: var(--space-2) var(--space-1);
  display: grid;
  gap: var(--space-2);
  border-inline-end: thin solid var(--color-divider);
}

.shell-state-item:last-child {
  border-inline-end: var(--space-0);
}

.shell-state-item > small {
  color: var(--color-text-tertiary);
  font-size: var(--text-xs);
  text-align: center;
}

.lila-shell {
  width: 100%;
  height: 100%;
  position: relative;
  display: grid;
  grid-template-rows:
    max(var(--statusbar-height), env(safe-area-inset-top))
    var(--header-height)
    minmax(var(--space-0), 1fr)
    calc(var(--navbar-height) + max(var(--safe-bottom), env(safe-area-inset-bottom)));
  overflow: hidden;
  border-radius: calc(var(--radius-lg) + var(--space-4));
  color: var(--color-text);
  background: var(--color-bg);
  isolation: isolate;
}

.shell-statusbar {
  min-width: var(--space-0);
  padding: var(--space-0) var(--space-4) var(--space-1);
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: var(--space-4);
  color: var(--color-text-secondary);
  background: var(--color-bg);
}

.shell-status-mark {
  width: var(--space-8);
  height: var(--space-2);
  border-radius: var(--radius-pill);
  background: var(--color-text);
}

.shell-status-icons {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.shell-status-icons svg {
  width: var(--space-5);
  height: var(--space-3);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.shell-status-icons .shell-battery {
  width: var(--space-6);
}

.shell-header {
  min-width: var(--space-0);
  min-height: var(--space-0);
  padding-inline: var(--space-1);
  display: grid;
  grid-template-columns: var(--space-12) minmax(var(--space-0), 1fr) var(--space-12);
  align-items: center;
  border-bottom: thin solid var(--color-divider);
  background: var(--color-bg);
  box-shadow: var(--shadow-sm);
  z-index: var(--z-header);
}

.shell-header-back {
  width: var(--space-12);
  height: var(--header-height);
  padding: var(--space-0);
  display: grid;
  place-items: center;
  border: none;
  border-radius: var(--radius-md);
  color: var(--color-text);
  background: transparent;
  cursor: pointer;
  transition:
    transform var(--duration-fast) var(--ease-standard),
    background-color var(--duration-fast) var(--ease-standard);
}

.shell-header-back svg {
  width: var(--space-6);
  height: var(--space-6);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.shell-header-back:active {
  transform: scale(.94);
  background: var(--color-accent-weak);
}

.shell-header-back.is-root {
  visibility: hidden;
  pointer-events: none;
}

.shell-header-title {
  min-width: var(--space-0);
  margin: var(--space-0);
  overflow: hidden;
  color: var(--color-text);
  font-size: var(--text-lg);
  line-height: var(--leading-tight);
  font-weight: var(--weight-bold);
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shell-header-title.is-placeholder {
  display: grid;
  place-items: center;
}

.shell-header-title.is-placeholder::after {
  width: 50%;
  height: var(--space-3);
  border-radius: var(--radius-pill);
  background: var(--color-skeleton);
  content: "";
}

.shell-depth {
  min-width: var(--space-0);
  min-height: var(--space-8);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
}

.shell-depth-dot {
  width: var(--space-1);
  height: var(--space-1);
  border-radius: var(--radius-pill);
  background: var(--color-border-strong);
}

.shell-depth-dot.is-current {
  width: var(--space-3);
  background: var(--color-accent);
}

.shell-content {
  min-width: var(--space-0);
  min-height: var(--space-0);
  position: relative;
  overflow: hidden;
  background: var(--color-surface);
  z-index: var(--z-base);
}

.shell-root,
.shell-stack,
.shell-stack-page {
  position: absolute;
  inset: var(--space-0);
  min-width: var(--space-0);
  min-height: var(--space-0);
}

.shell-stack {
  overflow: hidden;
  background: var(--color-surface);
}

.shell-stack-page {
  visibility: hidden;
  overflow: hidden;
  pointer-events: none;
  transform: translateX(100%);
  background: var(--color-surface);
  transition:
    transform var(--duration-base) var(--ease-decelerate),
    opacity var(--duration-fast) var(--ease-standard);
}

.shell-stack-page.is-active,
.shell-stack-page.is-under,
.shell-stack-page.is-preparing,
.shell-stack-page.is-exiting {
  visibility: visible;
}

.shell-stack-page.is-active {
  z-index: var(--z-push);
  pointer-events: auto;
  transform: translateX(var(--space-0));
}

.shell-stack-page.is-under {
  z-index: var(--z-base);
  transform: translateX(-25%);
}

.shell-stack-page.is-preparing {
  z-index: var(--z-push);
  transform: translateX(100%);
  transition: none;
}

.shell-stack-page.is-exiting {
  z-index: var(--z-push);
  transform: translateX(100%);
}

.shell-page-scroll {
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.shell-page-scroll::-webkit-scrollbar {
  display: none;
}

.shell-slot {
  min-width: var(--space-0);
  min-height: 100%;
}

.shell-stack-page[data-shell-scroll-mode="fill"] > .shell-page-scroll {
  min-height: var(--space-0);
  overflow: hidden;
  overscroll-behavior: none;
}

.shell-stack-page[data-shell-scroll-mode="fill"] > .shell-page-scroll > .shell-slot {
  width: 100%;
  height: 100%;
  min-height: var(--space-0);
  overflow: hidden;
}

.shell-fill-sample {
  width: 100%;
  height: 100%;
  min-height: var(--space-0);
  overflow: hidden;
  background: var(--color-bg);
}

.shell-fill-sample__viewport {
  width: 100%;
  height: 100%;
  min-height: var(--space-0);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-snap-type: y proximity;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.shell-fill-sample__viewport::-webkit-scrollbar {
  display: none;
}

.shell-fill-sample__panel {
  min-height: 100%;
  padding: var(--space-5) var(--space-4) var(--space-8);
  display: grid;
  align-content: start;
  gap: var(--space-4);
  scroll-snap-align: start;
}

.shell-placeholder-page {
  min-height: 100%;
  padding: var(--space-5) var(--space-4) var(--space-8);
  display: grid;
  align-content: start;
  gap: var(--space-4);
}

.shell-skeleton-line,
.shell-skeleton-block,
.shell-skeleton-card,
.shell-skeleton-icon {
  display: block;
  border-radius: var(--radius-md);
  background: var(--color-skeleton);
  overflow: hidden;
}

.shell-skeleton-line {
  width: 72%;
  height: var(--space-3);
  border-radius: var(--radius-pill);
}

.shell-skeleton-line.is-short {
  width: 42%;
}

.shell-skeleton-block {
  width: 100%;
  min-height: calc(var(--space-12) * 2);
  border-radius: var(--radius-lg);
}

.shell-skeleton-card {
  min-height: var(--space-12);
  padding: var(--space-3);
  display: grid;
  gap: var(--space-2);
  border: thin solid var(--color-border);
  background: var(--color-surface-raised);
  box-shadow: var(--shadow-sm);
}

.shell-skeleton-card .shell-skeleton-line,
.shell-skeleton-card .shell-skeleton-icon {
  background: var(--color-skeleton);
}

.shell-skeleton-icon {
  width: var(--space-10);
  height: var(--space-10);
  border-radius: var(--radius-md);
}

.shell-skeleton-group {
  display: grid;
  gap: var(--space-2);
}

.shell-placeholder-action {
  width: 100%;
  min-height: var(--space-12);
  padding: var(--space-3) var(--space-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  border: thin solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  background: var(--color-surface-raised);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  text-align: start;
  cursor: pointer;
  transition:
    transform var(--duration-fast) var(--ease-standard),
    background-color var(--duration-fast) var(--ease-standard);
}

.shell-placeholder-action:active {
  transform: scale(.98);
  background: var(--color-accent-weak);
}

.shell-placeholder-action svg {
  flex: none;
  width: var(--space-5);
  height: var(--space-5);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.shell-nav {
  min-width: var(--space-0);
  padding:
    var(--space-0)
    var(--space-2)
    max(var(--safe-bottom), env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(4, minmax(var(--space-0), 1fr));
  gap: var(--space-1);
  border-top: thin solid var(--color-divider);
  background: var(--color-bg);
  box-shadow: var(--shadow-nav);
  z-index: var(--z-nav);
}

.shell-tab {
  position: relative;
  min-width: var(--space-0);
  min-height: var(--navbar-height);
  padding: var(--space-1) var(--space-0);
  display: grid;
  grid-template-rows: var(--space-6) auto;
  place-items: center;
  gap: var(--space-1);
  border: none;
  border-radius: var(--radius-md);
  color: var(--color-text-tertiary);
  background: transparent;
  cursor: pointer;
  transition:
    color var(--duration-fast) var(--ease-standard),
    background-color var(--duration-fast) var(--ease-standard),
    transform var(--duration-fast) var(--ease-standard);
}

.shell-tab:hover {
  color: var(--color-text-secondary);
}

.shell-tab:active,
.shell-tab.is-pressed {
  color: var(--color-text);
  background: var(--color-accent-weak);
  transform: scale(.96);
}

.shell-tab.is-selected,
.shell-tab[aria-selected="true"] {
  color: var(--color-accent);
}

.shell-tab-icon {
  width: var(--space-8);
  height: var(--space-6);
  position: relative;
  display: grid;
  place-items: center;
  border-radius: var(--radius-md);
}

.shell-tab.is-selected .shell-tab-icon,
.shell-tab[aria-selected="true"] .shell-tab-icon {
  background: var(--color-accent-weak);
}

.shell-tab-icon svg {
  width: var(--space-5);
  height: var(--space-5);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.shell-tab-label {
  overflow: hidden;
  font-size: var(--text-xs);
  line-height: var(--leading-tight);
  font-weight: var(--weight-medium);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shell-tab-badge {
  width: var(--space-2);
  height: var(--space-2);
  position: absolute;
  top: var(--space-0);
  right: var(--space-0);
  border: medium solid var(--color-bg);
  border-radius: var(--radius-pill);
  background: var(--color-accent);
}

.shell-tab.has-badge .shell-tab-badge {
  display: block;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: var(--duration-fast) !important;
    transition-duration: var(--duration-fast) !important;
  }
}
