/* ============================================================
   Field Notes
   Clean, stable layout for feed, media, filters, share, likes
============================================================ */

/* ============================================================
   Feed Grid
============================================================ */

.news-feed {
  display: grid;
  gap: 2rem;
  padding: 2rem 0;
}

@media (min-width: 768px) {
  .news-feed {
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
  }
}

/* ============================================================
   Heading + Filters
============================================================ */

.container-profil .field-notes-heading {
  margin-top: 1.6rem;
  margin-bottom: 1rem;
}

#current-filter {
  color: var(--color-19);
}

.field-notes-filters {
  width: 100%;
  max-width: 800px;
  margin: 0 auto 2rem auto;
  text-align: center;
}

.filter-row {
  display: flex;
  align-items: baseline;
  justify-content: center;
  flex-wrap: wrap;
  width: 100%;
  margin: 0;
  padding: 0;
}

.filter-row-main {
  column-gap: 1.25rem;
  row-gap: 0.45rem;
}

.filter-row-topics {
  margin-top: 1rem;
  column-gap: 1.05rem;
  row-gap: 0.45rem;
}

.field-notes-filters .filter-btn,
.field-notes-filters .filter-btn:link,
.field-notes-filters .filter-btn:visited {
  display: inline-block;
  width: auto !important;
  height: auto !important;
  min-width: 0 !important;
  min-height: 0 !important;
  margin: 0;
  padding: 0;
  color: var(--color-11);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 1.25rem;
  line-height: 1.45;
  letter-spacing: 0.0825rem;
  font-weight: 400;
  text-decoration: none;
  white-space: nowrap;
  word-break: normal;
  overflow-wrap: normal;
  hyphens: none;
  -webkit-hyphens: none;
  cursor: pointer;
}

.filter-row-topics .filter-btn,
.filter-row-topics .filter-btn:link,
.filter-row-topics .filter-btn:visited {
  font-size: 1rem;
  line-height: 1.45;
}

.field-notes-filters .filter-btn:hover,
.field-notes-filters .filter-btn:active,
.field-notes-filters .filter-btn.active,
.field-notes-filters .filter-btn.active:link,
.field-notes-filters .filter-btn.active:visited {
  color: var(--color-19) !important;
  text-decoration: none;
}

.field-notes-filters .filter-btn:focus-visible {
  outline: 2px solid var(--color-19);
  outline-offset: 4px;
}

/* ============================================================
   News Item
============================================================ */

.news-item {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: visible;
  background: #f9f9f9;
  border-width: 1px 0 0 1px;
  border-style: solid;
  border-color: var(--color-15);
  border-radius: 0;
  opacity: 0;
  transform: translateY(42px) translateZ(0);
  will-change: opacity, transform;
  backface-visibility: hidden;
}

.news-item.visible {
  animation: fieldNotesItemReveal 1.4s cubic-bezier(0.19, 1, 0.22, 1) both;
}

.news-item.highlighted {
  background: #f9f9f9;
  color: #777;
  border: 2px solid var(--color-19);
}

.news-item.highlighted p,
.news-item.highlighted a,
.news-item.highlighted a:link,
.news-item.highlighted a:visited,
.news-item.highlighted a:active,
.news-item.highlighted button,
.news-item.highlighted .share-button {
  color: #777;
}

/* ============================================================
   Media
============================================================ */

.news-media-wrapper {
  position: relative;
  width: 100%;
  height: auto;
  padding-top: 0;
  overflow: hidden;
  background: transparent;
}

.news-media-wrapper .media-inner {
  position: relative;
  width: 100%;
  height: auto;
  padding-top: 0;
}

.news-media-wrapper img,
.news-media-wrapper video,
.news-media-wrapper .media-inner img,
.news-media-wrapper .media-inner video {
  position: relative;
  top: auto;
  left: auto;
  z-index: 2;
  display: block;
  width: 100%;
  height: auto;
  max-height: none;
  object-fit: contain;
}

.news-media-wrapper.iframe-wrapper {
  position: relative;
  width: 100%;
  height: auto;
  min-height: 0;
  padding-top: 0;
  aspect-ratio: 16 / 10;
  background: transparent;
}

