/*
 * Components: the reusable pieces pages are built from.
 *
 * Naming is BEM-ish: .block, .block__element, .block--modifier.
 * Components read semantic tokens only (never --palette-*), so they
 * re-theme with tokens.css and dark mode for free.
 */

@layer components {
  /* ---------------------------------------------------------------- *
   * Wordmark: the text logo. The highlighted "fm" echoes the brand.
   * ---------------------------------------------------------------- */
  .wordmark {
    display: inline-flex;
    align-items: center;
    min-height: var(--tap-min);
    color: var(--color-text);
    font-size: 1.625rem;
    font-weight: var(--weight-black);
    letter-spacing: -0.04em;
    line-height: 1;
    text-decoration: none;
  }

  .wordmark__mark {
    margin-left: 1px;
    padding: 0 3px;
    background: var(--color-highlight);
    color: var(--color-on-highlight);
  }

  /* ---------------------------------------------------------------- *
   * Site header and navigation.
   * ---------------------------------------------------------------- */
  .site-header {
    border-bottom: var(--border-thin) solid var(--color-rule);
  }

  .site-header__inner {
    --cluster-justify: space-between;
    --cluster-gap: var(--space-3) var(--space-6);
    padding-block: var(--space-4);
  }

  .nav__list {
    --cluster-gap: 0 var(--space-6);
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .nav__link {
    display: inline-flex;
    align-items: center;
    min-height: var(--tap-min);
    color: var(--color-text);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    text-decoration: none;
  }

  .nav__link:hover {
    text-decoration: underline;
  }

  /* ---------------------------------------------------------------- *
   * Small inline pieces.
   * ---------------------------------------------------------------- */
  .marker {
    flex: none;
    display: inline-block;
    width: var(--marker-size);
    height: var(--marker-size);
    background: var(--color-accent);
  }

  .marker--alt {
    background: var(--color-accent-alt);
  }

  .eyebrow {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
  }

  /* A highlighter stroke behind text; wraps cleanly across lines. */
  .highlight {
    padding-inline: 0.1em;
    background: var(--color-highlight);
    color: var(--color-on-highlight);
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
  }

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

  /* ---------------------------------------------------------------- *
   * Hero.
   * ---------------------------------------------------------------- */
  .hero {
    padding-block: var(--space-section);
  }

  .hero__title {
    max-width: 12em;
    margin-top: var(--space-5);
    font-size: var(--text-display);
    letter-spacing: var(--tracking-display);
  }

  .hero__body {
    margin-top: clamp(var(--space-6), 4vw, var(--space-7));
  }

  .hero__lede {
    max-width: 28em;
    font-size: var(--text-lg);
    line-height: 1.4;
  }

  /* ---------------------------------------------------------------- *
   * App button: a primary link that opens EventsFM in a chat app.
   * ---------------------------------------------------------------- */
  .app-buttons {
    --stack-gap: 0.625rem;
  }

  .app-button {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    min-height: var(--action-min);
    padding-inline: 1.25rem;
    border: var(--border-thin) solid var(--color-action-border);
    border-radius: var(--radius);
    background: var(--color-action-bg);
    color: var(--color-action-text);
    text-decoration: none;
    transition: background-color 120ms ease;
  }

  .app-button:hover {
    background: var(--color-action-bg-hover);
  }

  .app-button__icon {
    flex: none;
    width: 2rem;
    height: 2rem;
  }

  .app-button__label {
    flex: 1 1 auto;
    font-size: 1.1875rem;
    font-weight: var(--weight-semibold);
  }

  .app-button__arrow {
    color: var(--color-accent);
    font-size: 1.25rem;
    transition: transform 120ms ease;
  }

  .app-button:hover .app-button__arrow {
    transform: translateX(3px);
  }

  @media (prefers-reduced-motion: reduce) {
    .app-button,
    .app-button__arrow {
      transition: none;
    }
  }

  /* ---------------------------------------------------------------- *
   * Section head: a heavy rule, the heading, and an optional aside.
   * ---------------------------------------------------------------- */
  .section-head {
    --cluster-justify: space-between;
    --cluster-align: baseline;
    --cluster-gap: var(--space-2) var(--space-5);
    margin-bottom: var(--space-5);
    padding-top: var(--space-4);
    border-top: var(--border-thick) solid var(--color-rule-strong);
  }

  .section-head__title {
    font-size: var(--text-h2);
  }

  .section-head__aside {
    color: var(--color-text-muted);
    font-size: var(--text-sm);
  }

  /* ---------------------------------------------------------------- *
   * Steps: a short numbered sequence laid out in columns.
   * ---------------------------------------------------------------- */
  .steps {
    --grid-min: 16rem;
    --grid-gap: var(--space-5) var(--space-6);
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .step {
    --stack-gap: 0.875rem;
    padding-top: var(--space-2);
  }

  .step__number {
    font-size: var(--text-numeral);
    font-weight: var(--weight-black);
    letter-spacing: -0.05em;
    line-height: 1;
  }

  .step__title {
    margin-bottom: var(--space-1);
    font-size: var(--text-xl);
    font-weight: var(--weight-semibold);
    letter-spacing: var(--tracking-tight);
    line-height: var(--leading-snug);
  }

  .step__text {
    color: var(--color-text-soft);
  }

  /* ---------------------------------------------------------------- *
   * Examples: something a person might say, and what EventsFM does.
   * ---------------------------------------------------------------- */
  .examples {
    --grid-min: 20rem;
    --grid-gap: 0 var(--space-7);
  }

  .example {
    padding-block: 1.75rem var(--space-6);
    border-bottom: var(--border-thin) solid var(--color-rule-soft);
  }

  .example__quote {
    margin-bottom: var(--space-3);
    font-size: var(--text-quote);
    font-weight: var(--weight-semibold);
    letter-spacing: var(--tracking-tight);
    line-height: var(--leading-snug);
    quotes: "\201C" "\201D";
  }

  .example__quote::before {
    content: open-quote;
    color: var(--color-accent);
  }

  .example__quote::after {
    content: close-quote;
    color: var(--color-accent);
  }

  .example__text {
    max-width: var(--measure);
    color: var(--color-text-soft);
  }

  /* ---------------------------------------------------------------- *
   * Band: a full-width inverted section for a secondary offer.
   * Re-points the colour roles its children read, so components placed
   * inside it adapt without band-specific variants.
   * ---------------------------------------------------------------- */
  .band {
    --color-text: var(--color-band-text);
    --color-text-muted: var(--color-band-muted);
    --color-text-soft: var(--color-band-muted);
    --color-link: var(--color-band-text);
    --color-focus: var(--color-focus-on-band);
    border-block: var(--border-thin) solid var(--color-band-border);
    background: var(--color-band-bg);
    color: var(--color-text);
  }

  .band__title {
    font-size: var(--text-h2-band);
    letter-spacing: -0.05em;
  }

  .band__text {
    max-width: var(--measure);
    color: var(--color-text-muted);
  }

  /* ---------------------------------------------------------------- *
   * Code field: a value to copy, with a label and a copy button.
   * The button stays hidden until copy.js finds clipboard support.
   * ---------------------------------------------------------------- */
  .code-field__label {
    margin-bottom: var(--space-2);
    color: var(--color-text-muted);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
  }

  /* The button wraps below the value when both don't fit on one line,
     so a long URL is never broken mid-word to make room for it. */
  .code-field__row {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: var(--border-thin);
    background: var(--color-code-text);
  }

  .code-field__value {
    flex: 999 1 17rem;
    min-width: 0;
    padding: 1.125rem 1.25rem;
    background: var(--color-code-bg);
    color: var(--color-code-text);
    font-size: clamp(1rem, 0.9rem + 0.4vw, 1.25rem);
    font-weight: var(--weight-semibold);
    overflow-wrap: anywhere;
  }

  .code-field__copy {
    flex: 1 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-width: var(--tap-min);
    min-height: var(--tap-min);
    padding-inline: var(--space-4);
    border: 0;
    border-radius: var(--radius);
    background: var(--color-code-bg);
    color: var(--color-code-text);
    font: inherit;
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    cursor: pointer;
  }

  .code-field__copy:hover {
    text-decoration: underline;
  }

  .code-field__copy-icon {
    width: 1.125rem;
    height: 1.125rem;
  }

  /* ---------------------------------------------------------------- *
   * Numbered list: compact steps separated by thin rules.
   * ---------------------------------------------------------------- */
  .numbered-list {
    margin: var(--space-5) 0 0;
    padding: 0;
    list-style: none;
    counter-reset: numbered-list;
  }

  .numbered-list__item {
    display: flex;
    gap: 0.875rem;
    padding-block: var(--space-3);
    border-top: var(--border-thin) solid var(--color-band-rule);
    counter-increment: numbered-list;
  }

  .numbered-list__item:last-child {
    border-bottom: var(--border-thin) solid var(--color-band-rule);
  }

  .numbered-list__item::before {
    content: counter(numbered-list);
    flex: none;
    min-width: 1ch;
    color: var(--color-accent);
    font-weight: var(--weight-black);
  }

  /* ---------------------------------------------------------------- *
   * Site footer.
   * ---------------------------------------------------------------- */
  .site-footer {
    border-top: var(--border-thin) solid var(--color-rule);
    color: var(--color-text-muted);
    font-size: var(--text-xs);
  }

  .site-footer__inner {
    --cluster-justify: space-between;
    --cluster-gap: var(--space-3) var(--space-6);
    padding-block: var(--space-5) var(--space-6);
  }

  .site-footer__links {
    --cluster-gap: var(--space-2) var(--space-5);
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .site-footer__link {
    display: inline-flex;
    align-items: center;
    min-height: var(--tap-min);
    color: var(--color-link);
  }

  /* ---------------------------------------------------------------- *
   * Prose: long-form text pages (privacy policy, crawler notes).
   * ---------------------------------------------------------------- */
  .prose {
    padding-block: var(--space-7) var(--space-section);
    line-height: 1.65;
  }

  .prose h1 {
    font-size: clamp(2.25rem, 1.6rem + 2.6vw, 3.5rem);
    letter-spacing: var(--tracking-display);
  }

  .prose h2 {
    margin: 2.5rem 0 0.75rem;
    padding-top: var(--space-3);
    border-top: var(--border-thin) solid var(--color-rule);
    font-size: 1.5rem;
    letter-spacing: var(--tracking-tight);
    line-height: var(--leading-snug);
  }

  .prose h3 {
    margin: var(--space-6) 0 var(--space-2);
    font-size: 1.1875rem;
    font-weight: var(--weight-semibold);
    letter-spacing: -0.01em;
    line-height: 1.3;
  }

  .prose p,
  .prose ul,
  .prose ol,
  .prose pre {
    margin-block: 0 var(--space-4);
  }

  .prose ul,
  .prose ol {
    padding-left: 1.3rem;
  }

  .prose li {
    margin-block: 0.35rem;
  }

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

  .prose code {
    overflow-wrap: anywhere;
  }

  .prose pre {
    padding: 0.8rem 1rem;
    border: var(--border-thin) solid var(--color-rule);
    overflow-x: auto;
  }

  .prose hr {
    margin: 2.5rem 0;
    border: 0;
    border-top: var(--border-thin) solid var(--color-rule-soft);
  }

  .prose__meta {
    margin: var(--space-3) 0 var(--space-6);
    color: var(--color-text-muted);
  }
}
