/* ---------------------------------------------------------------------------
   GP shared-care letter generator — anne healthcare house-style demo.
   Tokens match the bloods finder and wider ah design system.
--------------------------------------------------------------------------- */

:root {
  --cta:            #1a67cc;
  --cta-dark:       #14509f;
  --cta-darker:     #175cb5;
  --accent:         #18d6c4;
  --accent-dark:    #13a89a;
  --cream:          #f4eed7;
  --cream-border:   #e9ddaf;
  --cream-light:    #fffcf0;
  --cool:           #e5eef8;
  --cool-border:    #bdd4ed;

  --dark:           #333;
  --grey:           #4d4d4d;
  --grey-soft:      #676767;
  --grey-line:      #e0e0e0;
  --light:          #fff;
  --danger:         #c12727;

  --font-heading:   "Inter", system-ui, sans-serif;
  --font-body:      "DM Sans", system-ui, sans-serif;

  --radius-sm:      0.5rem;
  --radius-md:      1.5rem;
  --radius-lg:      2rem;
  --radius-pill:    100em;
  --shadow-soft:    0 3px 6px 0 rgba(0, 0, 0, 0.06);
  --shadow-lift:    0 12px 32px -16px rgba(20, 80, 159, 0.22),
                    0  3px  6px  0   rgba(0, 0, 0, 0.06);
  --ring:           0 0 0 3px rgba(26, 103, 204, 0.18);

  --content-max:    112rem;
  --gutter:         clamp(2rem, 5vw, 6rem);
}

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

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

body {
  margin: 0;
  background: var(--light);
  color: var(--dark);
  font-family: var(--font-body);
  font-size: 1.7rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-image:
    radial-gradient(ellipse 90rem 50rem at 8% -10%, rgba(229, 238, 248, 0.9), transparent 60%),
    radial-gradient(ellipse 70rem 40rem at 100% 5%, rgba(244, 238, 215, 0.65), transparent 55%);
  background-repeat: no-repeat;
}

a { color: var(--cta); text-decoration: none; }
a:hover { color: var(--cta-dark); text-decoration: underline; }

.skip-link {
  position: absolute; left: -9999px;
  background: var(--cta); color: var(--light);
  padding: 1rem 1.6rem; border-radius: var(--radius-sm);
}
.skip-link:focus { left: 1rem; top: 1rem; z-index: 10; }

/* --- Header --------------------------------------------------------------- */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding: 2.4rem var(--gutter);
  max-width: var(--content-max);
  margin: 0 auto;
}
.brand { display: inline-flex; }
.brand img { height: 3.6rem; width: auto; display: block; }

.brand-group { display: flex; flex-direction: column; gap: 0.6rem; }
.back-links { display: flex; gap: 1.2rem; }


.back-link {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--cta);
  text-decoration: none;
  letter-spacing: 0.02em;
}
.back-link:hover { color: var(--cta-dark); text-decoration: underline; }

.chip {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-pill);
  background: var(--cream);
  color: var(--cta-dark);
  border: 1px solid var(--cream-border);
  white-space: nowrap;
}

/* --- Layout --------------------------------------------------------------- */

main {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 4rem var(--gutter) 8rem;
  display: flex;
  flex-direction: column;
  gap: 4rem;
}

/* --- Intro ---------------------------------------------------------------- */