.news-media-wrapper.iframe-wrapper iframe {
  position: relative;
  top: auto;
  left: auto;
  z-index: 2;
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
  border: 0;
}

.news-media-wrapper.iframe-wrapper.ratio-16x9 {
  aspect-ratio: 16 / 9;
}

.news-media-wrapper.iframe-wrapper.ratio-16x10 {
  aspect-ratio: 16 / 10;
}

.news-media-wrapper.iframe-wrapper.ratio-4x5 {
  aspect-ratio: 4 / 5;
}

.news-media-wrapper.iframe-wrapper.ratio-1x1 {
  aspect-ratio: 1 / 1;
}

.news-media-wrapper.iframe-wrapper.ratio-9x16 {
  aspect-ratio: 9 / 16;
}

/* Soft media reveal */
.news-media-wrapper[data-media-reveal-inited="1"] img,
.news-media-wrapper[data-media-reveal-inited="1"] video {
  opacity: 0;
  transform: scale(1.012);
  transition:
    opacity 1.05s ease,
    transform 1.15s cubic-bezier(0.19, 1, 0.22, 1);
}

.news-media-wrapper[data-media-reveal-inited="1"].media-loaded img,
.news-media-wrapper[data-media-reveal-inited="1"].media-loaded video {
  opacity: 1;
  transform: scale(1);
}

.news-media-wrapper[data-media-reveal-inited="1"] iframe {
  opacity: 0;
  transform: none;
  transition: opacity 1.05s ease;
}

.news-media-wrapper[data-media-reveal-inited="1"].media-loaded iframe {
  opacity: 1;
  transform: none;
}

.news-media-wrapper[data-media-reveal-inited="1"]::before {
  content: none;
}

/* Legacy video preview support */
.video-preview {
  position: relative;
  display: inline-block;
  width: 100%;
  margin-top: 0;
  cursor: default;
}

.video-preview img {
  display: block;
  width: 100%;
  height: auto;
  -webkit-user-drag: none;
}

.play-button {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 64px;
  height: 64px;
  pointer-events: none;
  background: url('/img/play.svg') no-repeat center center;
  background-size: contain;
  transform: translate(-50%, -50%);
}

/* ============================================================
   Content
============================================================ */

.news-content {
  padding: 1rem 1.5rem;
}

.news-content h3 {
  margin: 0 0 0.5rem;
  font-size: 1.4rem;
  line-height: 1.35;
  color: #111;
}

.news-content p {
  margin: 0 0 0.5rem;
  line-height: 1.6;
  color: #333;
}

.news-content small {
  color: #777;
  font-size: 0.9rem;
}

.news-content a,
.news-content a:link,
.news-content a:visited {
  display: inline;
  color: var(--color-11);
  text-decoration: none;
  padding: 0.3rem 0.3rem 0.3rem 0;
}

.news-content a:hover,
.news-content a:active {
  color: var(--color-19);
  text-decoration: none;
}

/* ============================================================
   Actions: Share + Like
============================================================ */

.news-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 1.4rem;
  margin-top: 1rem;
  flex-wrap: nowrap;
}

.news-actions .share-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin-top: 0;
}

.share-button,
.like-btn {
  all: unset;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.55rem;
  padding: 0.4rem 0;
  color: #000;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  font-size: 0.95rem;
  line-height: 1;
  letter-spacing: 0.0825rem;
}

.like-btn {
  gap: 0.45rem;
  font-weight: 500;
  letter-spacing: normal;
}

.share-button:hover,
.like-btn:hover {
  color: var(--color-19);
  background: transparent;
}

.share-button:focus-visible,
.like-btn:focus-visible,
.load-more:focus-visible {
  outline: 2px solid var(--color-19);
  outline-offset: 4px;
}

.share-icon-circle,
.like-icon-circle {
  width: 38px;
  height: 38px;
  min-width: 38px;
  min-height: 38px;
  box-sizing: border-box;
  border: 1px solid #000;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 1;
  overflow: hidden;
  transition: border-color 0.25s ease;
}

.share-icon,
.like-icon,
.share-button img,
.like-btn img {
  width: 16px;
  height: 16px;
  max-width: 16px;
  max-height: 16px;
  display: block;
  object-fit: contain;
}

