/* Clinical calculators front page, PanaceAI.
   Light, cool ground; indigo ink; the logo's own blue for links and focus;
   one stain colour (eosin magenta) for the condition under each calculator's name. */

:root {
  --ground: #f5f6f9;
  --ink: #191a30;
  --ink-2: #474b63;
  --ink-3: #62667d;
  --rule: #d9dce6;
  --rule-soft: #e4e6ee;
  --blue: #0066cc;
  --blue-deep: #00509f;
  --use-ground: #e8eff8;
  --stain: #9c2a6e;

  --display: "Libre Caslon Display", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --text: "Noto Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;

  --gutter: clamp(1.25rem, 4vw, 2.5rem);
  --max: 74rem;

  color-scheme: light;
}

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

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

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--text);
  font-size: clamp(1rem, 0.96rem + 0.18vw, 1.0625rem);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

p, li, dd, figcaption { text-wrap: pretty; }

img { max-width: 100%; height: auto; display: block; }

a { color: var(--blue); }
a:hover { color: var(--blue-deep); }

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

::selection { background: #cfe1f6; }

.wrap {
  width: min(100% - 2 * var(--gutter), var(--max));
  margin-inline: auto;
}

.vh {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.nw { white-space: nowrap; }

.skip {
  position: absolute;
  left: var(--gutter);
  top: -4rem;
  z-index: 10;
  padding: 0.6rem 1rem;
  background: var(--ink);
  color: #fff;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 500;
}
.skip:focus { top: 0.75rem; color: #fff; }

/* Masthead */

.masthead { border-bottom: 1px solid var(--rule); }

.masthead__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1.1rem;
}

.logo { height: 37px; width: auto; }
@media (min-width: 960px) { .masthead .logo { height: 42px; } }

.masthead__contact {
  color: var(--ink-2);
  font-size: 0.9375rem;
  text-decoration: none;
}
.masthead__contact:hover { color: var(--blue); text-decoration: underline; text-underline-offset: 0.2em; }
@media (max-width: 400px) { .masthead__contact { font-size: 0.875rem; } }

/* Introduction */

.intro {
  padding-block: clamp(2.5rem, 7vw, 5.5rem) clamp(2.5rem, 6vw, 4.5rem);
}

.intro__title {
  margin: 0 0 1.25rem;
  max-width: 13ch;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.5rem, 1.55rem + 3.9vw, 4.4rem);
  line-height: 1.03;
  letter-spacing: -0.005em;
  text-wrap: balance;
}

.intro__lead {
  margin: 0 0 2rem;
  max-width: 34em;
  color: var(--ink-2);
  font-size: clamp(1.0625rem, 1rem + 0.3vw, 1.2rem);
  line-height: 1.6;
}

.use {
  margin: 0 0 2.25rem;
  padding: 1.35rem 1.4rem 1.2rem;
  background: var(--use-ground);
  border-left: 3px solid var(--blue);
  border-radius: 0 8px 8px 0;
}

.use__title {
  margin: 0 0 0.7rem;
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.3;
}

.use__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.use__list li {
  position: relative;
  margin: 0 0 0.65rem;
  padding-left: 1.05rem;
  font-size: 0.96875rem;
  line-height: 1.55;
}
.use__list li:last-child { margin-bottom: 0; }
.use__list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--blue);
}

.contents__list {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--rule);
}

.contents__list li { border-bottom: 1px solid var(--rule); }
.contents__list li:last-child { border-bottom: 0; } /* the first calculator's own rule closes the list */

.contents__list a {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.8rem 0;
  color: var(--ink);
  text-decoration: none;
}

.contents__name {
  font-family: var(--display);
  font-size: 1.5rem;
  line-height: 1.2;
}

.contents__what {
  color: var(--ink-3);
  font-size: 0.9375rem;
}

.contents__list a:hover .contents__name {
  color: var(--blue);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

@media (min-width: 600px) {
  .contents__list a {
    flex-direction: row;
    align-items: baseline;
    justify-content: space-between;
    gap: 1.5rem;
  }
  .contents__what { text-align: right; }
}

@media (min-width: 960px) {
  .intro {
    display: grid;
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    grid-template-areas:
      "title    use"
      "lead     use"
      "contents use";
    grid-template-rows: auto auto 1fr;
    column-gap: clamp(3rem, 6vw, 5.5rem);
    align-items: start;
  }
  .intro__title { grid-area: title; }
  .intro__lead { grid-area: lead; }
  .use { grid-area: use; margin: 0.6rem 0 0; }
  .contents { grid-area: contents; align-self: end; }
}

/* One calculator */

.calc {
  padding-block: clamp(2.75rem, 7vw, 5.5rem);
  border-top: 1px solid var(--rule);
  scroll-margin-top: 1rem;
}

.calc__head { margin-bottom: 1.6rem; }

.calc__name {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.25rem, 1.55rem + 2.6vw, 3.4rem);
  line-height: 1.05;
  letter-spacing: -0.005em;
  text-wrap: balance;
}

