/* Magazine Content Styles */
.magazine-content {
  font-size: 16px;
  line-height: 1.8;
  color: #333;
}

/* Paragraphs */
.magazine-content p {
  margin-bottom: 1.5em;
}

/* Headings */
.magazine-content h1,
.magazine-content h2,
.magazine-content h3,
.magazine-content h4,
.magazine-content h5,
.magazine-content h6 {
  font-weight: bold;
  line-height: 1.4;
  margin-top: 1.5em;
  margin-bottom: 0.75em;
  color: #1a1a1a;
}

.magazine-content h1 {
  font-size: 2em;
}

.magazine-content h2 {
  font-size: 1.75em;
  border-bottom: 2px solid #e5e7eb;
  padding-bottom: 0.5em;
}

.magazine-content h3 {
  font-size: 1.5em;
}

.magazine-content h4 {
  font-size: 1.25em;
}

/* Lists */
.magazine-content ul,
.magazine-content ol {
  margin-bottom: 1.5em;
  padding-left: 1.5em;
}

.magazine-content ul {
  list-style-type: disc;
}

.magazine-content ol {
  list-style-type: decimal;
}

.magazine-content li {
  margin-bottom: 0.5em;
}

.magazine-content ul ul,
.magazine-content ol ul {
  list-style-type: circle;
  margin-top: 0.5em;
}

.magazine-content ul ol,
.magazine-content ol ol {
  list-style-type: lower-alpha;
  margin-top: 0.5em;
}

/* Links */
.magazine-content a {
  color: #3b82f6;
  text-decoration: underline;
}

.magazine-content a:hover {
  color: #2563eb;
}

/* Strong & Em */
.magazine-content strong {
  font-weight: bold;
}

.magazine-content em {
  font-style: italic;
}

.magazine-content s {
  text-decoration: line-through;
}

/* Blockquotes */
.magazine-content blockquote {
  background-color: #f9fafb;
  padding: 1.25rem 1.5rem;
  margin: 1.5em 0;
  color: #4b5563;
  font-style: italic;
  position: relative;
}

.magazine-content blockquote::before {
  content: '"';
  font-size: 3em;
  color: #3b82f6;
  opacity: 0.2;
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  line-height: 1;
  font-family: Georgia, serif;
}

.magazine-content blockquote p {
  margin-bottom: 0.75em;
  position: relative;
  z-index: 1;
}

.magazine-content blockquote p:last-child {
  margin-bottom: 0;
}

.magazine-content blockquote cite {
  display: block;
  margin-top: 0.5em;
  font-size: 0.9em;
  color: #6b7280;
  font-style: normal;
}

.magazine-content blockquote cite::before {
  content: '— ';
}

/* Images */
.magazine-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 1.5em 0;
  display: block;
}

/* Tables */
.magazine-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5em 0;
  overflow-x: auto;
  display: block;
  -webkit-overflow-scrolling: touch;
}

.magazine-content th,
.magazine-content td {
  border: 1px solid #e5e7eb;
  padding: 0.75em;
  text-align: left;
  min-width: 100px;
}

.magazine-content th {
  background-color: #f9fafb;
  font-weight: bold;
}

.magazine-content tbody tr:hover {
  background-color: #f9fafb;
}

/* Remove margin from paragraphs inside table cells */
.magazine-content th p,
.magazine-content td p {
  margin: 0;
}

/* Code */
.magazine-content code {
  background-color: #f3f4f6;
  padding: 0.2em 0.4em;
  border-radius: 3px;
  font-family: monospace;
  font-size: 0.9em;
}

.magazine-content pre {
  background-color: #1f2937;
  color: #f9fafb;
  padding: 1em;
  border-radius: 8px;
  overflow-x: auto;
  margin: 1.5em 0;
}

.magazine-content pre code {
  background-color: transparent;
  padding: 0;
  color: inherit;
}

/* iframe Responsive Wrapper (YouTube etc.) */
.magazine-content iframe {
  max-width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  margin: 1.5em auto;
  display: block;
}

/* For browsers that don't support aspect-ratio */
@supports not (aspect-ratio: 16 / 9) {
  .magazine-content iframe {
    width: 100%;
    height: 0;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    position: relative;
  }
}

/* Custom Blocks (data-type attributes from TipTap) */
.magazine-content [data-type] {
  margin: 1em 0;
}

.magazine-content [data-type='youtube'] {
  margin: 1.5em 0;
}

.magazine-content [data-type='horizontalRule'] {
  border: none;
  border-top: 2px solid #e5e7eb;
  margin: 2em 0;
}

.magazine-content [data-type='codeBlock'] {
  background-color: #1f2937;
  border-radius: 8px;
  padding: 1em;
  overflow-x: auto;
  margin: 1.5em 0;
}

.magazine-content [data-type='codeBlock'] code {
  color: #f9fafb;
  background-color: transparent;
}

/* Table of Contents */
.magazine-content .table-of-contents {
  background-color: #f9fafb;
  border: 1px solid #e5e7eb;
  padding: 1.5rem;
  border-radius: 0.5rem;
  margin: 2rem 0;
}

.magazine-content .toc-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0 0 1rem 0;
  color: #1f2937;
}

.magazine-content .toc-list {
  margin: 0;
  padding-left: 1.5rem;
  list-style-type: disc;
}

.magazine-content .toc-list li {
  margin: 0.5rem 0;
  line-height: 1.5;
}

.magazine-content .toc-list li.ml-4 {
  margin-left: 1rem;
  list-style-type: circle;
}

.magazine-content .toc-list a {
  color: #3b82f6;
  text-decoration: none;
}

.magazine-content .toc-list a:hover {
  text-decoration: underline;
}

/* Responsive */
@media (max-width: 640px) {
  .magazine-content {
    font-size: 15px;
  }

  .magazine-content h1 {
    font-size: 1.75em;
  }

  .magazine-content h2 {
    font-size: 1.5em;
  }

  .magazine-content h3 {
    font-size: 1.25em;
  }

  .magazine-content table {
    font-size: 0.875em;
  }

  .magazine-content th,
  .magazine-content td {
    min-width: 80px;
    padding: 0.5em;
  }
}
