/* Shared stylesheet for Download Solutions. Design direction D. Mobile first. */

/* Fonts: self-hosted, both under the SIL Open Font Licence (licences are in /assets/fonts/). */
@font-face {
  font-family: "Atkinson Hyperlegible";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/atkinson-hyperlegible-latin-400-normal.woff2") format("woff2");
}

@font-face {
  font-family: "Atkinson Hyperlegible";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/assets/fonts/atkinson-hyperlegible-latin-700-normal.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/assets/fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2");
}

:root {
  --text: #1c2430;
  --text-2: #3b4552;
  --muted: #4a5565;
  --accent: #1f3f8f;
  --accent-hover: #142b66;
  --panel: #f5f7fa;
  --rule: #d9dee5;
  --input-border: #7d8999;
  --placeholder: #f0f2f5;
  --footer-bg: #1c2430;
  --footer-text: #e4e8ee;
  --footer-text-2: #c5ccd6;
  --dark: #1c2430;
  --tick: #1f7a4d;
  --cross: #9b2c2c;
  --bg: #ffffff;
  --radius: 6px;
  --radius-card: 8px;
  --max: 1180px;
  --gutter: 24px;
  --sans: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
}

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

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

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
}

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

a {
  color: var(--accent);
}

a:hover {
  color: var(--accent-hover);
}

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

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  z-index: 10;
  padding: 0.5rem 1rem;
  background: var(--bg);
  color: var(--text);
}

.skip-link:focus {
  left: 0;
}

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

/* Headings and text */

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.2;
  font-weight: 700;
}

h1 {
  font-size: clamp(2.125rem, 1.4rem + 2.8vw, 3.125rem);
  letter-spacing: -0.01em;
}

h2 {
  font-size: 1.75rem;
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
}

h3 {
  font-size: 1.1875rem;
}

p {
  margin: 0 0 1rem;
}

.intro {
  font-size: 1.25rem;
  line-height: 1.5;
  color: var(--text-2);
}

.label {
  margin: 0 0 0.75rem;
  font-family: var(--mono);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Header and footer */

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

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-block: 0.875rem;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  font-size: 1.1875rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}

.logo:hover {
  color: var(--text);
}

.logo-icon {
  width: 28px;
  height: 28px;
  color: var(--accent);
}

.site-header ul,
.site-footer ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-header a {
  display: inline-block;
  padding-block: 0.375rem;
  color: var(--text-2);
  text-decoration: none;
}

.site-header a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.site-footer {
  margin-top: 4rem;
  padding-block: 2.5rem;
  background: var(--footer-bg);
  color: var(--footer-text-2);
  font-size: 0.9375rem;
}

.site-footer .footer-about {
  margin-bottom: 1.25rem;
  color: var(--footer-text);
}

.site-footer a {
  display: inline-block;
  padding-block: 0.25rem;
  color: var(--footer-text);
}

.site-footer a:hover {
  color: #ffffff;
}

.site-footer :focus-visible {
  outline-color: var(--footer-text);
}

/* Panels, cards and controls */

.panel {
  background: var(--panel);
}

.intro-block {
  padding-block: clamp(2.5rem, 7vw, 5rem);
  text-align: center;
}

.intro-block h1 {
  max-width: 22ch;
  margin-inline: auto;
}

.intro-block .intro {
  max-width: 44rem;
  margin: 1.25rem auto 0;
}

.search-form {
  max-width: 40rem;
  margin: 1.75rem auto 0;
  text-align: left;
}

.search-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 700;
  color: var(--text);
}

.search-row {
  display: flex;
  gap: 0.75rem;
}

.search-row input[type="search"] {
  flex: 1;
  min-width: 0;
}

input::placeholder {
  color: var(--muted);
  opacity: 1;
}

.shortcuts {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin: 1.25rem 0 0;
  padding: 0;
  list-style: none;
}

.shortcut {
  display: inline-block;
  padding: 0.5rem 0.875rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
}

.shortcut:hover {
  border-color: var(--accent);
  color: var(--accent-hover);
}

.section {
  padding-block: clamp(2.5rem, 6vw, 4rem);
}

.section h2,
.section-head h2 {
  margin-top: 0;
}

.centred {
  text-align: center;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  margin-bottom: 1.5rem;
}

.section-head h2 {
  margin-bottom: 0;
}

/* Ruled grid of product cells: 1px rules between cells, no gaps. */
.product-grid {
  display: grid;
  grid-template-columns: 1fr;
  border-top: 1px solid var(--rule);
  border-left: 1px solid var(--rule);
}

