/* Locayaan Color Theme Variables */
:root {
  --bg-color: #2C2C2A;
  --card-container-bg: #5F5E5A;
  --card-bg: #3a3a38;
  --input-bg: #444441;
  --input-border: #5F5E5A;
  --text-main: #F1EFE8;
  --text-muted: #B4B2A9;
  --primary-accent: #97C459;
  --pill-active-bg: #27500A;
  --pill-active-text: #C0DD97;
  --icon-brand-border: #173404;
}

/* Light Mode Overrides */
[data-theme="light"] {
  --bg-color: #F8F9FA;
  --card-container-bg: #E9ECEF;
  --card-bg: #FFFFFF;
  --input-bg: #FFFFFF;
  --input-border: #CED4DA;
  --text-main: #212529;
  --text-muted: #6C757D;
  --primary-accent: #27500A;
  --pill-active-bg: #97C459;
  --pill-active-text: #173404;
  --icon-brand-border: #27500A;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: #1a1a19;
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  min-height: 100vh;
  padding: 2rem 1rem;
}

/* Main Container Shell - Responsive for Laptop / Desktop Displays */
.app-container {
  width: 100%;
  max-width: 840px; /* Expanded for Desktop/Laptop screens */
  background-color: var(--bg-color);
  border-radius: 20px;
  padding: 1.75rem 2rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  transition: background-color 0.3s ease;
}

/* Header Component Styles */
.header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.logo-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background-color: var(--primary-accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--icon-brand-border);
}

.brand-title {
  font-weight: 600;
  font-size: 18px;
  color: var(--text-main);
  letter-spacing: -0.2px;
}

.theme-toggle-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 20px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: 8px;
  transition: all 0.2s;
}

.theme-toggle-btn:hover {
  color: var(--text-main);
  background-color: var(--input-bg);
}

/* Search Bar Component Styles */
.search-container {
  display: flex;
  align-items: center;
  gap: 10px;
  background-color: var(--input-bg);
  border: 0.5px solid var(--input-border);
  border-radius: 12px;
  padding: 0 16px;
  height: 46px;
  margin-bottom: 1rem;
}

.search-input {
  border: none;
  outline: none;
  background: transparent;
  flex: 1;
  font-size: 15px;
  height: 100%;
  color: var(--text-main);
  font-family: inherit;
}

.search-input::placeholder {
  color: var(--text-muted);
}

/* Filter Chips Component Styles */
.filter-chips-wrapper {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  margin-bottom: 1.25rem;
  padding-bottom: 4px;
}

.filter-chips-wrapper::-webkit-scrollbar {
  height: 4px;
}
.filter-chips-wrapper::-webkit-scrollbar-thumb {
  background: var(--input-border);
  border-radius: 4px;
}

.chip-btn {
  background-color: var(--input-bg);
  border: 0.5px solid var(--input-border);
  color: var(--text-muted);
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 8px;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  font-weight: 500;
}

.chip-btn:hover {
  color: var(--text-main);
}

.chip-btn.active {
  background-color: var(--pill-active-bg);
  color: var(--pill-active-text);
  border-color: transparent;
}

/* Section Title */
.feed-section-title {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 12px;
  font-weight: 500;
}

/* Cards List Container */
.cards-list-container {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background-color: var(--card-container-bg);
  border-radius: 12px;
  overflow: hidden;
}

/* Article Card Styles */
.article-card {
  background-color: var(--card-bg);
  padding: 16px 18px;
  transition: background-color 0.2s;
}

.article-card:hover {
  filter: brightness(1.04);
}

.article-title {
  font-size: 15px;
  font-weight: 500;
  margin: 0 0 8px 0;
  line-height: 1.45;
  color: var(--text-main);
  text-decoration: none;
  display: block;
}

.article-title:hover {
  text-decoration: underline;
}

.article-meta {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.article-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.category-tag {
  background-color: var(--pill-active-bg);
  color: var(--pill-active-text);
  font-size: 11.5px;
  padding: 4px 12px;
  border-radius: 6px;
  text-transform: capitalize;
  font-weight: 500;
}

.card-actions {
  display: flex;
  gap: 14px;
}

.action-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 18px;
  padding: 0;
  display: flex;
  align-items: center;
  transition: color 0.2s;
}

