/* ================================
   Login News — FINAL
   ================================ */

/* ---------- Tunables ---------- */
#login-news.ln {
  /* layout */
  --ln-maxw: 1100px;
  --ln-gap: 1rem;
  /* thumbnail (desktop/tablet) */
  --ln-thumb-size: 84px; /* 76–96px looks good */
  --ln-thumb-radius: 12px;
  /* type */
  --ln-title-fs: 1.08rem;
  --ln-title-lh: 1.22;
  --ln-title-lines: 2;
  --ln-body-fs: .88rem;
  --ln-body-lh: 1.5;
  --ln-body-lines-d: 6; /* desktop/tablet lines */
  --ln-body-lines-m: 4; /* mobile lines */
}

/* ---------- Wrapper & track ---------- */
#login-news.ln {
  width: 100%;
  max-width: var(--ln-maxw);
  margin: 16px auto 0;
}

  #login-news.ln .ln-track {
    display: grid;
    gap: var(--ln-gap);
    align-items: stretch;
  }

@media (min-width:641px) {
  #login-news.ln .ln-track {
    grid-template-columns: repeat(3,1fr);
  }
}

@media (max-width:640px) {
  #login-news.ln .ln-track {
    display: flex !important;
    overflow-x: auto !important;
    scroll-snap-type: x mandatory !important;
    gap: 16px !important;
    padding: 0 20px .25rem 20px !important;
  }
}

/* ---------- Card ---------- */
#login-news.ln .ln-slide {
  display: flex;
  flex-direction: column;
  background: rgba(255,255,255,.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: .75rem;
  padding: 1rem;
  box-shadow: 0 10px 24px rgba(0,0,0,.06);
  text-decoration: none;
  transition: transform .2s, box-shadow .2s;
  min-height: 0;
}

  #login-news.ln .ln-slide:hover {
    transform: translateY(-3px);
    box-shadow: 0 18px 36px rgba(0,0,0,.12);
  }

#login-news.ln .ln-body {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  min-width: 0;
}

#login-news.ln .ln-text-content {
  display: flow-root;
}
/* contains the float */

/* ---------- Title ---------- */
#login-news.ln .ln-title {
  margin: 0 0 .12rem 0;
  font-weight: 700;
  color: #0B1220;
  font-size: var(--ln-title-fs);
  line-height: var(--ln-title-lh);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
  -webkit-line-clamp: var(--ln-title-lines);
  text-wrap: balance;
  hyphens: auto;
  -webkit-hyphens: auto;
  overflow-wrap: anywhere;
}

/* ---------- Floated thumbnail (top-right, aligned with title) ---------- */
/* NOTE: this assumes <figure.ln-thumb> is inserted BEFORE the title in the DOM */
#login-news.ln .ln-thumb {
  float: right;
  width: var(--ln-thumb-size);
  height: var(--ln-thumb-size);
  margin: 0 0 .4rem .75rem; /* snug to the title; gap left/below */
  border-radius: var(--ln-thumb-radius);
  overflow: hidden;
  background: linear-gradient(180deg,#fff,#f8fafc);
  border: 1px solid rgba(17,24,39,0.08);
  box-shadow: 0 6px 18px rgba(0,0,0,.08);
  shape-outside: margin-box;
}

#login-news.ln .ln-thumb-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity .2s ease-out;
}

  #login-news.ln .ln-thumb-img.is-ready {
    opacity: 1;
  }

/* ---------- Body copy (height-based clamp so it wraps under the float) ---------- */
#login-news.ln .ln-text {
  margin: 0;
  color: #374151;
  font-size: var(--ln-body-fs);
  line-height: var(--ln-body-lh);
  display: block;
  hyphens: auto;
  -webkit-hyphens: auto;
  overflow-wrap: anywhere;
  word-break: normal;
  max-height: calc(var(--ln-body-lines-d) * 1em * var(--ln-body-lh));
  overflow: hidden;
}

@media (max-width:640px) {
  #login-news.ln .ln-text {
    max-height: calc(var(--ln-body-lines-m) * 1em * var(--ln-body-lh));
  }
}