.product-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 1.25rem;
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

/* Screenshots are never cropped: the box keeps its proportions and the whole image is shown inside it. */
.cell-image {
  aspect-ratio: 4 / 3;
  margin-bottom: 1rem;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--placeholder);
}

.cell-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.cell-category {
  margin-bottom: 0.375rem;
}

.product-cell h3 {
  margin-bottom: 0.5rem;
}

.cell-link {
  color: var(--text);
  text-decoration: none;
}

.cell-link::after {
  content: "";
  position: absolute;
  inset: 0;
}

.product-cell:hover .cell-link {
  color: var(--accent);
}

.cell-link:focus-visible {
  outline: none;
}

.product-cell:has(.cell-link:focus-visible) {
  outline: 3px solid var(--accent);
  outline-offset: -3px;
}

.cell-description {
  margin-bottom: 1rem;
  color: var(--text-2);
}

.cell-price {
  margin: auto 0 0.25rem;
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 500;
}

.cell-more {
  margin: 0;
  color: var(--accent);
  font-weight: 700;
}

.product-cell:hover .cell-more {
  text-decoration: underline;
}

.steps {
  display: grid;
  gap: 1rem;
  margin: 1.75rem 0 0;
  padding: 0;
  list-style: none;
}

.step {
  padding: 1.5rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius-card);
  background: var(--bg);
}

.step-number {
  margin: 0 0 0.75rem;
  font-family: var(--mono);
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--accent);
}

.step h3 {
  margin-bottom: 0.5rem;
}

.step p:last-child {
  margin-bottom: 0;
  color: var(--text-2);
}

.points {
  display: grid;
  gap: 2rem 2.5rem;
}

.point h2 {
  margin: 0 0 0.5rem;
  font-size: 1.1875rem;
}

.point p {
  margin: 0;
  color: var(--text-2);
}

.card {
  padding: 1.25rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius-card);
  background: var(--bg);
}

.card h3 {
  margin-bottom: 0.5rem;
}

.card p {
  margin-bottom: 0.25rem;
  color: var(--text-2);
}

.button {
  display: inline-block;
  min-height: 44px;
  padding: 0.6875rem 1.25rem;
  border: 0;
  border-radius: var(--radius);
  background: var(--accent);
  color: #ffffff;
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.4;
  text-decoration: none;
  cursor: pointer;
}

.button:hover {
  background: var(--accent-hover);
  color: #ffffff;
}

input[type="search"],
input[type="email"],
select {
  min-height: 44px;
  padding: 0.6875rem 0.875rem;
  border: 1px solid var(--input-border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1rem;
}

[hidden] {
  display: none !important;
}

.resend-field {
  width: 100%;
  max-width: 28rem;
}

.button-secondary {
  border: 1px solid var(--accent);
  background: var(--bg);
  color: var(--accent);
}

.button-secondary:hover {
  background: var(--panel);
  color: var(--accent-hover);
}

.page-head {
  padding-block: clamp(2rem, 5vw, 3.5rem);
}

.page-head .intro {
  max-width: 44rem;
  margin: 1rem 0 0;
}

.catalogue-form {
  max-width: 48rem;
  margin-top: 1.75rem;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1rem;
  margin-top: 1rem;
}

.field {
  display: flex;
  flex: 1 1 12rem;
  flex-direction: column;
  gap: 0.375rem;
  max-width: 20rem;
}

.field label {
  font-weight: 700;
}

.field select {
  width: 100%;
}

.section.section-tight {
  padding-top: 1.5rem;
}

.results-count {
  margin: 0 0 1rem;
  color: var(--muted);
}

.no-results {
  margin-bottom: 1.5rem;
  padding: 1.25rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius-card);
  background: var(--panel);
}

.no-results p {
  margin: 0;
}

.image-placeholder {
  background: var(--placeholder);
  border-radius: var(--radius);
}

/* Breadcrumb */

.breadcrumb {
  padding-top: 1.5rem;
}

.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.9375rem;
}

.breadcrumb li + li::before {
  content: "/";
  margin-right: 0.5rem;
  color: var(--muted);
}

/* Product page */

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

.label-accent {
  color: var(--accent);
}

.section.section-tight-top {
  padding-top: 0;
}

.product-intro {
  padding-block: 1.5rem 2.5rem;
  text-align: center;
}

/* Product titles are long, so the product page heading is smaller than the site heading: 46px down to about 32px. */
.product-intro h1 {
  margin: 0 0 1rem;
  font-size: clamp(2rem, 1.3rem + 2.2vw, 2.875rem);
  line-height: 1.15;
}

