/* Leicester Mental Health: site styles */

/* ---------- Fonts (self-hosted DM Sans, SIL Open Font License, see /assets/fonts/OFL.txt) ---------- */
@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-display: swap;
  font-weight: 100 1000;
  src: url("../fonts/dm-sans-latin-opsz-normal.woff2") format("woff2-variations"),
       url("../fonts/dm-sans-latin-opsz-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-display: swap;
  font-weight: 100 1000;
  src: url("../fonts/dm-sans-latin-ext-opsz-normal.woff2") format("woff2-variations"),
       url("../fonts/dm-sans-latin-ext-opsz-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- Tokens ---------- */
:root {
  --bg: #E4EAE6;          /* calm mist */
  --surface: #FAFBFA;     /* chat bubbles */
  --text: #24262B;        /* brand dark-strong */
  --text-muted: #565C67;
  --accent: #7B3FC6;      /* violet from the logo gradient */
  --focus: #5B2FB0;
  --line: rgba(36, 38, 43, .14);
  --solid: #24262B;       /* outgoing bubble / buttons */
  --solid-hover: #32353C; /* brand dark-light */
  --on-solid: #F4F6F5;
  --ok: #2E8B57;

  --band-bg: #24262B;
  --band-text: #F2F4F3;
  --band-muted: #B9BEC6;
  --band-line: rgba(242, 244, 243, .16);
  --band-accent: #C9A2F5;

  --wrap: 1180px;
  --radius-bubble: 26px;
  --radius-tight: 8px;
  --avatar: 36px;
  --avatar-gap: 10px;
}
@media (min-width: 720px) {
  :root { --avatar: 44px; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141719;
    --surface: #22272A;
    --text: #E9EDEA;
    --text-muted: #A2A9B2;
    --accent: #B08CF0;
    --focus: #C9A2F5;
    --line: rgba(233, 237, 234, .14);
    --solid: #E9EDEA;
    --solid-hover: #FFFFFF;
    --on-solid: #141719;
    --ok: #4CC389;

    --band-bg: #0C0E0F;
    --band-line: rgba(242, 244, 243, .12);
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-optical-sizing: auto;
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img, video { display: block; max-width: 100%; }

a {
  color: inherit;
  text-decoration-color: var(--accent);
  text-decoration-thickness: .08em;
  text-underline-offset: .22em;
}
a:hover { text-decoration-thickness: .15em; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 6px;
}

main:focus { outline: none; }

.skip-link {
  position: absolute;
  left: 16px; top: -100px;
  z-index: 10;
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--solid);
  color: var(--on-solid);
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus { top: 16px; }

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: 16px;
}
@media (min-width: 720px) {
  .wrap { padding-inline: 32px; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .6em;
  min-height: 44px;
  padding: .65em 1.2em;
  border-radius: 999px;
  background: var(--solid);
  color: var(--on-solid);
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  transition: background-color .15s ease, transform .15s ease;
}
.btn:hover { background: var(--solid-hover); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 1.05em; height: 1.05em; flex: none; }

/* ---------- Header ---------- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-block: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  text-decoration: none;
  flex: 0 1 auto;
}
.brand img { width: 44px; height: 44px; flex: none; }
.brand-text {
  font-weight: 700;
  font-size: 1.125rem;
  letter-spacing: 0;
  line-height: 1.1;
}

.nav {
  display: flex;
  flex: none;
  align-items: center;
  gap: clamp(8px, 2.5vw, 28px);
  font-size: .9375rem;
  font-weight: 500;
}
.nav a { white-space: nowrap; }
.nav a:not(.btn) {
  padding: 10px 4px;
  text-decoration: none;
}
.nav a:not(.btn):hover { text-decoration: underline; text-decoration-color: var(--accent); }
.nav .btn { padding-inline: 1em; }
@media (max-width: 519px) {
  .nav .nav-optional,
  .nav .btn { display: none; }
  .brand img { width: 40px; height: 40px; }
}

/* ---------- Hero: the chat thread ---------- */
.hero {
  display: grid;
  gap: 56px;
  padding-block: clamp(24px, 5vw, 64px) clamp(48px, 6vw, 72px);
}
@media (min-width: 960px) {
  .hero {
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
    gap: 72px;
    align-items: start;
  }
}

.avatar {
  position: absolute;
  left: calc(-1 * (var(--avatar) + var(--avatar-gap)));
  bottom: 0;
  width: var(--avatar); height: var(--avatar);
  border-radius: 50%;
}
.status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  padding-left: calc(var(--avatar) + var(--avatar-gap));
  font-size: .875rem;
  line-height: 1.3;
  color: var(--text-muted);
}
.status-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 24%, transparent);
  flex: none;
}

.thread {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding-left: calc(var(--avatar) + var(--avatar-gap)); /* gutter for the avatar */
}

.bubble {
  max-width: 36em;
  margin: 0;
  padding: .8em 1.15em;
  background: var(--surface);
  border-radius: var(--radius-tight) var(--radius-bubble) var(--radius-bubble) var(--radius-tight);
}
.bubble--first { border-top-left-radius: var(--radius-bubble); }
.bubble--last  { position: relative; }

.bubble--headline {
  padding: clamp(18px, 3vw, 30px) clamp(22px, 3.6vw, 40px) clamp(20px, 3.2vw, 34px);
}
.bubble--headline h1 {
  margin: 0;
  font-size: clamp(2.75rem, 1.5rem + 5.4vw, 5.75rem);
  font-weight: 700;
  line-height: .98;
  letter-spacing: -.035em;
}
.bubble--lede {
  font-size: clamp(1.125rem, 1rem + .5vw, 1.3125rem);
  line-height: 1.45;
}

.reply {
  align-self: flex-end;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  margin-top: 18px;
}
.btn--reply {
  font-size: clamp(1.0625rem, 1rem + .3vw, 1.1875rem);
  padding: 1em 1.45em;
  border-radius: var(--radius-bubble) var(--radius-bubble) var(--radius-tight) var(--radius-bubble);
}
.reply-note {
  margin: 0;
  font-size: .875rem;
  color: var(--text-muted);
}

/* The one orchestrated moment: the conversation arrives */
@media (prefers-reduced-motion: no-preference) {
  .thread > * {
    animation: bubble-in .55s cubic-bezier(.2, .8, .2, 1) both;
    transform-origin: bottom left;
  }
  .thread > .reply { transform-origin: bottom right; }
  .thread > :nth-child(1) { animation-delay: .05s; }
  .thread > :nth-child(2) { animation-delay: .45s; }
  .thread > :nth-child(3) { animation-delay: .8s; }
  .thread > :nth-child(4) { animation-delay: 1.3s; }

  @keyframes bubble-in {
    from { opacity: 0; transform: translateY(12px) scale(.97); }
    to   { opacity: 1; transform: none; }
  }
}

/* ---------- Hero aside ---------- */
@media (min-width: 960px) {
  .about { padding-top: 58px; }
}

.about-title {
  margin: 0 0 6px;
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -.005em;
}
.facts {
  margin: 0;
  border-top: 1px solid var(--line);
  font-size: .9375rem;
}
.facts > div {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2px;
  padding-block: 13px;
  border-bottom: 1px solid var(--line);
}
@media (min-width: 420px) {
  .facts > div {
    grid-template-columns: 9em 1fr;
    gap: 16px;
  }
}
.facts dt { color: var(--text-muted); }
.facts dd { margin: 0; }

/* ---------- FAQ ---------- */
.faq {
  display: grid;
  gap: 36px;
  padding-block: clamp(48px, 6vw, 80px) clamp(64px, 8vw, 104px);
}
@media (min-width: 960px) {
  .faq {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
    gap: 72px;
    align-items: start;
  }
  .faq-intro { position: sticky; top: 32px; }
}

.faq-intro h2 {
  margin: 0;
  max-width: 13em;
  font-size: clamp(2rem, 1.35rem + 2.5vw, 3.25rem);
  font-weight: 700;
  line-height: 1.04;
  letter-spacing: -.028em;
  text-wrap: balance;
}

.faq-list { border-top: 1px solid var(--line); }
.faq-list details { border-bottom: 1px solid var(--line); }

.faq-list summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 44px;
  padding-block: 20px;
  cursor: pointer;
  list-style: none;
}
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary h3 {
  margin: 0;
  font-size: clamp(1.0625rem, 1rem + .35vw, 1.25rem);
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -.01em;
}
.faq-list summary:hover h3 { text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: .22em; }

