/*
  BASE
  Page defaults, text, links, buttons, form fields, and small helpers that
  every page shares. Page-specific pieces live in components.css.
*/

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

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

body {
  margin: 0;
  background: var(--color-white);
  color: var(--color-black);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--line-height);
}

h1, h2, h3, p, ul, ol, dl, dd, figure {
  margin: 0;
}

ul, ol {
  padding: 0;
  list-style: none;
}

img, svg {
  display: block;
  max-width: 100%;
}

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

h1, h2, h3,
label, button, select, input, textarea, th,
.ui {
  font-family: var(--font-heading);
}

h1 {
  color: var(--color-green);
  font-size: var(--text-title);
  font-weight: 700;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

/* Section headings with a rule under them, as on the whiteboard sketches. */
.section-title {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  padding-bottom: var(--space-2);
  border-bottom: 2px solid var(--color-green);
  color: var(--color-green);
  font-size: var(--text-lead);
  font-weight: 700;
  line-height: 1.2;
}

/* Small bold label above a block of text (brand guide: paragraph headers). */
.label {
  color: var(--color-green);
  font-family: var(--font-heading);
  font-size: var(--text-small);
  font-weight: 700;
}

.meta {
  font-family: var(--font-heading);
  font-size: var(--text-small);
  color: var(--color-muted);
}

.count {
  font-size: var(--text-small);
  font-weight: 400;
  color: var(--color-muted);
}

.not-set {
  font-style: italic;
  font-weight: 400;
  color: var(--color-muted);
}

a {
  color: var(--color-green);
  text-underline-offset: 3px;
}

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

:focus-visible {
  outline: 2px solid var(--color-black);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Hidden only when JavaScript is running (it adds .js to <html>). */
.js .no-js-only {
  display: none;
}

/* Things that only work with JavaScript. */
html:not(.js) .js-only {
  display: none;
}

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

.page {
  width: 100%;
  max-width: var(--page-width);
  margin-inline: auto;
  padding: var(--space-6) var(--space-5) var(--space-7);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.stack--tight {
  gap: var(--space-2);
}

.stack--loose {
  gap: var(--space-6);
}

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}

/* ---- Buttons --------------------------------------------------------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--control-height);
  padding: 0 var(--space-4);
  border: 1px solid var(--color-green);
  border-radius: var(--radius);
  background: var(--color-green);
  color: var(--color-white);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
}

.button:hover {
  border-color: var(--color-black);
  background: var(--color-black);
  color: var(--color-white);
}

.button--quiet {
  border-color: var(--color-green);
  background: var(--color-white);
  color: var(--color-green);
}

.button--quiet:hover {
  border-color: var(--color-green);
  background: var(--color-green);
}

.button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* A button that looks like a link. */
.link-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--color-green);
  font-size: var(--text-small);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.link-button:hover {
  color: var(--color-black);
}

/* ---- Form fields ------------------------------------------------------ */

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.field > label {
  color: var(--color-green);
  font-size: var(--text-small);
  font-weight: 700;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: var(--control-height);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-green);
  border-radius: var(--radius);
  background: var(--color-white);
  color: var(--color-black);
  font-size: 1rem;
}

.textarea {
  min-height: 144px;
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--line-height);
  resize: vertical;
}

.select {
  width: auto;
  padding-right: var(--space-6);
}

/* ---- Messages (saved / error banners) --------------------------------- */

.messages {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.messages:empty {
  display: none;
}

.message {
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-green);
  border-radius: var(--radius);
  color: var(--color-green);
  font-family: var(--font-heading);
  font-size: var(--text-small);
}

.message--error {
  border-color: var(--color-error);
  color: var(--color-error);
}

@media (max-width: 640px) {
  .page {
    padding-inline: var(--space-4);
  }
}