.action-btn:hover {
  color: var(--primary-accent);
}

.action-btn.bookmarked {
  color: var(--primary-accent);
}

/* AI Summary Panel Styles */
.ai-summary-card {
  background-color: var(--card-bg);
  border: 1px solid var(--primary-accent);
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 1.25rem;
}

.ai-header {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--primary-accent);
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
}

.ai-answer-text {
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-main);
  margin-bottom: 10px;
}

.citations-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.citation-chip {
  font-size: 11px;
  background-color: var(--input-bg);
  color: var(--text-muted);
  padding: 3px 10px;
  border-radius: 5px;
  text-decoration: none;
  transition: color 0.2s;
}

.citation-chip:hover {
  color: var(--text-main);
}

/* Footer styling */
footer {
  text-align: center;
  font-size: 0.9rem;
  margin-top: 2rem;
  color: var(--text-muted);
}

/* Newspaper edition */
:root {
  --paper: #f3ecd9;
  --ink: #201b16;
  --muted: #63594b;
  --rule: #393127;
  --accent: #7a2924;
  --text-main: var(--ink);
  --text-muted: var(--muted);
}

body {
  display: block;
  min-height: 100vh;
  padding: 0;
  background: #ddd5c5;
  color: var(--ink);
  font-family: Georgia, 'Times New Roman', serif;
}

button, input {
  font: inherit;
}

.edition-shell {
  width: min(100% - 40px, 1160px);
  min-height: calc(100vh - 48px);
  margin: 24px auto;
  padding: 14px 28px 20px;
  border: 1px solid var(--rule);
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 12px 32px rgba(42, 33, 23, 0.12);
  animation: edition-arrive 420ms ease-out both;
}

.edition-strip {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.masthead {
  position: relative;
  padding: 12px 110px 9px;
  border-bottom: 4px double var(--rule);
  text-align: center;
}

.masthead h1 {
  margin: 0;
  color: var(--ink);
  font-family: 'Old English Text MT', Georgia, 'Times New Roman', serif;
  font-size: clamp(44px, 7vw, 68px);
  font-weight: 700;
  line-height: 1.04;
}

.masthead p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-style: italic;
}

.masthead-mark {
  position: absolute;
  top: 50%;
  left: 0;
  width: 58px;
  height: 58px;
  object-fit: contain;
  transform: translateY(-50%);
}

.saved-toggle {
  position: absolute;
  right: 0;
  bottom: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
}

.saved-toggle:hover, .saved-toggle.active {
  border-color: var(--rule);
  color: var(--ink);
}

.saved-count {
  min-width: 18px;
  padding: 1px 4px;
  border: 1px solid currentColor;
  text-align: center;
}

.section-nav {
  padding: 8px 0;
  border-bottom: 1px solid var(--rule);
  color: var(--ink);
  font-size: 11px;
  text-align: center;
  text-transform: uppercase;
}

.section-nav span {
  padding: 0 8px;
  color: var(--accent);
}

.search-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px 0 9px;
}

.search-row label, .filter-label {
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.search-input {
  flex: 1;
  min-width: 120px;
  height: 34px;
  padding: 6px 9px;
  border: 1px solid var(--rule);
  border-radius: 0;
  outline-color: var(--accent);
  background: transparent;
  color: var(--ink);
  font-size: 14px;
}

.search-input::placeholder {
  color: var(--muted);
  font-style: italic;
}

.search-submit {
  min-height: 34px;
  padding: 6px 12px;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: var(--ink);
  color: var(--paper);
  cursor: pointer;
  font-size: 11px;
  text-transform: uppercase;
}

.search-submit:disabled {
  cursor: default;
  opacity: 0.58;
}

.filter-list {
  display: grid;
  gap: 2px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--rule);
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px 16px;
  min-height: 25px;
  font-size: 12px;
  text-transform: uppercase;
}

