/* ==========================================================
   Public modal — login-dialog. Fristående för att hålla
   public-shell.css under filgränsen.
   ========================================================== */

/* ---- LOGIN MODAL ---- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--scrim-strong);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--space-5);
  opacity: 0;
  transition: opacity .25s ease;
}
.modal-backdrop.open { display: flex; opacity: 1; }
.modal {
  background: var(--paper);
  border-radius: var(--radius-lg);
  padding: var(--space-7) var(--space-7) var(--space-6);
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-2);
  transform: translateY(8px);
  transition: transform .25s ease;
}
.modal-backdrop.open .modal { transform: translateY(0); }
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-3);
}
.modal h3 { font-size: 1.75rem; font-weight: 400; line-height: 1.15; }
.modal-close {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: transparent;
  display: grid; place-items: center;
  font-size: 1.125rem;
  line-height: 1;
  color: var(--ink-mute);
  transition: background .2s, color .2s;
}
.modal-close:hover { background: var(--ink); color: var(--paper); }
.modal p { color: var(--ink-soft); font-size: 0.875rem; }
.modal label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-mute);
  margin: var(--space-5) 0 var(--space-2);
}
.modal input[type="email"] {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  font-size: 1rem; /* 16px = ingen mobil-zoom */
  font-family: inherit;
  background: var(--white);
  color: var(--ink);
}
.modal input:focus { outline: none; border-color: var(--ink); }
.modal .submit {
  width: 100%;
  padding: var(--space-4);
  background: var(--ink);
  color: var(--paper);
  border: 0;
  border-radius: var(--radius-md);
  margin-top: var(--space-4);
  font-size: 0.9375rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.modal .submit:hover { background: var(--accent-deep); }
.modal .alt {
  text-align: center;
  margin-top: var(--space-4);
  font-size: 0.8125rem;
  color: var(--ink-mute);
}
.modal .alt a { color: var(--ink); border-bottom: 1px solid var(--line); }
.modal .seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg-soft);
  border-radius: var(--radius-md);
  padding: 4px;
  margin-top: 6px;
  margin-bottom: 4px;
  gap: 4px;
}
.modal .seg button {
  border: 0;
  background: transparent;
  padding: var(--space-3);
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ink-mute);
  transition: background .2s, color .2s;
}
.modal .seg button.active {
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* ---- NEWS MODAL ---- */
/* Klickbart nyhetskort på startsidan öppnar detalj-modal med hela texten. */
.news-card[data-post-id] { cursor: pointer; }
.news-card[data-post-id]:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.news-modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--scrim-strong);
  backdrop-filter: blur(6px);
  z-index: 220;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-5);
  opacity: 0;
  transition: opacity .2s ease;
}
.news-modal-backdrop[hidden] { display: none; }
.news-modal-backdrop.open { opacity: 1; }

.news-modal {
  background: var(--paper);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 680px;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow-2);
  transform: translateY(8px);
  transition: transform .2s ease;
}
.news-modal-backdrop.open .news-modal { transform: translateY(0); }

.news-modal-close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--paper);
  display: grid; place-items: center;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--ink-mute);
  cursor: pointer;
  transition: background .2s, color .2s;
  z-index: 1;
}
.news-modal-close:hover { background: var(--ink); color: var(--paper); }

.news-modal-image {
  width: 100%;
  height: 280px;
  background-size: cover;
  background-position: center;
  background-color: var(--bg-soft);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.news-modal-body {
  padding: var(--space-6) var(--space-7) var(--space-7);
}
.news-modal-body .tag { display: inline-block; margin-bottom: var(--space-3); }
.news-modal-body .news-meta {
  font-size: 0.8125rem;
  color: var(--ink-mute);
  margin-bottom: var(--space-3);
}
.news-modal-body h3 {
  font-size: 1.75rem;
  font-weight: 400;
  line-height: 1.2;
  margin: 0 0 var(--space-4);
  color: var(--ink);
}
.news-modal-text {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink-soft);
  white-space: pre-wrap; /* bevarar radbrytningar i plain-text Body */
  word-wrap: break-word;
}

@media (max-width: 640px) {
  .news-modal-backdrop { padding: var(--space-3); }
  .news-modal-image { height: 200px; }
  .news-modal-body { padding: var(--space-5); }
  .news-modal-body h3 { font-size: 1.375rem; }
}
