/*
  Navigator v35w UX layer — 3 September 2026
  Front-end presentation only.

  Loaded AFTER the current v35w styles.css so the proven branding, accessibility,
  continuation-note, perspective and conversation rules remain available.

  This file intentionally does not redefine backend behaviour.
*/

:root {
  --ux-header-clearance: 11rem;
}

/* ---------- Real Navigator brand header ---------- */
.header-inner {
  min-height: 148px;
}

.header-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1.25rem;
  flex: 0 0 auto;
}

.pilot-version {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0.35rem 0.7rem;
  border: 1px solid rgba(182, 138, 58, 0.42);
  border-radius: 999px;
  background: rgba(182, 138, 58, 0.11);
  color: var(--accent-dark);
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
}

.top-nav {
  gap: 1.45rem;
}

/* ---------- Operational first screen ---------- */
.navigator-section {
  min-height: calc(100svh - 148px);
  padding-top: clamp(0.35rem, 1vh, 0.75rem);
  padding-bottom: 2.5rem;
}

.navigator-layout {
  display: grid;
  gap: 0.85rem;
}

.navigator-intro {
  width: min(100%, 1295px);
  margin: 0 auto;
}

.navigator-intro h1 {
  max-width: none;
  font-size: clamp(2.6rem, 4.2vw, 4.2rem);
  line-height: 1.01;
  letter-spacing: -0.045em;
}

.navigator-intro > p {
  margin: 0.4rem 0 0 0.25rem;
  max-width: 78ch;
  color: #27364a;
  font-size: clamp(1rem, 1.25vw, 1.15rem);
  line-height: 1.4;
}

.navigator-card-wrapper {
  width: min(100%, 1295px);
  margin: 0 auto;
  padding-top: 0 !important;
}

/* Override older opened-state rule that hides the intro on desktop. */
.navigator-section.navigator-open .navigator-intro {
  display: block;
  width: min(100%, 1295px);
  max-width: none;
  margin: 0 auto;
}

.navigator-section.navigator-open .navigator-intro > p {
  display: block !important;
  max-width: 78ch;
}

.navigator-section.navigator-open .navigator-card-wrapper {
  width: min(100%, 1295px);
}

.navigator-section.navigator-open {
  padding-top: clamp(0.35rem, 1vh, 0.75rem);
  padding-bottom: 2.5rem;
}

.navigator-section.navigator-open .navigator-grid {
  display: block;
}

/* ---------- Login gate, preserved but simplified ---------- */
.ux-login-card {
  width: min(720px, 100%);
  margin: 0 auto;
  padding: 1.4rem 1.5rem;
  border-top: 5px solid var(--deep);
}

.ux-login-card h2 {
  font-size: clamp(1.7rem, 2.7vw, 2.25rem);
}

.ux-login-card .stage-kicker {
  margin: 0 0 0.25rem;
}

.ux-login-card .pilot-privacy-note {
  padding: 0.8rem 0.9rem;
  border-radius: 14px;
  background: #fff7e8;
  border: 1px solid rgba(182, 138, 58, 0.26);
  color: var(--deep);
}

.login-action-row {
  display: flex;
  justify-content: flex-end;
}

/* ---------- Chat shell ---------- */
.chat-prototype {
  width: 100%;
  border-radius: 32px;
  box-shadow: var(--shadow);
  background: #fff;
}

.chat-header {
  min-height: 82px;
  padding: 0.95rem 1.15rem;
}

.chat-title > strong {
  display: block;
  font-size: 1.04rem;
}

.chat-version {
  display: inline;
  margin-left: 0.55rem;
  color: #fff !important;
  font-size: inherit !important;
}

.chat-header-actions .button {
  white-space: nowrap;
}

.privacy-strip {
  min-height: 72px;
  padding: 0.85rem 1.15rem;
  font-size: 0.96rem;
}

/* Compatibility stage is required by current script.js, but is not a visible UX step. */
#journeyChoice.ux-compat-stage {
  display: none !important;
}

/* ---------- Immediate situation entry ---------- */
.ux-start-stage {
  padding: 0.7rem 1.15rem 0.8rem;
  gap: 0.75rem;
  background: #f7f9fb;
}

.ux-opening-log {
  min-height: 0;
  max-height: none;
  overflow: visible;
  padding: 0;
  border: 0;
  background: transparent;
}

.ux-opening-log .message {
  width: min(1120px, 92%);
  max-width: 100%;
  margin: 0;
  padding: 0.78rem 1rem;
  border-radius: 18px;
  background: #fff;
}

.ux-start-stage .perspective-form {
  gap: 0.55rem;
  padding-top: 0.25rem;
}

.ux-start-stage .perspective-form > label {
  color: var(--deep);
  font-size: 1rem;
}

.ux-start-stage #perspectiveInput {
  min-height: 108px;
  border: 4px solid #d0e0ed;
  outline: 1px solid #aec4d6;
  border-radius: 24px;
  padding: 0.95rem 1rem;
  font-size: 1.04rem;
  line-height: 1.45;
}

.ux-start-stage #perspectiveInput:focus {
  border-color: #bdd0df;
  outline: 3px solid rgba(40, 95, 143, 0.2);
}

.ux-primary-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
}

.ux-action-buttons {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
}

.ux-continuity-entry {
  min-width: 300px;
  white-space: nowrap;
}

#perspectiveSubmitButton {
  min-width: 135px;
}