.like-icon-circle .like-icon {
  width: 17px;
  height: 17px;
  max-width: 17px;
  max-height: 17px;
}

.share-button:hover .share-icon-circle,
.like-btn:hover .like-icon-circle {
  border-color: var(--color-19);
}

.share-button:hover .share-icon,
.like-btn:hover .like-icon {
  filter: brightness(0) saturate(100%)
          invert(16%) sepia(90%) saturate(6000%)
          hue-rotate(355deg) brightness(63%) contrast(100%);
}

.like-btn[aria-pressed="true"] {
  opacity: 0.85;
}

.like-count {
  min-width: 1.5ch;
  text-align: left;
  color: var(--color-11);
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   Share Popup
============================================================ */

.share-popup {
  position: absolute;
  bottom: 100%;
  left: 0;
  z-index: 50;
  display: none;
  min-width: 320px;
  margin-bottom: 0.5rem;
  padding: 0.5rem;
  box-sizing: border-box;
  background: var(--color-16);
  border: 1px solid #ddd;
  border-radius: 6px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
  overflow: hidden;
}

.share-popup ul,
.news-content .share-popup ul {
  display: block;
  list-style: none;
  margin: 0 !important;
  padding: 0 !important;
}

.share-popup ul li,
.news-content .share-popup ul li {
  display: block;
  width: 100%;
  margin: 0 !important;
  padding: 0 !important;
  list-style: none;
}

.share-popup ul li::before,
.news-content .share-popup ul li::before {
  content: "" !important;
  display: none !important;
}

.share-popup a,
.share-popup li a,
.share-popup .full-link,
.news-content .share-popup a,
.news-content .share-popup li a,
.news-content .share-popup .full-link {
  display: block !important;
  width: calc(100% + 1rem) !important;
  max-width: none !important;
  box-sizing: border-box !important;
  margin: 0 0 0 -0.5rem !important;
  padding: 0.7rem 1rem !important;
  color: #111 !important;
  background: transparent;
  font-size: 0.95rem;
  line-height: 1.35;
  text-align: left;
  text-decoration: none !important;
  border-radius: 0;
  white-space: nowrap;
  transition:
    background-color 0.2s ease,
    color 0.2s ease;
}

.share-popup a:hover,
.share-popup li a:hover,
.share-popup .full-link:hover,
.news-content .share-popup a:hover,
.news-content .share-popup li a:hover,
.news-content .share-popup .full-link:hover {
  color: #000 !important;
  background-color: #fff !important;
  text-decoration: none !important;
}

/* ============================================================
   Load More + Quiet Loading Spacer
============================================================ */

.load-more {
  display: block;
  width: min(100%, 800px);
  box-sizing: border-box;
  margin: 2rem auto;
  padding: 0.8rem 1.5rem;
  color: var(--color-14);
  background: var(--color-15);
  border: none;
  border-radius: 0;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1.4;
  text-align: center;
  transition:
    background 0.3s ease,
    opacity 0.2s ease;
}

.load-more:hover {
  background: #333;
}

.load-more:disabled {
  cursor: default;
  opacity: 0.7;
}

/*
  Silent spacer while AJAX loads.
  No visible text, no spinner, no footer jump.
*/
.feed-loading-row {
  grid-column: 1 / -1;
  min-height: clamp(280px, 45vh, 560px);
  display: block;
  pointer-events: none;
  opacity: 1;
}

.news-feed.is-loading-feed {
  padding-bottom: 2rem;
}

.feed-loading-text {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  white-space: nowrap !important;
  border: 0 !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
}

.feed-empty-message {
  grid-column: 1 / -1;
  max-width: 800px;
  margin: 2rem auto;
  text-align: center;
  color: var(--color-11);
}

/* ============================================================
   Legacy Loading Indicator
============================================================ */

#loading-indicator {
  position: fixed;
  bottom: 7rem;
  left: 50%;
  z-index: 1000;
  display: none;
  width: 90px;
  height: 90px;
  margin-left: -400px;
  text-align: center;
  animation: spin 2s linear infinite;
}