.intro { max-width: 78rem; }
.kicker {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--cta);
  margin: 0 0 1.4rem;
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
}
.kicker::before {
  content: "";
  width: 2.4rem;
  height: 0.2rem;
  background: var(--accent);
  border-radius: 2px;
  display: inline-block;
}
h1 {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: clamp(3.8rem, 5.6vw, 6.4rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0 0 2rem;
  color: var(--dark);
}
.lede {
  font-size: clamp(1.8rem, 1.6vw, 2.1rem);
  line-height: 1.5;
  color: var(--grey);
  margin: 0;
  max-width: 56rem;
}

/* --- Wizard --------------------------------------------------------------- */

.wizard {
  max-width: 82rem;
}

/* --- Progress stepper ----------------------------------------------------- */

.stepper {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 3.2rem;
}
.stepper__step {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 0 0 auto;
}
.stepper__num {
  width: 3.6rem;
  height: 3.6rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.5rem;
  background: var(--grey-line);
  color: var(--grey-soft);
  transition: background 0.2s, color 0.2s;
  flex-shrink: 0;
}
.stepper__label {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--grey-soft);
  transition: color 0.2s;
  white-space: nowrap;
}
.stepper__line {
  flex: 1;
  height: 2px;
  background: var(--grey-line);
  margin: 0 1.6rem;
  min-width: 2rem;
  transition: background 0.2s;
}
.stepper__step--active .stepper__num {
  background: var(--cta);
  color: var(--light);
}
.stepper__step--active .stepper__label {
  color: var(--cta);
}
.stepper__step--done .stepper__num {
  background: var(--accent);
  color: var(--light);
}
.stepper__step--done .stepper__label {
  color: var(--accent-dark);
}
.stepper__line--done {
  background: var(--accent);
}
.stepper__line--active {
  background: linear-gradient(90deg, var(--accent) 0%, var(--cta) 100%);
}

@media (max-width: 720px) {
  .stepper__label { display: none; }
  .stepper__line { min-width: 1.4rem; margin: 0 0.8rem; }
}

/* --- Step panel ----------------------------------------------------------- */

.step-panel {
  background: var(--light);
  border: 1px solid var(--grey-line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  padding: 4rem clamp(2.4rem, 4vw, 5rem);
  animation: step-in 0.35s cubic-bezier(.22, 1, .36, 1);
}
@keyframes step-in {
  from { opacity: 0; transform: translateY(0.8rem); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .step-panel { animation: none; }
}

.step-panel__eyebrow {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cta);
  margin: 0 0 0.8rem;
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
}
.step-panel__eyebrow::before {
  content: "";
  width: 2rem;
  height: 0.2rem;
  background: var(--accent);
  border-radius: 2px;
}
.step-panel__title {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: clamp(2.4rem, 2.6vw, 3.2rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 0.8rem;
  color: var(--dark);
}
.step-panel__sub {
  font-size: 1.5rem;
  color: var(--grey-soft);
  margin: 0 0 3rem;
  max-width: 56rem;
}

/* --- Step navigation buttons ---------------------------------------------- */

.step-nav {
  display: flex;
  gap: 1.2rem;
  margin-top: 3.2rem;
  flex-wrap: wrap;
}

.btn {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-pill);
  padding: 1.1rem 3rem;
  cursor: pointer;
  line-height: 1;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}
.btn:focus-visible { outline: none; box-shadow: var(--ring); }

.btn--primary {
  background: var(--cta);
  color: var(--light);
}
.btn--primary:hover { background: var(--cta-dark); }
.btn--primary:disabled {
  background: var(--grey-line);
  color: var(--grey-soft);
  cursor: not-allowed;
}

.btn--secondary {
  background: transparent;
  color: var(--cta);
  border: 1.5px solid var(--grey-line);
}
.btn--secondary:hover {
  border-color: var(--cta);
  color: var(--cta-dark);
}

.btn--accent {
  background: var(--accent);
  color: var(--dark);
}
.btn--accent:hover { background: var(--accent-dark); color: var(--light); }

/* --- Member cards (step 1) ------------------------------------------------ */

.search-input {
  font-family: var(--font-body);
  font-size: 1.7rem;
  font-weight: 500;
  color: var(--dark);
  padding: 1.2rem 1.6rem;
  background: var(--light);
  border: 1.5px solid var(--grey-line);
  border-radius: var(--radius-sm);
  width: 100%;
  max-width: 40rem;
  transition: border-color 0.15s, box-shadow 0.15s;
  margin-bottom: 2.4rem;
}
.search-input:focus {
  outline: none;
  border-color: var(--cta);
  box-shadow: var(--ring);
}
.search-input::placeholder { color: #aeb7c2; font-weight: 400; }

.member-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(28rem, 1fr));
  gap: 1.6rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.member-card {
  background: var(--light);
  border: 1.5px solid var(--grey-line);
  border-radius: var(--radius-md);
  padding: 2.4rem 2.2rem;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
  position: relative;
}
.member-card:hover {
  border-color: var(--cta);
  box-shadow: var(--shadow-lift);
  transform: translateY(-2px);
}
.member-card--selected {
  border-color: var(--cta);
  box-shadow: var(--ring), var(--shadow-soft);
  background: #f7faff;
}
.member-card--selected::after {
  content: "";
  position: absolute;
  top: 1.2rem;
  right: 1.2rem;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  background: var(--cta);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
}

.member-card__name {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.9rem;
  color: var(--dark);
  margin: 0 0 0.6rem;
}
.member-card__detail {
  font-size: 1.4rem;
  color: var(--grey-soft);
  margin: 0.3rem 0;
  line-height: 1.5;
}
.member-card__detail strong {
  color: var(--grey);
  font-weight: 500;
}
.member-card__meds {
  font-size: 1.3rem;
  color: var(--grey);
  margin: 1rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid var(--grey-line);
  line-height: 1.5;
}

/* --- Scenario cards (step 2) ---------------------------------------------- */

.scenario-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(28rem, 1fr));
  gap: 1.6rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.scenario-card {
  background: var(--light);
  border: 1.5px solid var(--grey-line);
  border-radius: var(--radius-md);
  padding: 2.4rem 2.4rem;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.scenario-card:hover {
  border-color: var(--cta);
  box-shadow: var(--shadow-lift);
  transform: translateY(-2px);
}
.scenario-card--selected {
  border-color: var(--cta);
  box-shadow: var(--ring), var(--shadow-soft);
  background: #f7faff;
}
.scenario-card--selected::after {
  content: "";
  position: absolute;
  top: 1.2rem;
  right: 1.2rem;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  background: var(--cta);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
}

.scenario-card__icon {
  width: 4rem;
  height: 4rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--cool);
  color: var(--cta);
  margin-bottom: 0.4rem;
}
.scenario-card__title {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.8rem;
  color: var(--dark);
  margin: 0;
  line-height: 1.3;
}
.scenario-card__desc {
  font-size: 1.4rem;
  color: var(--grey-soft);
  margin: 0;
  line-height: 1.5;
}