.product-intro .intro {
  margin: 0 auto 1.5rem;
}

.buy-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1rem 1.5rem;
  margin-bottom: 1rem;
}

.price-large {
  margin: 0;
  font-family: var(--mono);
  font-size: 1.75rem;
  font-weight: 500;
  line-height: 1.2;
}

.small-note {
  margin: 0 auto 0.5rem;
  font-size: 0.9375rem;
  color: var(--muted);
}

/* Hero 16 to 9, feature images 4 to 3. The boxes reserve those proportions so nothing jumps as images load,
   and every image is shown whole (object-fit: contain), never trimmed. */
.hero-image,
.feature-image {
  overflow: hidden;
  border: 1px solid var(--rule);
  background: var(--placeholder);
}

.hero-image {
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-card);
}

.feature-image {
  aspect-ratio: 4 / 3;
  border-radius: var(--radius);
}

.hero-image img,
.feature-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.band {
  padding-block: clamp(2.5rem, 6vw, 4rem);
  background: var(--panel);
}

.band-ruled {
  border-block: 1px solid var(--rule);
}

.product-intro + .wrap + .band,
.product-intro + .band {
  margin-top: clamp(2rem, 5vw, 3rem);
}

.band h2 {
  margin-top: 0;
}

.band .label {
  margin-bottom: 0.5rem;
}

.band p:last-child {
  margin-bottom: 0;
}

.features {
  display: grid;
  gap: clamp(2.5rem, 6vw, 4rem);
  margin-top: 2rem;
}

.feature-row {
  display: grid;
  gap: 1.25rem;
  align-items: center;
}

.feature-row.feature-row-text-only {
  display: block;
  width: 100%;
  max-width: 44rem;
  margin-inline: auto;
}

.feature-number {
  margin: 0 0 0.5rem;
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 500;
  color: var(--accent);
}

.feature-text h3 {
  margin-bottom: 0.5rem;
}

.feature-text p:last-child {
  margin: 0;
  color: var(--text-2);
}

.fit-grid {
  display: grid;
  gap: 1.25rem;
  margin-top: 1.75rem;
}

.fit-card {
  padding: 1.5rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius-card);
}

.fit-card h3 {
  margin-bottom: 1rem;
}

.fit-list {
  display: grid;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.fit-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.icon {
  flex: none;
  width: 20px;
  height: 20px;
  margin-top: 0.2rem;
}

.icon-tick {
  color: var(--tick);
}

.icon-cross {
  color: var(--cross);
}

.contents-list {
  margin: 1.5rem 0 1.25rem;
  overflow: hidden;
  border: 1px solid var(--rule);
  border-radius: var(--radius-card);
  background: var(--bg);
}

.contents-row {
  display: grid;
  gap: 0.25rem;
  padding: 1rem 1.25rem;
}

.contents-row + .contents-row {
  border-top: 1px solid var(--rule);
}

.contents-row dt {
  font-weight: 700;
}

.contents-row dd {
  margin: 0;
  color: var(--text-2);
}

.mono-line {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.875rem;
  color: var(--text-2);
}

.limits-box {
  padding: 1.5rem;
  border: 1px solid var(--rule);
  border-left: 4px solid var(--muted);
  border-radius: var(--radius-card);
}

.limits-box h2 {
  margin: 0 0 1rem;
}

.limits-box ul {
  margin: 0;
  padding-left: 1.25rem;
}

.limits-box li + li {
  margin-top: 0.5rem;
}

.closing-panel {
  padding: clamp(2rem, 5vw, 3.5rem) 1.5rem;
  border-radius: var(--radius-card);
  background: var(--dark);
  color: var(--footer-text);
  text-align: center;
}

.closing-panel h2 {
  margin: 0 0 0.75rem;
  color: #ffffff;
}

.closing-panel p {
  margin: 0 0 1rem;
}

.closing-panel .price-large {
  margin-bottom: 1.25rem;
  color: #ffffff;
}

.closing-panel :focus-visible {
  outline-color: #ffffff;
}

.button-light {
  background: #ffffff;
  color: var(--dark);
}

.button-light:hover {
  background: var(--footer-text);
  color: var(--dark);
}

.related-grid {
  display: grid;
  gap: 1rem;
  margin-top: 1.5rem;
}

.related-card {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  padding: 1.25rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius-card);
  background: var(--bg);
  color: var(--text);
  text-decoration: none;
}

.related-card:hover {
  border-color: var(--accent);
  color: var(--text);
}

