/*
 * Reel News - News Feed Styling
 *
 * Developed by: Reel News team
 * Description: Defines the layout and appearance of the
 * vertically scrolling news feed and article cards.
 *
 * Team-developed functionality:
 * - Article card layout, typography, and positioning.
 * - Background image overlay for text readability.
 * - Responsive styling for smaller screens.
 * - Reel News category/button appearance, subject to
 *   attribution of any tutorial-derived styling.
 *
 * External code/references:
 * - Vertical scrolling and scroll-snapping behavior adapted
 *   from YouTube tutorials.
 *
 * External technologies:
 * - Standard CSS; no additional CSS libraries used in this file.
 */

#center {
  width: 100%;
  height: 100%;
}

.feed {
  height: 100svh;
  width: 100%;
  max-width: 1126px;
  margin-inline: auto;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;

  position: relative;
}

.feed-loading {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100svh;

  display: flex;
  align-items: center;
  justify-content: center;

  color: white;
  font-size: 24px;

  z-index: 0;
  pointer-events: none;
}

.feed::-webkit-scrollbar {
  display: none;
}

.article-card {
  height: 100svh;
  width: min(90%, 900px);
  margin-inline: auto;
  scroll-snap-align: start;
  scroll-snap-stop: always;

  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;

  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: 1fr auto 1fr; /* top | middle | bottom */
}

/* Dark fade at the TOP so the white text is readable */
.article-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    rgba(0, 0, 0, 0.9) 0%,
    rgba(0, 0, 0, 0.7) 35%,
    rgba(0, 0, 0, 0.2) 65%,
    transparent 90%
  );
}

.article-text {
  grid-row: 1;
  align-self: start;
  position: relative;
  z-index: 1;
  max-width: 750px;
  width: 100%;
  margin-inline: auto;
  padding: 60px 40px 0;
  color: white;
  text-align: center;
}

.article-text h1 {
  color: #fff;
  font-family: "Playfair Display", Georgia, "Times New Roman", serif;
  font-weight: 700;
  font-size: clamp(26px, 5vw, 38px);
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 0 0 20px;
  text-wrap: balance;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6), 0 4px 24px rgba(0, 0, 0, 0.5);
}

.article-text p {
  font-size: clamp(16px, 2.4vw, 19px);
  line-height: 1.6;
  max-width: 60ch;
  margin-inline: auto;
  text-wrap: pretty;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
}

.article-action {
  grid-row: 2;
  align-self: center;
  justify-self: center;
  position: relative;
  z-index: 1;

  /* Arrange action buttons horizontally */
  display: flex;
  align-items: center;
  gap: 12px;
}

.category {
  display: inline-block;
  background: #e63946;
  padding: 7px 12px;
  border-radius: 5px;
  margin-bottom: 15px;
  font-size: 13px;
  font-weight: bold;
  text-transform: uppercase;
}

@media (max-width: 360px) {
  .article-card {
    width: 100%;
  }

  .article-text {
    padding: 48px 24px 0;
  }

  .article-text h1 {
    font-size: clamp(28px, 8vw, 36px);
  }
}

.account-bar {
  position: fixed;
  top: 14px;
  right: 16px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  font-size: 14px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.account-bar form { margin: 0; }

.account-link {
  padding: 6px 14px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}

.account-link:hover { background: rgba(0, 0, 0, 0.7); }

/* Bookmark toggle button */
.bookmark-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  cursor: pointer;
  transition: background 0.2s ease;
}

/* Highlight the button when hovered */
.bookmark-button:hover {
  background: rgba(0, 0, 0, 0.7);
}

/* Fill the icon when the story is bookmarked */
.bookmark-button[aria-pressed="true"] svg {
  fill: currentColor;
}

/* Provide visual feedback for keyboard navigation */
.bookmark-button:focus-visible {
  outline: 2px solid white;
  outline-offset: 3px;
}

/* Indicate that a bookmark request is processing */
.bookmark-button:disabled {
  opacity: 0.5;
  cursor: wait;
}