/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* Keep the conversation composer in view while only the history scrolls. */
html:has(> body.conversation-screen) {
  overflow: hidden;
  overscroll-behavior: none;
}

body.conversation-screen {
  position: fixed;
  top: var(--conversation-viewport-top, 0px);
  left: 0;
  right: 0;
  height: var(--conversation-viewport-height, 100dvh);
  min-height: 0;
  overflow: hidden;
}

.conversation-screen #new_turn,
.conversation-screen #ai_chat_composer {
  padding-bottom: calc(0.75rem + var(--conversation-bottom-inset, env(safe-area-inset-bottom, 0px)));
}

.ai-chat-selection .is-selected {
  color: #1d4ed8;
  background: #dbeafe;
}

.text-selection-dialog {
  max-height: 85dvh;
}

.text-selection-dialog[open] {
  display: flex;
  flex-direction: column;
}

.text-selection-content {
  cursor: text;
  touch-action: pan-y pinch-zoom;
}

.text-selection-content .is-selected {
  color: #1e3a8a;
  background: #bfdbfe;
}

.ai-chat-furigana {
  line-height: 2.5;
  padding-top: 0.5em;
}

.ai-chat-furigana ruby {
  ruby-position: over;
  ruby-align: center;
}

.ai-chat-furigana rt {
  font-size: 0.55em;
  line-height: 1;
  text-align: center;
}

#new_turn textarea {
  min-height: 4.25rem;
  max-height: max(4.25rem, calc(var(--conversation-viewport-height, 100dvh) * 0.4));
  overflow-y: auto;
}

.translation-fullscreen {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  border: 0;
  padding: max(1rem, env(safe-area-inset-top)) max(1.5rem, env(safe-area-inset-right)) max(1.5rem, env(safe-area-inset-bottom)) max(1.5rem, env(safe-area-inset-left));
  background: white;
  color: #111827;
}

.translation-fullscreen[open] {
  display: flex;
  flex-direction: column;
}

.translation-fullscreen p {
  font-size: clamp(2rem, 6vw, 4rem);
  line-height: 1.5;
}

.turn-disclosure > summary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  font-size: 0.875rem;
  cursor: pointer;
  list-style: none;
}

.turn-disclosure > summary::-webkit-details-marker {
  display: none;
}

.turn-disclosure > summary > svg {
  flex-shrink: 0;
}

.turn-disclosure[open] > summary > svg {
  transform: rotate(90deg);
}

/* Keep native selection and iOS callouts out of displayed text interactions. */
.no-native-selection,
.ai-chat-japanese,
.ai-chat-selection {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.ai-chat-japanese {
  touch-action: pan-y;
}

.ai-chat-selection {
  cursor: text;
  touch-action: none;
}
