/*
  Reusable classes shared by elements across multiple pages:
  layout, blueprint sections, buttons, cards, icons, lists, rulers and scroll-reveal animations.
*/

/* Layout */
.container {
  width: min(100% - 32px, var(--content-width));
  margin-inline: auto;
}

main {
  counter-reset: section-number;
}

.section {
  position: relative;
  padding-block: 64px;
}

.section-heading {
  max-width: 760px;
  margin-bottom: 40px;
  counter-increment: section-number;
}

.section-heading-centered {
  margin-inline: auto;
  text-align: center;
}

.section-heading p {
  color: var(--muted-text);
  font-size: 1.1rem;
}

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

@media (min-width: 768px) {
  .section {
    padding-block: 104px;
  }

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

/* Dark blueprint section: navy paper with a light grid.
   Cards inside stay light "sheets", so only the loose headings and links are recolored. */
.section-muted {
  background-color: var(--blueprint-background);
  background-image:
    linear-gradient(var(--blueprint-grid-major-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--blueprint-grid-major-line) 1px, transparent 1px),
    linear-gradient(var(--blueprint-grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--blueprint-grid-line) 1px, transparent 1px);
  background-size: 120px 120px, 120px 120px, 24px 24px, 24px 24px;
  background-position: -1px -1px;
  color: var(--blueprint-text);
}

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

.section-muted .section-heading h2,
.section-muted .container > h2 {
  color: var(--blueprint-heading-text);
}

.section-muted .section-heading .eyebrow {
  color: var(--blueprint-eyebrow-text);
}

.section-muted .section-heading .eyebrow::after {
  color: var(--blueprint-text);
}

.section-muted .container > p > .text-link {
  color: var(--blueprint-link-text);
}

/* Small uppercase monospace label shown above headings, led by a crosshair marker. */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--eyebrow-text);
}

.eyebrow::before {
  content: "";
  flex-shrink: 0;
  width: 11px;
  height: 11px;
  background:
    linear-gradient(var(--eyebrow-marker), var(--eyebrow-marker)) center / 100% 2px no-repeat,
    linear-gradient(var(--eyebrow-marker), var(--eyebrow-marker)) center / 2px 100% no-repeat;
}

/* Section headings are numbered automatically, like the sections of a technical document. */
.section-heading .eyebrow::after {
  content: counter(section-number, decimal-leading-zero) " /";
  order: -1;
  color: var(--eyebrow-number-text);
  font-weight: 500;
}

.lead {
  font-size: clamp(1.1rem, 2.4vw, 1.3rem);
  color: var(--muted-text);
  max-width: 640px;
}

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

/* Italic serif highlight with a hand-drawn underline stroke. */
.highlight {
  font-style: italic;
  color: var(--highlight-text);
  background: linear-gradient(var(--highlight-underline), var(--highlight-underline)) left 0 bottom 0.06em / 100% 0.08em no-repeat;
  padding-bottom: 0.04em;
}

/* Ruler: a line of measurement ticks used as a divider under page introductions. */
.ruler {
  height: 14px;
  margin-top: 40px;
  border-top: 1px solid var(--ruler-tick);
  background:
    repeating-linear-gradient(90deg, var(--ruler-tick) 0 1px, transparent 1px 60px) top left / 100% 14px no-repeat,
    repeating-linear-gradient(90deg, var(--ruler-tick) 0 1px, transparent 1px 12px) top left / 100% 6px no-repeat;
}

/* Buttons: squared, with a hard offset shadow that "presses" on click. */
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 12px 24px;
  border: 1.5px solid transparent;
  border-radius: var(--radius-small);
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.button:hover {
  transform: translate(-2px, -2px);
}

.button:active {
  transform: translate(2px, 2px);
  box-shadow: none;
}

.button .icon {
  transition: transform 0.2s ease;
}

.button:hover .icon {
  transform: translateX(3px);
}

.button-primary {
  border-color: var(--primary-button-shadow);
  background: var(--primary-button-background);
  color: var(--primary-button-text);
  box-shadow: 4px 4px 0 var(--primary-button-shadow);
}

