/* Le journal du studio : /news et /news/<slug> (js/news.js).
   Les couleurs d'un article (--c1, --c2) sont celles de son app
   (js/apps.js) : décor uniquement, jamais une couleur de texte. */

.nw-page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 8px 24px 96px;
}

@media (max-width: 720px) { .nw-page { padding: 4px 16px 72px; } }

.nw-body .site-header { max-width: 1120px; padding-left: 24px; padding-right: 24px; }

@media (max-width: 720px) { .nw-body .site-header { padding-left: 16px; padding-right: 16px; } }

/* ---------- Barre de lecture ---------- */

.nw-progress {
  position: fixed;
  inset: 0 0 auto;
  height: 3px;
  z-index: 70;
  pointer-events: none;
}

.nw-progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--c1, #FFA97A), var(--c2, #9B8CF0));
  transform-origin: left;
  transform: scaleX(0);
}

/* ---------- Chargement ---------- */

.nw-loading { padding-top: 56px; }

.nw-skel {
  height: 220px;
  border-radius: 20px;
  background: linear-gradient(100deg, var(--surface) 30%, var(--surface-2) 50%, var(--surface) 70%);
  background-size: 300% 100%;
  animation: nw-shimmer 1.4s ease-in-out infinite;
  border: 1px solid var(--border);
}

.nw-skel-hero { height: 320px; margin-bottom: 20px; }

.nw-skel-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }

@media (max-width: 860px) { .nw-skel-grid { grid-template-columns: 1fr; } .nw-skel-grid .nw-skel + .nw-skel { display: none; } }

@keyframes nw-shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

@media (prefers-reduced-motion: reduce) { .nw-skel { animation: none; } }

/* ---------- En-tête de la liste ---------- */

.nw-hero { position: relative; padding: 56px 0 32px; max-width: 760px; }

.nw-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 18px;
  padding: 6px 12px 6px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.nw-eyebrow .ico { width: 18px; height: 18px; }

.nw-h1 {
  margin: 0 0 16px;
  font-size: clamp(38px, 7vw, 68px);
  line-height: 1.02;
  letter-spacing: -.035em;
  font-weight: 700;
}

.nw-h1 em {
  font-family: "Instrument Serif", Georgia, serif;
  font-style: italic;
  font-weight: 400;
  letter-spacing: -.01em;
  background: linear-gradient(90deg, #FFA97A, #9B8CF0 55%, #A9C8E8);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.nw-lead { color: var(--muted); font-size: 18px; line-height: 1.55; margin: 0; max-width: 560px; }

.nw-new { margin-top: 24px; }

.nw-new .ico { width: 18px; height: 18px; }

:root[data-theme="dark"] .btn-primary .ico { filter: brightness(.12); }

.nw-h2 { display: flex; align-items: center; gap: 10px; font-size: 20px; letter-spacing: -.02em; margin: 0 0 16px; }

/* ---------- Filtres et recherche ---------- */

.nw-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin: 8px 0 28px;
}

.nw-filters { display: flex; gap: 8px; flex-wrap: wrap; }

.nw-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px 7px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: color .2s ease, border-color .2s ease, background-color .2s ease;
}

.nw-filter:first-child { padding-left: 14px; }

.nw-filter:hover { color: var(--text); border-color: color-mix(in srgb, var(--text) 24%, transparent); }

.nw-filter[aria-selected="true"] { background: var(--text); border-color: var(--text); color: var(--bg); }

.nw-filter-ico { width: 22px; height: 22px; border-radius: 6px; display: block; }

.nw-filter-count { font-size: 12px; opacity: .6; font-variant-numeric: tabular-nums; }

.nw-search {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 240px;
  padding: 0 12px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  transition: border-color .2s ease;
}

.nw-search:focus-within { border-color: var(--focus); }

.nw-search .ico { width: 18px; height: 18px; opacity: .7; }

.nw-search input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 14px; outline: none; }

@media (max-width: 720px) { .nw-search { flex: 1 1 100%; min-width: 0; } }

/* ---------- Étiquette d'app ---------- */

.nw-tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 3px 10px 3px 3px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  background: color-mix(in srgb, var(--c1) 14%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--c1) 30%, var(--border));
}

.nw-tag-ico { width: 20px; height: 20px; border-radius: 6px; display: block; }

.nw-tag-extra { color: var(--muted); font-weight: 500; }

