/* RoastJokes.com Master Stylesheet */
/* Design System: #ef3b2d (red), #222222 (dark), #FFF8EF (light), system fonts */

/* ========== CSS CUSTOM PROPERTIES ========== */
:root {
  --color-accent: #ef3b2d;
  --color-dark: #222222;
  --color-light-bg: #FFF8EF;
  --color-text: #222222;
  --color-border: #e0e0e0;
  --color-secondary-text: #666666;
  --color-meta: #999999;
  --color-heart-empty: #cccccc;

  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: Georgia, serif;
  --line-height: 1.6;
  --line-height-tight: 1.3;
  --line-height-content: 1.7;

  --max-width: 1200px;
  --max-width-content: 800px;
  --spacing: 1rem;
  --spacing-lg: 2rem;
}

/* ========== RESET AND BASE ========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  font-size: 1rem;
  line-height: var(--line-height);
  color: var(--color-text);
  background-color: var(--color-light-bg);
}

/* ========== TYPOGRAPHY ========== */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: var(--line-height-tight);
  margin-bottom: 0.5rem;
  color: var(--color-dark);
}

h1 {
  font-size: 2.5rem;
  margin-bottom: 1.5rem;
  margin-top: 0;
}

h2 {
  font-size: 1.75rem;
  margin-top: 2rem;
  margin-bottom: 1rem;
}

h3 {
  font-size: 1.25rem;
  margin-top: 1.5rem;
}

p {
  margin-bottom: 1rem;
  color: var(--color-text);
}

a {
  color: var(--color-accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

ul, ol {
  margin-left: 1.5rem;
  margin-bottom: 1rem;
}

li {
  margin-bottom: 0.5rem;
}

/* ========== BUTTONS ========== */
.btn, button {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background-color: var(--color-accent);
  color: white;
  border: none;
  border-radius: 4px;
  font-family: var(--font-family);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease;
  text-decoration: none;
}

.btn:hover, button:hover {
  background-color: #d63220;
  text-decoration: none;
}

.btn-large {
  padding: 1rem 2rem;
  font-size: 1.1rem;
}

/* ========== LAYOUT: HEADER & STICKY NAV ========== */
header {
  background-color: var(--color-dark);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--spacing);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  height: 40px;
}

.logo img {
  height: 40px;
  width: auto;
}

nav ul {
  display: flex;
  list-style: none;
  margin: 0;
  gap: 2rem;
}

nav a {
  font-size: 14px;
  font-weight: 500;
  color: white;
  transition: color 0.2s ease;
}

nav a:hover {
  color: var(--color-accent);
  text-decoration: none;
}

/* Mobile nav toggle (CSS-only hamburger) */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}

.nav-toggle span {
  width: 25px;
  height: 3px;
  background-color: white;
  border-radius: 2px;
  transition: all 0.3s ease;
}

@media (max-width: 768px) {
  nav ul {
    flex-direction: column;
    gap: 1rem;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--color-dark);
    padding: 1rem var(--spacing);
    border-bottom: 1px solid rgba(255,255,255,0.1);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
  }

  nav.active ul {
    max-height: 500px;
  }

  .nav-toggle {
    display: flex;
  }

  h1 {
    font-size: 1.75rem;
  }

  h2 {
    font-size: 1.35rem;
  }
}

/* ========== LAYOUT: MAIN & TWO-COLUMN GRID ========== */
main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--spacing-lg);
}

.page-wrapper {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 20px;
  align-items: start;
}

.page-content {
  grid-column: 1;
}

.sidebar {
  grid-column: 2;
  position: sticky;
  top: 80px;
}

@media (max-width: 900px) {
  .page-wrapper {
    grid-template-columns: 1fr;
  }

  .sidebar {
    grid-column: 1;
    position: relative;
    top: auto;
  }
}