.faq-icon {
  position: relative;
  flex: none;
  width: 32px; height: 32px;
  border: 1px solid var(--line);
  border-radius: 50%;
}
.faq-icon::before,
.faq-icon::after {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  width: 12px; height: 2px;
  margin: -1px 0 0 -6px;
  border-radius: 2px;
  background: currentColor;
  transition: transform .25s ease;
}
.faq-icon::after { transform: rotate(90deg); }
details[open] .faq-icon::after { transform: rotate(0deg); }
details[open] .faq-icon { background: var(--surface); }

.faq-answer {
  max-width: 38em;
  padding: 0 52px 24px 0;
}
.faq-answer p { margin: 0 0 .8em; }
.faq-answer > :last-child { margin-bottom: 0; }
.faq-answer ul { margin: 0 0 .8em; padding-left: 1.2em; }
.faq-answer li { margin-bottom: .25em; }
.faq-answer li::marker { color: var(--accent); }

@media (prefers-reduced-motion: no-preference) {
  :root { interpolate-size: allow-keywords; }
  .faq-list details::details-content {
    block-size: 0;
    overflow: hidden;
    transition: block-size .3s ease, content-visibility .3s allow-discrete;
  }
  .faq-list details[open]::details-content { block-size: auto; }
}

/* ---------- Closing chat ---------- */
.closing {
  padding-block: 0 clamp(64px, 9vw, 120px);
}
.closing .thread { max-width: 30rem; }
.closing .bubble {
  font-size: clamp(1.75rem, 1.3rem + 1.8vw, 2.5rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -.025em;
  padding: .5em .75em .55em;
  border-radius: var(--radius-bubble) var(--radius-bubble) var(--radius-bubble) var(--radius-tight);
}
.closing .reply { margin-top: 12px; }

/* ---------- Urgent help ---------- */
.urgent {
  padding-block: clamp(64px, 9vw, 104px);
  background: var(--band-bg);
  color: var(--band-text);
}
.urgent-grid {
  display: grid;
  gap: 32px;
}
@media (min-width: 960px) {
  .urgent-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
    gap: 72px;
  }
}
.urgent h2 {
  margin: 0 0 14px;
  font-size: clamp(1.75rem, 1.3rem + 1.8vw, 2.5rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -.022em;
}
.urgent-intro p {
  margin: 0;
  max-width: 30em;
  color: var(--band-muted);
}
.urgent :focus-visible { outline-color: var(--band-accent); }

.lines {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--band-line);
}
.lines a {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  padding-block: 18px;
  border-bottom: 1px solid var(--band-line);
  color: inherit;
  text-decoration: none;
}
@media (min-width: 560px) {
  .lines a {
    grid-template-columns: 10.5rem 1fr;
    gap: 24px;
    align-items: baseline;
  }
}
.line-number {
  font-size: clamp(1.625rem, 1.35rem + 1vw, 2.125rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -.02em;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  transition: color .15s ease;
}
.line-number small {
  display: block;
  margin-top: 2px;
  font-size: .875rem;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--band-muted);
}
.line-text strong {
  display: block;
  font-weight: 600;
}
.line-text span { color: var(--band-muted); }
.lines a:hover .line-number { color: var(--band-accent); }
.lines a:hover .line-text strong { text-decoration: underline; text-decoration-color: var(--band-accent); text-underline-offset: .22em; }

/* ---------- Footer ---------- */
.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 40px;
  padding-block: 36px 44px;
  font-size: .9375rem;
  color: var(--text-muted);
}
.site-footer p { margin: 0; }
.site-footer .brand img { width: 36px; height: 36px; }
.site-footer .brand-text { font-size: 1rem; color: var(--text); }
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 28px;
}


/* ---------- 404 page ---------- */
.notfound {
  padding-block: clamp(32px, 6vw, 80px) clamp(64px, 9vw, 120px);
}
.notfound .thread { max-width: 40rem; }
.notfound .bubble--headline h1 {
  font-size: clamp(2.25rem, 1.5rem + 3.4vw, 4rem);
  line-height: 1.02;
}
.notfound-help {
  max-width: 40rem;
  margin: 56px 0 0;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  color: var(--text-muted);
}
.notfound-help strong { color: var(--text); }
