/* Welcome composer only. The theme supplies its active send and focus colors. */
body.yf-ui-prototype[data-yf-soft-route="home"]:not(.is-conversation-mode) #home #searchForm #chatActionBtn:disabled {
  opacity: .78;
  filter: grayscale(1);
}

body[data-yf-soft-route="home"]:not(.is-conversation-mode) #home #searchForm button:focus-visible {
  outline: 2px solid var(--yf-primary, currentColor);
  outline-offset: 2px;
}

/* The controller already exposes the saved mode through aria-selected. */
body[data-yf-soft-route="home"]:not(.is-conversation-mode) #home #chatModelMenu [aria-selected="true"] > span[id]::after {
  content: "";
  display: inline-block;
  width: .6em;
  height: .32em;
  margin-inline-start: .55em;
  border-inline-start: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-.2em) rotate(-45deg);
}

/* Borrow only the empty gutter. No padding, gap or border-box changes. */
@media (pointer: coarse) {
  body[data-yf-soft-route="home"]:not(.is-conversation-mode) #home #searchForm :is(#uploadMoreBtn, #chatModelBtn, #chatActionBtn) {
    position: relative;
  }

  body[data-yf-soft-route="home"]:not(.is-conversation-mode) #home #searchForm :is(#uploadMoreBtn, #chatModelBtn, #chatActionBtn)::before {
    content: "";
    position: absolute;
    inset: -4px -3px;
  }
}

/* Phone starters are already at least 44px high. Wider touch devices use 38px. */
@media (pointer: coarse) and (min-width: 721px) {
  body[data-yf-soft-route="home"]:not(.is-conversation-mode) #home #homeStarters button {
    position: relative;
  }

  body[data-yf-soft-route="home"]:not(.is-conversation-mode) #home #homeStarters button::before {
    content: "";
    position: absolute;
    inset: -4px 0;
  }
}

/* Student welcome page. Use the art palette and the existing control boxes. */
body[data-yf-soft-route="home"][data-yf-art-theme="paper"]:not(.is-conversation-mode) #home #searchForm.composer {
  border-color: color-mix(in srgb, var(--yf-text) 33%, var(--yf-surface)) !important;
  box-shadow: 0 2px 0 var(--yf-surface), 0 3px 0 var(--yf-border), 0 7px 16px color-mix(in srgb, var(--yf-text) 7%, transparent) !important;
}

body[data-yf-soft-route="home"][data-yf-art-theme="paper"]:not(.is-conversation-mode) #home #searchForm.composer:focus-within {
  border-color: var(--yf-primary) !important;
}

/* Draw only below the placeholder. The rules disappear on the first character. */
body[data-yf-soft-route="home"][data-yf-art-theme="paper"]:not(.is-conversation-mode) #home #searchForm #chatInput:placeholder-shown {
  --writing-rule: color-mix(in srgb, var(--yf-primary) 17%, var(--yf-surface));
  background-image: linear-gradient(var(--writing-rule), var(--writing-rule)), linear-gradient(var(--writing-rule), var(--writing-rule)) !important;
  background-repeat: no-repeat !important;
  background-size: 100% 1px !important;
  background-position: left calc(100% - 34px), left calc(100% - 10px) !important;
}

/* The palette controller computes readable ink on the root for the current fill.
   Resolve it there before art presets override their own decorative text colours. */
:root:has(> body[data-yf-soft-route="home"]:not(.is-conversation-mode)) {
  --welcome-upload-ink: var(--yf-on-primary, white);
}

/* A filled upload has one job on the empty form. The enabled Send takes over. */
body[data-yf-soft-route="home"]:not(.is-conversation-mode) #home #searchForm:has(#chatInput:placeholder-shown):has(#chatActionBtn:disabled) #uploadMoreBtn:not(:disabled) {
  color: var(--welcome-upload-ink) !important;
  background: var(--yf-primary) !important;
  border-color: var(--yf-primary) !important;
  box-shadow: none !important;
}

body[data-yf-soft-route="home"]:not(.is-conversation-mode) #home #searchForm #chatModelBtn {
  color: var(--yf-text) !important;
  background: var(--yf-surface) !important;
  border-color: var(--yf-border) !important;
  box-shadow: none !important;
}

body[data-yf-soft-route="home"]:not(.is-conversation-mode) #home #searchForm #chatModelBtn:is(:hover, [aria-expanded="true"]) {
  color: var(--yf-primary) !important;
  border-color: var(--yf-primary) !important;
}

/* Paper index tabs. The coloured edge, label and hit box share one button. */
body[data-yf-soft-route="home"][data-yf-art-theme="paper"]:not(.is-conversation-mode) #home #homeStarters button[data-home-start] {
  color: var(--yf-text) !important;
  background: color-mix(in srgb, var(--yf-surface) 95%, var(--yf-primary)) !important;
  border: 1px solid color-mix(in srgb, var(--yf-border) 75%, var(--yf-surface)) !important;
  border-radius: 3px 7px 7px 3px !important;
  box-shadow: inset 3px 0 var(--yf-primary) !important;
}

body[data-yf-soft-route="home"][data-yf-art-theme="paper"]:not(.is-conversation-mode) #home #homeStarters button[data-home-start]:is(:hover, :focus-visible) {
  color: var(--yf-primary) !important;
  background: var(--yf-primary-soft) !important;
  border-color: var(--yf-primary) !important;
}

@media (max-width: 720px) {
  body.yf-ui-prototype[data-yf-soft-route="home"].sidebar-open header.topbar {
    /* Keep the sidebar's own theme colour and make its open surface opaque. */
    background-color: rgb(from var(--yf-surface) r g b / 1) !important;
  }
}
