/* Junior PWA — værktøjs-direkte per brand.md.
   Off-white, charcoal, one rust accent per region, hairlines, no shadows. */
:root {
  --bg: #FAFAF7;
  --fg: #171717;
  --muted: #6B6B6B;
  --hairline: #E5E5E2;
  --accent: #C2410C;
  --accent-dim: rgba(194, 65, 12, 0.125);
  --sans: "IBM Plex Sans", sans-serif;
  --mono: "IBM Plex Mono", monospace;
}

* { box-sizing: border-box; margin: 0; }

/* App frame: the page never scrolls — the thread (#chat) does. 100dvh
   tracks the mobile browser chrome and on-screen keyboard; 100vh is
   the fallback for older engines. */
html, body { height: 100vh; height: 100dvh; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--fg);
  display: flex;
  flex-direction: column;
  max-width: 44rem;
  margin: 0 auto;
  padding: 0 1rem;
  overflow: hidden;
}

header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: calc(0.9rem + env(safe-area-inset-top)) 0 0.9rem;
  border-bottom: 1px solid var(--hairline);
}

.wordmark .name {
  font-weight: 500;
  font-size: 1.15rem;
  letter-spacing: 0.01em;
}

.wordmark .subtitle {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--muted);
  margin-left: 0.6rem;
}

.demo-badge {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
}

main {
  flex: 1;
  min-height: 0; /* lets the flex child actually shrink and scroll */
  overflow-y: auto;
  overscroll-behavior-y: contain; /* no pull-to-refresh mid-thread */
  -webkit-overflow-scrolling: touch;
}

/* Access gate */
.gate-card {
  margin-top: 22vh;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 20rem;
  margin-left: auto;
  margin-right: auto;
}

.mono-label {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
}

.gate-card input {
  font-family: var(--mono);
  font-size: 1rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  background: #fff;
  color: var(--fg);
}

.gate-card input:focus { outline: 1.5px solid var(--fg); }

.gate-card button,
#send {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 0.95rem;
  color: #fff;
  background: var(--fg);
  border: none;
  border-radius: 6px;
  padding: 0.6rem 1.1rem;
  cursor: pointer;
  transition: background 150ms ease-out;
}

.gate-card button:hover, #send:hover { background: var(--accent); }

.gate-hint { font-size: 0.8rem; color: var(--muted); }

/* Thread */
#thread { padding: 1.25rem 0 0.5rem; }

.msg { margin-bottom: 1.1rem; white-space: pre-wrap; line-height: 1.55; }

.msg.user {
  margin-left: 15%;
  background: #fff;
  border: 1px solid var(--hairline);
  border-radius: 8px 8px 2px 8px;
  padding: 0.6rem 0.85rem;
}

.msg.junior { margin-right: 5%; }

.msg .who {
  display: block;
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.msg .copy {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--muted);
  background: none;
  border: 1px solid var(--hairline);
  border-radius: 4px;
  padding: 0.15rem 0.5rem;
  margin-top: 0.4rem;
  cursor: pointer;
}

.msg .copy:hover { color: var(--fg); border-color: var(--fg); }

.msg.system {
  font-size: 0.85rem;
  color: var(--muted);
  border-left: 2px solid var(--hairline);
  padding-left: 0.75rem;
}

/* Install banner — hairline card, no shadow, per brand.md */
.install-banner {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  border: 1px solid var(--hairline);
  border-left: 2px solid var(--accent);
  border-radius: 6px;
  padding: 0.75rem 0.9rem;
  margin: 0.75rem 0;
  font-size: 0.85rem;
  color: var(--fg);
}

.install-actions { display: flex; gap: 0.5rem; }

.install-actions button {
  font-family: var(--mono);
  font-size: 0.75rem;
  padding: 0.35rem 0.7rem;
  border-radius: 4px;
  cursor: pointer;
  background: none;
}

.install-yes { border: 1px solid var(--fg); color: var(--fg); }
.install-no { border: 1px solid var(--hairline); color: var(--muted); }

/* Demo chips */
.chips { display: flex; flex-direction: column; gap: 0.5rem; padding-bottom: 0.75rem; }
.chips[hidden] { display: none; } /* display:flex would defeat [hidden] */

.chips button {
  font-family: var(--sans);
  font-size: 0.9rem;
  text-align: left;
  color: var(--fg);
  background: none;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  padding: 0.55rem 0.8rem;
  cursor: pointer;
}

.chips button:hover { border-color: var(--fg); }

/* Composer */
footer {
  border-top: 1px solid var(--hairline);
  padding: 0.75rem 0 calc(0.75rem + env(safe-area-inset-bottom));
  background: var(--bg);
}

.composer-inner { display: flex; gap: 0.5rem; align-items: flex-end; }

#input {
  flex: 1;
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.4;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  background: #fff;
  color: var(--fg);
  resize: none;
  max-height: 9rem;
}

#input:focus { outline: 1.5px solid var(--fg); }

.hint {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.5rem;
}

.cursor::after { content: "▍"; color: var(--muted); }

/* Touch ergonomics: fingers get full-size targets where mouse users
   get compact ones. 44px is the platform guideline minimum. */
@media (pointer: coarse) {
  .msg .copy {
    font-size: 0.8rem;
    padding: 0.5rem 0.9rem;
  }
  .install-actions button {
    font-size: 0.85rem;
    padding: 0.55rem 0.9rem;
  }
  .chips button {
    padding: 0.7rem 0.9rem;
  }
  #send {
    padding: 0.6rem 1.25rem;
    min-height: 2.75rem;
  }
  .gate-card button {
    min-height: 2.75rem;
  }
}