.filter-row button {
  padding: 0 0 1px;
  border: 0;
  border-bottom: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-size: inherit;
  text-transform: inherit;
}

.filter-row button:hover, .filter-row button.selected {
  border-bottom-color: var(--ink);
}

.filter-row button.selected {
  font-weight: 700;
}

.edition-content {
  padding-top: 14px;
}

.edition-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--rule);
}

.edition-heading h2 {
  margin: 0;
  font-size: 17px;
  font-variant: small-caps;
  font-weight: 700;
}

.edition-heading span {
  color: var(--muted);
  font-size: 11px;
  font-style: italic;
}

.story {
  min-width: 0;
  padding: 13px 18px 14px 0;
  border-bottom: 1px dotted var(--muted);
  animation: story-arrive 360ms ease-out both;
}

.story-kicker {
  margin: 0 0 5px;
  color: var(--accent);
  font-size: 10px;
  text-transform: uppercase;
}

.story h2, .story h3 {
  margin: 0 0 5px;
  font-weight: 700;
  line-height: 1.22;
}

.story h2 {
  font-size: clamp(25px, 3vw, 36px);
}

.story h3 {
  font-size: 18px;
}

.article-title {
  display: block;
  color: var(--ink);
  text-decoration: none;
}

.article-title:hover {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.article-meta {
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 11px;
  font-style: italic;
}

.story-summary {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.5;
  text-align: justify;
  hyphens: auto;
}

.story-actions {
  display: flex;
  gap: 13px;
  margin-top: 7px;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  min-height: 24px;
  padding: 2px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 17px;
}

.action-btn:hover, .action-btn.bookmarked {
  color: var(--accent);
}

.lead-story {
  padding: 17px 8% 15px;
  text-align: center;
}

.lead-story .story-summary {
  max-width: 670px;
  margin: 0 auto;
}

.lead-story .story-actions {
  justify-content: center;
}

.story-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: 22px;
}

.story-columns .story:not(:nth-child(3n)) {
  border-right: 1px solid var(--rule);
}

.ai-summary-card {
  margin: 12px 0;
  padding: 11px 13px;
  border: 1px solid var(--rule);
  border-radius: 0;
  background: rgba(255, 255, 255, 0.18);
}

.ai-header {
  margin-bottom: 5px;
  color: var(--accent);
  font-size: 12px;
  text-transform: uppercase;
}

.ai-answer-text {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.5;
}

.citation-chip {
  padding: 2px 5px;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  text-decoration: underline;
}

.paper-footer {
  margin-top: 15px;
  padding-top: 9px;
  border-top: 4px double var(--rule);
  text-align: center;
}

.footer-ornament {
  color: var(--accent);
  font-size: 12px;
}

.paper-footer p {
  margin: 3px 0;
  font-size: 15px;
  font-style: italic;
}

.paper-footer a {
  color: inherit;
}

.paper-footer span {
  color: var(--muted);
  font-size: 10px;
}

.loading-state, .placeholder {
  padding: 28px 12px;
  color: var(--muted);
  text-align: center;
}

.placeholder h2 {
  margin-bottom: 5px;
  color: var(--ink);
  font-size: 19px;
  font-style: italic;
}

.placeholder p {
  font-size: 13px;
}

@keyframes edition-arrive {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes story-arrive {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (max-width: 700px) {
  .edition-shell {
    width: 100%;
    min-height: 100vh;
    margin: 0;
    padding: 10px 16px 18px;
    border: 0;
    box-shadow: none;
  }

  .masthead {
    padding: 12px 0 44px;
  }

  .saved-toggle {
    right: 50%;
    bottom: 7px;
    transform: translateX(50%);
  }

  .search-row {
    flex-wrap: wrap;
  }

  .search-row label {
    flex-basis: 100%;
  }

  .search-input {
    flex-basis: 0;
  }

  .story-columns {
    grid-template-columns: 1fr;
  }

  .story-columns .story:not(:nth-child(3n)) {
    border-right: 0;
  }

  .story-columns .story {
    padding-right: 0;
  }

  .lead-story {
    padding: 15px 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
