/* Buttons, cards, lists, accordions - the parts sections are assembled from. */

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

.button {
  --button-ink: var(--ink);
  --button-bg: var(--text);
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  padding: 0.95rem 1.6rem;
  font-family: var(--font-display);
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--button-ink);
  background: var(--button-bg);
  border: 1px solid var(--button-bg);
  overflow: hidden;
  isolation: isolate;
  transition: color var(--duration-fast) var(--ease-out),
              border-color var(--duration-fast) var(--ease-out);
}

/*
 * The fill wipes up from the bottom on hover and leaves through the top, so
 * moving on feels like the same gesture continuing rather than a state undoing.
 */
.button::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--ink);
  transform: translate3d(0, 101%, 0);
  transition: transform var(--duration) var(--ease-out);
}

.button:hover::before,
.button:focus-visible::before { transform: translate3d(0, 0, 0); }

.button:hover, .button:focus-visible { color: var(--text); }

.button__arrow {
  transition: transform var(--duration) var(--ease-out);
  display: inline-block;
}

.button:hover .button__arrow { transform: translateX(4px); }

.button--ghost {
  --button-ink: var(--text);
  --button-bg: transparent;
  border-color: var(--line-strong);
}

.button--ghost::before { background: var(--text); }
.button--ghost:hover, .button--ghost:focus-visible { color: var(--ink); }

.button--large { padding: 1.15rem 2.1rem; font-size: var(--step-0); }

/* A text link that draws its own underline on approach. */
.link-underline {
  position: relative;
  display: inline-block;
  padding-bottom: 2px;
}

.link-underline::after {
  content: '';
  position: absolute;
  left: 0; bottom: 0;
  width: 100%; height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: 100% 50%;
  transition: transform var(--duration) var(--ease-out);
}

.link-underline:hover::after,
.link-underline:focus-visible::after {
  transform: scaleX(1);
  transform-origin: 0 50%;
}

/* Cards ------------------------------------------------------------------- */

/*
 * Cards are drawn with hairlines rather than boxes so the glyph field stays
 * visible through the page instead of being covered by a stack of panels.
 */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-s);
  padding: var(--space-l);
  border: 1px solid var(--line);
  background: rgba(8, 8, 8, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: border-color var(--duration) var(--ease-out),
              background-color var(--duration) var(--ease-out),
              transform var(--duration) var(--ease-out);
}

.card:hover {
  border-color: var(--line-strong);
  background: rgba(16, 16, 16, 0.72);
  transform: translateY(-3px);
}

.card__index {
  font-family: var(--font-mono);
  font-size: var(--step--2);
  color: var(--text-faint);
  letter-spacing: 0.16em;
}

.card__title {
  font-size: var(--step-2);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.card__body {
  color: var(--text-soft);
  font-size: var(--step-0);
  line-height: 1.6;
}

.grid {
  display: grid;
  gap: 1px;
  background: var(--line-faint);
  border: 1px solid var(--line-faint);
}

/* The 1px gap on a faint ground is the divider; cards paint over the rest. */
.grid > * { background: var(--ink); }

.grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); }

/* Metrics ----------------------------------------------------------------- */

.metric { display: grid; gap: var(--space-3xs); padding: var(--space-l); }

.metric__value {
  font-family: var(--font-display);
  font-size: var(--step-5);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.045em;
  font-variant-numeric: tabular-nums;
}

.metric__unit { color: var(--text-muted); font-size: 0.5em; font-weight: 500; }

.metric__label {
  font-family: var(--font-mono);
  font-size: var(--step--2);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-muted);
}

.metric__note { color: var(--text-soft); font-size: var(--step--1); line-height: 1.55; }

/* Accordion --------------------------------------------------------------- */

.accordion { border-top: 1px solid var(--line); }

.accordion__item { border-bottom: 1px solid var(--line); }

.accordion__trigger {
  display: flex;
  align-items: baseline;
  gap: var(--space-m);
  width: 100%;
  padding: var(--space-l) 0;
  text-align: left;
  color: var(--text-soft);
  transition: color var(--duration) var(--ease-out);
}

.accordion__trigger:hover,
.accordion__item.is-open .accordion__trigger { color: var(--text); }

.accordion__index {
  font-family: var(--font-mono);
  font-size: var(--step--2);
  color: var(--text-faint);
  letter-spacing: 0.14em;
  flex-shrink: 0;
}

.accordion__label {
  font-family: var(--font-display);
  font-size: var(--step-3);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.1;
  flex: 1;
}

.accordion__sign {
  flex-shrink: 0;
  width: 1.5rem; height: 1.5rem;
  position: relative;
  align-self: center;
}

.accordion__sign::before,
.accordion__sign::after {
  content: '';
  position: absolute;
  inset: 50% 0 auto 0;
  height: 1px;
  background: currentColor;
  transition: transform var(--duration) var(--ease-out);
}

.accordion__sign::after { transform: rotate(90deg); }
.accordion__item.is-open .accordion__sign::after { transform: rotate(0deg); }

/*
 * Collapsed to a measured pixel height rather than to `auto`, because `auto` is
 * not an animatable value and the panel would otherwise snap open.
 */
.accordion__panel {
  overflow: hidden;
  height: 0;
  transition: height var(--duration) var(--ease-out);
}

.accordion__inner {
  display: grid;
  gap: var(--space-m);
  padding-bottom: var(--space-l);
  max-width: var(--measure);
}

.tag-row { display: flex; flex-wrap: wrap; gap: var(--space-2xs); }

.tag {
  font-family: var(--font-mono);
  font-size: var(--step--2);
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--line);
  white-space: nowrap;
}

/* Numbered process steps -------------------------------------------------- */

.step { display: grid; gap: var(--space-s); padding: var(--space-l) 0; border-top: 1px solid var(--line); }

.step__index {
  font-family: var(--font-mono);
  font-size: var(--step--2);
  letter-spacing: 0.18em;
  color: var(--text-faint);
}

.step__title { font-size: var(--step-2); font-weight: 600; }
.step__body { color: var(--text-soft); max-width: 46ch; }

@media (min-width: 52rem) {
  .step {
    grid-template-columns: 6rem 1fr 1fr;
    align-items: start;
    gap: var(--space-l);
  }
}
