/* ============================================
   Public pages: the logged-out front page and the help page
   (templates/pages/index.html.twig, templates/pages/help.html.twig).

   Loaded with a <link> in each template's stylesheets block, so it's only
   downloaded on those two pages.

   Readability first, for older readers: 18px body text, lines no longer
   than ~70 characters, generous spacing, 44px+ buttons, and colours from
   root.css tokens (all checked for contrast there).
   ============================================ */

.public-page {
  max-width: 72rem;
  margin: 0 auto;
  padding: var(--space-lg) var(--space-md) var(--space-2xl);
  font-size: var(--font-size-lg);
  line-height: 1.6;
  color: var(--color-text-primary);
}

/* Keep paragraphs to a comfortable line length. */
.public-page p {
  max-width: 70ch;
}

/* One block of content per section, separated by a line. */
.public-section {
  padding: var(--space-xl) 0;
  border-top: 1px solid var(--color-border-light);
}

.public-section h2 {
  font-size: var(--font-size-3xl);
  margin: 0 0 var(--space-md);
}

.public-section h3 {
  font-size: var(--font-size-xl);
  margin: var(--space-lg) 0 var(--space-sm);
}

/* Links in running text: always underlined, so they don't rely on colour. */
.public-page p a,
.public-page li a:not(.btn) {
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.public-page a:not(.btn):hover {
  color: var(--color-primary-dark);
  text-decoration-thickness: 2px;
}

.public-page a:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}

/* ============================================
   Front page
   ============================================ */

/* Hero: centred, on the soft tertiary background. */
.front-hero {
  text-align: center;
  padding: var(--space-2xl) var(--space-lg);
  margin-bottom: var(--space-lg);
  background: var(--color-bg-tertiary);
  border-radius: var(--radius-xl);
}

.front-hero p {
  margin-left: auto;
  margin-right: auto;
}

.front-hero__title {
  font-size: var(--font-size-3xl);
  margin: 0 0 var(--space-md);
}

.front-hero__lead {
  font-size: var(--font-size-xl);
}

/* "Created by researchers at...": secondary, but still well above 4.5:1. */
.front-hero__by {
  color: var(--color-text-secondary);
}

/* Sign Up / Log In: side by side, stacked on narrow screens (full width
   there, so they're easy to tap). */
.front-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-md);
  margin-top: var(--space-lg);
}

.front-actions .btn {
  min-height: 48px;
}

.front-hero .front-actions,
.front-closing .front-actions {
  justify-content: center;
}

@media (max-width: 480px) {
  .front-actions .btn {
    width: 100%;
  }
}

/* Keystone / privacy: two columns when there's room. */
.front-about-points {
  display: grid;
  gap: var(--space-lg);
  grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
}

/* Feature cards: a grid that drops to one column on phones by itself. */
.feature-cards {
  list-style: none;
  margin: var(--space-lg) 0 0;
  padding: 0;
  display: grid;
  gap: var(--space-lg);
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
}

.feature-card {
  padding: var(--space-lg);
  background: var(--color-card-bg);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  box-shadow: 0 1px 3px var(--color-card-shadow);
}

.feature-card__icon {
  color: var(--color-primary);
}

.public-section .feature-card__title {
  margin-top: var(--space-md);
}

.feature-card__text {
  margin: 0;
}

.front-closing {
  text-align: center;
}

.front-closing p {
  margin-left: auto;
  margin-right: auto;
}

.front-closing__help {
  margin-top: var(--space-xl);
}

.front-closing__help .fa-solid {
  color: var(--color-primary);
  margin-right: var(--space-xs);
}

/* ============================================
   Help page
   ============================================ */

.help-intro {
  font-size: var(--font-size-xl);
}

/* "On this page": a boxed list of links, in columns when there's room. */
.help-contents {
  margin: var(--space-lg) 0 var(--space-xl);
  padding: var(--space-lg);
  background: var(--color-bg-tertiary);
  border-radius: var(--radius-lg);
}

.help-contents__title {
  font-size: var(--font-size-xl);
  margin: 0 0 var(--space-sm);
}

.help-contents ul {
  margin: 0;
  padding-left: var(--space-lg);
  columns: 2 16rem;
  column-gap: var(--space-xl);
}

/* Taller rows: easier to tap the right one. */
.help-contents li {
  padding: var(--space-xs) 0;
}

/* Jumping to a section (#medications) leaves a little room above it,
   and :target highlights the heading you landed on. */
.help-section {
  scroll-margin-top: var(--space-lg);
}

.help-section:target h2 {
  color: var(--color-primary-dark);
}

.help-answer {
  margin-top: 0;
}

/* "Go to Medications" + "Back to top" at the end of each section. */
.help-section__links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-lg);
  margin-top: var(--space-lg);
}

.help-section__links .btn {
  min-height: 44px;
}

.help-back-to-top {
  font-size: var(--font-size-base);
}

.help-more-links li {
  padding: var(--space-xs) 0;
}

/* Smooth jumps for those who haven't asked for less motion. */
@media (prefers-reduced-motion: no-preference) {
  html:has(.public-page) {
    scroll-behavior: smooth;
  }
}
