/**
 * News Page - Two-Column Master-Detail Layout
 *
 * Desktop: News list (left) + Selected article (right)
 * Mobile: Traditional stacked list linking to detail pages
 */

/* =============================================================================
   Page Layout
   ========================================================================== */

.page--news-masterdetail {
  display: grid;
  gap: 2rem;
}

/* Page Header */
.page-header {
  display: grid;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.page-header__intro {
  display: grid;
  gap: 1rem;
}

.page-header__title-row {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.page-header__title {
  font-size: clamp(2.5rem, 5vw, 3.5rem);
  font-weight: 900;
  line-height: 1.1;
  margin: 0;
  letter-spacing: -0.02em;
}

.page-header__meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 1rem;
}

/* Sidebar Toggle Button */
.news-sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--glass-subtle);
  color: rgba(226, 227, 234, 0.7);
  cursor: pointer;
  transition: all 0.2s ease;
}

.news-sidebar-toggle svg {
  width: 20px;
  height: 20px;
}

.news-sidebar-toggle:hover {
  background: var(--glass-medium);
  border-color: var(--border-medium);
  color: rgba(226, 227, 234, 0.9);
}

.news-sidebar-toggle:active {
  transform: scale(0.95);
}

/* Empty State */
.news-empty {
  display: grid;
  place-items: center;
  text-align: center;
  padding: 4rem 2rem;
  border-radius: var(--radius-lg);
  border: 1px dashed var(--border-medium);
  background: var(--glass-subtle);
  color: rgba(226, 227, 234, 0.6);
}

/* =============================================================================
   Two-Column Layout
   ========================================================================== */

.news-layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 2.5rem;
  align-items: start;
  transition: grid-template-columns 0.3s ease;
}

/* Hidden Sidebar State */
.news-layout--sidebar-hidden {
  grid-template-columns: 0 1fr;
  gap: 0;
}

.news-layout--sidebar-hidden .news-list {
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
  width: 0;
  min-width: 0;
}

/* =============================================================================
   Left Column: News List (Master)
   ========================================================================== */

.news-list {
  position: sticky;
  top: 2rem;
  display: grid;
  gap: 1.5rem;
  max-height: calc(100vh - 4rem);
  overflow-y: auto;
  padding-right: 0.5rem;
  transition: opacity 0.3s ease, width 0.3s ease;
}

.news-list__title {
  font-size: 1.2rem;
  font-weight: 800;
  margin: 0;
  letter-spacing: -0.01em;
  color: rgba(226, 227, 234, 0.9);
}

/* News Menu */
.news-menu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

.news-menu__item {
  margin: 0;
}

.news-menu__button {
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.85rem;
  padding: 0.75rem 0.85rem;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: inherit;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
}

.news-menu__button:hover {
  background: var(--glass-subtle);
}

.news-menu__button.is-active {
  background: rgba(var(--accent-primary-rgb), 0.04);
}

/* News Menu Date */
.news-menu__date {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  min-width: 45px;
  padding: 0.35rem;
  border-radius: var(--radius-sm);
  background: transparent;
}

.news-menu__date-day {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
  color: rgba(226, 227, 234, 0.95);
}

.news-menu__date-month {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(226, 227, 234, 0.5);
}

.news-menu__button.is-active .news-menu__date {
  background: rgba(var(--accent-primary-rgb), 0.06);
}

.news-menu__button.is-active .news-menu__date-day {
  color: var(--accent-primary);
}

.news-menu__button.is-active .news-menu__date-month {
  color: var(--accent-hover);
}

/* News Menu Content */
.news-menu__content {
  display: grid;
  gap: 0.5rem;
  align-content: center;
}

.news-menu__title {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.3;
  color: rgba(226, 227, 234, 0.95);
}

.news-menu__button.is-active .news-menu__title {
  color: var(--accent-primary);
}

/* Pagination in List */
.news-list__pagination {
  padding-top: 1rem;
  border-top: 1px dashed rgba(255, 255, 255, 0.04);
}

/* =============================================================================
   Right Column: News Detail (Detail)
   ========================================================================== */

.news-detail {
  position: relative;
  min-height: 500px;
}

.news-detail-panel {
  display: none;
  animation: fadeIn 0.3s ease;
}

.news-detail-panel.is-active {
  display: grid;
  gap: 2rem;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* News Detail Header */
.news-detail-panel__header {
  display: grid;
  gap: 1rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.04);
}

.news-detail-panel__title {
  font-size: 2.25rem;
  font-weight: 700;
  line-height: 1.2;
  margin: 0;
  letter-spacing: -0.02em;
}

.news-detail-panel__title a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition);
}

.news-detail-panel__title a:hover {
  color: var(--accent-hover);
}

.news-detail-panel__meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.news-detail-panel__date {
  font-size: 0.95rem;
  font-weight: 600;
  color: rgba(226, 227, 234, 0.7);
}

.news-detail-panel__tags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* News Detail Body */
.news-detail-panel__body {
  font-size: 1.05rem;
  line-height: 1.7;
  color: rgba(226, 227, 234, 0.85);
  max-width: 75ch; /* Optimal reading width: ~65-75 characters per line */
}