.related-card .label {
  margin: 0;
}

.related-title {
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.3;
}

.related-price {
  margin-top: auto;
  padding-top: 0.5rem;
  font-family: var(--mono);
  font-weight: 500;
}

/* The buy bar: a small script shows it once the opening button has scrolled away. Without JavaScript it stays hidden. */
.buy-bar {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 20;
  height: 64px;
  border-top: 1px solid var(--rule);
  background: var(--bg);
}

.buy-bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 100%;
}

.bar-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-price {
  font-family: var(--mono);
  font-weight: 500;
  white-space: nowrap;
}

.buy-bar .button {
  white-space: nowrap;
}

@media (max-width: 30rem) {
  .bar-title {
    display: none;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .buy-bar {
    transform: translateY(100%);
    transition: transform 0.25s ease;
  }

  .buy-bar.is-visible {
    transform: none;
  }
}

/* Content pages: How it works and Help */

.how-steps {
  display: grid;
  gap: 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.how-step {
  display: grid;
  gap: 0.5rem;
  padding: 1.5rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius-card);
  background: var(--bg);
}

.how-step .step-number {
  margin: 0;
}

/* Step titles are H2s but styled smaller than page section headings, so longer step text stays readable. */
.how-step h2 {
  margin: 0 0 0.75rem;
  font-size: 1.5rem;
}

.how-step p {
  margin: 0 0 1rem;
}

.how-step ul {
  margin: 0 0 1rem;
  padding-left: 1.25rem;
}

.how-step li + li {
  margin-top: 0.25rem;
}

.how-step-body > :last-child {
  margin-bottom: 0;
}

.prose h2 {
  margin: 2.5rem 0 0.75rem;
}

.prose h2:first-child {
  margin-top: 0;
}

.prose .button {
  margin-top: 0.5rem;
}

/* About page: the "How we work" points as bordered cards, two columns from tablet width. */
.work-grid {
  display: grid;
  gap: 1rem;
  margin: 0 0 1.5rem;
  padding: 0;
  list-style: none;
}

.work-card {
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius-card);
  background: var(--bg);
}

/* Contact page: the email address gets a bordered card under the intro, and plain lists and small print in the body. */
.contact-card {
  width: fit-content;
  max-width: 100%;
  margin: 1.5rem 0 0;
  padding: 1rem clamp(1rem, 4vw, 1.25rem);
  border: 1px solid var(--rule);
  border-radius: var(--radius-card);
  background: var(--bg);
  /* About 20px, scaling down on narrow phones so the whole address stays on one line. */
  font-size: clamp(1rem, 4.7vw, 1.25rem);
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.contact-card a {
  font-weight: 700;
}

.plain-list {
  margin: 0 0 1rem;
  padding-left: 1.25rem;
}

.plain-list li + li {
  margin-top: 0.25rem;
}

/* Legal pages: sub-headings and numbered lists in the reading column. */
.prose h3 {
  margin: 1.5rem 0 0.5rem;
}

.prose h2 + h3 {
  margin-top: 0;
}

ol.plain-list {
  padding-left: 1.5rem;
}

.small-print {
  margin-top: 2rem;
  font-size: 0.9375rem;
  color: var(--muted);
}

.help-group + .help-group {
  margin-top: 2.5rem;
}

.help-group h2 {
  margin: 0 0 0.75rem;
}

.help-group details p {
  margin: 0.5rem 0 0;
}

details {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--rule);
}

summary {
  cursor: pointer;
  font-weight: 700;
}

@media (min-width: 48rem) {
  h2 {
    font-size: 2rem;
  }

  h3 {
    font-size: 1.25rem;
  }

  .point h2 {
    font-size: 1.25rem;
  }

  .how-step {
    grid-template-columns: 3.5rem 1fr;
    gap: 1.5rem;
  }

  .work-grid {
    grid-template-columns: 1fr 1fr;
  }

  .feature-row {
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
  }

  .feature-row:nth-child(even) .feature-image {
    order: 2;
  }

  .fit-grid {
    grid-template-columns: 1fr 1fr;
  }

  .contents-row {
    grid-template-columns: minmax(10rem, 1fr) 2fr;
    gap: 1.5rem;
  }

  .related-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .product-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .steps {
    grid-template-columns: repeat(3, 1fr);
  }

  .points {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 64rem) {
  .related-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .product-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .points {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 30rem) {
  .search-row {
    flex-direction: column;
  }

  .search-row .button {
    width: 100%;
  }

  .field {
    max-width: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