/* Equalized text area so cards line up even if one has less text */
#login-news.ln .ln-text-content {
  min-height: calc( var(--ln-title-fs) * var(--ln-title-lh) * var(--ln-title-lines) + var(--ln-body-fs) * var(--ln-body-lh) * var(--ln-body-lines-d) + .4rem );
}

@media (max-width:640px) {
  #login-news.ln .ln-text-content {
    min-height: calc( var(--ln-title-fs) * var(--ln-title-lh) * var(--ln-title-lines) + var(--ln-body-fs) * var(--ln-body-lh) * var(--ln-body-lines-m) + .4rem );
  }
}

/* ---------- CTA ---------- */
#login-news.ln .ln-cta {
  display: inline-block;
  margin-top: .35rem;
  align-self: flex-start;
  font-size: .86rem;
  font-weight: 500;
  color: #0d6efd;
  transition: color .2s, transform .2s;
}

#login-news.ln .ln-slide:hover .ln-cta {
  color: #0056b3;
  text-decoration: underline;
}

/* ---------- Mobile card sizing ---------- */
@media (max-width:640px) {
  #login-news.ln .ln-slide {
    width: 320px;
    min-width: 320px;
    max-width: 320px;
    scroll-snap-align: start;
    padding: .85rem;
  }
  /* thumb goes full width on narrow screens for better use of space */
  #login-news.ln .ln-thumb {
    float: none;
    width: 100%;
    height: auto;
    aspect-ratio: 16/9;
    margin: 0 0 .5rem 0;
    box-shadow: 0 8px 20px rgba(0,0,0,.10);
  }
}

/* ---------- A11y & motion ---------- */
#login-news.ln .ln-slide:focus-visible {
  outline: 2px solid #0d6efd;
  outline-offset: 4px;
  border-radius: .75rem;
  transform: translateY(-2px);
  box-shadow: 0 16px 32px rgba(0,0,0,.12), 0 0 0 3px rgba(13,110,253,.2);
}

@media (prefers-contrast:more) {
  #login-news.ln .ln-slide {
    border: 2px solid rgba(0,0,0,.35);
  }
}

@media (prefers-reduced-motion:reduce) {
  #login-news.ln .ln-slide, #login-news.ln .ln-track {
    transition: none !important;
  }

  #login-news.ln .ln-thumb-img {
    transition: none !important;
  }
}

/* ---------- Place full-width within login row; cap inner content ---------- */
.login-main-content > #login-news.ln {
  flex: 0 0 100%;
  width: 100%;
  max-width: none;
  order: 99;
  align-self: stretch;
  margin-top: 12px;
}

  .login-main-content > #login-news.ln .ln-track {
    max-width: var(--ln-maxw);
    margin: 0 auto;
  }

/* ================================
   Link Confirmation Modal — FINAL
   ================================ */

.ln-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(17,24,39,.52);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.ln-modal {
  width: min(92vw,420px);
  background: #fff;
  color: #111827;
  border: 1px solid rgba(17,24,39,.06);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0,0,0,.20), 0 2px 8px rgba(0,0,0,.06);
  padding: 18px 18px 16px;
  transform-origin: center;
  animation: lnModalIn 160ms cubic-bezier(.2,.8,.2,1);
}

.ln-modal-title {
  margin: 0 0 6px;
  font: 600 1.05rem/1.25 system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial;
  color: #0b1220;
}

.ln-modal-desc {
  margin: 0 0 10px;
  font: 400 .92rem/1.45 system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial;
  color: #4b5563;
}

.ln-modal-url {
  margin: 0 0 14px;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  font: 500 .85rem/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color: #111827;
  word-break: break-all;
  max-height: 88px;
  overflow: auto;
}

.ln-modal-buttons {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.ln-modal-button {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 14px;
  font: 600 .9rem/1 system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial;
  cursor: pointer;
  transition: transform .12s, box-shadow .12s, background-color .12s, border-color .12s, color .12s;
}

.ln-modal-button-primary {
  background: #111827;
  color: #fff;
  border-color: #111827;
  box-shadow: 0 2px 0 rgba(0,0,0,.05);
}

  .ln-modal-button-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(17,24,39,.18);
  }

  .ln-modal-button-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(17,24,39,.18) inset;
  }