#loading-indicator img {
  width: 100%;
  height: auto;
}

/* ============================================================
   Animations
============================================================ */

@keyframes fieldNotesItemReveal {
  0% {
    opacity: 0;
    transform: translateY(42px) translateZ(0);
  }

  100% {
    opacity: 1;
    transform: translateY(0) translateZ(0);
  }
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

/* ============================================================
   Mobile
============================================================ */

@media (max-width: 768px) {
  .container-profil .field-notes-heading {
    margin-top: 1.35rem;
    margin-bottom: 0.9rem;
  }

  .field-notes-filters {
    width: calc(100vw - 2.5rem);
    max-width: calc(100vw - 2.5rem);
    margin-left: -0.625rem;
    margin-right: 0;
    margin-bottom: 1.6rem;
    padding-left: 0.625rem;
    padding-right: 0.625rem;
    box-sizing: border-box;
  }

  .filter-row-main {
    column-gap: 1rem;
    row-gap: 0.4rem;
  }

  .filter-row-topics {
    margin-top: 0.9rem;
    column-gap: 0.85rem;
    row-gap: 0.4rem;
  }

  .field-notes-filters .filter-btn,
  .field-notes-filters .filter-btn:link,
  .field-notes-filters .filter-btn:visited {
    font-size: 0.95rem;
    line-height: 1.4;
    letter-spacing: 0.055rem;
  }

  .filter-row-topics .filter-btn,
  .filter-row-topics .filter-btn:link,
  .filter-row-topics .filter-btn:visited {
    font-size: 0.86rem;
    line-height: 1.35;
    letter-spacing: 0.045rem;
  }

  .news-feed {
    gap: 2rem;
    padding: 1rem 0;
  }

  .news-content {
    padding: 0.9rem;
  }

  .news-content h3 {
    margin: 0 0 0.3rem;
    font-size: 1.2rem;
    line-height: 1.6rem;
  }

  .news-content p {
    margin: 0 0 0.5rem;
    font-size: 0.95rem;
    line-height: 1.4rem;
  }

  .news-actions {
    gap: 1rem;
  }

  .share-icon-circle,
  .like-icon-circle {
    width: 34px;
    height: 34px;
    min-width: 34px;
    min-height: 34px;
  }

  .share-icon,
  .like-icon,
  .share-button img,
  .like-btn img {
    width: 14px;
    height: 14px;
    max-width: 14px;
    max-height: 14px;
  }

  .like-icon-circle .like-icon {
    width: 15px;
    height: 15px;
    max-width: 15px;
    max-height: 15px;
  }

  .share-popup {
    min-width: 220px;
    width: calc(100vw - 4rem);
  }

  .load-more {
    width: 100%;
    margin-top: 1.6rem;
    margin-bottom: 1.6rem;
  }

  .feed-loading-row {
    min-height: clamp(240px, 42vh, 480px);
  }
}

@media (max-width: 420px) {
  .filter-row-main {
    column-gap: 0.8rem;
  }

  .filter-row-topics {
    column-gap: 0.7rem;
  }

  .field-notes-filters .filter-btn,
  .field-notes-filters .filter-btn:link,
  .field-notes-filters .filter-btn:visited {
    font-size: 1.1rem;
    letter-spacing: 0.045rem;
  }

  .filter-row-topics .filter-btn,
  .filter-row-topics .filter-btn:link,
  .filter-row-topics .filter-btn:visited {
    font-size: 0.82rem;
    letter-spacing: 0.035rem;
  }
}

/* ============================================================
   Reduced Motion
============================================================ */

@media (prefers-reduced-motion: reduce) {
  .news-item,
  .news-item.visible,
  .news-media-wrapper img,
  .news-media-wrapper video,
  .news-media-wrapper iframe,
  .load-more,
  .field-notes-filters .filter-btn,
  .share-popup li a,
  .share-popup .full-link {
    animation: none !important;
    transition: none !important;
  }

  .news-item {
    opacity: 1;
    transform: none;
  }

  .news-media-wrapper img,
  .news-media-wrapper video,
  .news-media-wrapper iframe {
    opacity: 1 !important;
    transform: none !important;
  }
}