/* --- Customise form (step 3) ---------------------------------------------- */

.form-grid {
  display: grid;
  gap: 2.4rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.form-group label,
.form-group__label {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.4rem;
  color: var(--dark);
}
.form-group__hint {
  font-size: 1.3rem;
  color: var(--grey-soft);
  margin: 0;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.4rem;
}
@media (max-width: 600px) {
  .form-row { grid-template-columns: 1fr; }
}

.text-input,
.textarea-input {
  font-family: var(--font-body);
  font-size: 1.6rem;
  font-weight: 500;
  color: var(--dark);
  padding: 1.1rem 1.4rem;
  background: var(--light);
  border: 1.5px solid var(--grey-line);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}
.text-input:focus,
.textarea-input:focus {
  outline: none;
  border-color: var(--cta);
  box-shadow: var(--ring);
}
.text-input::placeholder,
.textarea-input::placeholder {
  color: #aeb7c2;
  font-weight: 400;
}

.textarea-input {
  resize: vertical;
  min-height: 8rem;
  line-height: 1.5;
}

/* --- Checkbox group ------------------------------------------------------- */

.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.checkbox-pill {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--grey);
  background: var(--light);
  border: 1.5px solid var(--grey-line);
  border-radius: var(--radius-pill);
  padding: 0.8rem 1.6rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  user-select: none;
}
.checkbox-pill:hover {
  border-color: var(--cta);
  color: var(--cta-dark);
}
.checkbox-pill input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.checkbox-pill--checked {
  background: var(--cta);
  border-color: var(--cta);
  color: var(--light);
}
.checkbox-pill--checked:hover {
  background: var(--cta-dark);
  border-color: var(--cta-dark);
}

/* --- Letter preview (step 4) ---------------------------------------------- */

.letter-wrapper {
  position: relative;
}

.letter {
  background: var(--light);
  border: 1px solid var(--grey-line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lift);
  padding: clamp(3rem, 5vw, 6rem) clamp(3rem, 5vw, 6rem);
  max-width: 72rem;
  margin: 0 auto;
  position: relative;
  font-family: var(--font-body);
  font-size: 1.5rem;
  line-height: 1.7;
  color: var(--dark);
}

