/* The candidate portal's one page.
 *
 * Phone first. The reader is a nurse or a midwife between shifts, holding the phone in one hand, so the
 * layout is a column that fills the viewport: the thread scrolls and the composer stays where her thumb
 * already is. Desktop gets the same column, wider and centred — there is no second layout to keep true.
 *
 * Panels are sheets rather than pages, because the page is never reloaded: signing in, the profile and
 * the privacy text all slide over the conversation and leave it untouched underneath.
 */

:root {
  --paper: #fbfaf8;
  --surface: #ffffff;
  --ink: #14181b;
  --muted: #5d6771;
  --line: #e4e7ea;
  --line-soft: #eef0f2;
  --accent: #15584b;
  --accent-soft: #edf4f1;
  --flag: #8a4312;
  --flag-soft: #fdf2e8;
  --shadow: 0 1px 2px rgb(20 24 27 / 6%), 0 8px 24px rgb(20 24 27 / 8%);
  --radius: 14px;
  --gutter: 1rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #14181a;
    --surface: #1b2023;
    --ink: #e8eaec;
    --muted: #9aa5ad;
    --line: #2b3237;
    --line-soft: #232a2e;
    --accent: #6ec5ad;
    --accent-soft: #1d2b28;
    --flag: #f0b27f;
    --flag-soft: #2e2318;
    --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 8px 24px rgb(0 0 0 / 35%);
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font:
    17px/1.6 -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    system-ui,
    sans-serif;
  -webkit-text-size-adjust: 100%;
}

body.portal {
  display: flex;
  flex-direction: column;
  /* `dvh` so the composer is not hidden behind the phone browser's own chrome. */
  height: 100dvh;
  overflow: hidden;
}

a {
  color: var(--accent);
}

/* ---------- topbar ---------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem var(--gutter);
  padding-top: max(0.7rem, env(safe-area-inset-top));
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  flex: 0 0 auto;
}

.brand {
  font-weight: 650;
  letter-spacing: -0.01em;
}

.brand small {
  display: block;
  font-weight: 400;
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0;
}

.topbar nav {
  margin-left: auto;
  display: flex;
  gap: 0.4rem;
}

/* ---------- the conversation ---------- */

.scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.column {
  max-width: 44rem;
  margin: 0 auto;
  padding: 1.25rem var(--gutter) 1.5rem;
}

.intro h1 {
  font-size: 1.45rem;
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin: 0.25rem 0 0.5rem;
}

.intro p {
  margin: 0 0 1rem;
  color: var(--muted);
}

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

.chip {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  font: inherit;
  font-size: 0.92rem;
  cursor: pointer;
  text-align: left;
}

.chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

#thread {
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}

#thread:not(:empty) {
  margin-top: 1.4rem;
}

.turn .who {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.3rem;
}

.turn .text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.turn.du .text {
  background: var(--accent-soft);
  border-radius: var(--radius);
  padding: 0.6rem 0.85rem;
}

/* The caret while the answer is still arriving. Removed on `done`, so a finished answer is plain text. */
.turn.skriver .text::after {
  content: "";
  display: inline-block;
  width: 0.5em;
  height: 1.05em;
  margin-left: 0.1em;
  vertical-align: -0.18em;
  background: var(--accent);
  border-radius: 1px;
  animation: blink 1.1s steps(1) infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .turn.skriver .text::after {
    animation: none;
  }
}

.turn .fel {
  margin-top: 0.6rem;
  border-left: 3px solid var(--flag);
  background: var(--flag-soft);
  color: var(--ink);
  border-radius: 0 8px 8px 0;
  padding: 0.55rem 0.8rem;
  font-size: 0.95rem;
}

/* ---------- an avrop, as a card ---------- */

.kort {
  margin-top: 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 0.85rem 1rem;
  box-shadow: 0 1px 2px rgb(20 24 27 / 4%);
}

.kort h3 {
  margin: 0 0 0.15rem;
  font-size: 1rem;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.kort .var {
  margin: 0 0 0.6rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.kort dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.2rem 0.75rem;
  margin: 0;
  font-size: 0.92rem;
}

.kort dt {
  color: var(--muted);
}

.kort dd {
  margin: 0;
}

.kort .svarsdag {
  display: inline-block;
  margin-top: 0.7rem;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  background: var(--accent-soft);
  color: var(--accent);
}

.kort .svarsdag.ikvall {
  background: var(--flag-soft);
  color: var(--flag);
}

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

.composer {
  flex: 0 0 auto;
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding: 0.7rem var(--gutter);
  padding-bottom: max(0.7rem, env(safe-area-inset-bottom));
}

.composer .column {
  padding: 0;
}

#ask {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  padding: 0.35rem 0.35rem 0.35rem 0.75rem;
}

