/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --red:      #E31B23;
  --red-dark: #b01219;
  --black:    #0a0a0a;
  --white:    #ffffff;
  --off-white:#f7f5f0;
  --text:     #1c1c1e;
  --muted:    #6e6e73;
  --border:   #d0cec8;
  --green:    #00a86b;
  --green-dark:#007d50;
  --card-shadow: 0 8px 32px rgba(0,0,0,0.14), 0 2px 8px rgba(0,0,0,0.08);
  --font-serif: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-sans:  'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--off-white);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--red); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

.hidden { display: none !important; }
.red { color: var(--red); }

/* ===== SITE HEADER ===== */
.site-header {
  background: var(--black);
  border-bottom: 4px solid var(--red);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-name-link { text-decoration: none; }

.site-name {
  font-family: var(--font-serif);
  font-weight: 900;
  font-size: clamp(1.3rem, 4vw, 2rem);
  color: var(--white);
  letter-spacing: -1px;
  text-transform: uppercase;
  line-height: 1;
}

.site-name .red { color: var(--red); }

.site-nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.site-nav a {
  color: #aaa;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  text-decoration: none;
  transition: color 0.15s;
}

.site-nav a:hover, .site-nav a.active { color: var(--white); }

.nav-tip-btn {
  background: var(--red);
  color: var(--white) !important;
  padding: 0.4rem 0.9rem;
  border-radius: 3px;
  font-size: 0.78rem !important;
  transition: background 0.15s !important;
}

.nav-tip-btn:hover { background: var(--red-dark) !important; }

/* ===== LOADING / ERROR ===== */
.loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  color: var(--muted);
  gap: 1rem;
}

.loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #ddd;
  border-top-color: var(--red);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.error-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--muted);
}

/* ===== HOME LAYOUT ===== */
.home-layout {
  display: grid;
  grid-template-columns: 1fr;
  min-height: calc(100vh - 58px);
}

@media (min-width: 900px) {
  .home-layout {
    grid-template-columns: minmax(340px, 48%) 1fr;
    align-items: start;
  }
}

/* ===== STORY CARD ===== */
.card-column {
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

@media (min-width: 900px) {
  .card-column {
    padding: 2rem;
    position: sticky;
    top: 58px;
    max-height: calc(100vh - 58px);
    overflow-y: auto;
  }
}

.story-card {
  background: var(--white);
  border-radius: 6px;
  border-top: 6px solid var(--red);
  box-shadow: var(--card-shadow);
  width: 100%;
  max-width: 480px;
  overflow: hidden;
  cursor: grab;
  user-select: none;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
  touch-action: pan-y;
}

.story-card.dragging { cursor: grabbing; transition: none; }

.story-card.swipe-right { box-shadow: 0 8px 40px rgba(0,168,107,0.35); }
.story-card.swipe-left  { box-shadow: 0 8px 40px rgba(227,27,35,0.35); }

/* Swipe hint overlay */
.swipe-hint {
  display: flex;
  justify-content: space-between;
  padding: 0.4rem 0.75rem;
  background: var(--black);
}

.swipe-hint span {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #555;
  pointer-events: none;
}

.swipe-hint-yay { color: #00a86b !important; }
.swipe-hint-nay { color: var(--red) !important; }

/* Card image */
.card-image-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  overflow: hidden;
  background: #1a1a1a;
}

.card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.story-label {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  background: var(--red);
  color: var(--white);
  font-family: var(--font-sans);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  padding: 0.3rem 0.65rem;
  border-radius: 2px;
}

.story-label.label-reporting { background: var(--black); }
.story-label.label-opinion   { background: var(--red); }

/* Card body */
.card-body {
  padding: 1.25rem 1.25rem 1rem;
}

.story-headline {
  font-family: var(--font-serif);
  font-weight: 900;
  font-size: clamp(1.3rem, 3.5vw, 1.8rem);
  line-height: 1.2;
  color: var(--black);
  margin-bottom: 0.6rem;
  letter-spacing: -0.3px;
}

.story-dek {
  font-size: 0.93rem;
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 1.25rem;
}

/* ===== VOTE SECTION ===== */
.vote-prompt {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.6rem;
}

.vote-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
}

.vote-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 0.9rem 0.5rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--font-sans);
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  transition: transform 0.12s, filter 0.12s;
  line-height: 1;
}

.vote-btn:active { transform: scale(0.95); }
.vote-btn:hover  { filter: brightness(1.08); }

.vote-icon { font-size: 1.4rem; }
.vote-label { font-size: 0.85rem; }

