article {
  padding-left: 10rem;
  padding-right: 10rem;
}

article pre,
article code {
  font-family: Menlo, Monaco, "Courier New", monospace;
}

article pre {
  padding: 0.5rem;
  line-height: 1.25;
  overflow-x: scroll;
  background-color: var(--color-article-pre-background);
}

/* Table Styles */
article table {
  border-collapse: collapse;
  margin: 1.3rem 0;
  width: 100%;
  font-size: 0.9rem;
  line-height: 1.4;
}

article table th,
article table td {
  border: 1px solid var(--color-article-border, #ddd);
  padding: 0.75rem;
  text-align: left;
  vertical-align: top;
}

article table th {
  background-color: var(--color-article-th-background, #f8f9fa);
  font-weight: 600;
  color: var(--color-article-th-text, inherit);
}

article table tr:nth-child(even) {
  background-color: var(--color-article-tr-even, #f8f9fa);
}

article table tr:hover {
  background-color: var(--color-article-tr-hover, #f0f0f0);
}

/* Responsive tables */
@media screen and (max-width: 768px) {
  article table {
    font-size: 0.8rem;
  }
  
  article table th,
  article table td {
    padding: 0.5rem;
  }
}

/* Lists */
article ul,
article ol {
  margin: 1.3rem 0;
  padding-left: 2rem;
}

article ul li,
article ol li {
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

article ul {
  list-style-type: disc;
}

article ol {
  list-style-type: decimal;
}

/* Task lists (if using them) */
article ul li input[type="checkbox"] {
  margin-right: 0.5rem;
}

/* Horizontal rules */
article hr {
  border: 0;
  height: 1px;
  background-color: var(--color-article-border, #ddd);
  margin: 2rem 0;
}

/* Inline code */
article code:not(pre code) {
  background-color: var(--color-article-code-background, #f1f3f4);
  padding: 0.2em 0.4em;
  border-radius: 3px;
  font-size: 0.85em;
}

/* Emphasis and strong */
article em {
  font-style: italic;
}

article strong {
  font-weight: 600;
}

/* Definition lists (if using ParsedownExtra features) */
article dl {
  margin: 1.3rem 0;
}

article dt {
  font-weight: 600;
  margin-top: 1rem;
}

article dd {
  margin-left: 2rem;
  margin-bottom: 0.5rem;
}

/* Footnotes (if using ParsedownExtra features) */
article .footnotes {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-article-border, #ddd);
  font-size: 0.9rem;
}

article .footnotes ol {
  padding-left: 1.5rem;
}

@media print {
  article *,
  article *:before,
  article *:after {
    background: transparent !important;
    color: var(--color-article-text-black) !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  article a,
  article a:visited {
    text-decoration: underline;
  }

  article a[href]:after {
    content: " (" attr(href) ")";
  }

  article abbr[title]:after {
    content: " (" attr(title) ")";
  }

  article a[href^="#"]:after,
  article a[href^="javascript:"]:after {
    content: "";
  }

  article pre,
  article blockquote {
    border: 1px solid var(--color-article-border-print);
    page-break-inside: avoid;
  }

  article table {
    border-collapse: collapse;
    page-break-inside: avoid;
  }
  
  article table th,
  article table td {
    border: 1px solid var(--color-article-text-black) !important;
  }

  article thead {
    display: table-header-group;
  }

  article tr,
  article img {
    page-break-inside: avoid;
  }

  article img {
    max-width: 100% !important;
  }

  article p,
  article h2,
  article h3 {
    orphans: 3;
    widows: 3;
  }

  article h2,
  article h3 {
    page-break-after: avoid;
  }
}

article a,
article a:visited {
  color: var(--color-article-link-default);
}

article a:hover,
article a:focus,
article a:active {
  color: var(--color-article-link-hover);
}

article .retro-no-decoration {
  text-decoration: none;
}

article p,
article .retro-p {
  font-size: 1rem;
  margin-bottom: 1.3rem;
}

article h1,
article .retro-h1,
article h2,
article .retro-h2,
article h3,
article .retro-h3,
article h4,
article .retro-h4 {
  margin: 1.414rem 0 0.5rem;
  font-weight: inherit;
  line-height: 1.42;
}

article h1,
article .retro-h1 {
  margin-top: 0;
  font-size: 3.998rem;
}

article h2,
article .retro-h2 {
  font-size: 2.827rem;
}

article h3,
article .retro-h3 {
  font-size: 1.999rem;
}

article h4,
article .retro-h4 {
  font-size: 1.414rem;
}

article h5,
article .retro-h5 {
  font-size: 1.121rem;
}

article h6,
article .retro-h6 {
  font-size: 0.88rem;
}

article small,
article .retro-small {
  font-size: 0.707em;
}

/* https://github.com/mrmrs/fluidity */
article img,
article canvas,
article iframe,
article video,
article svg,
article select,
article textarea {
  max-width: 100%;
}

/* Enhanced media styling for your upcoming media embeds */
article video,
article audio {
  display: block;
  margin: 1.3rem 0;
}

article video {
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

article blockquote {
  border-left: 3px solid var(--color-article-blockquote-border);
  padding-left: 1rem;
}

/* Enhanced media styling for ParsedownMedia extension */

/* Base media element styling */
article video,
article audio {
  display: block;
  margin: 1.3rem auto; /* Center the media */
  max-width: 100%;
  height: auto;
}

/* Constrain video size to prevent overflow */
article video {
  width: auto;
  max-width: min(800px, 100%); /* Never wider than 800px or container */
  max-height: 60vh; /* Never taller than 60% of viewport height */
}

/* Audio doesn't need height constraints but should be reasonable width */
article audio {
  width: 100%;
  max-width: min(600px, 100%); /* Reasonable width for audio controls */
}

/* Video specific styling */
article video {
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  background-color: #000; /* Fallback background while loading */
  transition: box-shadow 0.3s ease, transform 0.2s ease;
}

article video:hover {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
  transform: translateY(-1px);
}

article video:focus {
  outline: 2px solid var(--color-article-link-default, #007acc);
  outline-offset: 2px;
}

/* Audio specific styling */
article audio {
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  background-color: var(--color-article-audio-background, #f8f9fa);
  padding: 0.5rem;
  border: 1px solid var(--color-article-border, #ddd);
  transition: box-shadow 0.3s ease;
}

article audio:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

article audio:focus {
  outline: 2px solid var(--color-article-link-default, #007acc);
  outline-offset: 2px;
}

/* Image sizing to match video constraints */
article img {
  max-width: min(800px, 100%); /* Same constraint as video */
  height: auto;
  display: block;
  margin: 1.3rem auto; /* Center images like videos */
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: box-shadow 0.3s ease, transform 0.2s ease;
}

article img:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  transform: translateY(-1px);
}

/* Media container styling for better spacing */
article p:has(video),
article p:has(audio),
article p:has(img) {
  margin-bottom: 1.5rem;
}

/* Dark mode considerations */
@media (prefers-color-scheme: dark) {
  article video {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  }
  
  article video:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  }
  
  article audio {
    background-color: var(--color-article-audio-background-dark, #2d3748);
    border-color: var(--color-article-border-dark, #4a5568);
  }
}

/* Responsive media queries */
@media screen and (max-width: 768px) {
  article video {
    max-width: 100%;
    max-height: 50vh; /* Shorter on mobile */
    margin: 1rem auto;
    border-radius: 6px;
  }
  
  article audio {
    max-width: 100%;
    margin: 1rem auto;
    border-radius: 6px;
  }
  
  article img {
    max-width: 100%;
    margin: 1rem auto;
  }
  
  article video:hover,
  article audio:hover,
  article img:hover {
    transform: none; /* Disable hover transforms on mobile */
  }
}

@media screen and (max-width: 480px) {
  article video {
    max-height: 40vh; /* Even shorter on small mobile */
    margin: 0.8rem auto;
    border-radius: 4px;
  }
  
  article audio {
    margin: 0.8rem auto;
    border-radius: 4px;
    padding: 0.3rem;
  }
  
  article img {
    margin: 0.8rem auto;
  }
}

/* High-DPI display optimizations */
@media screen and (min-resolution: 2dppx) {
  article video {
    border-radius: 8px;
  }
  
  article audio {
    border-radius: 6px;
  }
}

/* Print styles for media */
@media print {
  article video,
  article audio {
    border: 2px solid var(--color-article-text-black, #000) !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: white !important;
    page-break-inside: avoid;
  }
  
  article video::after {
    content: " [Video: " attr(src) "]";
    font-size: 0.8em;
    color: var(--color-article-text-black, #000) !important;
    display: block;
    margin-top: 0.5rem;
  }
  
  article audio::after {
    content: " [Audio: " attr(src) "]";
    font-size: 0.8em;
    color: var(--color-article-text-black, #000) !important;
    display: block;
    margin-top: 0.5rem;
  }
}

/* Accessibility enhancements */
@media (prefers-reduced-motion: reduce) {
  article video,
  article audio,
  article img {
    transition: none;
    transform: none;
  }
  
  article video:hover,
  article audio:hover,
  article img:hover {
    transform: none;
  }
}

/* Focus management for keyboard navigation */
article video[controls]:focus,
article audio[controls]:focus {
  outline: 3px solid var(--color-article-link-default, #007acc);
  outline-offset: 3px;
}

/* Loading state styling */
article video:not([src]),
article audio:not([src]) {
  background-color: var(--color-article-loading-background, #f0f0f0);
  position: relative;
}

article video:not([src])::before,
article audio:not([src])::before {
  content: "Loading...";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--color-article-text-muted, #666);
  font-size: 0.9em;
}

/* Responsive embed containers for YouTube, Vimeo, etc. */
article .embed-container {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
  height: 0;
  overflow: hidden;
  max-width: min(800px, 100%); /* Match your video constraints */
  margin: 1.3rem auto; /* Center and space like other media */
  border-radius: 8px; /* Match video styling */
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); /* Match video styling */
  background-color: #000; /* Fallback while loading */
  transition: box-shadow 0.3s ease, transform 0.2s ease;
}

article .embed-container:hover {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
  transform: translateY(-1px);
}

article .embed-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 8px; /* Match container */
}

/* Special handling for audio embeds (SoundCloud) */
article .embed-container[data-service="soundcloud"] {
  padding-bottom: 166px; /* Fixed height for audio */
  height: auto;
}

/* 4:3 aspect ratio for some older content */
article .embed-container.aspect-4-3 {
  padding-bottom: 75%; /* 4:3 aspect ratio */
}

/* Square aspect ratio for special content */
article .embed-container.aspect-square {
  padding-bottom: 100%; /* 1:1 aspect ratio */
}

/* Responsive behavior */
@media screen and (max-width: 768px) {
  article .embed-container {
    max-width: 100%;
    margin: 1rem auto;
    border-radius: 6px;
    padding-bottom: 50vh; /* Limit height on mobile */
    max-height: 50vh;
  }
  
  article .embed-container iframe {
    border-radius: 6px;
  }
  
  article .embed-container:hover {
    transform: none; /* Disable hover transforms on mobile */
  }
}

@media screen and (max-width: 480px) {
  article .embed-container {
    margin: 0.8rem auto;
    border-radius: 4px;
    padding-bottom: 40vh; /* Even shorter on small screens */
    max-height: 40vh;
  }
  
  article .embed-container iframe {
    border-radius: 4px;
  }
}

/* Dark mode adjustments */
@media (prefers-color-scheme: dark) {
  article .embed-container {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  }
  
  article .embed-container:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  }
}

/* Accessibility - respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  article .embed-container {
    transition: none;
    transform: none;
  }
  
  article .embed-container:hover {
    transform: none;
  }
}

/* Focus states for accessibility */
article .embed-container:focus-within {
  outline: 3px solid var(--color-article-link-default, #007acc);
  outline-offset: 3px;
}

/* Print styles for embeds */
@media print {
  article .embed-container {
    border: 2px solid var(--color-article-text-black, #000) !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: white !important;
    page-break-inside: avoid;
    position: static !important;
    padding-bottom: 0 !important;
    height: auto !important;
  }
  
  article .embed-container::before {
    content: "[Embedded Video: " attr(data-original-url) "]";
    font-size: 0.8em;
    color: var(--color-article-text-black, #000) !important;
    display: block;
    padding: 1rem;
    background: #f8f9fa !important;
  }
  
  article .embed-container iframe {
    display: none !important;
  }
}