#ask:focus-within {
  border-color: var(--accent);
}

#question {
  flex: 1 1 auto;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  resize: none;
  max-height: 8.5rem;
  padding: 0.45rem 0;
  outline: none;
}

.skicka {
  flex: 0 0 auto;
  width: 2.4rem;
  height: 2.4rem;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: var(--surface);
  cursor: pointer;
  display: grid;
  place-items: center;
}

.skicka svg {
  width: 1.1rem;
  height: 1.1rem;
  fill: currentcolor;
}

.skicka:disabled {
  opacity: 0.4;
  cursor: default;
}

.finstilt {
  margin: 0.55rem 0 0;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--muted);
  text-align: center;
}

/* ---------- buttons ---------- */

.knapp {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
}

.knapp:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.knapp.fylld {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

@media (prefers-color-scheme: dark) {
  .knapp.fylld {
    color: #10201c;
  }
}

.knapp.fylld:hover {
  color: #fff;
  opacity: 0.92;
}

@media (prefers-color-scheme: dark) {
  .knapp.fylld:hover {
    color: #10201c;
  }
}

/* ---------- sheets: consent, sign-in, profile, privacy ---------- */

.skugga {
  position: fixed;
  inset: 0;
  background: rgb(10 14 16 / 45%);
  z-index: 10;
}

.ark {
  position: fixed;
  z-index: 11;
  background: var(--surface);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  max-height: 88dvh;
}

/* Phone: a sheet from the bottom, where the thumb is. */
.ark {
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 18px 18px 0 0;
}

@media (min-width: 46rem) {
  .ark {
    left: 50%;
    right: auto;
    bottom: auto;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 34rem;
    border-radius: var(--radius);
    max-height: 82vh;
  }
}

.ark .innehall {
  overflow-y: auto;
  padding: 1.25rem var(--gutter) 1.5rem;
  padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
}

.ark h2 {
  margin: 0 0 0.6rem;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
}

.ark h3 {
  margin: 1.4rem 0 0.3rem;
  font-size: 0.95rem;
}

.ark p {
  margin: 0 0 0.8rem;
}

.ark .stang {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.4rem;
  line-height: 1;
  padding: 0.3rem 0.5rem;
  cursor: pointer;
}

.ark .val {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
}

/* ---------- forms inside a sheet ---------- */

.falt {
  display: block;
  margin: 0.9rem 0 0.2rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.ark input[type="email"] {
  width: 100%;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  color: inherit;
  font: inherit;
}

.ark input[type="email"]:focus {
  outline: none;
  border-color: var(--accent);
}

.besked {
  margin-top: 0.9rem;
  border-radius: 10px;
  padding: 0.6rem 0.8rem;
  font-size: 0.92rem;
  background: var(--accent-soft);
  color: var(--ink);
}

.besked.fel {
  background: var(--flag-soft);
  color: var(--ink);
}

/* ---------- the profile, read as a list ---------- */

.profil {
  margin: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.1rem;
}

.profil div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--line-soft);
}

.profil dt {
  color: var(--muted);
  font-size: 0.9rem;
}

.profil dd {
  margin: 0;
  text-align: right;
}

.profil dd.tom {
  color: var(--muted);
  font-style: italic;
}

.matare {
  height: 6px;
  border-radius: 3px;
  background: var(--line);
  overflow: hidden;
  margin: 0.35rem 0 0.9rem;
}

.matare span {
  display: block;
  height: 100%;
  background: var(--accent);
}

/* ---------- the privacy page, standing on its own ---------- */

body.prosa {
  display: block;
  height: auto;
  overflow: visible;
}

.prosa .column {
  padding-top: 1.75rem;
  padding-bottom: 4rem;
}

.prosa h1 {
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  margin: 0 0 0.75rem;
}

.prosa h2 {
  font-size: 1.05rem;
  margin: 2rem 0 0.4rem;
}

.prosa p {
  margin: 0 0 0.9rem;
}

[hidden] {
  display: none !important;
}