/* Fake paper edge */
.letter::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 0.5rem;
  background: linear-gradient(90deg, var(--cta) 0%, var(--accent) 100%);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.letter__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--grey-line);
  flex-wrap: wrap;
}
.letter__logo img {
  height: 3rem;
  width: auto;
}
.letter__org {
  font-size: 1.3rem;
  color: var(--grey-soft);
  text-align: right;
  line-height: 1.6;
}
.letter__org p { margin: 0; }

.letter__date {
  font-size: 1.4rem;
  color: var(--grey-soft);
  margin: 0 0 2rem;
}

.letter__address {
  font-size: 1.5rem;
  color: var(--dark);
  margin: 0 0 2.4rem;
  line-height: 1.6;
}

.letter__re {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.6rem;
  color: var(--dark);
  margin: 0 0 2rem;
  padding: 1.2rem 1.6rem;
  background: var(--cool);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--cta);
}

.letter__salutation {
  font-size: 1.5rem;
  margin: 0 0 1.6rem;
}

.letter__body p {
  margin: 0 0 1.4rem;
  font-size: 1.5rem;
  line-height: 1.7;
}
.letter__body p:last-child { margin-bottom: 0; }

.letter__body strong {
  font-weight: 600;
  color: var(--dark);
}
.letter__body em {
  font-style: italic;
  color: var(--dark);
  font-weight: 400;
}

.letter__close {
  margin-top: 2.4rem;
  font-size: 1.5rem;
  line-height: 1.7;
}
.letter__close p { margin: 0; }
.letter__sig {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.6rem;
  color: var(--dark);
  margin-top: 1.2rem;
}
.letter__sig-role {
  font-size: 1.4rem;
  color: var(--grey-soft);
  margin: 0.2rem 0 0;
  font-weight: 400;
}

/* --- Letter action buttons ------------------------------------------------ */

.letter-actions {
  display: flex;
  gap: 1.2rem;
  justify-content: center;
  margin-top: 3rem;
  flex-wrap: wrap;
}

/* --- Toast notification --------------------------------------------------- */

.toast {
  position: fixed;
  bottom: 3rem;
  left: 50%;
  transform: translateX(-50%) translateY(1rem);
  background: var(--dark);
  color: var(--light);
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 600;
  padding: 1.2rem 2.4rem;
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-lift);
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 100;
  pointer-events: none;
}
.toast--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* --- Footer --------------------------------------------------------------- */

.site-footer {
  border-top: 1px solid var(--grey-line);
  padding: 3rem var(--gutter) 4rem;
  max-width: var(--content-max);
  margin: 4rem auto 0;
  color: var(--grey-soft);
  font-size: 1.35rem;
}
.site-footer p { margin: 0; max-width: 64rem; }

/* --- Responsive ----------------------------------------------------------- */

@media (max-width: 720px) {
  :root { --gutter: 2rem; }
  .site-header { padding: 1.8rem var(--gutter); }
  main { padding: 2.4rem var(--gutter) 6rem; gap: 3rem; }
  h1 { letter-spacing: -0.015em; }
  .step-panel { padding: 2.8rem 2rem; }
  .member-grid,
  .scenario-grid { grid-template-columns: 1fr; }
  .letter { padding: 2.4rem 2rem; }
}

/* --- Print ---------------------------------------------------------------- */

@media print {
  :root {
    --gutter: 0;
    --shadow-soft: none;
    --shadow-lift: none;
  }
  body { background: none; color: #000; font-size: 11pt; }
  .site-header,
  .site-footer,
  .skip-link,
  .intro,
  .stepper,
  .step-nav,
  .letter-actions,
  .toast { display: none !important; }
  main { display: block; max-width: none; padding: 0; }
  .wizard { max-width: none; }
  .step-panel { border: none; box-shadow: none; padding: 0; animation: none; }
  .letter {
    box-shadow: none;
    border: none;
    padding: 0;
    max-width: none;
    animation: none;
  }
  .letter::before { display: none; }
  .letter__body p { font-size: 11pt; }
}
