/* Ask HYPER — the assistant console. Inherits every token from site.css. */

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.console { padding-block: clamp(2rem, 4vw, 3.25rem) 0; }

.console__inner {
  display: grid;
  grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
  gap: clamp(1.75rem, 4vw, 3.5rem);
  align-items: start;
}

/* ------------------------------------------------------------- rail ----- */

.console__rail { position: sticky; top: 100px; }

.console__title { font-size: clamp(2.4rem, 5vw, 3.2rem); margin-bottom: 1rem; }
.console__blurb {
  color: var(--paint-dim);
  font-size: 0.95rem;
  margin-bottom: 2.25rem;
}

.rail-block { margin-bottom: 2rem; }
.rail-block__head {
  color: var(--paint-faint);
  margin-bottom: 0.9rem;
}

.chips { display: flex; flex-direction: column; gap: 0.5rem; }
.chip {
  text-align: left;
  padding: 0.7rem 0.9rem;
  background: var(--cab);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--paint-dim);
  font-family: var(--body);
  font-size: 0.87rem;
  cursor: pointer;
  transition: border-color 0.18s var(--ease), color 0.18s var(--ease),
              transform 0.18s var(--ease);
}
.chip:hover {
  border-color: var(--signal);
  color: var(--paint);
  transform: translateX(3px);
}

.langs { display: flex; gap: 0.4rem; }
.lang {
  padding: 0.45rem 0.75rem;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--paint-faint);
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  cursor: pointer;
  transition: border-color 0.18s var(--ease), color 0.18s var(--ease);
}
.lang:hover { color: var(--paint-dim); border-color: var(--line-strong); }
.lang.is-active { color: var(--asphalt-deep); background: var(--signal); border-color: var(--signal); }

.rail-reset {
  padding: 0;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  color: var(--paint-faint);
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.18s var(--ease), border-color 0.18s var(--ease);
}
.rail-reset:hover { color: var(--clay); border-color: var(--clay); }

/* ----------------------------------------------------------- thread ----- */

.thread-wrap {
  display: flex;
  flex-direction: column;
  background: var(--cab);
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: min(72vh, 720px);
  max-height: min(72vh, 720px);
  overflow: hidden;
}

.thread {
  flex: 1;
  overflow-y: auto;
  padding: 1.75rem;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.thread::-webkit-scrollbar { width: 8px; }
.thread::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 4px; }

.msg {
  display: flex;
  gap: 0.9rem;
  margin-bottom: 1.6rem;
  animation: msgIn 0.32s var(--ease) both;
}
.msg:last-child { margin-bottom: 0; }
@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
}

.msg__who {
  flex: none;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 600;
}
.msg--ai .msg__who { background: var(--signal); color: var(--asphalt-deep); }
.msg--op .msg__who { background: var(--cab-raised); color: var(--paint-dim); }

.msg__body {
  min-width: 0;
  font-size: 0.95rem;
  line-height: 1.7;
}
.msg--op .msg__body { color: var(--paint-dim); }
.msg--ai .msg__body { color: var(--paint); }
.msg__body p { margin-bottom: 0.75rem; }
.msg__body p:last-child { margin-bottom: 0; }
.msg__body strong { color: var(--guide); font-weight: 600; }
.msg__body code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--asphalt-deep);
  padding: 0.1em 0.4em;
  border-radius: 3px;
}
.msg__body ul { margin: 0 0 0.75rem; padding-left: 1.15rem; }
.msg__body li { margin-bottom: 0.3rem; }
.msg__body a { color: var(--signal); text-decoration: underline; }

.msg--error .msg__who { background: var(--clay); color: var(--asphalt-deep); }
.msg--error .msg__body { color: var(--clay); }

.msg__meta {
  display: block;
  margin-top: 0.5rem;
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--paint-faint);
}

/* typing indicator */
.dots { display: inline-flex; gap: 5px; padding-top: 0.6rem; }
.dots span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--paint-faint);
  animation: bob 1.1s var(--ease) infinite;
}
.dots span:nth-child(2) { animation-delay: 0.15s; }
.dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes bob {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.45; }
  30%           { transform: translateY(-4px); opacity: 1; }
}

