/* ==========================================================================
   Components — buttons, links, navigation, form controls
   ========================================================================== */

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  height: 52px;
  padding: 0 1.5rem;
  font-size: 0.9375rem;
  font-weight: 500;
  letter-spacing: -0.005em;
  white-space: nowrap;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background-color 0.25s, color 0.25s, border-color 0.25s;
}

.btn .icon {
  transition: transform 0.3s var(--ease);
}

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

.btn-sm {
  height: 42px;
  padding: 0 1.15rem;
  font-size: var(--fs-sm);
}

.btn-dark {
  color: var(--white);
  background: var(--ink);
}

.btn-dark:hover {
  background: var(--teal-dark);
}

.btn-light {
  color: var(--ink);
  background: var(--white);
}

.btn-light:hover {
  background: var(--teal-pale);
}

.btn-ghost {
  color: var(--ink);
  border-color: var(--line);
}

.btn-ghost:hover {
  border-color: var(--ink);
}

.btn-ghost-light {
  color: var(--white);
  border-color: rgba(255, 255, 255, 0.32);
}

.btn-ghost-light:hover {
  border-color: var(--white);
}

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

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

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9375rem;
  font-weight: 500;
  border-bottom: 1px solid currentColor;
  padding-bottom: 2px;
  transition: color 0.25s;
}

.text-link .icon {
  width: 16px;
  height: 16px;
  transition: transform 0.3s var(--ease);
}

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

/* Header ------------------------------------------------------------------ */

.site-header {
  position: fixed;
  top: 1rem;
  left: 0;
  right: 0;
  z-index: 50;
  padding-inline: var(--gutter);
  pointer-events: none;
}

.nav {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 2rem;
  max-width: calc(var(--container) - 2 * var(--gutter));
  margin-inline: auto;
  padding: 0.4rem 0.4rem 0.4rem 1.25rem;
  background: var(--paper);
  border-radius: var(--radius-pill);
  box-shadow: 0 1px 0 rgba(17, 27, 38, 0.06), 0 8px 24px -12px rgba(17, 27, 38, 0.25);
}

.nav-logo img {
  height: 34px;
  width: auto;
}

.nav-links {
  display: flex;
  gap: 0.25rem;
  margin-left: auto;
}

.nav-links a {
  display: block;
  padding: 0.5rem 0.85rem;
  font-size: 0.9375rem;
  font-weight: 450;
  color: var(--muted);
  transition: color 0.2s;
}

.nav-links a:hover,
.nav-links a.is-active {
  color: var(--ink);
}

.nav-links a.is-active {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 6px;
}

.nav-toggle {
  display: none;
  position: relative;
  width: 42px;
  height: 42px;
  margin-left: auto;
  border: 0;
  border-radius: 50%;
  background: var(--ink);
  cursor: pointer;
}

.nav-toggle span {
  position: absolute;
  left: 50%;
  width: 16px;
  height: 1.5px;
  background: var(--white);
  transform: translateX(-50%);
  transition: transform 0.3s var(--ease), top 0.3s var(--ease);
}

.nav-toggle span:first-child { top: 17px; }
.nav-toggle span:last-child  { top: 23px; }

.nav-toggle[aria-expanded="true"] span:first-child,
.nav-toggle[aria-expanded="true"] span:last-child {
  top: 20px;
}

.nav-toggle[aria-expanded="true"] span:first-child { transform: translateX(-50%) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:last-child  { transform: translateX(-50%) rotate(-45deg); }

/* Mobile menu ------------------------------------------------------------- */

.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 2.5rem;
  padding: 7rem var(--gutter) 2.5rem;
  background: var(--ink);
  color: var(--white);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.mobile-menu.is-open {
  opacity: 1;
  visibility: visible;
}

.mobile-menu li {
  border-top: 1px solid var(--line-light);
}

.mobile-menu a:not(.btn) {
  display: block;
  padding: 0.9rem 0;
  font-size: 2.25rem;
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.1;
}

/* Form controls ----------------------------------------------------------- */

.field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 2rem;
}

.field {
  display: flex;
  flex-direction: column;
  margin-bottom: 2rem;
}

.field label {
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--muted);
}

.field .optional {
  margin-left: 0.35rem;
  font-weight: 400;
  opacity: 0.7;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 0.6rem 0 0.7rem;
  font-size: var(--fs-md);
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.2s;
}

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

.field input:hover,
.field select:hover,
.field textarea:hover {
  border-bottom-color: rgba(17, 27, 38, 0.35);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-bottom-color: var(--ink);
}

.field select:invalid {
  color: var(--muted);
}

.select-wrap {
  position: relative;
}

.select-wrap::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 2px;
  width: 7px;
  height: 7px;
  border-right: 1.5px solid var(--ink);
  border-bottom: 1.5px solid var(--ink);
  transform: translateY(-75%) rotate(45deg);
  pointer-events: none;
}

.field.has-error input,
.field.has-error select {
  border-bottom-color: #b4442f;
}

.field-error {
  margin-top: 0.4rem;
  font-size: var(--fs-sm);
  color: #b4442f;
}

.field-error:empty {
  display: none;
}

/* Checkbox */

.checkbox {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  font-size: var(--fs-sm);
  line-height: 1.45;
  color: var(--muted);
  cursor: pointer;
}

.checkbox input {
  position: absolute;
  width: 18px;
  height: 18px;
  margin: 0;
  opacity: 0;
}

.checkbox-box {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  border: 1px solid rgba(17, 27, 38, 0.35);
  border-radius: 3px;
  transition: background-color 0.2s, border-color 0.2s;
}

.checkbox-box::after {
  content: "";
  width: 4px;
  height: 9px;
  margin-top: -2px;
  border-right: 1.5px solid var(--white);
  border-bottom: 1.5px solid var(--white);
  transform: rotate(45deg);
  opacity: 0;
}

.checkbox input:checked + .checkbox-box {
  background: var(--ink);
  border-color: var(--ink);
}

.checkbox input:checked + .checkbox-box::after {
  opacity: 1;
}

.checkbox input:focus-visible + .checkbox-box {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

/* Responsive -------------------------------------------------------------- */

@media (max-width: 900px) {
  .nav-links,
  .nav-cta {
    display: none;
  }

  .nav-toggle {
    display: block;
  }

  .nav-logo img {
    height: 30px;
  }
}

@media (max-width: 600px) {
  .field-row {
    grid-template-columns: 1fr;
  }
}
