/* HeroUI-style article styles */
@layer components {
  /* Use variables defined in global.css, no need to redefine */

  /* Article container base styles */
  .article-wrapper {
    max-width: 90ch;
    margin: 0 auto;
  }

  /* Article content area */
  .article-content {
    font-size: 1rem;
    line-height: 1.8;
    color: var(--color-text-secondary);
  }

  html.dark .article-content {
    color: var(--color-text-secondary-dark);
  }

  /* Heading styles - HeroUI style */
  .article-content h1,
  .article-content h2,
  .article-content h3,
  .article-content h4,
  .article-content h5,
  .article-content h6 {
    font-weight: 700;
    line-height: 1.3;
    margin-top: 1.8em;
    margin-bottom: 1em;
    scroll-margin-top: 6rem;
    position: relative;
  }

  .article-content h1 {
    font-size: 2.5rem;
    letter-spacing: -0.025em;
    color: var(--color-text-primary);
    margin-top: 0;
  }

  html.dark .article-content h1 {
    color: var(--color-text-primary-dark);
  }

  .article-content h2 {
    font-size: 2rem;
    letter-spacing: -0.025em;
    color: var(--color-text-primary);
    padding-bottom: 0.75rem;
    border-bottom: 1px dashed rgba(var(--color-primary-rgb), 0.2);
    margin-top: 2em;
  }

  html.dark .article-content h2 {
    color: var(--color-text-primary-dark);
    border-bottom-color: rgba(var(--color-primary-rgb), 0.3);
  }

  .article-content h3 {
    font-size: 1.625rem;
    color: var(--color-text-primary);
    margin-top: 2.5em;
  }

  html.dark .article-content h3 {
    color: var(--color-text-secondary-dark);
  }

  .article-content h4 {
    font-size: 1.375rem;
    color: var(--color-text-secondary);
    margin-top: 2em;
  }

  html.dark .article-content h4 {
    color: var(--color-text-secondary-dark);
  }

  .article-content h5 {
    font-size: 1.125rem;
    color: var(--color-neutral-500);
    margin-top: 1.75em;
  }

  html.dark .article-content h5 {
    color: var(--color-text-tertiary-dark);
  }

  /* Paragraph styles */
  .article-content p {
    font-size: 1rem;
    margin: 1.75em 0;
    line-height: 1.8;
    /* Prevent long words or links from overflowing */
    overflow-wrap: break-word;
    word-wrap: break-word;
  }

  .article-content > p:first-of-type {
    font-size: 1rem;
    color: var(--color-text-secondary);
    margin-top: 0;
  }

  html.dark .article-content > p:first-of-type {
    color: var(--color-text-secondary-dark);
  }

  /* Link styles - HeroUI style */
  .article-content a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 600;
    border-bottom: 1px dashed var(--color-primary-lighter);
    padding-bottom: 1px;
    transition: all 0.2s ease;
    /* Auto-wrap long links */
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
  }

  .article-content a:hover {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
    background-color: var(--color-primary-bg-light);
  }

  html.dark .article-content a {
    color: var(--color-primary-light-dark);
    border-bottom-color: var(--color-primary-lighter);
  }

  html.dark .article-content a:hover {
    color: var(--color-primary-light-dark);
    border-bottom-color: var(--color-primary);
    background-color: var(--color-primary-bg);
  }

  /* List styles */
  .article-content ul,
  .article-content ol {
    margin: 2em 0;
    padding-left: 2em;
  }

  .article-content li {
    margin: 0.75em 0;
    line-height: 1.75;
    padding-left: 0.5em;
  }

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

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

  .article-content li::marker {
    color: var(--color-primary);
    font-weight: 600;
  }

  html.dark .article-content li::marker {
    color: var(--color-primary);
  }

  .article-content ul ul,
  .article-content ol ol,
  .article-content ul ol,
  .article-content ol ul {
    margin: 0.75em 0;
  }

  /* Blockquote styles - HeroUI card style */
  .article-content blockquote {
    margin: 2.5em 0;
    padding: 1.75rem 1.5rem;
    background: var(--color-primary-bg-light);
    border-left: 5px solid var(--color-primary);
    border-radius: 0.75rem;
    font-style: italic;
    color: var(--color-neutral-600);
    box-shadow: 0 1px 3px 0 rgba(var(--color-primary-rgb), 0.06);
  }

  html.dark .article-content blockquote {
    background: var(--color-primary-bg);
    border-left-color: var(--color-primary);
    color: var(--color-text-tertiary-dark);
    box-shadow: 0 1px 3px 0 rgba(var(--color-primary-rgb), 0.25);
  }

  .article-content blockquote p {
    margin: 0.75em 0;
  }

  .article-content blockquote p:first-child {
    margin-top: 0;
    font-size: 1rem;
  }

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

  /* Code block styles - HeroUI style */
  .article-content :not(pre) > code {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Consolas', 'Courier New', monospace;
    font-size: 0.9em;
    padding: 0.25em 0.5em;
    background: var(--color-primary-bg-light);
    border: 1px solid var(--color-primary-lighter);
    border-radius: 0.375rem;
    color: var(--color-primary);
    font-weight: 600;
  }

  html.dark .article-content :not(pre) > code {
    background: var(--color-primary-bg);
    border-color: rgba(var(--color-primary-rgb), 0.3);
    color: var(--color-primary-light-dark);
  }

  .article-content pre {
    margin: 2.5em 0;
    padding: 1.75rem;
    background: var(--color-bg-primary-dark);
    border-radius: 0.75rem;
    overflow-x: auto;
    box-shadow: 0 4px 6px -1px rgba(var(--color-primary-rgb), 0.06), 0 2px 4px -2px rgba(var(--color-primary-rgb), 0.06);
    border: 1px solid var(--color-neutral-700);
  }

  html.dark .article-content pre {
    background: var(--color-bg-primary-dark);
    border-color: var(--color-neutral-700);
  }

  .article-content pre code {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    color: var(--color-text-secondary-dark) !important;
    font-size: 0.9375rem;
    line-height: 1.7;
    font-weight: 400;
  }

  /* Image styles - HeroUI card style */
  .article-content img {
    max-width: 100%;
    height: auto;
    margin: 2.5em auto;
    display: block;
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px -1px rgba(var(--color-primary-rgb), 0.06), 0 2px 4px -2px rgba(var(--color-primary-rgb), 0.06);
    border: 1px solid var(--color-neutral-200);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
  }

  html.dark .article-content img {
    border-color: var(--color-neutral-700);
    box-shadow: 0 4px 6px -1px rgba(var(--color-primary-rgb), 0.25), 0 2px 4px -2px rgba(var(--color-primary-rgb), 0.18);
  }

  .article-content img:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(var(--color-primary-rgb), 0.06), 0 4px 6px -4px rgba(var(--color-primary-rgb), 0.06);
  }

  /* Table styles - HeroUI style */
  .article-content table {
    width: 100%;
    margin: 2.5em 0;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: 0 1px 3px 0 rgba(var(--color-primary-rgb), 0.06);
    border: 1px solid var(--color-neutral-200);
  }

  html.dark .article-content table {
    border-color: var(--color-neutral-700);
    box-shadow: 0 1px 3px 0 rgba(var(--color-primary-rgb), 0.25);
  }

  .article-content thead {
    background: var(--color-neutral-100);
  }

  html.dark .article-content thead {
    background: var(--color-bg-secondary-dark);
  }

  .article-content th {
    padding: 1rem 1.25rem;
    text-align: left;
    font-weight: 700;
    font-size: 0.875rem;
    color: var(--color-neutral-700);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--color-neutral-200);
  }

  html.dark .article-content th {
    color: var(--color-text-secondary-dark);
    border-bottom-color: var(--color-neutral-700);
  }

  .article-content td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--color-neutral-200);
  }

  html.dark .article-content td {
    border-bottom-color: var(--color-neutral-700);
  }

  .article-content tr:last-child td {
    border-bottom: none;
  }

  .article-content tbody tr {
    transition: background-color 0.2s ease;
  }

  .article-content tbody tr:hover {
    background: var(--color-neutral-100);
  }

  html.dark .article-content tbody tr:hover {
    background: var(--color-bg-secondary-dark);
  }

  /* Separator styles */
  .article-content hr {
    margin: 3.5em 0;
    border: none;
    height: 2px;
    background: linear-gradient(to right, transparent, var(--color-neutral-200), transparent);
  }

  html.dark .article-content hr {
    background: linear-gradient(to right, transparent, var(--color-neutral-700), transparent);
  }

  /* Emphasis styles */
  .article-content strong {
    font-weight: 700;
    color: var(--color-text-primary);
  }

  html.dark .article-content strong {
    color: var(--color-text-primary-dark);
  }

  .article-content em {
    font-style: italic;
    color: var(--color-text-secondary);
  }

  html.dark .article-content em {
    color: var(--color-text-secondary-dark);
  }

  /* Strikethrough */
  .article-content del {
    text-decoration: line-through;
    opacity: 0.7;
  }

  /* Mark/highlight styles */
  .article-content mark {
    background: rgb(254,249,195);
    color: rgb(113,63,18);
    padding: 0.2em 0.4em;
    border-radius: 0.25rem;
  }

  html.dark .article-content mark {
    background: rgb(113,63,18);
    color: rgb(254,249,195);
  }

  /* Article header styles */
  .article-header {
    text-align: center;
    margin-bottom: 4rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px dashed rgba(var(--color-primary-rgb), 0.15);
  }

  html.dark .article-header {
    border-bottom-color: rgba(var(--color-primary-rgb), 0.25);
  }

  .article-title {
    font-size: 2.5rem;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.025em;
    margin: 2rem 0 2rem;
    color: var(--color-text-primary);
  }

  html.dark .article-title {
    color: var(--color-text-primary-dark);
  }

  @media (min-width: 768px) {
    .article-title {
      font-size: 2.75rem;
    }
  }

  /* Tag styles */
  .article-tags {
    display: flex;
    gap: 0.625rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
  }

  .article-tag {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 1rem;
    font-size: 0.875rem;
    font-weight: 400;
    letter-spacing: .5px;
    color: var(--color-primary-lighter);
    background: var(--color-primary-bg);
    border: 1px solid rgba(var(--color-primary-rgb), .2);
    border-radius: 9999px;
    transition: all 0.2s ease;
  }

  html.dark .article-tag {
    color: var(--color-primary-light-dark);
    background: var(--color-primary-bg);
    border-color: rgba(var(--color-primary-rgb), .35);
  }

  .article-tag:hover {
    background: var(--color-primary-bg-light);
    border-color: var(--color-primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(var(--color-primary-rgb), 0.2);
  }

  html.dark .article-tag:hover {
    background: rgba(var(--color-primary-rgb), 0.25);
    box-shadow: 0 2px 4px rgba(var(--color-primary-rgb), 0.3);
  }

  /* Article metadata */
  .article-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--color-neutral-500);
    margin-top: 1.5rem;
  }


  .article-meta-divider {
    width: 4px;
    height: 4px;
    background: var(--color-neutral-300);
    border-radius: 9999px;
  }

  html.dark .article-meta-divider {
    background: var(--color-neutral-600);
  }

  /* Responsive optimization */
  @media (max-width: 768px) {
    .article-content {
      font-size: 1rem;
    }

    .article-title {
      font-size: 2rem;
    }

    .article-content h2 {
      font-size: 1.625rem;
    }

    .article-content h3 {
      font-size: 1.375rem;
    }

    .article-content pre {
      padding: 1.25rem;
      margin: 2em -1rem;
      border-radius: 0;
    }

    /* Force link wrapping on mobile */
    .article-content a {
      word-break: break-all;
      display: inline-block;
      max-width: 100%;
    }

    /* Long word wrapping on mobile */
    .article-content p,
    .article-content li,
    .article-content td {
      word-break: break-word;
      overflow-wrap: break-word;
    }
  }
}