.button-primary:hover {
  background: var(--primary-button-hover-background);
  box-shadow: 6px 6px 0 var(--primary-button-shadow);
}

.button-secondary {
  background: var(--secondary-button-background);
  color: var(--secondary-button-text);
  border-color: var(--secondary-button-border);
  box-shadow: 4px 4px 0 var(--secondary-button-shadow);
}

.button-secondary:hover {
  box-shadow: 6px 6px 0 var(--secondary-button-hover-shadow);
}

.button-light {
  background: var(--light-button-background);
  color: var(--light-button-text);
  box-shadow: 4px 4px 0 var(--light-button-shadow);
}

.button-light:hover {
  box-shadow: 6px 6px 0 var(--light-button-shadow);
}

@media (max-width: 479px) {
  .button-row .button {
    width: 100%;
  }
}

/* Inline text link with an arrow that slides on hover */
.text-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 650;
  color: var(--link-text);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
}

.text-link .icon {
  transition: transform 0.2s ease;
}

.text-link:hover .icon {
  transform: translateX(4px);
}

/* Cards: paper sheets with crop marks in two corners and a hard offset shadow. */
.card {
  padding: 28px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-medium);
  background:
    linear-gradient(var(--card-corner-mark), var(--card-corner-mark)) top 10px left 10px / 12px 1.5px no-repeat,
    linear-gradient(var(--card-corner-mark), var(--card-corner-mark)) top 10px left 10px / 1.5px 12px no-repeat,
    linear-gradient(var(--card-corner-mark), var(--card-corner-mark)) bottom 10px right 10px / 12px 1.5px no-repeat,
    linear-gradient(var(--card-corner-mark), var(--card-corner-mark)) bottom 10px right 10px / 1.5px 12px no-repeat,
    var(--card-background);
  box-shadow: 6px 6px 0 var(--card-shadow);
}

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

@media (min-width: 768px) {
  .card {
    padding: 36px;
  }
}

/* Icons */
.icon {
  width: 1.25em;
  height: 1.25em;
  flex-shrink: 0;
}

.icon-badge {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  margin-bottom: 20px;
  border: 1px solid var(--icon-badge-border);
  border-radius: var(--radius-small);
  background: var(--icon-badge-background);
  color: var(--icon-badge-text);
}

.icon-badge .icon {
  width: 24px;
  height: 24px;
  stroke-width: 1.75;
}

/* Lists with check icons shown inside small filled squares, like ticked boxes on a form. */
.icon-list {
  display: grid;
  gap: 12px;
  list-style: none;
}

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

.icon-list .icon {
  margin-top: 0.2em;
}

.icon-list-check .icon {
  width: 1.2em;
  height: 1.2em;
  padding: 3px;
  border-radius: 3px;
  background: var(--list-check-background);
  color: var(--list-check-icon);
  stroke-width: 3;
}

/* Form fields and form messages, used by every form on the website. */
.form-field label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  color: var(--heading-text);
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  min-height: 50px;
  padding: 12px 16px;
  border: 1.5px solid var(--input-border);
  border-radius: var(--radius-small);
  background: var(--input-background);
  color: var(--input-text);
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.form-field textarea {
  min-height: 160px;
  resize: vertical;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--input-focus-border);
  box-shadow: 4px 4px 0 var(--input-focus-shadow);
}

.field-error {
  margin: 6px 0 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--form-error-text);
}

.form-message {
  display: flex;
  gap: 14px;
  padding: 18px 20px;
  margin-bottom: 24px;
  border-radius: var(--radius-medium);
}

.form-message .icon {
  margin-top: 0.2em;
}

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

.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: 100;
  padding: 10px 18px;
  border-radius: var(--radius-small);
  background: var(--skip-link-background);
  color: var(--skip-link-text);
  font-weight: 650;
}

.skip-link:focus {
  top: 12px;
}

/* Scroll reveal: only hidden when JavaScript is running, so content stays visible without it. */
@media (prefers-reduced-motion: no-preference) {
  .js .reveal {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
  }

  .js .reveal.is-visible {
    opacity: 1;
    transform: none;
  }
}