.vote-btn-yay  { background: var(--green);  color: var(--white); }
.vote-btn-nay  { background: var(--red);    color: var(--white); }

.vote-swipe-hint-mobile {
  text-align: center;
  font-size: 0.7rem;
  color: #aaa;
  margin-top: 0.25rem;
}

@media (min-width: 900px) { .vote-swipe-hint-mobile { display: none; } }

/* ===== VOTE TALLY ===== */
.vote-tally {
  margin-top: 0.75rem;
}

.tally-row {
  display: grid;
  grid-template-columns: 4rem 1fr 3rem;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}

.tally-label-yay, .tally-label-nay {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.tally-label-yay { color: var(--green); }
.tally-label-nay { color: var(--red); }

.tally-bar {
  height: 10px;
  background: #eee;
  border-radius: 5px;
  overflow: hidden;
}

.tally-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.7s cubic-bezier(0.25, 1, 0.5, 1);
}

.tally-fill-yay { background: var(--green); }
.tally-fill-nay { background: var(--red); }

.tally-pct {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  text-align: right;
}

.tally-total {
  font-size: 0.72rem;
  color: #aaa;
  text-align: center;
  margin-top: 0.2rem;
}

/* ===== CARD ACTIONS ===== */
.card-actions {
  display: flex;
  gap: 0.6rem;
  margin-top: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.btn-permalink {
  display: inline-block;
  background: transparent;
  border: 2px solid var(--black);
  color: var(--black);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 0.45rem 0.85rem;
  border-radius: 3px;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.btn-permalink:hover { background: var(--black); color: var(--white); }

.btn-next {
  background: var(--red);
  color: var(--white);
  border: none;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 0.45rem 0.85rem;
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-next:hover { background: var(--red-dark); }

/* ===== ARTICLE COLUMN ===== */
.article-column {
  background: var(--white);
  padding: 2rem 1.5rem;
  border-left: 1px solid var(--border);
  min-height: 100%;
}

@media (min-width: 900px) {
  .article-column {
    padding: 2.5rem 3rem;
    max-height: calc(100vh - 58px);
    overflow-y: auto;
  }
}

.article-body {
  max-width: 680px;
  font-size: 1rem;
  line-height: 1.75;
  color: var(--text);
}

.article-body h1,
.article-body h2,
.article-body h3 {
  font-family: var(--font-serif);
  font-weight: 700;
  color: var(--black);
  margin: 1.75rem 0 0.6rem;
  line-height: 1.25;
}

.article-body h1 { font-size: 1.9rem; }
.article-body h2 { font-size: 1.45rem; border-bottom: 2px solid var(--border); padding-bottom: 0.4rem; }
.article-body h3 { font-size: 1.15rem; }

.article-body p { margin-bottom: 1.1rem; }

.article-body blockquote {
  border-left: 4px solid var(--red);
  margin: 1.5rem 0;
  padding: 0.75rem 1.25rem;
  background: #fdf5f5;
  font-style: italic;
  color: #444;
}

.article-body ul, .article-body ol {
  padding-left: 1.5rem;
  margin-bottom: 1.1rem;
}

.article-body li { margin-bottom: 0.4rem; }

.article-body a { color: var(--red); }
.article-body a:hover { text-decoration: underline; }

.article-body strong { font-weight: 700; color: var(--black); }

/* ===== SOURCES ===== */
.sources-section {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 3px solid var(--black);
  max-width: 680px;
}

.sources-heading {
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 0.75rem;
}

.sources-list {
  list-style: none;
  padding: 0;
}

.sources-list li {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}

.sources-list li:last-child { border-bottom: none; }

.sources-list a {
  color: var(--red);
  word-break: break-word;
}

.article-footer-actions {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  max-width: 680px;
}

.share-link {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

/* ===== TIPS FORM SECTION ===== */
.tips-form-section {
  background: var(--black);
  padding: 3rem 1.5rem;
  margin-top: 2rem;
}

@media (min-width: 900px) {
  .tips-form-section {
    grid-column: 1 / -1;
  }
}

.tips-container {
  max-width: 640px;
  margin: 0 auto;
}

.tips-heading {
  font-family: var(--font-serif);
  font-size: 2rem;
  color: var(--white);
  margin-bottom: 0.6rem;
}

.tips-heading::after {
  content: '';
  display: block;
  width: 50px;
  height: 4px;
  background: var(--red);
  margin-top: 0.5rem;
}

.tips-subhead {
  color: #888;
  font-size: 0.88rem;
  line-height: 1.65;
  margin-bottom: 2rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #aaa;
  margin-bottom: 0.4rem;
}

.tips-form-section .form-group label { color: #888; }

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 4px;
  color: var(--white);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  padding: 0.65rem 0.85rem;
  transition: border-color 0.15s;
  outline: none;
}

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

.form-group select option { background: #1a1a1a; }

.form-group small {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.75rem;
  color: #666;
}

.cf-turnstile {
  margin: 1.25rem 0;
}

.btn-submit {
  width: 100%;
  background: var(--red);
  color: var(--white);
  border: none;
  border-radius: 4px;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 0.9rem;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-submit:hover { background: var(--red-dark); }
.btn-submit:disabled { background: #444; cursor: not-allowed; }

.tip-status {
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 4px;
  font-size: 0.88rem;
  font-weight: 600;
}

.tip-status.success { background: rgba(0,168,107,0.15); color: #00c87b; border: 1px solid #00a86b; }
.tip-status.error   { background: rgba(227,27,35,0.15);  color: #ff6666; border: 1px solid var(--red); }

/* ===== ARCHIVE PAGE ===== */
.archive-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.archive-header {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 4px solid var(--black);
}

.archive-title {
  font-family: var(--font-serif);
  font-size: 2.5rem;
  font-weight: 900;
  line-height: 1;
}

.archive-count {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 0.3rem;
}

.archive-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 640px) {
  .archive-grid { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 1024px) {
  .archive-grid { grid-template-columns: 1fr 1fr 1fr; }
}

.archive-card {
  background: var(--white);
  border-radius: 4px;
  border-top: 4px solid var(--red);
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s;
  text-decoration: none;
  display: block;
  color: var(--text);
}

.archive-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.14);
  text-decoration: none;
}

.archive-card.label-reporting { border-top-color: var(--black); }

.archive-card-image {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  background: #1a1a1a;
}

.archive-card-body {
  padding: 1rem;
}

.archive-card-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 0.4rem;
}

.archive-card.label-reporting .archive-card-label { color: var(--black); }

.archive-card-headline {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.3;
  margin-bottom: 0.4rem;
  color: var(--black);
}

.archive-card-dek {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.archive-card-meta {
  margin-top: 0.6rem;
  font-size: 0.72rem;
  color: #aaa;
}

.archive-empty {
  text-align: center;
  padding: 4rem;
  color: var(--muted);
}

/* ===== STORY PERMALINK PAGE ===== */
.story-page { max-width: 720px; margin: 2rem auto; padding: 0 1.5rem; }

.story-page-header { margin-bottom: 1.5rem; }

.story-page-label {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  background: var(--red);
  color: var(--white);
  padding: 0.3rem 0.65rem;
  margin-bottom: 0.75rem;
}

.story-page-label.label-reporting { background: var(--black); }

.story-page-title {
  font-family: var(--font-serif);
  font-size: clamp(1.8rem, 5vw, 3rem);
  font-weight: 900;
  line-height: 1.15;
  margin-bottom: 0.75rem;
}

.story-page-dek {
  font-size: 1.1rem;
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 1rem;
}

.story-page-date {
  font-size: 0.8rem;
  color: #aaa;
}

.story-page-image {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  border-radius: 4px;
  margin: 1.5rem 0;
}

/* Vote on permalink page */
.story-vote-block {
  background: var(--off-white);
  border-radius: 6px;
  padding: 1.5rem;
  margin: 2rem 0;
  border: 1px solid var(--border);
}

/* ===== SITE FOOTER ===== */
.site-footer {
  background: var(--black);
  padding: 1.5rem;
  margin-top: 3rem;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.footer-name {
  font-family: var(--font-serif);
  font-weight: 900;
  font-size: 1rem;
  color: var(--white);
}

.footer-tagline {
  font-size: 0.75rem;
  color: #555;
  flex: 1;
  margin: 0 1rem;
}

.footer-nav { display: flex; gap: 1rem; }
.footer-nav a { font-size: 0.78rem; color: #555; }
.footer-nav a:hover { color: #999; }

/* ===== UTILITY BUTTONS ===== */
.btn-primary {
  background: var(--red);
  color: var(--white);
  border: none;
  border-radius: 4px;
  padding: 0.55rem 1.1rem;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-primary:hover { background: var(--red-dark); }

.btn-secondary {
  background: transparent;
  border: 2px solid var(--border);
  color: var(--muted);
  border-radius: 4px;
  padding: 0.5rem 1rem;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.btn-secondary:hover { border-color: var(--text); color: var(--text); }

.btn-danger {
  background: transparent;
  border: 2px solid var(--red);
  color: var(--red);
  border-radius: 4px;
  padding: 0.5rem 1rem;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.btn-danger:hover { background: var(--red); color: var(--white); }
