/* aimlink.ai news section: what both variants share (chips, fallback, preview switch).
   Load after site.css; the rules join its cascade layers. Variant styles: fresh.css (A), gallery.css (B). */

@layer components {
  /* "New": lime as a fill with dark text (the only way lime may sit on a light page) */
  .news-new {
    position: relative; display: inline-flex; align-items: center; min-height: 24px; padding: 0 9px;
    border-radius: var(--radius-pill); background: var(--color-lime); color: var(--color-night);
    font: 600 var(--type-label-size)/1 var(--font-text); letter-spacing: 0.1em; text-transform: uppercase;
  }
  /* The ring that lands with it, played once by a variant (keyframes below) */
  .news-new::after {
    content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
    box-shadow: 0 0 0 1.5px var(--color-lime); opacity: 0;
  }

  /* Category on a photo: the app's competition colours (design system, 03 Colors) with night text, 5.6:1 or better;
     a category without a colour keeps the dark chip (snow on night 72 %: 6.8:1 over white) */
  .news-tag {
    display: inline-flex; align-items: center; min-height: 24px; padding: 0 9px;
    border-radius: var(--radius-pill); background: color-mix(in srgb, var(--color-night) 72%, transparent);
    -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
    color: var(--color-snow); font: 500 var(--type-label-size)/1 var(--font-text); letter-spacing: 0.1em; text-transform: uppercase;
  }

  .news-tag[data-cat] { background: var(--cat, color-mix(in srgb, var(--color-night) 72%, transparent)); color: var(--cat-ink, var(--color-snow)); -webkit-backdrop-filter: none; backdrop-filter: none; }
  /* the slugs of "categories" in content/news.js; "company-press" keeps the dark chip, and lime stays with "New" */
  .news-tag[data-cat="product"] { --cat: var(--color-purple); --cat-ink: var(--color-night); }
  .news-tag[data-cat="app-releases"] { --cat: var(--color-gold); --cat-ink: var(--color-night); }
  .news-tag[data-cat="clubs-ranges"] { --cat: var(--color-orange); --cat-ink: var(--color-night); }
  .news-tag[data-cat="events-community"] { --cat: var(--color-pink); --cat-ink: var(--color-night); }
  .news-tag[data-cat="partnerships"] { --cat: var(--color-mist); --cat-ink: var(--color-night); }

  @keyframes news-impact { from { opacity: 0.9; transform: scale(1); } to { opacity: 0; transform: scale(1.8); } }
}

@layer sections {
  /* Before the stories have loaded (or without JS): heading and the archive link */
  .news[data-news]:not(.is-rendered) { min-height: 46rem; }
  .news-fallback { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: var(--space-5); }
  /* without JS: say why the stories are not here (index.html <noscript>), and do not hold their room open */
  .news-fallback noscript { display: contents; }
  .news-nojs { flex-basis: 100%; order: 1; margin: 0; max-width: 60ch; color: var(--text-muted); font-size: var(--type-lede-size); line-height: var(--type-lede-leading); }
  .news-fallback .btn { order: 2; }
  @media (scripting: none) { .news[data-news]:not(.is-rendered) { min-height: 0; } }

  /* The newsletter, last before the footer (index.html: <section class="subscribe subscribe--news" data-rhythm="proof">).
     Since the review pass it follows the dark three-app close, so it has its own role padding and its own paper; it is centred like the
     news head, and the form sits on a plate with the same solid front edge as the shelf and the cards. */
  .subscribe--news { background: var(--bg-alt); }
  .subscribe--news .container { display: grid; justify-items: center; }
  .subscribe--news .subscribe-head { justify-items: center; text-align: center; }
  .subscribe--news .lede { margin-inline: auto; }
  .subscribe--news .sub-panel {
    width: min(100%, 64rem); padding: clamp(1.5rem, 3vw, 2.5rem);
    border-radius: var(--radius-panel); background: var(--bg);
    box-shadow: 0 10px 0 color-mix(in srgb, var(--color-ink) 16%, var(--color-stone)), 0 28px 44px -30px rgb(19 32 26 / 0.35);
  }
  .subscribe--news .field input { background: var(--bg-alt); }
  .subscribe--news .sub-note { text-align: center; }
  @media (max-width: 599.98px) { .subscribe--news .sub-panel { border-radius: var(--radius-panel); } }
}