.ln-modal-button-secondary {
  background: #fff;
  color: #111827;
  border-color: #e5e7eb;
}

  .ln-modal-button-secondary:hover {
    background: #f9fafb;
    border-color: #d1d5db;
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(0,0,0,.06);
  }

.ln-modal-button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(59,130,246,.35);
}

@keyframes lnModalIn {
  from {
    opacity: 0;
    transform: translateY(6px) scale(.985);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width:480px) {
  .ln-modal {
    width: min(94vw,420px);
    padding: 16px;
    border-radius: 12px;
  }

  .ln-modal-buttons {
    flex-direction: column;
  }

  .ln-modal-button {
    width: 100%;
  }
}

@media (prefers-reduced-motion:reduce) {
  .ln-modal {
    animation: none;
  }

  .ln-modal-button {
    transition: none;
  }
}

@media (prefers-color-scheme:dark) {
  .ln-modal-overlay {
    background: rgba(0,0,0,.55);
  }

  .ln-modal {
    background: #0b1020;
    color: #e5e7eb;
    border-color: rgba(255,255,255,.06);
    box-shadow: 0 24px 60px rgba(0,0,0,.45);
  }

  .ln-modal-title {
    color: #f3f4f6;
  }

  .ln-modal-desc {
    color: #cbd5e1;
  }

  .ln-modal-url {
    background: rgba(255,255,255,.04);
    border-color: rgba(255,255,255,.09);
    color: #e5e7eb;
  }

  .ln-modal-button-secondary {
    background: transparent;
    color: #e5e7eb;
    border-color: rgba(255,255,255,.12);
  }

  .ln-modal-button-primary {
    background: #2563eb;
    border-color: #2563eb;
  }

    .ln-modal-button-primary:hover {
      box-shadow: 0 8px 18px rgba(37,99,235,.35);
    }
}

/* ================================
   Design Overrides (moved from JS)
   ================================ */
#login-news.ln .ln-track {
  align-items: start !important;
}

#login-news.ln .ln-slide {
  min-height: 0 !important;
}

#login-news.ln .ln-text {
  overflow: hidden !important;
}

#login-news.ln .ln-cta {
  margin-top: 0 !important;
  align-self: auto !important;
  display: inline-block !important;
  margin-left: .25rem !important;
}

/* ================================
   Loading Skeleton
   ================================ */
#login-news.ln .ln-skeleton-card {
  display: flex;
  flex-direction: column;
  background: rgba(255,255,255,.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: .75rem;
  padding: 1rem;
  box-shadow: 0 10px 24px rgba(0,0,0,.06);
  pointer-events: none;
  min-height: 0;
}

@media (max-width:640px) {
  #login-news.ln .ln-skeleton-card {
    width: 320px;
    min-width: 320px;
    max-width: 320px;
    scroll-snap-align: start;
    padding: .85rem;
  }
}

.ln-skeleton-thumb {
  width: var(--ln-thumb-size);
  height: var(--ln-thumb-size);
  float: right;
  margin: 0 0 .4rem .75rem;
  border-radius: var(--ln-thumb-radius);
  background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 50%, #e5e7eb 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

@media (max-width:640px) {
  .ln-skeleton-thumb {
    float: none;
    width: 100%;
    height: auto;
    aspect-ratio: 16/9;
    margin: 0 0 .5rem 0;
  }
}

.ln-skeleton-title {
  height: calc(var(--ln-title-fs) * var(--ln-title-lh));
  background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 50%, #e5e7eb 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
  margin-bottom: .5rem;
  width: 85%;
}

.ln-skeleton-text {
  height: calc(var(--ln-body-fs) * var(--ln-body-lh) * 3);
  background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 50%, #e5e7eb 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
  clear: both;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

@media (prefers-reduced-motion:reduce) {
  .ln-skeleton-thumb,
  .ln-skeleton-title,
  .ln-skeleton-text {
    animation: none;
  }
}
