/* Members: header sign-in / avatar menu, sign-in dialog, save buttons, and the My News page. Uses the theme's tokens. */

/* ---------- Icons ---------- */
.vmem-signin svg,
.vmem-save svg,
.vmem-modal-close svg,
.vmem-empty svg {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- Header ---------- */
.vmem-signin {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  height: 36px;
  padding: 0 0.85rem 0 0.7rem;
  border: 1px solid #d8e1ef;
  border-radius: 999px;
  background: #fff;
  color: var(--color-heading, #0a4b95);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.vmem-signin:hover {
  background: #eef4fb;
  border-color: #b9cde6;
}

.vmem-user {
  position: relative;
}

.vmem-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  overflow: hidden;
  border: 2px solid #d8e1ef;
  border-radius: 50%;
  background: var(--color-heading, #0a4b95);
  color: #fff;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
}

.vmem-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.vmem-avatar--large {
  width: 64px;
  height: 64px;
  font-size: 1.5rem;
  cursor: default;
}

.vmem-menu {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  z-index: 80;
  width: 250px;
  padding: 0.4rem;
  background: #fff;
  border: 1px solid #d8e1ef;
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(11, 26, 77, 0.16);
}

.vmem-menu[hidden] {
  display: none;
}

.vmem-menu-head {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  margin-bottom: 0.3rem;
  padding: 0.55rem 0.7rem 0.65rem;
  border-bottom: 1px solid #e2ebf2;
}

.vmem-menu-head strong {
  overflow: hidden;
  color: var(--color-text, #1d2f43);
  font-size: 0.9rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vmem-menu-head span {
  overflow: hidden;
  color: var(--color-muted, #657285);
  font-size: 0.76rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vmem-menu a,
.vmem-menu button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--color-text, #1d2f43);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.vmem-menu a:hover,
.vmem-menu button:hover {
  background: #eef4fb;
}

.vmem-count {
  min-width: 20px;
  padding: 0 0.4rem;
  border-radius: 999px;
  background: var(--color-accent, #1da64a);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
}

/* ---------- Save (bookmark) buttons ---------- */
.vmem-save {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: none;
  color: var(--color-heading, #0a4b95);
  cursor: pointer;
  transition: color 0.18s ease, transform 0.18s ease, background 0.18s ease;
}

.vmem-save--tool {
  padding: 0.4rem;
  border-radius: 6px;
}

.vmem-save--tool svg {
  width: 26px;
  height: 26px;
}

.vmem-save:hover {
  color: var(--color-accent, #1da64a);
  transform: translateY(-1px);
}

.vmem-save.is-saved {
  color: var(--color-accent, #1da64a);
}

.vmem-save.is-saved svg {
  fill: currentColor;
}

/* On article cards the button floats in the top-right corner of the card. */
.post-list-item,
.post-card {
  position: relative;
}

.vmem-save--card {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  z-index: 3;
  width: 34px;
  height: 34px;
  border: 1px solid #d8e1ef;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 2px 8px rgba(11, 26, 77, 0.12);
}

.vmem-save:focus-visible,
.vmem-signin:focus-visible,
.vmem-avatar:focus-visible,
.vmem-primary:focus-visible,
.vmem-secondary:focus-visible,
.vmem-topic:focus-visible,
.vmem-tabs button:focus-visible {
  outline: 2px solid var(--color-brand-blue, #0f82cb);
  outline-offset: 2px;
}

/* ---------- Sign-in dialog ---------- */
.vmem-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(10, 25, 50, 0.55);
}

.vmem-overlay[hidden],
.vmem-modal[hidden] {
  display: none;
}

.vmem-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 121;
  width: min(430px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  padding: 1.7rem 1.6rem 1.4rem;
  overflow-y: auto;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(11, 26, 77, 0.3);
  transform: translate(-50%, -50%);
}

.vmem-modal h2 {
  margin: 0 0 0.35rem;
  color: var(--color-heading, #0a4b95);
  font-family: "Inter", sans-serif;
  font-size: 1.35rem;
}

.vmem-lead {
  margin: 0 0 0.9rem;
  color: var(--color-muted, #657285);
  font-size: 0.92rem;
}

.vmem-modal-close {
  position: absolute;
  top: 0.8rem;
  right: 0.8rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--color-muted, #657285);
  cursor: pointer;
}

.vmem-modal-close:hover {
  background: #e8ecf3;
}

.vmem-benefits {
  margin: 0 0 1.2rem;
  padding: 0;
  list-style: none;
}

.vmem-benefits li {
  position: relative;
  margin: 0.4rem 0;
  padding-left: 1.55rem;
  font-size: 0.9rem;
}

.vmem-benefits li::before {
  position: absolute;
  top: 0.15rem;
  left: 0;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: var(--color-accent, #1da64a);
  color: #fff;
  content: "\2713";
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1rem;
  text-align: center;
}

.vmem-google {
  display: flex;
  justify-content: center;
  min-height: 44px;
  margin-bottom: 0.4rem;
}

.vmem-status {
  margin: 0.4rem 0 0;
  color: var(--color-muted, #657285);
  font-size: 0.84rem;
  text-align: center;
}

.vmem-modal .vmem-status:not([hidden]) {
  color: #b3261e;
}

.vmem-legal {
  margin: 0.9rem 0 0;
  color: var(--color-muted, #657285);
  font-size: 0.74rem;
  line-height: 1.5;
  text-align: center;
}

.vmem-legal a {
  color: var(--color-brand-blue, #0f82cb);
  text-decoration: underline;
}

html.vmem-lock {
  overflow: hidden;
}

/* ---------- Buttons ---------- */
.vmem-primary,
.vmem-secondary {
  padding: 0.6rem 1.1rem;
  border: 1px solid var(--color-heading, #0a4b95);
  border-radius: 8px;
  background: var(--color-heading, #0a4b95);
  color: #fff;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
}

.vmem-primary:hover {
  background: #08396f;
}

.vmem-secondary {
  background: #fff;
  color: var(--color-heading, #0a4b95);
}

.vmem-secondary:hover {
  background: #eef4fb;
}

.vmem-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--color-brand-blue, #0f82cb);
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}

/* ---------- My News page ---------- */
.vmem-gate {
  max-width: 560px;
  margin: 1.5rem auto 3rem;
  padding: 2rem 1.6rem;
  text-align: center;
  background: var(--color-surface, #f3f7fb);
  border: 1px solid var(--color-border, #d6dfe7);
  border-radius: 14px;
}

.vmem-gate h2 {
  margin: 0 0 0.5rem;
  color: var(--color-heading, #0a4b95);
}

.vmem-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin: 0 0 1.4rem;
  border-bottom: 2px solid #e2ebf2;
}

.vmem-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: -2px;
  padding: 0.7rem 1rem;
  border: 0;
  border-bottom: 3px solid transparent;
  background: none;
  color: var(--color-muted, #657285);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
}

.vmem-tabs button[aria-selected="true"] {
  border-bottom-color: var(--color-heading, #0a4b95);
  color: var(--color-heading, #0a4b95);
}

.vmem-panel[hidden] {
  display: none;
}

.vmem-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  margin: 2rem 0;
  padding: 2rem 1rem;
  color: var(--color-muted, #657285);
  text-align: center;
  background: var(--color-surface, #f3f7fb);
  border: 1px dashed var(--color-border, #d6dfe7);
  border-radius: 12px;
}

.vmem-empty[hidden] {
  display: none;
}

.vmem-empty svg {
  width: 30px;
  height: 30px;
}

.vmem-topics-section {
  margin-top: 2rem;
  scroll-margin-top: 5rem;
}

.vmem-topics-section h3 {
  margin: 0 0 0.4rem;
  color: var(--color-heading, #0a4b95);
  font-size: 1.1rem;
}

.vmem-hint {
  margin: 0 0 0.9rem;
  color: var(--color-muted, #657285);
}

.vmem-topics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.2rem;
}

.vmem-topic {
  padding: 0.45rem 0.95rem;
  border: 1px solid var(--color-border, #d6dfe7);
  border-radius: 999px;
  background: #f6f9fd;
  color: var(--color-heading, #0a4b95);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
}

.vmem-topic.is-on {
  border-color: var(--color-heading, #0a4b95);
  background: var(--color-heading, #0a4b95);
  color: #fff;
}

.vmem-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.8rem;
  margin-top: 1rem;
}

.vmem-profile {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--color-surface, #f3f7fb);
  border: 1px solid var(--color-border, #d6dfe7);
  border-radius: 12px;
}

.vmem-profile > div {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.vmem-profile strong {
  font-size: 1.05rem;
}

.vmem-profile > div span,
.vmem-profile > div small {
  color: var(--color-muted, #657285);
  overflow-wrap: anywhere;
}

/* ---------- Alerts: the bell ---------- */
.vmem-alerts {
  position: relative;
}

/* The bell is only an icon, like the theme and search icons beside it: no round outline, no background. */
.vmem-bell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: #5c6680;
  cursor: pointer;
  transition: color 0.18s ease;
}

.vmem-bell:hover,
.vmem-bell[aria-expanded="true"] {
  color: var(--color-heading, #0a4b95);
}

.vmem-bell svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transform-origin: 50% 8%;
}

.vmem-badge {
  position: absolute;
  top: 0;
  right: -2px;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 999px;
  background: #d93025;
  box-shadow: 0 0 0 2px #fff;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 19px;
  text-align: center;
  pointer-events: none;
}

.vmem-badge[hidden] {
  display: none;
}

@keyframes vmem-ring {
  0%, 100% { transform: rotate(0); }
  15% { transform: rotate(16deg); }
  30% { transform: rotate(-14deg); }
  45% { transform: rotate(10deg); }
  60% { transform: rotate(-7deg); }
  75% { transform: rotate(3deg); }
}

.vmem-bell.is-ringing svg {
  animation: vmem-ring 1s ease-in-out;
}

.vmem-alert-panel {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  z-index: 80;
  width: min(370px, calc(100vw - 1.5rem));
  overflow: hidden;
  background: #fff;
  border: 1px solid #d8e1ef;
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(11, 26, 77, 0.16);
}

.vmem-alert-panel[hidden] {
  display: none;
}

.vmem-alert-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0.95rem;
  border-bottom: 1px solid #e2ebf2;
}

.vmem-alert-head strong {
  color: var(--color-text, #1d2f43);
  font-size: 0.95rem;
}

.vmem-alert-head a {
  color: var(--color-brand-blue, #0f82cb);
  font-size: 0.78rem;
  font-weight: 600;
}

.vmem-alert-body {
  max-height: min(62vh, 430px);
  overflow-y: auto;
}

.vmem-alert-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.vmem-alert-item {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.7rem 0.95rem;
  border-bottom: 1px solid #eef2f7;
  color: var(--color-text, #1d2f43);
  text-decoration: none;
}

.vmem-alert-item:hover {
  background: #f3f7fb;
}

.vmem-alert-item.is-new {
  background: #f0f8f3;
}

.vmem-alert-thumb {
  flex: none;
  width: 56px;
  height: 56px;
  border-radius: 8px;
  background: #e2e8f0;
  object-fit: cover;
}

.vmem-alert-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.vmem-alert-title {
  display: -webkit-box;
  overflow: hidden;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.vmem-alert-meta {
  color: var(--color-muted, #657285);
  font-size: 0.74rem;
}

.vmem-alert-dot {
  flex: none;
  width: 9px;
  height: 9px;
  margin-top: 0.35rem;
  border-radius: 50%;
  background: var(--color-accent, #1da64a);
}

.vmem-alert-empty {
  padding: 1.5rem 1.1rem;
  color: var(--color-muted, #657285);
  font-size: 0.88rem;
  line-height: 1.5;
  text-align: center;
}

.vmem-alert-empty p {
  margin: 0 0 0.8rem;
}

.vmem-alert-cta {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  background: var(--color-heading, #0a4b95);
  color: #fff;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.vmem-alert-foot {
  display: block;
  padding: 0.75rem 0.95rem;
  border-top: 1px solid #e2ebf2;
  color: var(--color-heading, #0a4b95);
  font-size: 0.8rem;
  font-weight: 700;
  text-align: center;
}

.vmem-alert-foot:hover,
.vmem-alert-head a:hover {
  text-decoration: underline;
}

.vmem-bell:focus-visible,
.vmem-alert-item:focus-visible,
.vmem-alert-foot:focus-visible,
.vmem-alert-cta:focus-visible {
  outline: 2px solid var(--color-brand-blue, #0f82cb);
  outline-offset: 2px;
}

@media (max-width: 640px) {
  .vmem-alert-panel {
    position: fixed;
    top: var(--vmem-top, 8.5rem);
    right: 0.75rem;
    left: 0.75rem;
    width: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .vmem-bell.is-ringing svg {
    animation: none;
  }
}

/* ---------- Welcome pop-up (right after signing in) ----------
   Uses (almost) the full width of the screen so every topic is visible at once: no scroll box. Centred layout. */
.vmem-welcome {
  width: min(1400px, calc(100vw - 3rem));
  padding: 1.9rem 2.2rem 1.6rem;
  text-align: center;
}

.vmem-welcome:focus {
  outline: none;
}

.vmem-welcome-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  margin: 0 0 0.45rem;
  padding: 0 2.5rem;
}

.vmem-welcome-head h2 {
  margin: 0;
}

.vmem-welcome .vmem-avatar {
  flex: none;
  cursor: default;
}

.vmem-welcome .vmem-lead {
  max-width: 64ch;
  margin: 0 auto 1.1rem;
}

.vmem-welcome .vmem-topics {
  justify-content: center;
  margin: 0 0 0.9rem;
  padding: 2px;
}

.vmem-welcome .vmem-hint {
  margin: 0 0 0.2rem;
  font-size: 0.8rem;
}

.vmem-welcome .vmem-status {
  min-height: 1.3em;
  color: #b3261e;
}

.vmem-welcome .vmem-actions {
  justify-content: center;
  margin-top: 0.5rem;
}

/* Phones: a full-width panel rising from the bottom edge, with slightly smaller topic buttons so they all fit. */
@media (max-width: 640px) {
  .vmem-welcome {
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    max-height: 100vh;
    max-height: 100dvh;
    padding: 1.35rem 1rem calc(1rem + env(safe-area-inset-bottom, 0px));
    border-radius: 18px 18px 0 0;
    transform: none;
  }

  .vmem-welcome-head {
    padding: 0 2.4rem;
  }

  .vmem-welcome-head h2 {
    font-size: 1.2rem;
  }

  .vmem-welcome .vmem-lead {
    margin-bottom: 0.85rem;
    font-size: 0.86rem;
    line-height: 1.45;
  }

  .vmem-welcome .vmem-topics {
    gap: 0.4rem;
    margin-bottom: 0.6rem;
  }

  .vmem-welcome .vmem-topic {
    padding: 0.36rem 0.72rem;
    font-size: 0.8rem;
  }

  .vmem-welcome .vmem-actions {
    flex-direction: column;
    gap: 0.35rem;
  }

  .vmem-welcome .vmem-primary {
    width: 100%;
  }
}

/* Short phones (e.g. 375x667, 360x640): tighter spacing so every topic still fits without scrolling. */
@media (max-width: 640px) and (max-height: 720px) {
  .vmem-welcome {
    padding-top: 1.05rem;
  }

  .vmem-welcome-head .vmem-avatar {
    display: none;
  }

  .vmem-welcome .vmem-lead {
    margin-bottom: 0.6rem;
    font-size: 0.82rem;
    line-height: 1.4;
  }

  .vmem-welcome .vmem-topics {
    gap: 0.32rem;
    margin-bottom: 0.4rem;
  }

  .vmem-welcome .vmem-topic {
    padding: 0.3rem 0.62rem;
    font-size: 0.78rem;
  }

  .vmem-welcome .vmem-hint {
    display: none;
  }

  .vmem-welcome .vmem-status {
    min-height: 0;
  }
}

/* ---------- Small screens ---------- */
@media (max-width: 640px) {
  .vmem-signin {
    width: 36px;
    padding: 0;
    justify-content: center;
  }

  .vmem-signin span {
    display: none;
  }

  .vmem-menu {
    position: fixed;
    top: var(--vmem-top, 8.5rem);
    right: 0.75rem;
    left: 0.75rem;
    width: auto;
  }

  .vmem-tabs button {
    padding: 0.6rem 0.7rem;
    font-size: 0.84rem;
  }
}

@media print {
  .vmem-signin,
  .vmem-bell,
  .vmem-alerts,
  .vmem-user,
  .vmem-save,
  .vmem-modal,
  .vmem-overlay {
    display: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .vmem-save,
  .vmem-signin {
    transition: none;
  }
}