/* Recommendation appears directly below the user's opening dialogue. */
.ux-start-stage .perspective-recommendation {
  margin-top: 0.25rem;
}

/* ---------- Continuity route ---------- */
#continuationPasteStage,
#continuationReviewStage {
  padding: 1.15rem 1.25rem 1.35rem;
}

#continuationPasteStage textarea {
  min-height: 220px;
}

.continuity-footer {
  display: grid;
  justify-items: center;
  gap: 0.35rem;
  width: calc(100% - 2rem);
  margin: 0.7rem auto 1rem;
  padding: 0.9rem 1.5rem 0.75rem;
  border-radius: 22px;
  background: var(--soft);
  color: #64758a;
  text-align: center;
}

.continuity-footer p {
  max-width: 1000px;
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.38;
}

.continuation-note-action {
  border: 0;
  border-radius: 5px;
  background: #fff;
  color: var(--deep);
  padding: 0.25rem 0.75rem;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.continuation-note-action:hover,
.continuation-note-action:focus-visible {
  box-shadow: 0 0 0 2px rgba(182, 138, 58, 0.25);
}

/* ---------- Active conversation ---------- */
.navigator-section.navigator-open .chat-prototype.conversation-started {
  border-radius: 28px;
}

.navigator-section.navigator-open .chat-prototype.conversation-started #messages {
  background: #f9fafb;
}

.lens-control {
  background: rgba(242, 245, 248, 0.97);
}

/* ---------- About stays below the operational experience ---------- */
.ux-about-section {
  min-height: auto;
  padding-top: 4.5rem;
  padding-bottom: 7rem;
}

/* ---------- Responsive ---------- */
@media (min-width: 861px) and (max-width: 1300px) {
  .header-inner {
    min-height: 118px;
  }

  .navigator-section {
    min-height: calc(100svh - 118px);
  }

  .navigator-intro h1 {
    font-size: clamp(2.35rem, 4vw, 3.4rem);
  }

  .chat-header {
    min-height: 72px;
  }

  .privacy-strip {
    min-height: 64px;
  }

  .ux-start-stage #perspectiveInput {
    min-height: 92px;
  }
}

@media (max-width: 860px) {
  .header-right {
    width: 100%;
    justify-content: space-between;
    gap: 0.75rem;
  }

  .pilot-version {
    order: 2;
  }

  .top-nav {
    order: 1;
  }

  .navigator-section {
    min-height: auto;
    padding-top: 1rem;
  }

  .navigator-intro h1 {
    font-size: clamp(2rem, 8vw, 2.9rem);
  }

  .navigator-intro > p {
    margin-left: 0;
    font-size: 0.98rem;
  }

  .chat-prototype {
    border-radius: 20px;
  }

  .ux-primary-actions {
    grid-template-columns: 1fr;
  }

  .ux-action-buttons {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .ux-continuity-entry,
  #perspectiveSubmitButton {
    width: 100%;
    min-width: 0;
  }

  .continuity-footer {
    width: calc(100% - 1rem);
    padding: 0.8rem 0.9rem 0.7rem;
  }
}

@media (max-width: 540px) and (orientation: portrait) {
  .header-right {
    align-items: center;
  }

  .pilot-version {
    font-size: 0.7rem;
    min-height: 28px;
  }

  .navigator-section {
    padding-top: 0.7rem;
  }

  .navigator-intro h1 {
    font-size: clamp(1.72rem, 7.5vw, 2.15rem);
    line-height: 1.04;
  }

  .navigator-intro > p {
    font-size: 0.9rem;
    line-height: 1.38;
  }

  .chat-header {
    min-height: 0;
  }

  .privacy-strip {
    min-height: 0;
  }

  .ux-start-stage {
    padding: 0.55rem 0.7rem 0.7rem;
  }

  .ux-opening-log .message {
    width: 100%;
    padding: 0.65rem 0.75rem;
    font-size: 0.9rem;
  }

  .ux-start-stage #perspectiveInput {
    min-height: 92px;
    border-width: 3px;
    border-radius: 18px;
    font-size: 0.94rem;
  }

  .continuity-footer p {
    font-size: 0.8rem;
  }
}

/* v35w UX Fix 1 — 3 September 2026
   Narrow visual corrections only:
   1) keep "Navigator v35w" on one line in the dark chat header;
   2) restore visible dark styling for the user's message in the opening
      perspective dialogue (the UX override had made it white-on-white). */

.chat-title > strong {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  flex-wrap: nowrap;
}

.chat-title > strong .chat-version {
  display: inline !important;
  margin-left: 0;
  white-space: nowrap;
}

.ux-opening-log .message.user-message {
  margin-left: auto;
  background: var(--deep);
  color: #fff;
  border-color: var(--deep);
}

/* v35w UX Polish 1 — 3 September 2026
   Make the session-level Continuity Note action visually distinct from the
   ordinary Change control while keeping it secondary to the conversation. */
.lens-control #continuationNoteButton {
  border: 2px solid var(--accent);
  background: #fffaf0;
  color: var(--deep);
  box-shadow: 0 0 0 2px rgba(182, 138, 58, 0.10);
}

.lens-control #continuationNoteButton:hover {
  background: #fff5dd;
  box-shadow: 0 0 0 3px rgba(182, 138, 58, 0.14);
}

.lens-control #continuationNoteButton:focus-visible {
  outline-color: rgba(182, 138, 58, 0.42);
}
