/* ===================================================================
   CARTFIT.AI · news.css
   section 06 — news (backend-ready list template)
   each .nw-item = one record { date, category, title, excerpt, image, slug }
   when an image is supplied, drop <img> inside .nw-item__thumb —
   it covers the placeholder automatically.
   load order matters — see index.html
   =================================================================== */

.nw-list {
  border-top: 1px solid var(--line-1);
  margin-top: 8px;
}

.nw-item {
  position: relative;
  display: grid;
  grid-template-columns: 56px 216px 1fr 44px;
  gap: 36px;
  align-items: center;
  padding: 24px 0;
  border-bottom: 1px solid var(--line-1);
  cursor: default; /* detail pages not wired yet — switch to pointer when live */
}

/* accent hairline sweeps across the top edge on hover */
.nw-item::before {
  content: '';
  position: absolute;
  left: 0; top: -1px;
  height: 1px; width: 0;
  background: var(--accent);
  transition: width 0.55s cubic-bezier(0.16, 1, 0.3, 1);
}
.nw-item:hover::before { width: 100%; }

/* index + square dot */
.nw-item__idx {
  display: flex; align-items: center; gap: 12px;
  font-family: var(--font-mono);
  font-size: 10px; letter-spacing: 0.2em;
  color: var(--fg-3);
  transition: color 0.3s;
}
.nw-item__sq {
  width: 5px; height: 5px;
  border: 1px solid var(--line-3);
  flex: none;
  transition: border-color 0.3s, background 0.3s;
}
.nw-item:hover .nw-item__idx { color: var(--fg-1); }
.nw-item:hover .nw-item__sq { border-color: var(--accent); background: var(--accent); }

/* thumbnail — striped placeholder until backend supplies an image */
.nw-item__thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--bg-1);
  background-image: repeating-linear-gradient(45deg, #101010 0, #101010 1px, transparent 1px, transparent 9px);
  border: 1px solid var(--line-2);
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  transition: border-color 0.3s;
}
.nw-item:hover .nw-item__thumb { border-color: var(--line-3); }
.nw-item__thumb img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.nw-item:hover .nw-item__thumb img { transform: scale(1.04); }
.nw-item__thumb-label {
  font-family: var(--font-mono);
  font-size: 8px; letter-spacing: 0.22em;
  color: #2E2E2E;
  position: relative; z-index: 1;
}

/* text block */
.nw-item__main { min-width: 0; }
.nw-item__meta {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 10px;
}
.nw-item__date {
  font-family: var(--font-mono);
  font-size: 9px; letter-spacing: 0.18em;
  color: var(--fg-3);
}
.nw-item__metaline {
  width: 24px; height: 1px;
  background: var(--line-2);
  flex: none;
  transition: background 0.3s;
}
.nw-item:hover .nw-item__metaline { background: var(--accent); }
.nw-item__cat {
  font-family: var(--font-mono);
  font-size: 8.5px; letter-spacing: 0.24em;
  color: var(--fg-2);
  border: 1px solid var(--line-2);
  padding: 3px 8px;
  transition: color 0.3s, border-color 0.3s;
}
.nw-item:hover .nw-item__cat { color: var(--accent); border-color: var(--line-3); }
.nw-item__title {
  font-family: var(--font-jp);
  font-weight: 400;
  font-size: 15px; letter-spacing: 0.06em;
  line-height: 1.5;
  color: var(--fg-2);
  margin: 0 0 8px;
  transition: color 0.3s;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2; /* 真实标题常超一行；卡高有余量 */
  -webkit-box-orient: vertical;
}
.nw-item:hover .nw-item__title { color: var(--fg-0); }
.nw-item__excerpt {
  font-family: var(--font-jp);
  font-weight: 300;
  font-size: 11.5px; letter-spacing: 0.04em;
  line-height: 1.8;
  color: #6E6E6E;
  margin: 0;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* arrow cell */
.nw-item__arrow {
  width: 40px; height: 40px;
  border: 1px solid var(--line-2);
  display: flex; align-items: center; justify-content: center;
  justify-self: end;
  transition: border-color 0.3s;
}
.nw-item__arrow span {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--fg-3);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), color 0.3s;
}
.nw-item:hover .nw-item__arrow { border-color: var(--fg-0); }
.nw-item:hover .nw-item__arrow span { transform: translateX(3px); color: var(--fg-0); }

