/* Sunset surfaces. The city stays still; the same palette cycle paints the
   palm in wide fields and primary buttons. Load after warm-interactions.css. */

:is(#root .app-shell.wb-portal.portal-redesign.daylight, body:has(.daylight) .cd-composer) {
  --sunset-button-sky: url("/assets/scene/sunset-city-day.svg");
  --sunset-city: url("/assets/scene/sunset-city-day.svg");
  --sunset-palm: url("/assets/scene/sunset-palm-day.svg");
  --sunset-veil: var(--sd-surface);
  --sunset-press: cubic-bezier(.2, 0, 0, 1);
  --sunset-button-glow: rgb(214 110 96 / 55%);
  --sunset-glass-line: rgb(255 255 255 / 70%);
  --sunset-button-rest:
    linear-gradient(180deg, rgb(255 255 255 / 22%), rgb(255 255 255 / 0%) 55%),
    radial-gradient(closest-side, rgb(255 236 222 / 62%), rgb(255 236 222 / 0%)) center / 92% 110% no-repeat,
    var(--sunset-palm) center bottom / auto 100% no-repeat,
    var(--sunset-button-sky) center 62% / cover no-repeat;
  --sunset-button-hover:
    linear-gradient(180deg, rgb(255 255 255 / 30%), rgb(255 255 255 / 0%) 60%),
    radial-gradient(closest-side, rgb(255 236 222 / 55%), rgb(255 236 222 / 0%)) center / 92% 110% no-repeat,
    var(--sunset-palm) center bottom / auto 100% no-repeat,
    var(--sunset-button-sky) center 62% / cover no-repeat;
}
#root .app-shell.wb-portal.portal-redesign.daylight[data-appearance=dark],
body:has(.daylight[data-appearance=dark]) .cd-composer {
  --sunset-city: url("/assets/scene/sunset-city-dusk.svg");
  --sunset-palm: url("/assets/scene/sunset-palm-dusk.svg");
  --sunset-button-glow: rgb(0 0 0 / 45%);
  --sunset-glass-line: rgb(255 255 255 / 10%);
}
@media (prefers-reduced-motion: reduce) {
  :is(#root .app-shell.wb-portal.portal-redesign.daylight, body:has(.daylight) .cd-composer) {--sunset-palm: url("/assets/scene/sunset-palm-day-still.svg")}
  #root .app-shell.wb-portal.portal-redesign.daylight[data-appearance=dark],
  body:has(.daylight[data-appearance=dark]) .cd-composer {--sunset-palm: url("/assets/scene/sunset-palm-dusk-still.svg")}
}

/* ── Primary buttons: the picture, capsule, Apple depth ───────────────── */
:is(#root .app-shell.wb-portal.portal-redesign.daylight, body:has(.daylight) .cd-composer)
  :is(.neon-button,.primary-button,.kg-primary,.cm-primary,.cd-primary,.cd-send,.cd-primary-link,.cd-compose-fab,.cd-other-new-post,.project-chat-compose footer>button[type=submit],.chat-room-modal>button):not(.danger,.danger-button,.recording) {
  background: var(--sunset-button-rest) var(--web-action-start) !important;
  white-space: nowrap;
  color: var(--web-action-ink) !important;
  border: 1px solid rgb(255 255 255 / 45%) !important;
  border-radius: var(--sd-radius-full) !important;
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 55%),
    inset 0 -1px 0 rgb(80 30 30 / 10%),
    0 1px 2px rgb(80 30 30 / 14%),
    0 10px 22px -12px var(--sunset-button-glow) !important;
  font-weight: 600;
  letter-spacing: -.01em;
  text-shadow: 0 1px 0 rgb(255 255 255 / 30%);
  transition: transform 160ms var(--sunset-press), box-shadow 160ms var(--sunset-press), filter 160ms var(--sunset-press) !important;
}
:is(#root .app-shell.wb-portal.portal-redesign.daylight, body:has(.daylight) .cd-composer)
  :is(.neon-button,.primary-button,.kg-primary,.cm-primary,.cd-primary,.cd-send,.cd-primary-link,.cd-compose-fab,.cd-other-new-post,.project-chat-compose footer>button[type=submit],.chat-room-modal>button):not(.danger,.danger-button,.recording):hover:not(:disabled,[aria-disabled=true]) {
  background: var(--sunset-button-hover) var(--web-action-hover-start) !important;
  filter: saturate(1.08);
}
:is(#root .app-shell.wb-portal.portal-redesign.daylight, body:has(.daylight) .cd-composer)
  :is(.neon-button,.primary-button,.kg-primary,.cm-primary,.cd-primary,.cd-send,.cd-primary-link,.cd-compose-fab,.cd-other-new-post,.project-chat-compose footer>button[type=submit],.chat-room-modal>button):not(.danger,.danger-button,.recording):active:not(:disabled,[aria-disabled=true]) {
  transform: scale(.97);
  filter: brightness(.96);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 40%), 0 1px 2px rgb(80 30 30 / 14%) !important;
}
/* Disabled: plain grey capsule, like a disabled iOS button — not a faded picture. */
:is(#root .app-shell.wb-portal.portal-redesign.daylight, body:has(.daylight) .cd-composer)
  :is(.neon-button,.primary-button,.kg-primary,.cm-primary,.cd-primary,.cd-send,.cd-primary-link,.cd-compose-fab,.cd-other-new-post,.project-chat-compose footer>button[type=submit],.chat-room-modal>button):not(.danger,.danger-button,.recording):is(:disabled,[aria-disabled=true]) {
  background: var(--sd-surface-sunken) !important;
  color: var(--sd-ink-3) !important;
  border-color: transparent !important;
  box-shadow: none !important;
  text-shadow: none;
  filter: none;
  opacity: 1 !important;
  cursor: not-allowed;
}

/* ── Secondary buttons: frosted glass capsule ─────────────────────────── */
#root .app-shell.wb-portal.portal-redesign.daylight :is(.ghost-button,.secondary-button):not(.card-actions>*,.adult-access-report>*,.danger,.danger-button) {
  border-radius: var(--sd-radius-full);
  background-color: color-mix(in srgb, var(--sd-surface) 72%, transparent);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  backdrop-filter: blur(20px) saturate(1.6);
  border: 1px solid var(--sd-border-strong);
  box-shadow: inset 0 1px 0 var(--sunset-glass-line), 0 1px 2px rgb(16 19 31 / 6%);
  font-weight: 500;
  transition: transform 160ms var(--sunset-press), background-color 160ms var(--sunset-press);
}
#root .app-shell.wb-portal.portal-redesign.daylight :is(.ghost-button,.secondary-button):not(.card-actions>*,.adult-access-report>*,.danger,.danger-button):hover:not(:disabled,[aria-disabled=true]) {
  background-color: color-mix(in srgb, var(--sd-surface-sunken) 80%, transparent);
}
#root .app-shell.wb-portal.portal-redesign.daylight :is(.ghost-button,.secondary-button,.reference-action-menu>summary,.reference-info>summary,.pc-catalog-more>summary,.input-icon-button):active:not(:disabled,[aria-disabled=true]) {
  transform: scale(.97);
}
/* Icon-only buttons are circles, like Apple's toolbar buttons. */
#root .app-shell.wb-portal.portal-redesign.daylight :is(.reference-action-menu>summary,.reference-info>summary,.pc-catalog-more>summary,.input-icon-button) {
  border-radius: var(--sd-radius-full) !important;
}