/* --------------------------------------------------------- composer ----- */

.composer {
  border-top: 1px solid var(--line);
  background: var(--asphalt-deep);
  padding: 1rem 1.25rem 0.9rem;
}
.composer__form {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
}
.composer textarea {
  flex: 1;
  min-height: 44px;
  max-height: 160px;
  resize: none;
  padding: 0.7rem 0.9rem;
  background: var(--cab);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--paint);
  font-family: var(--body);
  font-size: 0.95rem;
  line-height: 1.5;
  transition: border-color 0.18s var(--ease);
}
.composer textarea:focus { outline: none; border-color: var(--signal); }
.composer textarea::placeholder { color: var(--paint-faint); }

.composer__actions { display: flex; gap: 0.5rem; align-items: center; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--paint-dim);
  cursor: pointer;
  transition: color 0.18s var(--ease), border-color 0.18s var(--ease),
              background 0.18s var(--ease);
}
.icon-btn:hover { color: var(--paint); border-color: var(--paint-dim); }
.icon-btn.is-recording {
  background: var(--clay);
  border-color: var(--clay);
  color: var(--asphalt-deep);
  animation: rec 1.4s var(--ease) infinite;
}
@keyframes rec {
  0%, 100% { box-shadow: 0 0 0 0 rgba(228, 87, 46, 0.5); }
  60%      { box-shadow: 0 0 0 8px rgba(228, 87, 46, 0); }
}

.composer__status {
  margin-top: 0.65rem;
  min-height: 1.1rem;
}
.composer__status .mono {
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  color: var(--paint-faint);
}
.composer__status .mono.is-alert { color: var(--clay); }
.composer__status .mono.is-live { color: var(--guide); }

button[disabled] { opacity: 0.45; cursor: not-allowed; }

/* ------------------------------------------------------- responsive ----- */

@media (max-width: 980px) {
  /* On a phone the thread has to be the first thing you reach, so the rail
     dissolves and its parts sit above and below the conversation. */
  .console__inner { display: flex; flex-direction: column; gap: 1.5rem; }
  .console__rail { display: contents; }

  .console__rail .marker { order: 1; margin-bottom: 0; }
  .console__title      { order: 2; }
  .console__blurb      { order: 3; margin-bottom: 0; }
  .thread-wrap         { order: 4; min-height: 62vh; max-height: none; }
  .rail-block          { order: 5; margin-bottom: 0; }
  .rail-reset          { order: 6; align-self: flex-start; }

  .thread { max-height: 58vh; max-height: 58dvh; }
  .chips { flex-direction: row; flex-wrap: wrap; }
  .chip { flex: 1 1 210px; }
}

@media (max-width: 560px) {
  /* dvh so the iOS address bar sliding in and out doesn't crop the composer. */
  .thread-wrap { min-height: 60vh; min-height: 60dvh; }
  .thread { padding: 1.15rem; max-height: 56vh; max-height: 56dvh; }

  .console__blurb { font-size: 0.9rem; }
  .chip { flex: 1 1 100%; padding: 0.85rem 0.95rem; }
  .langs { gap: 0.5rem; }
  .lang { flex: 1; min-height: 44px; }
  .rail-reset { min-height: 44px; }

  /* Bigger type in the composer: 16px stops iOS zooming the page on focus. */
  .composer { padding: 0.85rem 0.9rem 0.8rem; }
  .composer textarea { font-size: 16px; min-height: 48px; }
  .icon-btn { width: 48px; height: 48px; }
  .composer__actions .btn { padding-block: 0.85rem; }
}

@media (max-width: 560px) {
  /* Full-width input; controls get their own row rather than fighting it. */
  .composer__form { flex-wrap: wrap; }
  .composer textarea { flex: 1 1 100%; }
  .composer__actions { width: 100%; justify-content: space-between; }
  .composer__actions .btn { flex: 1; margin-left: 0.5rem; }
}
