/* LGDataFinder — Production Design System
   Direction A: Government Portal
   Navy + white + gold, serif headings, sans-serif body,
   generous whitespace, calm and authoritative. */

/* --- Reset & base --- */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* Palette */
  --navy: #112e51;
  --navy-light: #205493;
  --navy-dark: #0b1a33;
  --gold: #fdb81e;
  --gold-muted: #f9c642;
  --white: #ffffff;
  --off-white: #f7f7f7;
  --gray-lightest: #f0f0f0;
  --gray-light: #e0e0e0;
  --gray-mid: #8b9ab0;
  --gray-dark: #4a5568;
  --text: #1b1b1b;
  /* Error: calm neutral, not red alarm — same visual weight as assistant bubbles */
  --error-bg: #f5f0eb;
  --error-text: #4a4540;
  --error-border: #d8d0c8;
  --warning-bg: #fff3cd;
  --warning-text: #664d03;
  --warning-border: #ffecb5;

  /* Typography */
  --font-serif: "Georgia", "Times New Roman", serif;
  --font-sans: "Helvetica Neue", Helvetica, Arial, sans-serif;

  /* Layout */
  --max-width: 960px;
}

html {
  font-size: 18px;
  line-height: 1.7;
}

body {
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--white);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--navy-light);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:hover {
  color: var(--navy);
}

a:focus-visible,
button:focus-visible,
textarea:focus-visible,
input:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

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

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 2rem;
}

/* ===================================================================
   LANDING PAGE
   =================================================================== */

/* --- Gov bar --- */

.gov-bar {
  background: var(--navy-dark);
  color: var(--gray-mid);
  font-size: 0.72rem;
  padding: 0.4rem 0;
  letter-spacing: 0.02em;
}

.gov-bar .container {
  display: flex;
  justify-content: space-between;
}

/* --- Site header --- */

.site-header {
  background: var(--navy);
  color: var(--white);
  padding: 1.5rem 0;
  border-bottom: 4px solid var(--gold);
}

.site-title {
  font-family: var(--font-serif);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--white);
  letter-spacing: -0.01em;
}

.site-tagline {
  color: var(--gray-mid);
  font-size: 0.92rem;
  margin-top: 0.15rem;
}

/* --- Hero --- */

.hero {
  text-align: center;
  padding: 2.5rem 0 2rem;
  border-bottom: 1px solid var(--gray-light);
}

.hero h2 {
  font-family: var(--font-serif);
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--navy);
}

.hero p {
  color: var(--gray-dark);
  margin-top: 0.5rem;
  max-width: 620px;
  margin-left: auto;
  margin-right: auto;
}

/* --- Tile grid --- */

.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  padding: 2.5rem 0;
}

.tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 1.75rem;
  min-height: 240px;
  background: var(--off-white);
  border: 1px solid var(--gray-light);
  border-left: 4px solid var(--navy);
  text-decoration: none;
  color: var(--text);
  cursor: pointer;
  transition: border-left-color 0.15s, box-shadow 0.15s;
}

.tile:hover {
  border-left-color: var(--gold);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  text-decoration: none;
}

.tile:focus-visible {
  border-left-color: var(--gold);
}

.tile-icon {
  color: var(--navy);
  margin-bottom: 0.75rem;
}

.tile-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gray-mid);
  margin-bottom: 0.3rem;
  font-weight: 600;
}

.tile-name {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 0.4rem;
}

.tile-description {
  color: var(--gray-dark);
  font-size: 0.88rem;
  line-height: 1.55;
  margin-bottom: auto;
}

.tile-example {
  font-size: 0.82rem;
  color: var(--navy-light);
  font-style: italic;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--gray-light);
}

/* --- About brief (landing page) --- */

.about-brief {
  padding: 2.5rem 0;
  border-top: 1px solid var(--gray-light);
}

.about-brief h2 {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 0.75rem;
}

.about-brief p {
  color: var(--gray-dark);
  font-size: 0.92rem;
  margin-bottom: 0.75rem;
  max-width: 680px;
}

/* --- Footer --- */

.site-footer {
  margin-top: auto;
  background: var(--navy);
  color: var(--gray-mid);
  padding: 1.5rem 0;
  font-size: 0.82rem;
}

.site-footer nav a {
  color: var(--gray-mid);
  margin-right: 1.5rem;
}

.site-footer nav a:hover {
  color: var(--white);
}

/* ===================================================================
   STATUS BANNER (health check / dev mode)
   =================================================================== */

.status-banner {
  background: var(--warning-bg);
  color: var(--warning-text);
  padding: 0.6rem 2rem;
  text-align: center;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--warning-border);
}

/* ===================================================================
   CHAT PAGE
   =================================================================== */

.chat-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* --- Chat header --- */

.chat-header {
  background: var(--navy);
  color: var(--white);
  padding: 1rem 0;
  border-bottom: 4px solid var(--gold);
}

.breadcrumb {
  font-size: 0.82rem;
  color: var(--gray-mid);
}

.breadcrumb a {
  color: var(--gray-mid);
}

.breadcrumb a:hover {
  color: var(--white);
}

.breadcrumb span[aria-hidden] {
  margin: 0 0.35rem;
}

#skill-name {
  color: var(--white);
  font-weight: 600;
}

.skill-description {
  color: var(--gray-mid);
  font-size: 0.88rem;
  margin-top: 0.2rem;
}

/* --- Chat container --- */

.chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding-top: 1rem;
  padding-bottom: 1rem;
  overflow: hidden;
  background: var(--white);
}

/* --- Transcript --- */

.transcript {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 1rem;
}

.message {
  margin-bottom: 1.25rem;
  max-width: 85%;
}

.message--user {
  margin-left: auto;
  text-align: right;
}