/* ========== INTRO TEXT ========== */
.intro {
  font-size: 1.05rem;
  line-height: var(--line-height-content);
  margin-bottom: var(--spacing-lg);
  color: var(--color-text);
}

/* ========== JOKE LIST: STANDARD ROWS ========== */
.jokes-list {
  list-style: none;
  margin: var(--spacing-lg) 0;
  padding: 0;
}

.joke-item {
  background-color: white;
  border-bottom: 1px solid var(--color-border);
  padding: 20px 16px;
  margin-bottom: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.joke-item.alt {
  background-color: var(--color-light-bg);
}

.joke-item:first-child {
  border-radius: 8px 8px 0 0;
}

.joke-item:last-of-type:not(.joke-featured) {
  border-radius: 0 0 8px 8px;
}

.joke-content {
  flex: 1;
}

.joke-subject {
  font-weight: 700;
  color: var(--color-dark);
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

.joke-text {
  color: var(--color-text);
  font-family: var(--font-serif);
  font-size: 17px;
  line-height: var(--line-height-content);
}

/* ========== LIKE BUTTON ========== */
.like-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.heart-icon {
  stroke: var(--color-heart-empty);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: all 0.2s ease;
}

.like-btn:hover .heart-icon {
  stroke: var(--color-accent);
}

.like-count {
  font-size: 11px;
  color: var(--color-meta);
  font-weight: 500;
  min-width: 20px;
  text-align: center;
}

/* ========== JOKE LIST: FEATURED CARDS ========== */
.joke-featured {
  width: 100%;
  min-height: 200px;
  border-radius: 8px;
  padding: 40px;
  margin: 24px 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  color: white;
  position: relative;
}

.joke-featured-text {
  font-family: var(--font-serif);
  font-size: 24px;
  line-height: 1.5;
  margin-bottom: 1rem;
}

.joke-featured-attribution {
  font-size: 13px;
  opacity: 0.8;
  font-family: var(--font-family);
}

.joke-featured .like-btn {
  position: absolute;
  bottom: 20px;
  right: 20px;
}

.joke-featured .heart-icon {
  stroke: white;
  fill: none;
}

.joke-featured .like-btn:hover .heart-icon {
  stroke: white;
  fill: white;
}

/* Featured card gradient variations */
.joke-featured:nth-of-type(1) {
  background: linear-gradient(135deg, #ef3b2d 0%, #c0321f 100%);
}

.joke-featured:nth-of-type(2) {
  background: linear-gradient(135deg, #222222 0%, #ef3b2d 100%);
}

.joke-featured:nth-of-type(3) {
  background: linear-gradient(135deg, #c0321f 0%, #891f12 100%);
}

.joke-featured:nth-of-type(4) {
  background: linear-gradient(135deg, #ef3b2d 0%, #c0321f 100%);
}

/* ========== CTA BLOCK ========== */
.cta-block {
  background-color: var(--color-accent);
  color: white;
  padding: var(--spacing-lg);
  border-radius: 8px;
  margin: 3rem 0;
  text-align: center;
}

.cta-block h2 {
  color: white;
  margin-bottom: 1rem;
}

.cta-block p {
  color: white;
  font-size: 1.05rem;
  margin-bottom: 1.5rem;
}

.cta-block .btn {
  background-color: white;
  color: var(--color-accent);
  font-weight: 700;
}

.cta-block .btn:hover {
  background-color: var(--color-light-bg);
  color: var(--color-accent);
}

/* ========== SIDEBAR: AD BOX ========== */
.sidebar-ad {
  background-color: white;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
}

.sidebar-ad-logo {
  width: 160px;
  margin: 0 auto 1rem;
}

.sidebar-ad-logo img {
  width: 100%;
  height: auto;
  display: block;
}

.sidebar-ad p {
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 1rem;
  color: var(--color-text);
}

.sidebar-ad .btn {
  width: 100%;
  text-align: center;
  display: block;
  padding: 12px;
  font-size: 14px;
  border-radius: 4px;
}

/* ========== SIDEBAR: RELATED/MOST LIKED ========== */
.related-section, .most-liked-section {
  background-color: white;
  border: 1px solid var(--color-border);
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 20px;
}

.related-section h3, .most-liked-section h3 {
  margin-top: 0;
  font-size: 1.1rem;
  border-bottom: 2px solid var(--color-accent);
  padding-bottom: 0.75rem;
}

.related-links, .most-liked-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.related-links li, .most-liked-list li {
  margin-bottom: 0.75rem;
}

.related-links a, .most-liked-list a {
  display: block;
  padding: 0.5rem 0;
  color: var(--color-accent);
  font-weight: 500;
  transition: padding-left 0.2s ease;
  font-size: 0.95rem;
}

.related-links a:hover, .most-liked-list a:hover {
  padding-left: 0.5rem;
  text-decoration: none;
}

.most-liked-item {
  font-size: 0.85rem;
  color: var(--color-secondary-text);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* ========== FAQ SECTION ========== */
.faq-section {
  margin: 3rem 0;
  background-color: white;
  padding: var(--spacing-lg);
  border-radius: 8px;
}

.faq-item {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--color-border);
}

.faq-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.faq-question {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-dark);
  margin-bottom: 0.75rem;
  cursor: pointer;
  user-select: none;
}

.faq-answer {
  color: var(--color-text);
  line-height: var(--line-height);
  font-size: 0.95rem;
}

/* ========== SPECIFICITY GAP SECTION ========== */
.specificity-gap {
  background-color: white;
  border-left: 4px solid var(--color-accent);
  padding: 20px;
  margin: 2rem 0;
  border-radius: 4px;
}

.specificity-gap h3 {
  margin-top: 0;
}

/* ========== AUTHOR BYLINE ========== */
.author-byline {
  background-color: white;
  border-top: 2px solid var(--color-border);
  padding-top: 1.5rem;
  margin-top: 2rem;
  font-size: 0.9rem;
  color: var(--color-meta);
  line-height: 1.6;
}

.author-byline a {
  color: var(--color-accent);
  font-weight: 500;
}

/* ========== FOOTER ========== */
footer {
  background-color: var(--color-dark);
  color: white;
  padding: var(--spacing-lg);
  margin-top: 3rem;
}

.footer-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--spacing);
}

.footer-tagline {
  font-size: 1rem;
  margin-bottom: 1.5rem;
  line-height: var(--line-height);
}

.footer-links {
  display: flex;
  gap: 2rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.footer-links a {
  color: white;
  font-weight: 500;
  transition: color 0.2s ease;
}

.footer-links a:hover {
  color: var(--color-accent);
  text-decoration: none;
}

.footer-cta {
  background-color: transparent;
  border: 2px solid var(--color-accent);
  color: var(--color-accent);
  padding: 0.5rem 1rem;
  font-size: 0.95rem;
  display: inline-block;
}

.footer-cta:hover {
  background-color: var(--color-accent);
  color: white;
  text-decoration: none;
}

.footer-copyright {
  font-size: 0.85rem;
  color: var(--color-meta);
  border-top: 1px solid rgba(255,255,255,0.2);
  padding-top: 1rem;
  margin-top: 1rem;
}

/* ========== UTILITY CLASSES ========== */
.text-center {
  text-align: center;
}

.text-accent {
  color: var(--color-accent);
}

.mt-large {
  margin-top: var(--spacing-lg);
}

.mb-large {
  margin-bottom: var(--spacing-lg);
}

/* ========== IMAGE OPTIMIZATION ========== */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

img[loading="lazy"] {
  background-color: #f5f5f5;
}

/* ========== PRINT STYLES ========== */
@media print {
  header, footer, .cta-block, .sidebar {
    display: none;
  }

  main {
    max-width: 100%;
    padding: 0;
  }

  .page-wrapper {
    grid-template-columns: 1fr;
  }
}
