/* style.css - AstoriaStreet Herald (New York Times Editorial Design) */

:root {
  /* NYT Fonts */
  --font-logo: 'UnifrakturMaguntia', serif;
  --font-headline: 'Playfair Display', serif;
  --font-body: 'Georgia', serif;
  --font-sans: 'IBM Plex Sans', sans-serif;

  /* Theme: Newspaper Paper (Default Light Mode) */
  --bg-color: #fbfbf9; /* Soft cream newspaper paper color */
  --text-primary: #111111; /* Black ink */
  --text-secondary: #444444; /* Charcoal ink */
  --border-color: #111111; /* Thin black borders */
  --border-light: rgba(17, 17, 17, 0.15);
  --accent-color: #000000;
  
  --column-gap: 28px;
  --column-rule-color: rgba(17, 17, 17, 0.12);
}

/* Dark Mode Theme overrides */
[data-theme="dark"] {
  --bg-color: #121212;
  --text-primary: #f5f5f5;
  --text-secondary: #b5b5b5;
  --border-color: #f5f5f5;
  --border-light: rgba(245, 245, 245, 0.2);
  --accent-color: #ffffff;
  --column-rule-color: rgba(245, 245, 245, 0.15);
}

/* E-Ink Mode Theme overrides (High Contrast, Pure White/Pure Black, No gradients/shadows) */
[data-theme="eink"] {
  --bg-color: #ffffff;
  --text-primary: #000000;
  --text-secondary: #000000;
  --border-color: #000000;
  --border-light: #000000;
  --accent-color: #000000;
  --column-rule-color: #000000;
}

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

body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-family: var(--font-body);
  line-height: 1.6;
  transition: background-color 0.25s ease, color 0.25s ease;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* App Shell container */
.herald-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 15px;
}

/* --- EDITORIAL HEADER (New York Times Style) --- */
.herald-header {
  text-align: center;
  margin-bottom: 10px;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 5px;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.header-logo-container {
  padding: 10px 0 5px 0;
  border-bottom: 1px solid var(--border-color);
}

.newspaper-logo {
  font-family: var(--font-logo);
  font-size: clamp(2.5rem, 7vw, 4.8rem);
  font-weight: 400;
  letter-spacing: -0.5px;
  line-height: 1;
  color: var(--text-primary);
}

.header-meta-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-top: 3px double var(--border-color);
  border-bottom: 1px solid var(--border-color);
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
}

.meta-item.motto {
  font-family: var(--font-headline);
  font-size: 0.85rem;
  font-style: italic;
  text-transform: none;
  font-weight: 400;
}

/* --- NAVIGATION --- */
.herald-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  padding: 8px 0;
  border-bottom: 3px double var(--border-color);
  margin-bottom: 25px;
  overflow-x: auto;
  white-space: nowrap;
}

.nav-btn {
  background: none;
  border: none;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px 12px;
  transition: color 0.15s ease, border-bottom-color 0.15s ease;
  position: relative;
}

.nav-btn:hover, .nav-btn.active {
  color: var(--text-primary);
}

.nav-btn.active::after {
  content: '';
  position: absolute;
  bottom: -9px;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: var(--text-primary);
}

.btn-contrast-toggle {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
  margin-left: auto;
}

.btn-contrast-toggle:hover {
  color: var(--text-primary);
}

/* --- SECTIONS VIEW --- */
.tab-section {
  display: none;
}

.tab-section.active {
  display: block;
}

/* --- BUTTONS --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  border: 1px solid var(--border-color);
  background-color: transparent;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary {
  background-color: var(--text-primary);
  color: var(--bg-color);
}

.btn-primary:hover {
  opacity: 0.9;
}

.btn-secondary {
  background-color: transparent;
  color: var(--text-primary);
}

.btn-secondary:hover {
  background-color: rgba(17, 17, 17, 0.05);
}

[data-theme="dark"] .btn-secondary:hover {
  background-color: rgba(245, 245, 245, 0.08);
}

.btn-sm {
  padding: 4px 8px;
  font-size: 0.65rem;
}

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
}

/* Sync badge */
.sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border: 1px solid var(--border-color);
  font-weight: 700;
  background-color: rgba(17, 17, 17, 0.03);
}

[data-theme="dark"] .sync-badge {
  background-color: rgba(245, 245, 245, 0.05);
}

.sync-badge.disconnected {
  background-color: #ffcccc;
  border-color: #cc0000;
  color: #cc0000;
}

[data-theme="dark"] .sync-badge.disconnected {
  background-color: #551111;
  border-color: #ff4444;
  color: #ff4444;
}

/* --- EDITORS PICK / FEATURED BANNER --- */
.editors-pick-container {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 25px;
  margin-bottom: 25px;
}

.featured-article {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 25px;
}

@media (max-width: 768px) {
  .featured-article {
    grid-template-columns: 1fr;
  }
}

.featured-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-right: 15px;
}

.editorial-tag {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  color: #c00;
  margin-bottom: 8px;
  letter-spacing: 1.5px;
}

.featured-title {
  font-family: var(--font-headline);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 12px;
  cursor: pointer;
}

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