.nw-item__thumb--empty {
  background-image: none;
  background: var(--bg-1);
}

.nw-foot {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid var(--line-1);
  display: flex; justify-content: space-between;
  align-items: center;
}

/* pagination dots */
.nw-pager {
  display: flex; align-items: center; gap: 11px;
}
.nw-dot {
  width: 7px; height: 7px;
  padding: 0;
  border: 1px solid var(--line-3);
  background: transparent;
  cursor: pointer;
  transition: border-color 0.3s, background 0.3s;
}
.nw-dot:hover { border-color: var(--fg-1); }
.nw-dot.is-active {
  background: var(--accent);
  border-color: var(--accent);
}

/* =================================================================
   news article overlay（图文记事）
   ================================================================= */
.nw-modal { position: fixed; inset: 0; z-index: 70; }
.nw-modal[hidden] { display: none; }
.nw-modal__backdrop {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.84);
  cursor: pointer;
}
.nw-modal__panel {
  position: relative;
  margin: 6vh auto;
  width: min(720px, calc(100vw - 48px));
  max-height: 88vh;
  background: var(--bg-0);
  border: 1px solid var(--line-2);
  display: flex;
  flex-direction: column;
}
.nw-modal__bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line-1);
  flex-shrink: 0;
}
.nw-modal__bar-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.22em;
  color: var(--fg-3);
}
.nw-modal__close {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-3);
  padding: 4px 6px;
  cursor: pointer;
}
.nw-modal__close:hover { color: var(--fg-0); }
.nw-modal__scroll { overflow-y: auto; }
.nw-modal__content { padding: 36px 44px 44px; }

.nw-art__meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--fg-3);
  margin-bottom: 16px;
}
.nw-art__metaline { width: 28px; height: 1px; background: var(--line-3); }
.nw-art__title {
  font-family: var(--font-jp);
  font-weight: 500;
  font-size: 24px;
  letter-spacing: 0.04em;
  line-height: 1.5;
  color: var(--fg-0);
  margin: 0 0 28px;
  text-wrap: pretty;
}
.nw-art__fig { margin: 0 0 28px; }
.nw-art__fig img {
  display: block;
  width: 100%;
  border: 1px solid var(--line-1);
}
.nw-art__cap {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  color: var(--fg-3);
  padding-top: 8px;
}
.nw-art__p {
  font-family: var(--font-jp);
  font-weight: 300;
  font-size: 13.5px;
  letter-spacing: 0.03em;
  line-height: 2;
  color: #A6A6A6;
  margin: 0 0 20px;
  text-wrap: pretty;
}
.nw-art__link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 12px 22px;
  border: 1px solid var(--line-3);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--fg-2);
}
.nw-art__link:hover { color: var(--fg-0); border-color: var(--fg-0); }

/* ── mobile (≤768) ───────────────────────────────────────────── */
@media (max-width: 768px) {
  .nw-item {
    grid-template-columns: 104px 1fr;
    gap: 16px;
    padding: 18px 0;
    align-items: start;
  }
  .nw-item__idx, .nw-item__arrow { display: none; }
  .nw-item__meta { margin-bottom: 6px; }
  .nw-item__title { font-size: 13px; }
  .nw-item__excerpt { font-size: 10.5px; }

  .nw-modal__panel {
    margin: 0;
    width: 100vw;
    max-height: 100vh;
    height: 100%;
    border: none;
  }
  .nw-modal__content { padding: 24px 20px 40px; }
  .nw-art__title { font-size: 19px; }
}