.message--user .message-bubble {
  background: var(--navy);
  color: var(--white);
  display: inline-block;
  padding: 0.6rem 1rem;
  border-radius: 4px;
}

.message--assistant .message-bubble {
  background: var(--off-white);
  border: 1px solid var(--gray-light);
  padding: 0.8rem 1rem;
  border-radius: 4px;
  line-height: 1.7;
  font-size: 0.95rem;
}

.message--assistant .message-bubble p {
  margin-bottom: 0.6rem;
}

.message--assistant .message-bubble p:last-child {
  margin-bottom: 0;
}

.message--assistant .message-bubble strong {
  color: var(--navy);
}

.message--assistant .message-bubble .md-heading {
  font-family: var(--font-serif);
  font-weight: 700;
  color: var(--navy);
  margin-top: 0.8rem;
  margin-bottom: 0.3rem;
}

.message--assistant .message-bubble h2.md-heading { font-size: 1.15rem; }
.message--assistant .message-bubble h3.md-heading { font-size: 1.05rem; }
.message--assistant .message-bubble h4.md-heading { font-size: 0.95rem; }

/* Tables in responses */

.message--assistant .message-bubble table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0;
  font-size: 0.88rem;
}

.message--assistant .message-bubble th,
.message--assistant .message-bubble td {
  text-align: left;
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--gray-light);
}

.message--assistant .message-bubble th {
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--gray-dark);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Source citation */

.message-source {
  font-size: 0.78rem;
  color: var(--gray-mid);
  margin-top: 0.5rem;
  font-style: italic;
}

/* Error messages — calm, same visual weight as assistant bubbles.
   No red, no exclamation marks, no alarm styling per §6.3. */

.message--error .message-bubble {
  background: var(--error-bg);
  color: var(--error-text);
  border: 1px solid var(--error-border);
  padding: 0.8rem 1rem;
  border-radius: 4px;
  font-size: 0.95rem;
  line-height: 1.65;
}

.message--error .retry-btn {
  display: inline-block;
  margin-top: 0.75rem;
  padding: 0.4rem 1rem;
  font-size: 0.85rem;
  background: var(--off-white);
  border: 1px solid var(--gray-light);
  border-radius: 4px;
  color: var(--gray-dark);
  cursor: pointer;
  font-family: var(--font-sans);
  min-height: 44px;
  transition: border-color 0.15s;
}

.message--error .retry-btn:hover {
  border-color: var(--navy-light);
  color: var(--navy);
}

/* Cross-tile suggestion link */

.cross-tile-link {
  display: inline-block;
  margin-top: 0.75rem;
  padding: 0.4rem 1rem;
  font-weight: 600;
  color: var(--navy);
  background: var(--off-white);
  border: 1px solid var(--gray-light);
  border-radius: 4px;
  text-decoration: none;
  font-size: 0.9rem;
  min-height: 44px;
  line-height: 2;
  transition: border-color 0.15s;
}

.cross-tile-link:hover {
  border-color: var(--navy-light);
  color: var(--navy-light);
}

/* --- Typing indicator --- */

.typing-indicator {
  display: inline-flex;
  gap: 4px;
  padding: 0.6rem 1rem;
  background: var(--off-white);
  border: 1px solid var(--gray-light);
  border-radius: 4px;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gray-mid);
  opacity: 0.4;
  animation: typing-dot 1.2s infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-dot {
  0%, 60%, 100% { opacity: 0.4; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

/* --- Example questions --- */

.examples {
  padding: 0.75rem 0;
}

.examples-label {
  font-size: 0.82rem;
  color: var(--gray-dark);
  margin-bottom: 0.5rem;
}

.example-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.example-btn {
  background: var(--off-white);
  border: 1px solid var(--gray-light);
  border-radius: 4px;
  padding: 0.5rem 0.9rem;
  font-size: 0.82rem;
  color: var(--text);
  cursor: pointer;
  font-family: var(--font-sans);
  min-height: 44px;
  display: flex;
  align-items: center;
  transition: border-color 0.15s;
}

.example-btn:hover {
  border-color: var(--navy-light);
  color: var(--navy);
}

/* --- Chat form --- */

.chat-form {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}

.chat-input {
  flex: 1;
  font-family: var(--font-sans);
  font-size: 1rem;
  padding: 0.6rem 0.8rem;
  border: 2px solid var(--gray-light);
  border-radius: 4px;
  resize: vertical;
  min-height: 44px;
  max-height: 160px;
  line-height: 1.4;
}

.chat-input:focus {
  border-color: var(--navy-light);
  outline: none;
}

.submit-btn {
  padding: 0.6rem 1.5rem;
  background: var(--navy);
  color: var(--white);
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  font-family: var(--font-sans);
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
  min-width: 44px;
  transition: background 0.15s;
}

.submit-btn:hover {
  background: var(--navy-light);
}

.submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* --- Chat controls --- */

.chat-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 0.5rem;
}

.start-over-btn {
  font-size: 0.82rem;
  background: transparent;
  border: 1px solid var(--gray-light);
  border-radius: 4px;
  padding: 0.35rem 0.8rem;
  color: var(--gray-dark);
  cursor: pointer;
  min-height: 44px;
  font-family: var(--font-sans);
}

.start-over-btn:hover {
  border-color: var(--navy-light);
  color: var(--navy);
}

.char-count {
  font-size: 0.78rem;
  color: var(--gray-mid);
}

/* ===================================================================
   RESPONSIVE
   =================================================================== */

@media (max-width: 640px) {
  .tile-grid {
    grid-template-columns: 1fr;
  }

  .message {
    max-width: 95%;
  }

  .container {
    padding: 0 1.25rem;
  }

  .gov-bar .container {
    flex-direction: column;
    gap: 0.15rem;
  }
}