.calc__condition {
  margin: 0.45rem 0 0;
  color: var(--stain);
  font-weight: 500;
  font-size: 1.0625rem;
}

.report {
  margin: 0;
  border-top: 1px solid var(--rule);
}

.report__row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.15rem;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--rule-soft);
}

.report dt {
  color: var(--ink-3);
  font-size: 0.9375rem;
  font-weight: 500;
}

.report dd {
  margin: 0;
  max-width: 62ch;
}

@media (min-width: 560px) {
  .report__row {
    grid-template-columns: 6.25rem minmax(0, 1fr);
    column-gap: 1.25rem;
  }
  .report dt { padding-top: 0.08rem; }
}

.paper {
  font-weight: 500;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

.cite {
  display: block;
  margin-top: 0.2rem;
  color: var(--ink-2);
  font-size: 0.9375rem;
}

.go {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1.25rem;
  margin: 2rem 0 0;
}

.go__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: 0.75rem 1.5rem;
  background: var(--ink);
  color: #fff;
  border-radius: 6px;
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.2;
  text-decoration: none;
  transition: background-color 0.15s ease;
}
.go__button:hover { background: var(--blue); color: #fff; }

.go__address {
  color: var(--ink-3);
  font-size: 0.9375rem;
  overflow-wrap: anywhere;
}

@media (max-width: 559px) {
  .go { flex-direction: column; align-items: stretch; }
  .go__button { width: 100%; }
  .go__address { text-align: center; }
}

/* The illustration */

.plate { margin: 2.5rem 0 0; }

.plate__frame {
  position: relative;
  overflow: hidden;
  overflow: clip; /* clip, not hidden: hidden would make the frame its own scroll reference */
  border-radius: 6px;
  background: #e6e8ef;
}
.plate__frame::before {
  /* a hairline so the pale plate keeps its edge on the pale ground */
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(25, 26, 48, 0.08);
  pointer-events: none;
}

.plate figcaption {
  margin-top: 0.75rem;
  max-width: 52ch;
  color: var(--ink-3);
  font-size: 0.875rem;
  line-height: 1.5;
}

@media (min-width: 960px) {
  .calc {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 32rem;
    column-gap: clamp(2.5rem, 5vw, 4.5rem);
    align-items: start;
  }
  .plate { margin-top: 0.4rem; }
}

/* The stain: each plate arrives in grey and takes its colour left to right as it
   scrolls into view. CSS only, and only where the browser supports scroll-linked
   animation and the reader has not asked for reduced motion. */
@supports (animation-timeline: view()) and (overflow: clip) {
  @media (prefers-reduced-motion: no-preference) {
    .plate__frame { view-timeline: --plate block; }

    .plate__frame::after {
      content: "";
      position: absolute;
      inset: 0;
      z-index: 1;
      -webkit-backdrop-filter: grayscale(1);
      backdrop-filter: grayscale(1);
      border-left: 2px solid rgba(156, 42, 110, 0.55);
      pointer-events: none;
      animation: stain linear both;
      animation-timeline: --plate;
      animation-range: entry 20% cover 45%;
    }

    @keyframes stain {
      from { transform: translateX(0); }
      to   { transform: translateX(100%); }
    }
  }
}

/* Footer */

.footer {
  border-top: 1px solid var(--rule);
  background: #eef0f5;
}

.footer__inner {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding-block: 2.5rem 3rem;
}

.logo--footer { height: 44px; }

.footer__text {
  color: var(--ink-2);
  font-size: 0.9375rem;
}
.footer__text p { margin: 0 0 0.5rem; max-width: 60ch; }

.footer__small {
  color: var(--ink-3);
  font-size: 0.875rem;
}

@media (min-width: 760px) {
  .footer__inner {
    flex-direction: row;
    align-items: flex-start;
    gap: 3rem;
  }
}

@media print {
  .skip, .plate__frame::after { display: none; }
  body { background: #fff; }
  .calc { break-inside: avoid; }
  .go__button { background: none; color: var(--ink); padding: 0; min-height: 0; }
  .go__button::after { content: " (" attr(href) ")"; font-weight: 400; }
}