.featured-summary {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 15px;
  line-height: 1.5;
}

.featured-meta {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.featured-image-container {
  width: 100%;
  height: 100%;
  max-height: 380px;
  overflow: hidden;
  border: 1px solid var(--border-light);
}

.featured-image-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.featured-image-container img:hover {
  transform: scale(1.02);
}

/* --- FEED COLUMNS GRID --- */
.feed-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

/* Newspaper Article Card */
.news-card {
  display: flex;
  flex-direction: column;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-light);
  border-right: 1px solid var(--border-light);
  padding-right: 20px;
  margin-right: -10px;
}

/* Remove right borders on last column on desktop */
@media (min-width: 992px) {
  .feed-grid > .news-card:nth-child(3n) {
    border-right: none;
    padding-right: 0;
  }
}

.news-card-image {
  width: 100%;
  height: 180px;
  overflow: hidden;
  margin-bottom: 12px;
  border: 1px solid var(--border-light);
}

.news-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.news-card-meta {
  display: flex;
  gap: 10px;
  align-items: center;
  font-family: var(--font-sans);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 6px;
  color: var(--text-secondary);
}

.news-badge {
  padding: 2px 6px;
  border: 1px solid var(--border-color);
  font-size: 0.6rem;
  letter-spacing: 0.5px;
}

.news-badge.source {
  background-color: var(--text-primary);
  color: var(--bg-color);
}

.news-card-title {
  font-family: var(--font-headline);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 8px;
  cursor: pointer;
}

.news-card-title:hover {
  text-decoration: underline;
}

.news-card-summary {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-card-footer {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-sans);
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
}

.news-card-footer a {
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.news-card-footer a:hover {
  text-decoration: underline;
}

/* --- SIMPLIFIED WRITER TAB --- */
.editor-layout {
  display: grid;
  grid-template-columns: 45% 55%;
  gap: 30px;
}

@media (max-width: 992px) {
  .editor-layout {
    grid-template-columns: 1fr;
  }
}

.editor-input-panel {
  padding-right: 10px;
}

.section-title {
  font-family: var(--font-headline);
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 5px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-subtitle {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Forms */
.editor-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-group-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

@media (max-width: 576px) {
  .form-group-row {
    grid-template-columns: 1fr;
  }
}

.form-group label {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-secondary);
}

.form-group input, .form-group textarea, .form-group select {
  font-family: var(--font-body);
  font-size: 0.9rem;
  padding: 10px;
  border: 1px solid var(--border-light);
  background-color: var(--bg-color);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s;
}

.form-group select {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
}

.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
  border-color: var(--border-color);
}

.form-group textarea {
  height: 280px;
  resize: vertical;
  line-height: 1.5;
}

.editor-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 10px;
}

/* --- NEW YORK TIMES NEWSPAPER PREVIEW PANEL --- */
.editor-preview-panel {
  background-color: var(--bg-color);
  padding: 15px;
  border-left: 1px solid var(--border-light);
}

@media (max-width: 992px) {
  .editor-preview-panel {
    border-left: none;
    border-top: 1px solid var(--border-light);
    padding-top: 25px;
  }
}

.nyt-newspaper-page {
  border: 1px solid var(--border-color);
  padding: 25px;
  background-color: var(--bg-color);
  box-shadow: 0 4px 20px rgba(0,0,0,0.03);
}

[data-theme="eink"] .nyt-newspaper-page {
  box-shadow: none;
  border: 2px solid #000;
}

.preview-nyt-header {
  text-align: center;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 10px;
  margin-bottom: 20px;
}

.preview-nyt-header h3 {
  font-family: var(--font-logo);
  font-size: 2.2rem;
  font-weight: 400;
  margin-bottom: 2px;
}

.preview-nyt-edition {
  font-family: var(--font-sans);
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
}

/* Article Styling */
.preview-article, .nyt-reading-layout {
  display: flex;
  flex-direction: column;
}

.preview-article h1, .nyt-reading-layout h1 {
  font-family: var(--font-headline);
  font-size: clamp(1.5rem, 3.5vw, 2.1rem);
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 10px;
  text-align: center;
}

.preview-catenaccio, .nyt-reading-layout .reading-catenaccio {
  font-family: var(--font-body);
  font-size: 1rem;
  font-style: italic;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 12px;
  text-align: center;
  padding: 0 10px;
}

.preview-meta, .nyt-reading-layout .reading-byline {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  font-family: var(--font-sans);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-secondary);
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  padding: 5px 0;
  margin-bottom: 15px;
}

.preview-img-container, .nyt-reading-layout .reading-image-container {
  width: 100%;
  max-height: 250px;
  overflow: hidden;
  margin-bottom: 15px;
  border: 1px solid var(--border-light);
}

.preview-img-container img, .nyt-reading-layout .reading-image-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* --- AUTOMATIC COLUMNS FLOW (New York Times style) --- */
.preview-body-columns, .reading-body-text {
  font-family: var(--font-body);
  font-size: 0.88rem;
  line-height: 1.6;
  text-align: justify;
  text-justify: inter-word;
  
  /* CSS Multi-Column layout */
  column-count: 2;
  column-gap: var(--column-gap);
  column-rule: 1px solid var(--column-rule-color);
}