.news-detail-panel__body h2 {
  font-size: 1.6rem;
  font-weight: 800;
  margin: 2rem 0 1rem;
  color: rgba(226, 227, 234, 0.95);
}

.news-detail-panel__body h3 {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 1.5rem 0 0.75rem;
  color: rgba(226, 227, 234, 0.9);
}

.news-detail-panel__body p {
  margin: 0 0 1rem;
}

.news-detail-panel__body ul,
.news-detail-panel__body ol {
  margin: 0 0 1rem;
  padding-left: 1.5rem;
}

.news-detail-panel__body li {
  margin-bottom: 0.5rem;
}

.news-detail-panel__body a {
  color: var(--accent-hover);
  text-decoration: underline;
  transition: color 0.2s ease;
}

.news-detail-panel__body a:hover {
  color: var(--accent-primary);
}

.news-detail-panel__body img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  margin: 1.5rem 0;
}

.news-detail-panel__body blockquote {
  margin: 1.5rem 0;
  padding: 1rem 1.5rem;
  border-left: 4px solid rgba(var(--accent-primary-rgb), 0.4);
  background: var(--glass-subtle);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic;
  color: rgba(226, 227, 234, 0.8);
}

/* =============================================================================
   Light Theme
   ========================================================================== */

/* Light theme - Typography colors only (design tokens handle backgrounds/borders) */
html[data-theme="light"] .news-sidebar-toggle {
  color: rgba(32, 36, 52, 0.7);
}

html[data-theme="light"] .news-sidebar-toggle:hover {
  color: rgba(32, 36, 52, 0.9);
}

html[data-theme="light"] .news-empty {
  color: rgba(32, 36, 52, 0.6);
}

html[data-theme="light"] .news-list__title {
  color: rgba(32, 36, 52, 0.9);
}

html[data-theme="light"] .news-menu__button.is-active {
  border-color: rgba(var(--accent-primary-rgb), 0.3);
  background: rgba(var(--accent-primary-rgb), 0.06);
}

html[data-theme="light"] .news-menu__date-day {
  color: rgba(32, 36, 52, 0.95);
}

html[data-theme="light"] .news-menu__date-month {
  color: rgba(32, 36, 52, 0.6);
}

html[data-theme="light"] .news-menu__button.is-active .news-menu__date {
  background: rgba(var(--accent-primary-rgb), 0.12);
}

html[data-theme="light"] .news-menu__button.is-active .news-menu__date-day {
  color: var(--accent-primary);
}

html[data-theme="light"] .news-menu__button.is-active .news-menu__date-month {
  color: var(--accent-hover);
}

html[data-theme="light"] .news-menu__title {
  color: rgba(32, 36, 52, 0.95);
}

html[data-theme="light"] .news-menu__button.is-active .news-menu__title {
  color: var(--accent-primary);
}

/* Border colors handled by design tokens */

html[data-theme="light"] .news-detail-panel__title a:hover {
  color: var(--accent-hover);
}

html[data-theme="light"] .news-detail-panel__date {
  color: rgba(47, 50, 68, 0.7);
}

html[data-theme="light"] .news-detail-panel__body {
  color: rgba(47, 50, 68, 0.85);
}

html[data-theme="light"] .news-detail-panel__body h2 {
  color: rgba(32, 36, 52, 0.95);
}

html[data-theme="light"] .news-detail-panel__body h3 {
  color: rgba(32, 36, 52, 0.9);
}

html[data-theme="light"] .news-detail-panel__body a {
  color: var(--accent-hover);
}

html[data-theme="light"] .news-detail-panel__body a:hover {
  color: var(--accent-primary);
}

html[data-theme="light"] .news-detail-panel__body blockquote {
  border-left-color: rgba(var(--accent-primary-rgb), 0.4);
  color: rgba(47, 50, 68, 0.8);
}

/* Footer border handled by design tokens */

/* =============================================================================
   Responsive
   ========================================================================== */

/* Below LG (1024px) */
@media (max-width: 63.99rem) {
  .news-layout {
    grid-template-columns: 320px 1fr;
    gap: 2rem;
  }

  .news-list {
    top: 1.5rem;
    max-height: calc(100vh - 3rem);
  }

  .news-detail-panel__title {
    font-size: 2rem;
  }
}

/* Below SM (640px): Stack layout on mobile - traditional list */
@media (max-width: 39.99rem) {
  .news-layout {
    grid-template-columns: 1fr;
    gap: 0;
  }

  /* Hide master list on mobile */
  .news-list {
    display: none;
  }

  /* Show all panels as traditional cards on mobile */
  .news-detail {
    display: grid;
    gap: 1.5rem;
  }

  .news-detail-panel {
    display: grid;
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    background: var(--glass-subtle);
    animation: none;
  }

  .news-detail-panel.is-active {
    /* All panels shown on mobile */
  }

  .news-detail-panel__title {
    font-size: 1.5rem;
  }

  /* Light theme styling handled by design tokens */
}
