/*
  public/CSS/common.css
  Classes used on two or more pages: layout, section rhythm, panels, buttons,
  links, form parts and messages.
*/

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

.container {
  width: 100%;
  max-width: var(--container-width);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.container-narrow {
  max-width: 880px;
}

main {
  flex: 1;
}

/* Sections are separated by space, not by lines. */
.section {
  padding-block: clamp(48px, 7vw, 96px);
}

/* A soft, rounded block of the palest blue that sets one part of a page apart. */
.panel {
  padding: clamp(28px, 5vw, 64px);
  border-radius: var(--radius-panel);
  background: var(--panel-background);
}

/* A dark section: Delft ink background with light text. */
.section-dark {
  background: var(--dark-background);
  color: var(--dark-text);
}

.section-dark h1,
.section-dark h2,
.section-dark h3 {
  color: var(--dark-text);
}

.section-dark .muted,
.section-dark .lead {
  color: var(--dark-muted-text);
}

/* Links in text only: buttons keep their own colors. */
.section-dark a:not(.button) {
  color: var(--dark-text);
  text-decoration-color: var(--dark-accent-text);
}

.section-dark :focus-visible {
  outline-color: var(--dark-focus-outline);
}

/* Heading on the left, introduction on the right (on wide screens). */
.section-heading {
  display: grid;
  gap: 8px 64px;
  margin-bottom: clamp(36px, 5vw, 64px);
}

.section-heading h2 {
  max-width: 18ch;
  margin-bottom: 0;
}

.section-heading .lead {
  align-self: end;
}

@media (min-width: 960px) {
  .section-heading {
    grid-template-columns: 1fr 1fr;
  }
}

.two-columns {
  display: grid;
  gap: 48px;
}

@media (min-width: 900px) {
  .two-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 64px;
  }
}

/* ---------- Text ---------- */

.lead {
  color: var(--muted-text);
  font-size: clamp(1.1rem, 1.5vw, 1.25rem);
  line-height: 1.6;
}

.muted {
  color: var(--muted-text);
}

.note {
  color: var(--muted-text);
  font-size: 0.92rem;
}

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

.skip-link {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 100;
  padding: 12px 20px;
  border-radius: var(--radius-control);
  background: var(--primary-button-background);
  color: var(--primary-button-text);
  transform: translateY(-160%);
  transition: transform 0.2s var(--ease);
}

.skip-link:focus {
  transform: translateY(0);
}

/* ---------- Icons ---------- */

.icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* ---------- Buttons and links ---------- */

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 12px 26px;
  border: 1.5px solid transparent;
  border-radius: var(--radius-control);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease);
}

.button-primary {
  background: var(--primary-button-background);
  color: var(--primary-button-text);
}

.button-primary:hover {
  background: var(--primary-button-hover-background);
  color: var(--primary-button-text);
}

.button-secondary {
  border-color: var(--secondary-button-border);
  background: transparent;
  color: var(--secondary-button-text);
}

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

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

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

/* A link that leads on to another page, set apart from running text. */
.text-link {
  display: inline-block;
  padding-block: 6px;
  font-weight: 600;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 6px;
}

/* ---------- Lists ---------- */

/* A list with a small cobalt check in front of each point. */
.check-list {
  display: grid;
  gap: 10px;
}

.check-list li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.check-list .icon {
  width: 18px;
  height: 18px;
  margin-top: 4px;
  color: var(--accent-text);
}

.section-dark .check-list .icon {
  color: var(--dark-accent-text);
}

/* ---------- Forms ---------- */

.form-grid {
  display: grid;
  gap: 24px;
}

@media (min-width: 640px) {
  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-field-wide {
    grid-column: 1 / -1;
  }
}

.required-marker {
  color: var(--required-marker);
}

.field-error {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
  color: var(--error-text);
  font-size: 0.92rem;
}

.field-error .icon {
  width: 16px;
  height: 16px;
}

[aria-invalid="true"] {
  border-color: var(--error-border);
}

/* Spam trap: a field that is hidden from visitors and screen readers. */
.form-trap {
  position: absolute;
  left: -10000px;
}

/* Success or error message above a form. */
.form-message {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 32px;
  padding: 18px 22px;
  border-radius: var(--radius-control);
}

.form-message .icon {
  margin-top: 3px;
}

.form-message-success {
  background: var(--success-background);
  color: var(--success-text);
}

.form-message-error {
  background: var(--error-background);
  color: var(--error-text);
}

.form-message a {
  color: inherit;
}

/* ---------- Page introduction (sub-pages) ---------- */

.page-intro {
  padding-block: clamp(40px, 6vw, 80px) clamp(32px, 4vw, 56px);
}

.page-intro h1 {
  max-width: 20ch;
}

.page-intro .lead {
  max-width: 58ch;
}

/* The first section follows the introduction closely. */
.page-intro + .section {
  padding-top: clamp(16px, 3vw, 32px);
}