.nw-fresh {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--bg);
  background: linear-gradient(90deg, var(--c1, #FFA97A), var(--c2, #9B8CF0));
}

/* ---------- Visuel (couverture, ou icône d'app dans un halo) ---------- */

.nw-visual {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background:
    radial-gradient(120% 90% at 20% 0%, color-mix(in srgb, var(--c1) 38%, transparent), transparent 60%),
    radial-gradient(100% 90% at 100% 100%, color-mix(in srgb, var(--c2) 40%, transparent), transparent 60%),
    var(--surface-2);
  display: grid;
  place-items: center;
}

.nw-visual::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(color-mix(in srgb, var(--text) 14%, transparent) 1px, transparent 1px);
  background-size: 18px 18px;
  mask-image: radial-gradient(70% 70% at 50% 50%, #000, transparent);
  opacity: .5;
  pointer-events: none;
}

.nw-cover { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .6s cubic-bezier(.2, .8, .2, 1); }

.nw-visual-glow {
  position: absolute;
  width: 46%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--c1) 70%, transparent), transparent 70%);
  filter: blur(18px);
  opacity: .7;
}

.nw-visual-ico {
  position: relative;
  z-index: 1;
  width: 22%;
  min-width: 56px;
  max-width: 96px;
  aspect-ratio: 1;
  border-radius: 24%;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .35), 0 0 0 1px color-mix(in srgb, #fff 12%, transparent);
  transition: transform .5s cubic-bezier(.2, .8, .2, 1);
}

.nw-visual-ico.brand-logo { box-shadow: none; border-radius: 0; }

/* ---------- La une ---------- */

.nw-feature {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  margin-bottom: 28px;
  border: 1px solid var(--border);
  border-radius: 24px;
  overflow: hidden;
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  transition: border-color .3s ease, transform .4s cubic-bezier(.2, .8, .2, 1), box-shadow .4s ease;
}

.nw-feature:hover {
  border-color: color-mix(in srgb, var(--c1) 45%, var(--border));
  transform: translateY(-3px);
  box-shadow: 0 24px 60px -24px color-mix(in srgb, var(--c1) 45%, transparent);
}

.nw-feature .nw-visual { aspect-ratio: auto; min-height: 340px; }

.nw-feature .nw-visual-ico { width: 30%; max-width: 132px; }

.nw-feature .nw-card-body { padding: 40px; justify-content: center; }

.nw-feature .nw-card-title { font-size: clamp(26px, 3.4vw, 38px); line-height: 1.08; letter-spacing: -.03em; }

.nw-feature .nw-card-excerpt { font-size: 16px; -webkit-line-clamp: 4; }

.nw-feature:hover .nw-visual-ico { transform: scale(1.06) rotate(-3deg); }

.nw-feature:hover .nw-cover { transform: scale(1.03); }

@media (max-width: 860px) {
  .nw-feature { grid-template-columns: 1fr; }
  .nw-feature .nw-visual { min-height: 0; aspect-ratio: 16 / 9; }
  .nw-feature .nw-card-body { padding: 24px; }
}

/* ---------- Grille ---------- */

.nw-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }

.nw-grid-2 { grid-template-columns: repeat(2, 1fr); }

@media (max-width: 960px) { .nw-grid { grid-template-columns: repeat(2, 1fr); } }

@media (max-width: 620px) { .nw-grid, .nw-grid-2 { grid-template-columns: 1fr; } }

.nw-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  transition: border-color .3s ease, transform .4s cubic-bezier(.2, .8, .2, 1), box-shadow .4s ease;
}

.nw-card:hover {
  border-color: color-mix(in srgb, var(--c1) 45%, var(--border));
  transform: translateY(-3px);
  box-shadow: 0 20px 44px -24px color-mix(in srgb, var(--c1) 50%, transparent);
}

.nw-card:hover .nw-visual-ico { transform: scale(1.08) rotate(-3deg); }

.nw-card:hover .nw-cover { transform: scale(1.04); }

.nw-feature:focus-visible, .nw-card:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }

.nw-card-body { display: flex; flex-direction: column; gap: 10px; padding: 20px 22px 22px; flex: 1; }

.nw-card-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.nw-card-title { margin: 2px 0 0; font-size: 19px; line-height: 1.25; letter-spacing: -.015em; overflow-wrap: anywhere; }

.nw-card-excerpt {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}

.nw-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: auto 0 0;
  padding-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.nw-read { color: var(--text); font-weight: 600; transition: transform .3s ease; }

.nw-read::after { content: " →"; }

.nw-feature:hover .nw-read { transform: translateX(3px); }

/* ---------- Brouillons (admins) ---------- */

