/*
 * 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;

  border-left: 3px solid #ffffff;
  border-right: 3px solid #ffffff;
  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: clamp(32px, 7vh, 60px) clamp(16px, 4vw, 40px) 0;
  color: white;
  text-align: center;
}

.article-text h1 {
  display: inline-block;
  max-width: 100%;
  padding: 8px 16px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-family: "Playfair Display", Georgia, "Times New Roman", serif;
  font-weight: 700;
  font-size: clamp(22px, min(5vw, 5vh), 38px);
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 0 0 20px;
  text-wrap: balance;
}

.article-text p {
  display: inline-block;
  padding: 10px 16px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: clamp(13px, min(2.3vw, 2.3vh), 21px);
  line-height: 1.6;
  max-width: 60ch;
  margin-inline: auto;
  text-wrap: pretty;
}

.summary-toggle {
  margin-left: 4px;
  padding: 0 2px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
}

.summary-toggle:hover {
  color: #0866d9;
}

.summary-toggle:focus-visible {
  border-radius: 3px;
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.summary-toggle[hidden] {
  display: none;
}

.article-action {
  grid-row: 2;
  align-self: center;
  justify-self: center;
  position: relative;
  z-index: 1;
  transform: translateY(20px);

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

.category {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 33px;
  background: #0866d9;
  padding: 7px 12px;
  border-radius: 5px;
  margin-bottom: 0;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  text-transform: uppercase;
}

.sources-link:visited {
  color: #fff;
}

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

  .article-text {
    padding: clamp(28px, 6vh, 48px) 24px 0;
  }

  .article-text h1 {
    font-size: clamp(22px, min(8vw, 5vh), 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); }

.account-icon-link {
  display: inline-flex;
  padding: 6px;
}

/* Resume reading prompt */
.resume-reading-prompt {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;

    width: max-content;
    max-width: calc(100% - 32px);
    padding: 12px 16px;

    background: rgba(20, 20, 20, 0.95);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

/* Ensure the prompt remains hidden until needed. */
.resume-reading-prompt[hidden] {
    display: none;
}

/* Align the prompt title and dismiss button. */
.resume-reading-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    font-size: 14px;
}

/* Dismiss button */
.resume-reading-dismiss {
    background: none;
    border: none;
    color: #aaa;
    font-size: 22px;
    cursor: pointer;
}

.resume-reading-dismiss:hover {
    color: white;
}

/* Resume reading button */
.resume-reading-button {
    width: 100%;
    margin-top: 8px;
    padding: 10px;

    background: rgba(255, 255, 255, 0.12);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
}

.resume-reading-button:hover {
    background: rgba(255, 255, 255, 0.22);
}
