:root {
  color-scheme: light;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background-color: #f9fafb;
  color: #111827;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.utility-bar {
  background: #0b1f47;
  color: #f9fafb;
  padding: 0.5rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.95rem;
}

#current-date {
  font-weight: 600;
}

.utility-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.utility-link {
  color: #fcdc2a;
  text-decoration: none;
  font-weight: 600;
}

.utility-button {
  background: transparent;
  border: none;
  padding: 0;
  font: inherit;
  cursor: pointer;
}

.utility-email {
  color: #fcdc2a;
  font-weight: 600;
  white-space: nowrap;
}

.utility-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.utility-actions > * {
  display: inline-flex;
  align-items: center;
}

.utility-button:focus {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

.utility-link:hover {
  text-decoration: underline;
}

.masthead {
  display: grid;
  grid-template-columns: minmax(0, auto) 1fr minmax(0, auto);
  align-items: center;
  padding: 1rem 2rem;
  background: #ffffff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  position: sticky;
  top: 0;
  z-index: 900;
}

#menu-button {
  width: 3rem;
  height: 3rem;
  border: none;
  background: transparent;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  cursor: pointer;
}

#menu-button span {
  width: 1.8rem;
  height: 0.2rem;
  background: #0b1f47;
  border-radius: 999px;
  display: block;
}

.masthead-title {
  text-align: center;
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
  color: #0b1f47;
}

#auth-controls {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.75rem;
}

#user-email {
  color: #d1d5db;
  font-size: 0.925rem;
  word-break: break-word;
  white-space: nowrap;
}

.auth-button {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 0.375rem;
  background: #2563eb;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  -webkit-appearance: none;
  appearance: none;
}

#timeline {
  flex: 1;
  padding: 2rem;
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.timeline-empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 2rem;
  background: rgba(11, 31, 71, 0.05);
  border-radius: 0.75rem;
  text-align: center;
  color: #1f2937;
  font-weight: 500;
}

.article-card {
  padding: 1.5rem;
  background: #fff;
  border-radius: 0.75rem;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.article-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.12);
}

.article-card h2 {
  margin: 0;
  font-size: 1.25rem;
  color: #1f2937;
  cursor: pointer;
  transition: color 0.15s ease;
}

.headline-trigger:focus,
.headline-trigger:hover {
  color: #2563eb;
  outline: none;
}

.article-card a {
  color: #2563eb;
  text-decoration: none;
  font-weight: 500;
}

.article-card time,
.article-card span {
  font-size: 0.875rem;
  color: #4b5563;
}

.headline-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.headline-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.headline-toggle {
  border: none;
  background: transparent;
  color: #2563eb;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  text-decoration: none;
  -webkit-appearance: none;
  appearance: none;
}

.headline-toggle:focus {
  outline: none;
  text-decoration: underline;
}

.summary-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 1000;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.summary-modal--visible {
  pointer-events: auto;
  opacity: 1;
}

.summary-modal--hidden {
  pointer-events: none;
  opacity: 0;
}


.summary-content {
  max-width: 600px;
  width: 100%;
  background: #ffffff;
  border-radius: 0.75rem;
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.25);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  outline: none;
}

.summary-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.summary-title {
  margin: 0;
  font-size: 1.25rem;
  color: #111827;
}

.summary-spinner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: #2563eb;
  font-weight: 600;
}

.summary-spinner::before {
  content: '';
  width: 1.25rem;
  height: 1.25rem;
  border: 3px solid rgba(37, 99, 235, 0.3);
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.subscribe-prompt {
  background: rgba(37, 99, 235, 0.1);
  border: 1px solid rgba(37, 99, 235, 0.25);
  padding: 1rem;
  border-radius: 0.75rem;
  color: #1f2937;
  font-size: 0.95rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.subscribe-prompt strong {
  color: #2563eb;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}


.summary-close {
  border: none;
  background: transparent;
  color: #6b7280;
  font-size: 1.75rem;
  cursor: pointer;
  font-weight: 600;
  line-height: 1;
  padding: 0;
  flex-shrink: 0;
  align-self: flex-start;
  margin-left: auto;
}

.summary-close:hover,
.summary-close:focus {
  color: #111827;
}


.summary-body {
  font-size: 1rem;
  line-height: 1.5;
  color: #1f2937;
  white-space: pre-wrap;
}

.summary-link {
  color: #2563eb;
  font-weight: 600;
  text-decoration: none;
}

.summary-link:hover {
  text-decoration: underline;
}

#source-drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: min(320px, 80vw);
  height: 100vh;
  background: #f9fafb;
  box-shadow: 4px 0 12px rgba(15, 23, 42, 0.12);
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  z-index: 950;
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  gap: 1rem;
}

#source-drawer.open {
  transform: translateX(0);
}

#source-drawer.open ~ body {
  overflow: hidden;
}

.drawer-controls {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.drawer-search {
  position: relative;
}

.drawer-search-input {
  width: 100%;
  padding: 0.6rem 0.85rem;
  border: 1px solid #cbd5f5;
  border-radius: 0.6rem;
  font: inherit;
  background: #ffffff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.drawer-search-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.drawer-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  font-size: 0.9rem;
  color: #334155;
}

.drawer-actions {
  display: inline-flex;
  gap: 0.5rem;
}

.drawer-action {
  border: none;
  background: transparent;
  color: #2563eb;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.drawer-action:hover,
.drawer-action:focus {
  text-decoration: underline;
}

#drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  z-index: 900;
  backdrop-filter: blur(2px);
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.drawer-header h2 {
  margin: 0;
  font-size: 1.25rem;
  color: #0b1f47;
}

#close-drawer {
  border: none;
  background: transparent;
  font-size: 1.5rem;
  cursor: pointer;
  color: #0b1f47;
}

#source-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
}

.source-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  background: #ffffff;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.source-toggle label {
  font-weight: 600;
  color: #0b1f47;
}

.switch {
  position: relative;
  width: 46px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #d1d5db;
  transition: 0.3s;
  border-radius: 999px;
}

.slider::before {
  position: absolute;
  content: '';
  height: 18px;
  width: 18px;
  left: 3px;
  top: 3px;
  background-color: #ffffff;
  transition: 0.3s;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.15);
}

.switch input:checked + .slider {
  background-color: #2563eb;
}

.switch input:checked + .slider::before {
  transform: translateX(22px);
}

@media (max-width: 768px) {
  .utility-bar,
  .masthead {
    padding: 0.75rem 1rem;
  }

  .masthead {
    grid-template-columns: minmax(0, auto) 1fr minmax(0, auto);
  }

  .masthead-title {
    font-size: 1.6rem;
  }

  #source-drawer {
    width: min(90vw, 360px);
  }

  #timeline {
    padding: 1rem;
    grid-template-columns: 1fr;
  }

  .article-card {
    padding: 1.25rem;
  }
}

