/* Changelog entries (app/changelog/changelog.js, PHP ChangelogPage): the dashboard's
   What's new, the operator editor's preview and /changelog. Each tag says
   its word, so color is never the only signal. */

@layer components {
  .changelog-entry {
    padding-block: 28px;
    border-top: 1px solid var(--border);
  }

  .changelog-entry:first-child {
    padding-top: 0;
    border-top: 0;
  }

  .changelog-entry header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
  }

  .changelog-entry time {
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: var(--text-muted);
  }

  .changelog-entry h2 {
    order: 1;
    flex-basis: 100%;
    font-size: 20px;
    font-weight: 620;
    letter-spacing: -0.3px;
    line-height: 1.3;
    color: var(--text-primary);
    overflow-wrap: anywhere;
  }

  .changelog-entry > p {
    max-width: 68ch;
    margin-top: 12px;
    font-size: 14px;
    line-height: 1.65;
    color: var(--text-secondary);
    overflow-wrap: anywhere;
  }

  .changelog-entry > p + p {
    margin-top: 8px;
  }

  /* Tags in one column as wide as the widest, so every item's text starts on
     the same line; a line is as tall as a tag, which centres it on the first. */
  .changelog-items {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: 10px 12px;
    margin: 18px 0 0;
    padding: 0;
    list-style: none;
  }

  .changelog-items li {
    display: grid;
    grid-template-columns: subgrid;
    grid-column: 1 / -1;
    align-items: start;
    font-size: 14px;
    line-height: 22px;
    color: var(--text-primary);
    overflow-wrap: anywhere;
  }

  .changelog-tag,
  .changelog-new {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 22px;
    padding: 0 10px 0 8px;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    color: var(--tag);
    background: color-mix(in srgb, var(--tag) 14%, transparent);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tag) 26%, transparent);
  }

  .changelog-tag::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
  }

  .changelog-tag-new {
    --tag: var(--success);
  }

  .changelog-tag-improved {
    --tag: var(--role-tank);
  }

  .changelog-tag-fixed {
    --tag: var(--role-ranged);
  }

  /* What's new's unread marker: copper, the one color the tags don't use. */
  .changelog-new {
    --tag: var(--accent);
    height: 20px;
    padding-inline: 8px;
    font-size: 11px;
  }

  .changelog-empty {
    font-size: 14px;
    color: var(--text-secondary);
  }

  /* The public /changelog page, as wide as the header: each entry's date and
     title on the left, what changed on the right (SeoController fills the list). */
  .changelog-page {
    padding-block: 56px 96px;
  }

  .changelog-page h1 {
    margin-top: 14px;
    font-size: 34px;
    letter-spacing: -0.8px;
    line-height: 1.18;
  }

  .changelog-lead {
    max-width: 60ch;
    margin-top: 14px;
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-secondary);
  }

  .changelog-list {
    margin-top: 40px;
    padding-top: 40px;
    border-top: 1px solid var(--border);
  }

  .changelog-page .changelog-entry {
    display: grid;
    grid-template-columns: minmax(200px, 280px) minmax(0, 760px);
    column-gap: 56px;
    align-items: start;
    padding-block: 40px;
  }

  .changelog-page .changelog-entry:first-child {
    padding-top: 0;
  }

  .changelog-page .changelog-entry header {
    grid-column: 1;
    grid-row: 1 / span 30;
  }

  .changelog-page .changelog-entry > p,
  .changelog-page .changelog-items {
    grid-column: 2;
    max-width: none;
  }

  .changelog-page .changelog-entry > :nth-child(2) {
    margin-top: 0;
  }

  .changelog-page .changelog-entry > p {
    font-size: 15px;
  }
}

@layer responsive {
  @media (max-width: 800px) {
    /* The changelog's entries stack: date and title above what changed. */
    .changelog-page .changelog-entry {
      display: block;
    }

    .changelog-page .changelog-entry > :nth-child(2) {
      margin-top: 12px;
    }
  }

  @media (max-width: 600px) {
    .changelog-page {
      padding-block: 32px 72px;
    }

    .changelog-list {
      margin-top: 28px;
      padding-top: 28px;
    }

    .changelog-page .changelog-entry {
      padding-block: 28px;
    }

    .changelog-page h1 {
      font-size: 28px;
    }
  }
}
