/*
 * Shared presentation for the in-app information dialog and standalone help.
 * Calendar event colours intentionally remain outside this stylesheet.
 */

:is(.help-document, .project-story) {
  --help-ink: var(--ink, #182934);
  --help-ink-soft: var(--ink-soft, #405563);
  --help-muted: var(--muted, #667985);
  --help-brand: var(--brand, #315f7d);
  --help-brand-dark: var(--brand-dark, #244a63);
  --help-brand-soft: var(--brand-soft, #eaf1f5);
  --help-accent: var(--accent, #b58b3a);
  --help-line: var(--line, #dbe2e5);
  --help-paper: var(--paper, #fffdf8);
  --help-surface: var(--surface, #fff);
  --help-surface-soft: var(--surface-soft, #f5f8f7);
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  color: var(--help-ink-soft);
  line-height: 1.62;
}

.help-document {
  display: grid;
  gap: clamp(0.85rem, 1.7vw, 1.25rem);
}

:is(.help-document, .project-story) :is(h1, h2, h3, h4, h5, p) {
  overflow-wrap: break-word;
}

:is(.help-document, .project-story) :is(h1, h2, h3, h4, h5) {
  margin: 0;
  color: var(--help-ink);
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  font-weight: 600;
  line-height: 1.16;
}

:is(.help-document, .project-story) p {
  margin: 0;
}

:is(.help-document, .project-story) a {
  color: var(--help-brand);
  font-weight: 700;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

:is(.help-document, .project-story) a:hover {
  color: var(--help-brand-dark);
}

.help-eyebrow,
.help-kicker {
  margin: 0 0 0.26rem !important;
  color: var(--help-brand) !important;
  font-family: ui-sans-serif, system-ui, sans-serif !important;
  font-size: 0.67rem !important;
  font-weight: 820 !important;
  letter-spacing: 0.13em;
  line-height: 1.3 !important;
  text-transform: uppercase;
}

.help-kicker {
  color: #7f6227 !important;
  font-size: 0.62rem !important;
}

.help-hero {
  position: relative;
  display: grid;
  min-height: 10.5rem;
  align-content: end;
  gap: 0.62rem;
  overflow: hidden;
  padding: clamp(1rem, 2.6vw, 1.7rem);
  border: 1px solid rgba(49, 95, 125, 0.16);
  border-radius: 1rem;
  background:
    linear-gradient(112deg, rgba(255, 255, 255, 0.99) 0%, rgba(255, 255, 255, 0.94) 58%, rgba(234, 241, 245, 0.7) 100%),
    radial-gradient(circle at 92% 18%, rgba(181, 139, 58, 0.2), transparent 11rem);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 10px 28px rgba(24, 41, 52, 0.06);
}

.help-hero::after {
  position: absolute;
  top: -2.2rem;
  right: clamp(1rem, 5vw, 4rem);
  width: 7.5rem;
  height: 11rem;
  border: 1px solid rgba(181, 139, 58, 0.17);
  border-radius: 99rem 99rem 0 0;
  content: "";
  opacity: 0.75;
  transform: rotate(10deg);
}

.help-hero > * {
  position: relative;
  z-index: 1;
}

.help-hero h1 {
  max-width: 22ch;
  font-size: clamp(1.65rem, 3.4vw, 2.65rem);
  letter-spacing: -0.025em;
}

.help-hero--compact {
  min-height: 8.4rem;
}

.help-intro {
  max-width: 72ch;
  color: var(--help-ink-soft);
  font-size: clamp(0.95rem, 1.4vw, 1.08rem);
}

.help-section-nav {
  display: flex;
  gap: 0.4rem;
  padding: 0.22rem 0.08rem 0.3rem;
  overflow-x: auto;
  scrollbar-width: thin;
  scroll-snap-type: x proximity;
}

.help-section-nav a {
  min-height: 2rem;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  padding: 0.38rem 0.68rem;
  border: 1px solid var(--help-line);
  border-radius: 999px;
  background: var(--help-surface);
  color: var(--help-brand-dark);
  font-size: 0.72rem;
  line-height: 1.2;
  scroll-snap-align: start;
  text-decoration: none;
}

.help-section-nav a:hover {
  border-color: rgba(49, 95, 125, 0.38);
  background: var(--help-brand-soft);
}

.help-section {
  display: grid;
  gap: 0.82rem;
  padding: clamp(0.9rem, 2vw, 1.3rem);
  border: 1px solid var(--help-line);
  border-radius: 0.95rem;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 6px 22px rgba(24, 41, 52, 0.045);
  scroll-margin-top: 1rem;
}

.help-section--tinted {
  background: linear-gradient(135deg, rgba(234, 241, 245, 0.72), rgba(255, 253, 248, 0.92));
}

.help-section__heading {
  display: grid;
  max-width: 74ch;
  gap: 0.28rem;
}

.help-section__heading h2 {
  font-size: clamp(1.25rem, 2.2vw, 1.65rem);
}

.help-section__heading > p:not(.help-kicker) {
  color: var(--help-muted);
  font-size: 0.9rem;
}

.help-split {
  display: grid;
  grid-template-columns: minmax(15rem, 0.82fr) minmax(0, 1.45fr);
  align-items: start;
  gap: clamp(0.85rem, 2vw, 1.35rem);
}

.help-split--reverse {
  grid-template-columns: minmax(0, 1.45fr) minmax(15rem, 0.82fr);
}

.help-copy {
  display: grid;
  max-width: 72ch;
  gap: 0.68rem;
}

.help-copy h3 {
  font-size: 1.08rem;
}

.help-copy :is(ul, ol) {
  display: grid;
  gap: 0.38rem;
  margin: 0;
  padding-left: 1.15rem;
}

.help-copy li::marker {
  color: var(--help-accent);
  font-weight: 800;
}

.help-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.62rem;
}

.help-grid--two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.help-card {
  display: grid;
  align-content: start;
  gap: 0.35rem;
  padding: 0.82rem;
  border: 1px solid var(--help-line);
  border-radius: 0.75rem;
  background: var(--help-surface-soft);
}

.help-card h3 {
  font-size: 0.98rem;
}

.help-card p,
.help-card li {
  color: var(--help-muted);
  font-size: 0.8rem;
  line-height: 1.5;
}

.help-card :is(ul, ol) {
  display: grid;
  gap: 0.3rem;
  margin: 0;
  padding-left: 1.05rem;
}

.help-step-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.62rem;
  counter-reset: help-step;
}

.help-step {
  position: relative;
  display: grid;
  align-content: start;
  gap: 0.36rem;
  min-height: 8.3rem;
  padding: 0.9rem 0.85rem 0.85rem 3.05rem;
  border: 1px solid var(--help-line);
  border-radius: 0.78rem;
  background: var(--help-surface);
  counter-increment: help-step;
}

.help-step::before {
  position: absolute;
  top: 0.82rem;
  left: 0.82rem;
  display: grid;
  width: 1.65rem;
  height: 1.65rem;
  place-items: center;
  border-radius: 50%;
  background: var(--help-brand-dark);
  color: white;
  content: counter(help-step, decimal-leading-zero);
  font-size: 0.62rem;
  font-weight: 850;
}

.help-step h3 {
  font-size: 0.98rem;
}

.help-step p {
  color: var(--help-muted);
  font-size: 0.8rem;
}

.help-figure {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  border: 1px solid rgba(49, 95, 125, 0.17);
  border-radius: 0.82rem;
  background: #eef3f5;
  box-shadow: 0 12px 30px rgba(24, 41, 52, 0.09);
}

.help-figure picture {
  display: block;
}

.help-figure img,
.prose .help-figure img,
.standalone-help .help-figure img {
  display: block;
  width: 100%;
  max-width: none;
  height: auto;
  max-height: none;
  margin: 0;
  border-radius: 0;
  object-fit: contain;
}

.help-figure figcaption {
  padding: 0.54rem 0.68rem;
  border-top: 1px solid rgba(49, 95, 125, 0.13);
  background: rgba(255, 255, 255, 0.96);
  color: var(--help-muted);
  font-size: 0.7rem;
  line-height: 1.42;
}

.help-figure--contained img {
  max-height: 34rem;
  object-fit: contain;
}

.help-callout {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 0.62rem;
  padding: 0.78rem 0.85rem;
  border: 1px solid rgba(181, 139, 58, 0.24);
  border-radius: 0.72rem;
  background: #fbf7ed;
  color: #5d4d2f;
}

.help-callout::before {
  display: grid;
  width: 1.35rem;
  height: 1.35rem;
  place-items: center;
  border: 1px solid rgba(181, 139, 58, 0.38);
  border-radius: 50%;
  content: "i";
  font-family: Georgia, serif;
  font-size: 0.78rem;
  font-style: italic;
  font-weight: 700;
}

.help-callout p {
  font-size: 0.8rem;
  line-height: 1.5;
}

.help-quote {
  margin: 0;
  padding: 0.8rem 0.9rem 0.8rem 1rem;
  border-left: 3px solid var(--help-accent);
  border-radius: 0 0.7rem 0.7rem 0;
  background: var(--help-paper);
  color: #6f342f;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.93rem;
  font-style: italic;
}

.help-quote cite {
  display: block;
  margin-top: 0.42rem;
  color: var(--help-muted);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 750;
}

.help-link-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.help-link-card {
  display: grid;
  gap: 0.12rem;
  padding: 0.72rem 0.8rem;
  border: 1px solid var(--help-line);
  border-radius: 0.7rem;
  background: var(--help-surface);
  color: var(--help-brand-dark) !important;
  text-decoration: none !important;
}

.help-link-card:hover {
  border-color: rgba(49, 95, 125, 0.38);
  box-shadow: 0 8px 20px rgba(24, 41, 52, 0.07);
}

.help-link-card small {
  color: var(--help-muted);
  font-size: 0.68rem;
  font-weight: 500;
}

.help-table-shell {
  width: 100%;
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--help-line);
  border-radius: 0.75rem;
  background: var(--help-surface);
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.help-table,
.prose .help-table,
.standalone-help .help-table {
  width: 100% !important;
  min-width: 32rem;
  margin: 0 !important;
  border: 0;
  border-collapse: separate !important;
  border-spacing: 0;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 0.76rem;
}

.help-table caption {
  padding: 0.7rem 0.78rem;
  background: var(--help-surface-soft);
  color: var(--help-ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.95rem;
  font-weight: 650;
  text-align: left;
}

.help-table :is(th, td),
.prose .help-table :is(th, td),
.standalone-help .help-table :is(th, td) {
  min-width: 0;
  padding: 0.5rem 0.58rem;
  border: 0;
  border-right: 1px solid var(--help-line);
  border-bottom: 1px solid var(--help-line);
  text-align: left;
  vertical-align: top;
}

.help-table :is(th, td):last-child {
  border-right: 0;
}

.help-table tbody tr:last-child :is(th, td) {
  border-bottom: 0;
}

.help-table thead th,
.prose .help-table thead th,
.standalone-help .help-table thead th {
  position: sticky;
  z-index: 1;
  top: 0;
  background: var(--help-brand-dark);
  color: #fff;
  font-size: 0.67rem;
  letter-spacing: 0.03em;
}

.help-table tbody th {
  background: #f2f6f7;
  color: var(--help-ink);
  font-weight: 800;
}

.help-table tbody tr:nth-child(even) :is(th, td),
.prose .help-table tbody tr:nth-child(even) :is(th, td) {
  background: #f8faf9;
}

.help-table--codes {
  min-width: 25rem;
}

.help-table--calendar {
  min-width: 44rem;
}

.help-details {
  overflow: hidden;
  border: 1px solid var(--help-line);
  border-radius: 0.75rem;
  background: var(--help-surface);
}

.help-details > summary {
  padding: 0.72rem 0.82rem;
  color: var(--help-brand-dark);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 780;
}

.help-details > :not(summary) {
  margin: 0.72rem 0.82rem;
}

/* Project tab */
.project-story {
  display: grid;
  gap: 0.85rem;
}

.project-story__hero {
  position: relative;
  display: grid;
  min-height: 11rem;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: end;
  gap: clamp(0.85rem, 2vw, 1.25rem);
  overflow: hidden;
  padding: clamp(1rem, 2.6vw, 1.6rem);
  border: 1px solid rgba(49, 95, 125, 0.16);
  border-radius: 1rem;
  background:
    linear-gradient(105deg, rgba(255, 255, 255, 0.99), rgba(255, 255, 255, 0.93) 58%, rgba(234, 241, 245, 0.72)),
    radial-gradient(circle at 90% 15%, rgba(181, 139, 58, 0.22), transparent 12rem);
  box-shadow: 0 10px 28px rgba(24, 41, 52, 0.06);
}

.project-story__hero h3 {
  font-size: clamp(1.75rem, 3.4vw, 2.7rem);
  letter-spacing: -0.03em;
}

.project-story__lead {
  max-width: 58ch;
  margin-top: 0.45rem !important;
  color: var(--help-ink-soft);
  font-size: clamp(0.98rem, 1.5vw, 1.12rem);
}

.project-story__mark {
  position: relative;
  display: grid;
  width: clamp(3.2rem, 6vw, 4.7rem);
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid rgba(49, 95, 125, 0.22);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 10px 24px rgba(24, 41, 52, 0.08);
}

.project-story__mark::before,
.project-story__mark::after {
  position: absolute;
  border-radius: 99px;
  background: var(--help-brand-dark);
  content: "";
}

.project-story__mark::before {
  width: 2px;
  height: 58%;
}

.project-story__mark::after {
  width: 42%;
  height: 2px;
  transform: translateY(-12%);
}

.project-story__intro,
.project-story__sources {
  display: grid;
  grid-template-columns: minmax(12rem, 0.58fr) minmax(0, 1.42fr);
  align-items: start;
  gap: clamp(0.8rem, 2vw, 1.4rem);
  padding: 1rem;
  border-bottom: 1px solid var(--help-line);
}

.project-story__intro h4,
.project-story__sources h4,
.project-story__section-heading h4 {
  font-size: clamp(1.15rem, 2vw, 1.48rem);
}

.project-story__pillars {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.58rem;
}

.project-story__pillars article {
  display: grid;
  min-height: 9rem;
  align-content: start;
  gap: 0.38rem;
  padding: 0.88rem;
  border: 1px solid var(--help-line);
  border-radius: 0.78rem;
  background: linear-gradient(155deg, #fff, var(--help-surface-soft));
}

.project-story__pillars span {
  color: var(--help-accent);
  font-size: 0.62rem;
  font-weight: 850;
  letter-spacing: 0.1em;
}

.project-story__pillars h4 {
  font-size: 1rem;
}

.project-story__pillars p {
  color: var(--help-muted);
  font-size: 0.79rem;
}

.project-story__section {
  display: grid;
  gap: 0.7rem;
  padding-top: 0.4rem;
}

.project-story__credits {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.58rem;
}

.project-story__credits article {
  padding: 0.85rem;
  border: 1px solid var(--help-line);
  border-radius: 0.75rem;
  background: var(--help-surface);
}

.project-story__credits article:last-child {
  grid-column: 1 / -1;
}

.project-story__credits h5 {
  margin-bottom: 0.3rem;
  color: var(--help-brand-dark);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 0.77rem;
  font-weight: 800;
}

.project-story__credits p {
  font-size: 0.79rem;
}

.project-story__sources nav {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
}

.project-story__sources a {
  display: grid;
  gap: 0.1rem;
  padding: 0.68rem 0.72rem;
  border: 1px solid var(--help-line);
  border-radius: 0.68rem;
  background: var(--help-surface);
  color: var(--help-brand-dark);
  font-size: 0.77rem;
  text-decoration: none;
}

.project-story__sources a:hover {
  border-color: rgba(49, 95, 125, 0.38);
  box-shadow: 0 7px 18px rgba(24, 41, 52, 0.07);
}

.project-story__sources small {
  color: var(--help-muted);
  font-size: 0.64rem;
  font-weight: 500;
}

.project-story__future {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.7rem;
  padding: 0.82rem 0.9rem;
  border: 1px solid rgba(181, 139, 58, 0.24);
  border-radius: 0.75rem;
  background: linear-gradient(135deg, #fbf7ed, var(--help-paper));
  color: #5d4d2f;
}

.project-story__future > span {
  color: var(--help-accent);
}

.project-story__future p {
  font-size: 0.8rem;
}

@media (max-width: 900px) {
  .help-grid,
  .help-step-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .help-split,
  .help-split--reverse {
    grid-template-columns: 1fr;
  }

  .help-split--reverse .help-copy {
    order: -1;
  }

  .project-story__sources {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .help-document {
    gap: 0.7rem;
  }

  .help-hero {
    min-height: 8.5rem;
    padding: 0.92rem;
    border-radius: 0.78rem;
  }

  .help-hero--compact {
    min-height: 7.4rem;
  }

  .help-hero h1 {
    font-size: clamp(1.45rem, 8vw, 1.9rem);
  }

  .help-section {
    gap: 0.68rem;
    padding: 0.78rem;
    border-radius: 0.78rem;
  }

  .help-grid,
  .help-grid--two,
  .help-step-grid,
  .project-story__pillars,
  .project-story__credits,
  .project-story__sources nav {
    grid-template-columns: 1fr;
  }

  .project-story__credits article:last-child {
    grid-column: auto;
  }

  .help-step {
    min-height: 0;
  }

  .help-figure {
    border-radius: 0.65rem;
  }

  .help-figure figcaption {
    font-size: 0.66rem;
  }

  .help-table {
    font-size: 0.72rem;
  }

  .project-story__hero {
    min-height: 8.7rem;
    align-items: center;
    padding: 0.9rem;
    border-radius: 0.78rem;
  }

  .project-story__mark {
    width: 3rem;
  }

  .project-story__hero h3 {
    font-size: clamp(1.4rem, 7vw, 1.8rem);
  }

  .project-story__lead {
    font-size: 0.86rem;
  }

  .project-story__intro {
    grid-template-columns: 1fr;
    padding: 0.8rem 0.15rem;
  }

  .project-story__pillars article {
    min-height: 0;
  }

  .project-story__sources {
    padding: 0.8rem 0.15rem;
  }
}

@media print {
  .help-section-nav {
    display: none;
  }

  :is(.help-section, .help-card, .help-step, .help-figure) {
    break-inside: avoid;
    box-shadow: none;
  }
}