/* ── Wide text fields: city with a colour-changing palm on the right ───── */
#root .app-shell.wb-portal.portal-redesign.daylight :is(
  .ask-sphyrum .search-composer .simplified-composer,
  .ask-sphyrum .chat-input,
  .ask-sphyrum .platform-helper-compose,
  .project-chat-compose,
  .cd-feed-search,
  .cd-message-search,
  .pc-catalog-search,
  .redesign-sidebar-search:not(.topbar *)
),
:is(#root .app-shell.wb-portal.portal-redesign.daylight, body:has(.daylight) .cd-composer)
  textarea:not(:is(.simplified-composer,.chat-input,.platform-helper-compose,.project-chat-compose) textarea,.kg-renderer *,.xterm *) {
  /* The veil keeps the text side calm; the scene shows through on the right. */
  --sunset-field-rest:
    linear-gradient(90deg,
      color-mix(in srgb, var(--sunset-veil) 94%, transparent) 0%,
      color-mix(in srgb, var(--sunset-veil) 92%, transparent) 46%,
      color-mix(in srgb, var(--sunset-veil) 55%, transparent) 72%,
      color-mix(in srgb, var(--sunset-veil) 8%, transparent) 100%),
    var(--sunset-palm) right var(--sunset-palm-offset, 0px) bottom / auto 100% no-repeat,
    var(--sunset-city) right bottom / auto 100% repeat-x;
  background: var(--sunset-field-rest) var(--sd-surface-sunken) !important;
  border: 1px solid var(--sunset-glass-line) !important;
  border-radius: var(--sd-radius-lg) !important;
  box-shadow: inset 0 1px 2px rgb(16 19 31 / 6%) !important;
}
@media (min-width: 901px) {
  #root .app-shell.wb-portal.portal-redesign.daylight :is(.ask-sphyrum .search-composer .simplified-composer,.ask-sphyrum .chat-input,.ask-sphyrum .platform-helper-compose,.project-chat-compose) {--sunset-palm-offset: 112px}
}
@media (min-width: 901px) {
  /* The Community feed search is narrow on desktop: keep it plain. */
  #root .app-shell.wb-portal.portal-redesign.daylight .cd-feed-search {--sunset-palm: none; --sunset-city: none}
}
/* Focus: a single accent line under the field, on top of the scene. */
#root .app-shell.wb-portal.portal-redesign.daylight :is(
  .ask-sphyrum .search-composer .simplified-composer,
  .ask-sphyrum .chat-input,
  .ask-sphyrum .platform-helper-compose,
  .project-chat-compose,
  .cd-feed-search,
  .cd-message-search,
  .pc-catalog-search,
  .redesign-sidebar-search:not(.topbar *)
):focus-within,
:is(#root .app-shell.wb-portal.portal-redesign.daylight, body:has(.daylight) .cd-composer)
  textarea:not(:is(.simplified-composer,.chat-input,.platform-helper-compose,.project-chat-compose) textarea,.kg-renderer *,.xterm *):focus {
  --sunset-field-focused:
    linear-gradient(var(--sd-accent), var(--sd-accent)) center bottom / calc(100% - 2 * var(--sd-radius-lg)) 2px no-repeat,
    linear-gradient(90deg,
      color-mix(in srgb, var(--sunset-veil) 97%, transparent) 0%,
      color-mix(in srgb, var(--sunset-veil) 95%, transparent) 46%,
      color-mix(in srgb, var(--sunset-veil) 60%, transparent) 72%,
      color-mix(in srgb, var(--sunset-veil) 10%, transparent) 100%),
    var(--sunset-palm) right var(--sunset-palm-offset, 0px) bottom / auto 100% no-repeat,
    var(--sunset-city) right bottom / auto 100% repeat-x;
  background: var(--sunset-field-focused) var(--web-input-active) !important;
}
/* Inner inputs of the compound fields stay transparent over the scene. */
#root .app-shell.wb-portal.portal-redesign.daylight :is(
  .ask-sphyrum .search-composer .simplified-composer,
  .ask-sphyrum .chat-input,
  .ask-sphyrum .platform-helper-compose,
  .project-chat-compose,
  .cd-feed-search,
  .cd-message-search,
  .pc-catalog-search,
  .redesign-sidebar-search:not(.topbar *)
) :is(textarea,input:not([type=checkbox]):not([type=radio]):not([type=file])),
#root .app-shell.wb-portal.portal-redesign.daylight :is(
  .ask-sphyrum .search-composer .simplified-composer,
  .ask-sphyrum .chat-input,
  .ask-sphyrum .platform-helper-compose,
  .project-chat-compose,
  .cd-feed-search,
  .cd-message-search,
  .pc-catalog-search,
  .redesign-sidebar-search:not(.topbar *)
) :is(textarea,input:not([type=checkbox]):not([type=radio]):not([type=file])):focus {
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

@media (prefers-reduced-motion: reduce) {
  :is(#root .app-shell.wb-portal.portal-redesign.daylight, body:has(.daylight) .cd-composer) :is(button,a,summary) {transition: none !important}
  :is(#root .app-shell.wb-portal.portal-redesign.daylight, body:has(.daylight) .cd-composer) :is(button,a,summary):active {transform: none !important}
}
/* Pictures disappear in forced colours; keep system button and field colours. */
@media (forced-colors: active) {
  :is(#root .app-shell.wb-portal.portal-redesign.daylight, body:has(.daylight) .cd-composer) {
    --sunset-button-rest: none;
    --sunset-button-hover: none;
  }
  #root .app-shell.wb-portal.portal-redesign.daylight :is(
    .ask-sphyrum .search-composer .simplified-composer,
    .ask-sphyrum .chat-input,
    .ask-sphyrum .platform-helper-compose,
    .project-chat-compose,
    .cd-feed-search,
    .cd-message-search,
    .pc-catalog-search,
    .redesign-sidebar-search:not(.topbar *)
  ),
  :is(#root .app-shell.wb-portal.portal-redesign.daylight, body:has(.daylight) .cd-composer)
    textarea:not(:is(.simplified-composer,.chat-input,.platform-helper-compose,.project-chat-compose) textarea,.kg-renderer *,.xterm *) {
    --sunset-field-rest: none;
  }
  #root .app-shell.wb-portal.portal-redesign.daylight :is(
    .ask-sphyrum .search-composer .simplified-composer,
    .ask-sphyrum .chat-input,
    .ask-sphyrum .platform-helper-compose,
    .project-chat-compose,
    .cd-feed-search,
    .cd-message-search,
    .pc-catalog-search,
    .redesign-sidebar-search:not(.topbar *)
  ):focus-within,
  :is(#root .app-shell.wb-portal.portal-redesign.daylight, body:has(.daylight) .cd-composer)
    textarea:not(:is(.simplified-composer,.chat-input,.platform-helper-compose,.project-chat-compose) textarea,.kg-renderer *,.xterm *):focus {
    --sunset-field-focused: none;
  }
}

/* Blocking dialogs (18+ declaration, payments) must cover the fixed phone
   composer of Ask (z-index 1000 in ask-reference.css). */
#root .app-shell.wb-portal.portal-redesign.daylight :is(.first-login-consent-overlay,.payment-overlay) {z-index: 2000}