@media (max-width: 600px) {
  .preview-body-columns, .reading-body-text {
    column-count: 1;
  }
}

.preview-body-columns p, .reading-body-text p {
  margin-bottom: 12px;
  text-indent: 18px; /* Classic indentation for newspaper paragraphs */
}

/* Remove indent for first paragraph and add large Drop-Cap */
.preview-body-columns p:first-of-type, .reading-body-text p:first-of-type {
  text-indent: 0;
}

.first-letter {
  float: left;
  font-family: var(--font-headline);
  font-size: 3.2rem;
  line-height: 0.8;
  padding-top: 4px;
  padding-right: 6px;
  font-weight: 800;
  color: var(--text-primary);
}

/* --- LOCAL REPORTS TAB --- */
.reports-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}

.report-item-card {
  border: 1px solid var(--border-color);
  padding: 20px;
  background-color: var(--bg-color);
  display: flex;
  flex-direction: column;
}

.report-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-family: var(--font-sans);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
}

.report-item-title {
  font-family: var(--font-headline);
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 8px;
  cursor: pointer;
}

.report-item-title:hover {
  text-decoration: underline;
}

.report-item-summary {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 15px;
}

.report-item-footer {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.report-item-actions {
  display: flex;
  gap: 8px;
}

/* --- FULL READING MODAL --- */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.6);
  z-index: 1000;
  padding: 30px 15px;
  overflow-y: auto;
}

.modal.active {
  display: block;
}

.modal-content {
  background-color: var(--bg-color);
  max-width: 900px;
  margin: 0 auto;
  border: 2px solid var(--border-color);
  padding: 25px;
}

[data-theme="eink"] .modal-content {
  border: 3px solid #000;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
  margin-bottom: 20px;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

/* Modal full article layout */
.nyt-reading-layout h1 {
  font-size: clamp(1.8rem, 4.5vw, 2.5rem);
}

.nyt-reading-layout .reading-body-text {
  /* 3 columns on desktop for reading */
  column-count: 3;
  font-size: 0.95rem;
  margin-bottom: 25px;
}

@media (max-width: 800px) {
  .nyt-reading-layout .reading-body-text {
    column-count: 2;
  }
}

@media (max-width: 550px) {
  .nyt-reading-layout .reading-body-text {
    column-count: 1;
  }
}

.reading-footer-actions {
  border-top: 1px solid var(--border-color);
  padding-top: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* --- LOADER AND EMPTY STATES --- */
.news-loader {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 50px 0;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  text-transform: uppercase;
  gap: 12px;
}

.spinner {
  width: 30px;
  height: 30px;
  animation: spin 1s linear infinite;
  color: var(--text-primary);
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 20px;
  border: 1px dashed var(--border-light);
  color: var(--text-secondary);
}

.empty-state i {
  font-size: 2rem;
  margin-bottom: 10px;
}

.empty-state p {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  margin-bottom: 15px;
}

/* Responsive adjustments */
@media (max-width: 576px) {
  .herald-container {
    padding: 10px;
  }
  .header-meta-bar {
    flex-direction: column;
    gap: 4px;
  }
  .meta-item.motto {
    display: none;
  }
  .herald-nav {
    justify-content: flex-start;
    padding-bottom: 5px;
  }
  .nav-btn {
    font-size: 0.7rem;
    padding: 4px 8px;
  }
}

/* --- FULL-TEXT HOME FEED LAYOUT --- */
.feed-list {
  display: flex;
  flex-direction: column;
  gap: 50px;
  margin-top: 20px;
}

.news-card-full {
  display: flex;
  flex-direction: column;
  border-bottom: 4px double var(--border-color);
  padding-bottom: 40px;
}

.news-card-full:last-child {
  border-bottom: none;
}

.news-card-header-full {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  font-family: var(--font-sans);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-secondary);
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  padding: 6px 0;
  margin-bottom: 15px;
}

.news-card-title-full {
  font-family: var(--font-headline);
  font-size: clamp(1.8rem, 4.5vw, 2.5rem);
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 12px;
  text-align: center;
  color: var(--text-primary);
}

.news-card-catenaccio-full {
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-style: italic;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 18px;
  text-align: center;
  padding: 0 10%;
}

.news-card-image-full {
  width: 100%;
  max-height: 450px;
  overflow: hidden;
  margin-bottom: 20px;
  border: 1px solid var(--border-light);
}

.news-card-image-full img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.news-card-body-full {
  font-family: var(--font-body);
  font-size: 0.95rem;
  line-height: 1.6;
  text-align: justify;
  text-justify: inter-word;
  column-count: 3;
  column-gap: var(--column-gap);
  column-rule: 1px solid var(--column-rule-color);
}

.news-card-body-full p {
  margin-bottom: 12px;
  text-indent: 18px;
}

.news-card-body-full p:first-of-type {
  text-indent: 0;
}

@media (max-width: 992px) {
  .news-card-body-full {
    column-count: 2;
  }
}

@media (max-width: 600px) {
  .news-card-body-full {
    column-count: 1;
  }
}