.nw-drafts { margin: 0 0 32px; padding: 20px; border: 1px dashed var(--border); border-radius: 18px; }

.nw-drafts-list { display: grid; gap: 6px; }

.nw-draft {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  transition: background-color .15s ease;
}

.nw-draft:hover { background: var(--surface-2); }

.nw-draft .nw-tag { --c1: #a1a1aa; --c2: #52525b; }

.nw-draft-title { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nw-draft-meta { color: var(--muted); font-size: 13px; white-space: nowrap; }

@media (max-width: 620px) { .nw-draft { flex-wrap: wrap; } .nw-draft-meta { width: 100%; } }

/* ---------- Vide / erreur ---------- */

.nw-empty, .nw-error { text-align: center; padding: 56px 16px; }

.nw-error { padding-top: 96px; }

.nw-error .nw-lead { margin: 0 auto 24px; }

.nw-empty-ico { width: 72px; height: 72px; margin: 0 auto 16px; display: block; }

:root[data-theme="light"] .nw-empty-ico { filter: brightness(.22) contrast(1.15); }

.nw-empty-title { font-size: 18px; font-weight: 600; margin: 0 0 6px; }

.nw-empty-text { color: var(--muted); margin: 0; }

/* ---------- Newsletter ---------- */

.nw-letter {
  display: flex;
  align-items: center;
  gap: 32px;
  margin-top: 56px;
  padding: 32px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background:
    radial-gradient(80% 120% at 0% 0%, color-mix(in srgb, #FFA97A 12%, transparent), transparent 60%),
    radial-gradient(80% 120% at 100% 100%, color-mix(in srgb, #9B8CF0 14%, transparent), transparent 60%),
    var(--surface);
}

.nw-letter > div:last-child { flex: 1; }

.nw-letter .nl-form { max-width: 520px; }

.nw-letter .nl-title { font-size: 20px; letter-spacing: -.02em; }

.nw-letter-art {
  flex: none;
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  border-radius: 24px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.nw-letter-art img { width: 56px; height: 56px; }

:root[data-theme="light"] .nw-letter-art img { filter: brightness(.22) contrast(1.15); }

@media (max-width: 620px) {
  .nw-letter { flex-direction: column; align-items: flex-start; gap: 20px; padding: 24px; }
  .nw-letter-art { width: 72px; height: 72px; border-radius: 18px; }
  .nw-letter-art img { width: 42px; height: 42px; }
}

/* ---------- Article ---------- */

.nw-article { position: relative; }

.nw-article::before {
  content: "";
  position: absolute;
  inset: -120px 0 auto;
  height: 520px;
  z-index: -1;
  background:
    radial-gradient(50% 60% at 30% 20%, color-mix(in srgb, var(--c1) 20%, transparent), transparent 70%),
    radial-gradient(40% 50% at 75% 10%, color-mix(in srgb, var(--c2) 18%, transparent), transparent 70%);
  pointer-events: none;
}

.nw-article-head { max-width: 760px; margin: 0 auto; padding-top: 24px; }

.nw-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 28px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color .2s ease, transform .2s ease;
}

.nw-back .ico { width: 18px; height: 18px; }

.nw-back:hover { color: var(--text); transform: translateX(-3px); }

.nw-article-tags { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; }

.nw-article-title {
  margin: 0 0 18px;
  font-size: clamp(34px, 6vw, 56px);
  line-height: 1.05;
  letter-spacing: -.035em;
  overflow-wrap: anywhere;
}

.nw-article-lede { margin: 0 0 28px; font-size: 20px; line-height: 1.55; color: var(--muted); }

.nw-byline {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 40px;
}

.nw-byline-logo { width: 36px; height: 36px; border-radius: 10px; }

.nw-byline-name { margin: 0; font-weight: 600; font-size: 14px; }

.nw-byline-meta { margin: 0; color: var(--muted); font-size: 13px; }

.nw-share { display: flex; gap: 6px; margin-left: auto; }

.nw-icon-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color .2s ease, transform .2s ease;
}

.nw-icon-btn:hover { border-color: color-mix(in srgb, var(--text) 28%, transparent); }

.nw-icon-btn:active { transform: scale(.92); }

.nw-icon-btn .ico { width: 18px; height: 18px; }

.nw-admin { margin: -16px 0 32px; }

.nw-article-layout {
  display: grid;
  grid-template-columns: minmax(0, 760px);
  justify-content: center;
}

.nw-toc { display: none; }

/* Sur grand écran, le sommaire se pose à droite de la colonne de lecture,
   qui reste centrée : la mise en page sort du conteneur de 1120 px. */
@media (min-width: 1240px) {
  .nw-article-layout:has(.nw-toc:not([hidden])) {
    --w: min(100vw - 64px, 1400px);
    width: var(--w);
    margin-left: calc((100% - var(--w)) / 2);
    grid-template-columns: 1fr minmax(0, 760px) 1fr;
    column-gap: 48px;
  }
  .nw-article-layout:has(.nw-toc:not([hidden])) .nw-prose { grid-column: 2; }
  .nw-toc:not([hidden]) { display: block; grid-column: 3; grid-row: 1; max-width: 240px; position: sticky; top: 32px; align-self: start; }
}

.nw-toc-title { margin: 4px 0 12px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }

.nw-toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border); }

.nw-toc a {
  display: block;
  padding: 6px 0 6px 14px;
  margin-left: -1px;
  border-left: 2px solid transparent;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  text-decoration: none;
  transition: color .2s ease, border-color .2s ease;
}

.nw-toc a:hover { color: var(--text); }

.nw-toc-sub a { padding-left: 26px; font-size: 12.5px; }

.nw-toc a[aria-current] { color: var(--text); border-left-color: var(--c1, var(--text)); }

/* Le texte : une colonne de lecture, aérée. */

.nw-prose { font-size: 18px; line-height: 1.75; }

.nw-prose > :first-child { margin-top: 0; }

.nw-prose p, .nw-prose ul, .nw-prose blockquote { margin: 0 0 22px; }

.nw-prose h2 { font-size: 28px; line-height: 1.2; letter-spacing: -.025em; margin: 48px 0 14px; scroll-margin-top: 24px; }

.nw-prose h3 { font-size: 21px; letter-spacing: -.015em; margin: 36px 0 10px; scroll-margin-top: 24px; }

.nw-prose h4 { font-size: 17px; margin: 28px 0 8px; }

.nw-prose ul { padding-left: 0; list-style: none; }

.nw-prose li { position: relative; padding-left: 26px; margin-bottom: 8px; }

.nw-prose li::before {
  content: "";
  position: absolute;
  left: 6px;
  top: .72em;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  transform: rotate(45deg);
  background: linear-gradient(135deg, var(--c1, #FFA97A), var(--c2, #9B8CF0));
}

.nw-prose blockquote {
  position: relative;
  margin: 32px 0;
  padding: 4px 0 4px 24px;
  border-left: 3px solid transparent;
  border-image: linear-gradient(var(--c1, #FFA97A), var(--c2, #9B8CF0)) 1;
  color: var(--text);
  font-family: "Instrument Serif", Georgia, serif;
  font-size: 26px;
  line-height: 1.35;
}

.nw-prose img {
  width: 100%;
  margin: 32px 0;
  border-radius: 18px;
  border: 1px solid var(--border);
  box-shadow: 0 24px 60px -30px rgba(0, 0, 0, .5);
}

.nw-prose a { color: var(--text); text-decoration-color: color-mix(in srgb, var(--c1, #FFA97A) 70%, transparent); text-decoration-thickness: 2px; }

.nw-prose a:hover { text-decoration-color: var(--c1, #FFA97A); }

.nw-prose strong { font-weight: 650; }

@media (max-width: 620px) {
  .nw-prose { font-size: 17px; }
  .nw-prose h2 { font-size: 24px; }
  .nw-prose blockquote { font-size: 22px; }
  .nw-article-lede { font-size: 18px; }
}

.nw-article-foot { max-width: 760px; margin: 56px auto 0; }

.nw-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 56px; }

.nw-pager[hidden] { display: none; }

.nw-pager-link {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  transition: border-color .2s ease, transform .3s cubic-bezier(.2, .8, .2, 1);
}

.nw-pager-link:hover { border-color: color-mix(in srgb, var(--text) 26%, transparent); transform: translateY(-2px); }

.nw-pager-next { grid-column: 2; text-align: right; }

.nw-pager-dir { color: var(--muted); font-size: 13px; }

.nw-pager-title { font-weight: 600; line-height: 1.35; }

@media (max-width: 620px) {
  .nw-pager { grid-template-columns: 1fr; }
  .nw-pager-next { grid-column: auto; }
}

.nw-more .nw-card-title { font-size: 17px; }

/* ---------- Éditeur ---------- */

.nw-editor { max-width: 1040px; margin: 0 auto; padding-top: 16px; }

.nw-editor h1 { font-size: 30px; letter-spacing: -.02em; margin: 0 0 20px; }
