/* Блок новин на главной (из news-block.html). Классы nw-*. */
#fp-news {
  --nw-ink: #1a0f0f; --nw-muted: #7a6e68; --nw-accent: #8a1c2b; --nw-accent-dark: #6b1220;
  --nw-paper: #fffdf8; --nw-line: #e7dfd4; --nw-radius: 6px; --nw-bg: #faf7f2;
  --nw-tag-bg: rgba(138,28,43,.04);
}
body.page-dark #fp-news {
  --nw-ink: #f6f4ee; --nw-muted: rgba(246,244,238,.62); --nw-line: rgba(246,244,238,.18); --nw-tag-bg: rgba(246,244,238,.06);
  --nw-bg: #420101;
}
#fp-news .nw-card__title, #fp-news .nw-card__excerpt, #fp-news .nw-tags a { transition: color .5s ease, background-color .25s, border-color .5s, transform .25s; }
#fp-news .nw-card__title { font-family: "Source Serif 4", Georgia, serif; }
/* ---------- Сітка: featured + стопка ---------- */
  .nw-grid {
    display: grid;
    grid-template-columns: 1.65fr 1fr;
    gap: 40px;
  }
  .nw-side { display: grid; gap: 32px; align-content: start; }

  /* ---------- Картка ---------- */
  .nw-card { position: relative; }
  .nw-card__media {
    position: relative; overflow: hidden; border-radius: var(--nw-radius);
    aspect-ratio: 16 / 9; background: #2a1a1a;
  }
  .nw-card__media img {
    width: 100%; height: 100%; object-fit: cover; display: block;
    transition: transform .7s cubic-bezier(.2,.7,.2,1);
  }
  .nw-card:hover .nw-card__media img { transform: scale(1.045); }
  .nw-card__media::after {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(to top, rgba(26,15,15,.35), transparent 45%);
    opacity: 0; transition: opacity .4s ease;
  }
  .nw-card:hover .nw-card__media::after { opacity: 1; }

  /* ---------- Відривний календар ---------- */
  .nw-cal {
    --w: 68px;
    position: absolute; top: 18px; left: 18px; z-index: 2;
    width: var(--w);
    text-align: center; line-height: 1;
    transform: rotate(-4deg);
    transform-origin: 50% 0;
    filter: drop-shadow(0 10px 14px rgba(0,0,0,.32)) drop-shadow(0 2px 3px rgba(0,0,0,.2));
    transition: transform .5s cubic-bezier(.3,1.5,.5,1);
  }
  .nw-card:hover .nw-cal { transform: rotate(2deg); }

  /* кільця пружини */
  .nw-cal::before, .nw-cal::after {
    content: ""; position: absolute; top: -6px; z-index: 2;
    width: 5px; height: 14px; border-radius: 3px;
    background: linear-gradient(90deg, #6d6d6d, #e9e9e9 45%, #8a8a8a);
    box-shadow: 0 1px 1px rgba(0,0,0,.35);
  }
  .nw-cal::before { left: 26%; }
  .nw-cal::after  { right: 26%; }

  /* шапка з місяцем */
  .nw-cal__mon {
    position: relative;
    display: block;
    padding: 11px 0 6px;
    background: linear-gradient(180deg, var(--nw-accent) 0%, var(--nw-accent-dark) 100%);
    color: #fff;
    font: 600 10px/1 "Source Sans 3", sans-serif;
    letter-spacing: .2em; text-transform: uppercase;
    border-radius: 7px 7px 0 0;
  }
  /* отвори під кільця */
  .nw-cal__mon::before, .nw-cal__mon::after {
    content: ""; position: absolute; top: 4px;
    width: 7px; height: 4px; border-radius: 50%;
    background: rgba(0,0,0,.45);
  }
  .nw-cal__mon::before { left: calc(26% - 1px); }
  .nw-cal__mon::after  { right: calc(26% - 1px); }

  /* аркуш із числом */
  .nw-cal__page {
    position: relative;
    display: block;
    padding: 7px 0 9px;
    background:
      linear-gradient(var(--nw-paper), var(--nw-paper)) padding-box;
    border-radius: 0 0 7px 7px;
    /* стос аркушів під верхнім */
    box-shadow:
      0 3px 0 -1px #f1e9dc,
      0 6px 0 -2px #e3d7c4;
    overflow: hidden;
  }
  /* лінія перфорації під шапкою */
  .nw-cal__page::before {
    content: ""; position: absolute; top: 0; left: 6px; right: 6px; height: 1px;
    background: repeating-linear-gradient(90deg, #d8cbb6 0 3px, transparent 3px 6px);
  }
  /* загнутий куточок */
  .nw-cal__page::after {
    content: ""; position: absolute; right: 0; bottom: 0;
    width: 14px; height: 14px;
    background: linear-gradient(135deg, #e6dccb 0%, #f7f1e6 48%, var(--nw-bg) 50%);
    border-top-left-radius: 4px;
    box-shadow: -1px -1px 2px rgba(0,0,0,.12);
    transition: width .4s ease, height .4s ease;
  }
  .nw-card:hover .nw-cal__page::after { width: 20px; height: 20px; }

  .nw-cal__day {
    display: block;
    font-family: "Unbounded", sans-serif; font-weight: 700;
    font-size: 28px; letter-spacing: -.02em; color: var(--nw-ink);
  }
  .nw-cal__wd {
    display: block; margin-top: 5px;
    font: 600 9px/1 "Source Sans 3", sans-serif;
    letter-spacing: .14em; text-transform: uppercase; color: var(--nw-muted);
  }
  .cal__wd--sun { color: var(--nw-accent); }

  /* ---------- Тіло картки ---------- */
  .nw-card__body { padding-top: 18px; }
  .nw-card__title {
    font-family: "Source Serif 4", Georgia, serif; font-weight: 700;
    font-size: 20px; line-height: 1.3; margin: 0;
  }
  .nw-card__title a {
    color: inherit; text-decoration: none;
    background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
    transition: background-size .45s ease;
  }
  .nw-card:hover .nw-card__title a { background-size: 100% 1px; }
  /* вся картка клікабельна */
  .nw-card__title a::after { content: ""; position: absolute; inset: 0; z-index: 3; }
  .nw-card__title a:focus-visible { outline: none; }
  .nw-card:has(.nw-card__title a:focus-visible) { outline: 2px solid var(--nw-accent); outline-offset: 6px; border-radius: var(--nw-radius); }

  .nw-card__excerpt { color: var(--nw-muted); margin: 10px 0 0; font-size: 15px; }

  /* ---------- Теги ---------- */
  .nw-tags {
    position: relative; z-index: 4;          /* над stretched-link */
    display: flex; flex-wrap: wrap; gap: 6px;
    list-style: none; margin: 14px 0 0; padding: 0;
  }
  .nw-tags a {
    display: inline-block;
    padding: 4px 10px 5px;
    font-size: 12px; font-weight: 600; line-height: 1.2;
    color: var(--nw-muted); text-decoration: none;
    background: var(--nw-tag-bg);
    border: 1px solid var(--nw-line);
    border-radius: 999px;
    transition: color .25s, background-color .25s, border-color .25s, transform .25s;
  }
  .nw-tags a::before { content: "#"; color: var(--nw-accent); opacity: .6; margin-right: 1px; transition: color .25s, opacity .25s; }
  .nw-tags a:hover, .nw-tags a:focus-visible {
    color: #fff; background: var(--nw-accent); border-color: var(--nw-accent);
    transform: translateY(-1px); outline: none;
  }
  .nw-tags a:hover::before, .nw-tags a:focus-visible::before { color: #fff; opacity: .7; }

  /* ---------- Featured ---------- */
  .nw-card--featured .nw-card__media { aspect-ratio: 16 / 10; }
  .nw-card--featured .nw-card__title { font-size: clamp(22px, 2.4vw, 30px); }
  .nw-card--featured .nw-card__excerpt { font-size: 16px; max-width: 60ch; }
  .nw-card--featured .nw-cal { --w: 80px; top: 22px; left: 22px; }
  .nw-card--featured .nw-cal__day { font-size: 34px; }

  /* ---------- Компактні ---------- */
  .nw-card--compact { display: grid; grid-template-columns: 44% 1fr; gap: 18px; align-items: start; }
  .nw-card--compact .nw-card__media { aspect-ratio: 4 / 3; }
  .nw-card--compact .nw-card__body { padding-top: 0; }
  .nw-card--compact .nw-card__title { font-size: 17px; }
  .nw-card--compact .nw-cal { --w: 54px; top: 12px; left: 12px; }
  .nw-card--compact .nw-cal__mon { padding: 9px 0 5px; font-size: 9px; }
  .nw-card--compact .nw-cal__day { font-size: 21px; }
  .nw-card--compact .nw-cal__wd { display: none; }
  .nw-card--compact .nw-tags { margin-top: 10px; gap: 5px; }
  .nw-card--compact .nw-tags a { font-size: 11px; padding: 3px 8px 4px; }
  .nw-side .nw-card + .nw-card { padding-top: 32px; border-top: 1px solid var(--nw-line); }

  /* ---------- Поява при скролі ---------- */
  .nw-js .nw-reveal { opacity: 0; transform: translateY(18px); }
  .nw-js .nw-reveal.is-visible {
    opacity: 1; transform: none;
    transition: opacity .7s ease, transform .7s cubic-bezier(.2,.7,.2,1);
  }
  .nw-js .nw-reveal .nw-cal { opacity: 0; transform: rotate(-4deg) translateY(-14px); }
  .nw-js .nw-reveal.is-visible .nw-cal {
    opacity: 1; transform: rotate(-4deg);
    transition: opacity .5s ease .35s, transform .7s cubic-bezier(.3,1.5,.5,1) .35s;
  }
  .nw-js .nw-reveal.is-visible:hover .nw-cal { transform: rotate(2deg); transition-delay: 0s; }

  
.nw-card__media.nw-noimg { background: #2a1a1a; }

/* ---------- Адаптив ---------- */
  @media (max-width: 900px) {
    .nw-grid { grid-template-columns: 1fr; }
  }
  @media (max-width: 560px) {
    .nw-card--compact { grid-template-columns: 1fr; }
    .nw-card--compact .nw-card__media { aspect-ratio: 16 / 9; }
  }
  @media (prefers-reduced-motion: reduce) {
    #fp-news *, #fp-news *::before, #fp-news *::after { transition: none !important; }
    .nw-js .nw-reveal, .nw-js .nw-reveal .nw-cal { opacity: 1; transform: none; }
    .nw-js .nw-reveal .nw-cal { transform: rotate(-4deg); }
  }

/* без загнутого уголка на листке календаря */
#fp-news .nw-cal__page::after { display: none; }

/* после появления — календарик возвращается без задержки */
#fp-news .nw-js .nw-reveal.nw-done .nw-cal,
.nw-js .nw-reveal.nw-done .nw-cal { transition: transform .5s cubic-bezier(.3,1.5,.5,1); }
.nw-js .nw-reveal.nw-done { transition: none; }

/* заголовок наследовал тёмный цвет страницы — берём из переменной */
#fp-news .nw-card__title, #fp-news .nw-card__title a { color: var(--nw-ink); }
/* листок календаря всегда светлый — цифры не зависят от тёмного режима */
#fp-news .nw-cal__day { color: #1a0f0f; }
#fp-news .nw-cal__wd { color: #7a6e68; }
#fp-news .nw-cal__wd--sun { color: #8a1c2b; }
