/* The landing hero's picture: two phone screens of the Stash app (the Projects list, and a
   project on its Features tab), drawn in HTML so they follow the site's palette and theme.
   A tidied-up version of the real app, not a copy of it: the fields and labels are the app's.

   Inputs are the site's tokens (site.css); every other colour is mixed from them:
     --ground --ink --ink-2 --tile --tile-2 --brand --brand-ink --spark

   Scale: everything is in em, and the stage's one font-size comes from the root's own width
   (container query units). Size the root with `width` and the screens follow. Under 520px of
   width the stage shows the Projects phone alone. */

[data-ui].sx {
  /* Inputs. */
  --sx-ground: var(--ground, #f4f7f8);
  --sx-ink: var(--ink, #10191e);
  --sx-ink-2: var(--ink-2, #44525a);
  --sx-tile: var(--tile, #e8eef0);
  --sx-tile-2: var(--tile-2, #dde6e9);
  --sx-brand: var(--brand, #0b5f73);
  --sx-brand-ink: var(--brand-ink, #ffffff);
  --sx-spark: var(--spark, #ffc857);

  /* Derived app surfaces (light). */
  --sx-bezel: color-mix(in oklab, var(--sx-ink) 92%, var(--sx-ground));
  --sx-screen: var(--sx-ground);
  --sx-card: color-mix(in oklab, var(--sx-ground) 30%, #ffffff);
  --sx-sunken: var(--sx-tile);
  --sx-raised: var(--sx-card);
  --sx-line: color-mix(in oklab, var(--sx-ink) 10%, var(--sx-ground));
  --sx-rule: color-mix(in oklab, var(--sx-ink) 7%, var(--sx-card));
  --sx-track: color-mix(in oklab, var(--sx-ink) 13%, var(--sx-card));
  --sx-brand-soft: color-mix(in oklab, var(--sx-brand) 14%, var(--sx-card));
  --sx-brand-text: color-mix(in oklab, var(--sx-brand) 78%, var(--sx-ink));
  --sx-spark-mark: color-mix(in oklab, var(--sx-spark) 78%, var(--sx-ink));

  container: sx / inline-size;
  display: block;
  width: 100%;
  color: var(--sx-ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  font-weight: 400;
  line-height: 1.35;
  letter-spacing: 0;
  text-align: left;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

@media (prefers-color-scheme: dark) {
  [data-ui].sx {
    --sx-bezel: color-mix(in oklab, var(--sx-ink) 17%, var(--sx-ground));
    --sx-card: var(--sx-tile);
    --sx-sunken: color-mix(in oklab, var(--sx-ink) 11%, var(--sx-card));
    --sx-raised: color-mix(in oklab, var(--sx-ink) 22%, var(--sx-card));
    --sx-line: color-mix(in oklab, var(--sx-ink) 9%, var(--sx-ground));
    --sx-rule: color-mix(in oklab, var(--sx-ink) 8%, var(--sx-card));
    --sx-track: color-mix(in oklab, var(--sx-ink) 16%, var(--sx-card));
    --sx-brand-soft: color-mix(in oklab, var(--sx-brand) 22%, var(--sx-card));
    --sx-brand-text: color-mix(in oklab, var(--sx-brand) 80%, var(--sx-ink));
    --sx-spark-mark: color-mix(in oklab, var(--sx-spark) 88%, var(--sx-ink));
  }
}

[data-ui].sx *,
[data-ui].sx *::before,
[data-ui].sx *::after {
  box-sizing: border-box;
}

[data-ui].sx svg {
  display: block;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── Stage ─────────────────────────────────────── */

[data-ui] .sx-stage {
  /* Two 21.875em phones and a 1em gap. */
  --sx-span: 44.75;
  font-size: calc(100cqi / var(--sx-span));
  display: grid;
  grid-template-columns: 21.875em 21.875em;
  column-gap: 1em;
  align-items: start;
  /* Optional crop from the bottom, e.g. `--sx-crop: 34em` where the hero's edge cuts it. */
  max-height: var(--sx-crop, none);
  overflow: hidden;
}

[data-ui] .sx-phone--detail {
  margin-top: 3em;
}

@container sx (max-width: 520px) {
  [data-ui] .sx-stage {
    --sx-span: 21.875;
    grid-template-columns: 21.875em;
  }

  [data-ui] .sx-phone--detail {
    display: none;
  }
}

/* ── Phone ─────────────────────────────────────── */

[data-ui] .sx-phone {
  width: 21.875em;
  height: 46.625em;
  padding: 0.3125em;
  border-radius: 2.9375em;
  background: var(--sx-bezel);
}

[data-ui] .sx-screen {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  border-radius: 2.625em;
  background: var(--sx-screen);
}

/* Home indicator, under the tab bar. */
[data-ui] .sx-phone--list .sx-screen::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0.5em;
  width: 7.5em;
  height: 0.25em;
  margin-left: -3.75em;
  border-radius: 1em;
  background: var(--sx-ink);
  opacity: 0.85;
}

[data-ui] .sx-status {
  position: relative;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 2.875em;
  padding: 0.25em 1.75em 0 2em;
}

[data-ui] .sx-time {
  font-size: 0.875em;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

[data-ui] .sx-cam {
  position: absolute;
  left: 50%;
  top: 0.75em;
  width: 0.875em;
  height: 0.875em;
  margin-left: -0.4375em;
  border-radius: 50%;
  background: var(--sx-bezel);
}

[data-ui] .sx-sys {
  display: flex;
  align-items: center;
  gap: 0.375em;
}

[data-ui] .sx-sys svg {
  width: 1.0625em;
  height: 1.0625em;
}

[data-ui] .sx-sys .sx-batt {
  width: 1.5em;
}

/* ── Shared bits ───────────────────────────────── */

[data-ui] .sx-icon {
  width: 1.375em;
  height: 1.375em;
}

[data-ui] .sx-pill {
  flex: none;
  display: inline-flex;
  align-items: center;
  height: 1.75em;
  padding: 0 0.7em;
  border-radius: 999px;
  font-size: 0.6875em;
  font-weight: 650;
  white-space: nowrap;
  background: var(--sx-sunken);
  color: var(--sx-ink-2);
}

[data-ui] .sx-pill--active {
  background: var(--sx-brand-soft);
  color: var(--sx-brand-text);
}

[data-ui] .sx-pill--ready {
  background: var(--sx-brand);
  color: var(--sx-brand-ink);
}

/* Ripeness: five pillars, Overview, Stack, Notes, Links, Features. */
[data-ui] .sx-ripe {
  display: inline-flex;
  gap: 0.1875em;
}

[data-ui] .sx-ripe i {
  width: 0.875em;
  height: 0.3125em;
  border-radius: 1em;
  background: var(--sx-track);
}

[data-ui] .sx-ripe i.on {
  background: var(--sx-brand);
}

/* Priority: three steps, filled to the level. */
[data-ui] .sx-prio {
  display: inline-flex;
  align-items: flex-end;
  gap: 0.125em;
  height: 0.75em;
  margin-right: 0.375em;
}

[data-ui] .sx-prio i {
  width: 0.1875em;
  border-radius: 0.1em;
  background: var(--sx-track);
}

[data-ui] .sx-prio i:nth-child(1) { height: 40%; }
[data-ui] .sx-prio i:nth-child(2) { height: 70%; }
[data-ui] .sx-prio i:nth-child(3) { height: 100%; }

[data-ui] .sx-prio[data-level="1"] i:nth-child(-n + 1),
[data-ui] .sx-prio[data-level="2"] i:nth-child(-n + 2) {
  background: currentColor;
}

/* High is the one priority that asks for attention. */
[data-ui] .sx-prio[data-level="3"] i {
  background: var(--sx-spark-mark);
}

/* ── Projects list ─────────────────────────────── */

[data-ui] .sx-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75em 1.25em 0.875em;
}

[data-ui] .sx-title {
  font-size: 1.75em;
  font-weight: 750;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

[data-ui] .sx-actions {
  display: flex;
  gap: 1.125em;
  color: var(--sx-ink-2);
}

[data-ui] .sx-seg {
  flex: none;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.125em;
  margin: 0 1.25em 0.875em;
  padding: 0.1875em;
  border-radius: 0.75em;
  background: var(--sx-sunken);
}

[data-ui] .sx-seg-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3em;
  height: 2.25em;
  border-radius: 0.5625em;
  font-size: 0.8125em;
  font-weight: 600;
  color: var(--sx-ink-2);
  white-space: nowrap;
}

[data-ui] .sx-seg-item.is-on {
  background: var(--sx-raised);
  color: var(--sx-ink);
  box-shadow: 0 0 0 1px var(--sx-line);
}

[data-ui] .sx-n {
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--sx-ink-2);
}

[data-ui] .sx-list {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.625em;
  padding: 0 1em;
  overflow: hidden;
}

[data-ui] .sx-card {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 0.5em;
  padding: 0.875em 1em 0.8125em;
  border-radius: 1em;
  background: var(--sx-card);
  border: 1px solid var(--sx-line);
}

[data-ui] .sx-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75em;
}

[data-ui] .sx-card-title {
  font-size: 1em;
  font-weight: 650;
  line-height: 1.3;
  letter-spacing: -0.005em;
}

[data-ui] .sx-card-pitch {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  font-size: 0.8125em;
  line-height: 1.4;
  color: var(--sx-ink-2);
}

[data-ui] .sx-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375em;
}

[data-ui] .sx-tag {
  padding: 0.15em 0.55em;
  border-radius: 0.4em;
  font-size: 0.6875em;
  font-weight: 550;
  background: var(--sx-sunken);
  color: var(--sx-ink-2);
}

[data-ui] .sx-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75em;
  margin-top: 0.125em;
  font-size: 0.75em;
  color: var(--sx-ink-2);
  font-variant-numeric: tabular-nums;
}

[data-ui] .sx-card-foot .sx-ripe {
  font-size: 1.3333em; /* back to the card's em, so the bar matches the hero's */
}

[data-ui] .sx-foot-start,
[data-ui] .sx-foot-end {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  white-space: nowrap;
}

[data-ui] .sx-foot-end .sx-sep {
  opacity: 0.6;
}

[data-ui] .sx-foot-end svg {
  width: 1.1em;
  height: 1.1em;
  margin-right: -0.2em;
}

[data-ui] .sx-tabbar {
  flex: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: 5em;
  padding: 0.5em 2.5em 1.25em;
  background: var(--sx-card);
  border-top: 1px solid var(--sx-line);
}

[data-ui] .sx-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25em;
  color: var(--sx-ink-2);
}

[data-ui] .sx-tab svg {
  width: 1.5em;
  height: 1.5em;
}

[data-ui] .sx-tab span {
  font-size: 0.6875em;
  font-weight: 600;
}

[data-ui] .sx-tab.is-on {
  color: var(--sx-ink);
}

[data-ui] .sx-tab.is-on svg {
  fill: currentColor;
  fill-opacity: 0.14;
  stroke-width: 1.9;
}

/* ── Project detail ────────────────────────────── */

[data-ui] .sx-nav {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5em 1.25em 0.375em 0.875em;
  color: var(--sx-ink-2);
}

[data-ui] .sx-back {
  display: inline-flex;
  align-items: center;
  gap: 0.125em;
  font-size: 0.9375em;
  font-weight: 500;
}

[data-ui] .sx-nav-end {
  display: inline-flex;
  align-items: center;
  gap: 1em;
}

[data-ui] .sx-saved {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  font-size: 0.75em;
}

[data-ui] .sx-saved svg {
  width: 1.2em;
  height: 1.2em;
}

[data-ui] .sx-hero {
  flex: none;
  padding: 0.75em 1.25em 1.125em;
}

[data-ui] .sx-hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75em;
}

[data-ui] .sx-hero-title {
  font-size: 1.625em;
  font-weight: 750;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

[data-ui] .sx-pitch {
  display: block;
  margin-top: 0.5em;
  font-size: 0.875em;
  line-height: 1.45;
  color: var(--sx-ink-2);
}

[data-ui] .sx-facts {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  margin-top: 1em;
  padding: 0.6875em 0;
  border-radius: 0.875em;
  background: var(--sx-card);
  border: 1px solid var(--sx-line);
}

[data-ui] .sx-fact {
  display: flex;
  flex-direction: column;
  gap: 0.25em;
  min-width: 0;
  padding: 0 0.75em;
}

[data-ui] .sx-fact + .sx-fact {
  border-left: 1px solid var(--sx-rule);
}

[data-ui] .sx-fact-k {
  font-size: 0.6875em;
  color: var(--sx-ink-2);
}

[data-ui] .sx-fact-v {
  display: inline-flex;
  align-items: center;
  font-size: 0.8125em;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

[data-ui] .sx-fact-v .sx-prio {
  font-size: 1.2em;
}

/* Ripeness in the hero: one segment per pillar, in tab order. */
[data-ui] .sx-hero-ripe {
  display: flex;
  align-items: center;
  gap: 0.75em;
  margin-top: 0.875em;
  font-size: 0.75em;
  color: var(--sx-ink-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

[data-ui] .sx-hero-ripe .sx-ripe {
  flex: 1 1 auto;
  font-size: 1.3333em;
  gap: 0.25em;
}

[data-ui] .sx-hero-ripe .sx-ripe i {
  flex: 1 1 0;
  width: auto;
}

/* Pillar tabs. */
[data-ui] .sx-pillars {
  flex: none;
  display: flex;
  justify-content: space-between;
  padding: 0 1.25em;
  border-bottom: 1px solid var(--sx-line);
}

[data-ui] .sx-pillar {
  position: relative;
  padding: 0.25em 0 0.75em;
  font-size: 0.8125em;
  font-weight: 550;
  color: var(--sx-ink-2);
}

[data-ui] .sx-pillar.is-on {
  color: var(--sx-ink);
  font-weight: 700;
}

[data-ui] .sx-pillar.is-on::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 0.15em;
  border-radius: 1em;
  background: var(--sx-ink);
}

[data-ui] .sx-pane {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  padding: 1.125em 1.25em 0;
}

[data-ui] .sx-sec + .sx-feat,
[data-ui] .sx-sec {
  margin-bottom: 0.25em;
}

[data-ui] .sx-feat + .sx-sec {
  margin-top: 1.25em;
}

[data-ui] .sx-sec-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

[data-ui] .sx-sec-title {
  font-size: 1em;
  font-weight: 700;
}

[data-ui] .sx-sec-count {
  font-size: 0.75em;
  color: var(--sx-ink-2);
  font-variant-numeric: tabular-nums;
}

[data-ui] .sx-progress {
  height: 0.3125em;
  margin-top: 0.5em;
  border-radius: 1em;
  background: var(--sx-track);
  overflow: hidden;
}

[data-ui] .sx-progress span {
  display: block;
  height: 100%;
  border-radius: 1em;
  background: var(--sx-brand);
}

[data-ui] .sx-feat {
  display: grid;
  grid-template-columns: 1.25em minmax(0, 1fr) auto;
  column-gap: 0.75em;
  align-items: start;
  padding: 0.75em 0;
  border-bottom: 1px solid var(--sx-rule);
}

[data-ui] .sx-feat-title {
  font-size: 0.875em;
  line-height: 1.43;
  font-weight: 500;
}

[data-ui] .sx-feat.is-done .sx-feat-title {
  color: var(--sx-ink-2);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
  text-decoration-color: color-mix(in oklab, var(--sx-ink-2) 60%, transparent);
}

[data-ui] .sx-feat-est {
  margin-top: 0.1em;
  padding: 0.15em 0.55em;
  border-radius: 0.4em;
  font-size: 0.6875em;
  font-weight: 550;
  white-space: nowrap;
  background: var(--sx-sunken);
  color: var(--sx-ink-2);
}

/* Check circles. */
[data-ui] .sx-check {
  position: relative;
  width: 1.25em;
  height: 1.25em;
  margin-top: 0.03em;
  border-radius: 50%;
  border: 0.1em solid color-mix(in oklab, var(--sx-ink-2) 70%, var(--sx-card));
}

[data-ui] .is-done > .sx-check {
  border-color: var(--sx-brand);
  background: var(--sx-brand);
}

[data-ui] .is-done > .sx-check::after {
  content: "";
  position: absolute;
  left: 30%;
  top: 16%;
  width: 30%;
  height: 52%;
  border: solid var(--sx-brand-ink);
  border-width: 0 0.14em 0.14em 0;
  transform: rotate(45deg);
}

/* Sub-tasks, under their feature. */
[data-ui] .sx-subs {
  grid-column: 2 / -1;
  display: flex;
  flex-direction: column;
  gap: 0.5em;
  margin-top: 0.625em;
  padding-left: 0.875em;
  border-left: 0.125em solid var(--sx-rule);
}

[data-ui] .sx-subs-k {
  font-size: 0.6875em;
  color: var(--sx-ink-2);
}

[data-ui] .sx-sub {
  display: flex;
  align-items: center;
  gap: 0.625em;
}

[data-ui] .sx-sub .sx-check {
  width: 1em;
  height: 1em;
  margin: 0;
}

[data-ui] .sx-sub span {
  font-size: 0.8125em;
}

[data-ui] .sx-sub.is-done span {
  color: var(--sx-ink-2);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
  text-decoration-color: color-mix(in oklab, var(--sx-ink-2) 60%, transparent);
}

@media (prefers-reduced-motion: no-preference) {
  [data-ui] .sx-phone {
    animation: sx-rise 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  }

  [data-ui] .sx-phone--detail {
    animation-delay: 0.12s;
  }

  @keyframes sx-rise {
    from {
      opacity: 0;
      transform: translateY(1.5em);
    }
    to {
      opacity: 1;
      transform: none;
    }
  }
}
