/* ==========================================================================
   Theme News - iframe Embed Theme for Halo 2.x
   ========================================================================== */

/* Variables
   ========================================================================== */
:root {
  --primary-color: #1a5cff;
  --primary-hover: #0047e0;
  --primary-light: #e8f0ff;
  --text-color: #333333;
  --text-secondary: #666666;
  --text-muted: #999999;
  --border-color: #e5e7eb;
  --border-light: #f3f4f6;
  --bg-color: #ffffff;
  --bg-secondary: #f9fafb;
  --bg-tertiary: #f3f4f6;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --radius-sm: 0.25rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-full: 9999px;
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html.iframe-auto-height {
  overflow: hidden;
}

body {
  font-family: 'Inter', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-color);
  background-color: var(--bg-color);
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

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

a {
  color: var(--primary-color);
  text-decoration: none;
  transition: color var(--transition-fast);
}

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

/* Typography
   ========================================================================== */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-color);
  margin-top: 1.5em;
  margin-bottom: 0.5em;
}

h1 {
  font-size: 2rem;
}

h2 {
  font-size: 1.5rem;
}

h3 {
  font-size: 1.25rem;
}

h4 {
  font-size: 1.125rem;
}

p {
  margin-bottom: 1em;
}

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

li {
  margin-bottom: 0.25em;
}

blockquote {
  margin: 1.5em 0;
  padding: 1em 1.5em;
  border-left: 4px solid var(--primary-color);
  background-color: var(--bg-secondary);
  color: var(--text-secondary);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

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

code {
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 0.875em;
  background-color: var(--bg-tertiary);
  padding: 0.2em 0.4em;
  border-radius: var(--radius-sm);
}

pre {
  margin: 1.5em 0;
  padding: 1em 1.5em;
  background-color: var(--bg-tertiary);
  border-radius: var(--radius-md);
  overflow-x: auto;
  font-size: 0.875rem;
  line-height: 1.6;
}

pre code {
  background-color: transparent;
  padding: 0;
}

table {
  width: 100%;
  margin: 1.5em 0;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

th, td {
  padding: 0.75em 1em;
  border: 1px solid var(--border-color);
  text-align: left;
}

th {
  background-color: var(--bg-secondary);
  font-weight: 600;
}

tr:nth-child(even) {
  background-color: var(--bg-secondary);
}

hr {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 2em 0;
}

/* Page Title
   ========================================================================== */
.page-title {
  font-size: 2rem;
  font-weight: 700;
  text-align: center;
  margin: 0 0 2rem 0;
  color: var(--text-color);
  position: relative;
  padding-bottom: 1rem;
}

.page-title::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 3px;
  background-color: var(--primary-color);
  border-radius: var(--radius-full);
}

/* Category Description
   ========================================================================== */
.category-description {
  text-align: center;
  color: var(--text-secondary);
  margin: -1rem 0 2rem 0;
  font-size: 1.0625rem;
}

/* Post Detail
   ========================================================================== */
.post-detail {
  max-width: 100%;
}

.post-header {
  margin-bottom: 2rem;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.post-meta time {
  color: var(--text-muted);
}

.meta-category {
  display: inline-block;
  padding: 0.2em 0.75em;
  background-color: var(--primary-light);
  color: var(--primary-color);
  border-radius: var(--radius-full);
  font-size: 0.8125rem;
  font-weight: 500;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.meta-category:hover {
  background-color: var(--primary-color);
  color: white;
  text-decoration: none;
}

.post-title {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.3;
  margin: 0 0 1rem 0;
  color: var(--text-color);
}

.post-author {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1rem;
}

.author-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-light);
}

.author-name {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.post-cover {
  margin: 1.5rem 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.post-cover img {
  width: 100%;
  aspect-ratio: 21 / 9;
  object-fit: cover;
}

/* Prose (Article Content)
   ========================================================================== */
.prose {
  font-size: 1.0625rem;
  line-height: 1.8;
  color: var(--text-color);
}

.prose h1 {
  font-size: 1.75rem;
  margin-top: 2em;
}

.prose h2 {
  font-size: 1.5rem;
  margin-top: 1.75em;
}

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

.prose h4 {
  font-size: 1.125rem;
  margin-top: 1.25em;
}

.prose p {
  margin-bottom: 1.25em;
}

.prose img {
  margin: 1.5em 0;
  border-radius: var(--radius-md);
}

.prose a {
  color: var(--primary-color);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.prose a:hover {
  color: var(--primary-hover);
}

.prose ul, .prose ol {
  margin-bottom: 1.25em;
}

.prose li {
  margin-bottom: 0.375em;
}

.prose blockquote {
  margin: 1.75em 0;
  font-style: italic;
}

.prose pre {
  margin: 1.75em 0;
}

.prose table {
  margin: 1.75em 0;
}

.prose video {
  width: 100%;
  margin: 1.5em 0;
  border-radius: var(--radius-md);
}

.prose iframe {
  width: 100%;
  margin: 1.5em 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

/* Post Tags
   ========================================================================== */
.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.4em 1em;
  background-color: var(--bg-tertiary);
  color: var(--text-secondary);
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.tag-chip:hover {
  background-color: var(--primary-color);
  color: white;
  text-decoration: none;
}

/* Comment Section
   ========================================================================== */
halo\:comment {
  display: block;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
}

/* Archives List
   ========================================================================== */
.news-archive {
  max-width: 100%;
}

.archives-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.archive-item {
  display: flex;
  gap: 1.5rem;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border-color);
}

.archive-item:first-child {
  padding-top: 0;
}

.archive-item:last-child {
  border-bottom: none;
}

.archive-item time {
  flex-shrink: 0;
  width: 100px;
  font-size: 0.875rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  padding-top: 0.25rem;
}

.archive-info {
  flex: 1;
  min-width: 0;
}

.archive-info h2 {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0 0 0.5rem 0;
  line-height: 1.4;
}

.archive-info h2 a {
  color: var(--text-color);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.archive-info h2 a:hover {
  color: var(--primary-color);
}

.archive-excerpt {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 0.75rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.archive-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.archive-meta .meta-category {
  font-size: 0.75rem;
  padding: 0.15em 0.6em;
}

.view-count {
  color: var(--text-muted);
}

/* Pagination
   ========================================================================== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
}

.pagination-link {
  display: inline-flex;
  align-items: center;
  padding: 0.6em 1.25em;
  background-color: var(--bg-secondary);
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  font-weight: 500;
  transition: all var(--transition-fast);
  text-decoration: none;
  border: 1px solid var(--border-color);
}

.pagination-link:hover {
  background-color: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
  text-decoration: none;
}

.pagination-link.prev::before {
  content: '← ';
}

.pagination-link.next::after {
  content: ' →';
}

.pagination-info {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* Categories Grid
   ========================================================================== */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.category-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  background-color: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  text-align: center;
  transition: all var(--transition-normal);
  text-decoration: none;
  color: var(--text-color);
}

.category-card:hover {
  background-color: var(--primary-light);
  border-color: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  text-decoration: none;
  color: var(--text-color);
}

.category-card h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0 0 0.5rem 0;
  color: var(--text-color);
}

.category-card .count {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 500;
}

.category-card:hover h3 {
  color: var(--primary-color);
}

.category-card:hover .count {
  color: var(--primary-color);
}

/* Tags Cloud
   ========================================================================== */
.tags-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}

.tag-cloud-item {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5em 1.125em;
  background-color: var(--bg-secondary);
  color: var(--text-secondary);
  border-radius: var(--radius-full);
  font-size: 0.9375rem;
  font-weight: 500;
  border: 1px solid var(--border-color);
  transition: all var(--transition-fast);
  text-decoration: none;
}

.tag-cloud-item:hover {
  background-color: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
  text-decoration: none;
}

.tag-cloud-item .tag-name {
  color: inherit;
}

.tag-cloud-item .tag-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5em;
  height: 1.5em;
  padding: 0 0.4em;
  background-color: var(--bg-tertiary);
  color: var(--text-muted);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
}

.tag-cloud-item:hover .tag-count {
  background-color: rgba(255, 255, 255, 0.25);
  color: white;
}

/* Page Detail
   ========================================================================== */
.page-detail {
  max-width: 100%;
}

.page-detail .page-title {
  text-align: center;
  margin-bottom: 2rem;
}

.page-content {
  margin-top: 2rem;
}

/* Responsive
   ========================================================================== */
@media (max-width: 768px) {
  body {
    padding: 1.5rem 1rem;
    font-size: 0.9375rem;
  }

  .page-title {
    font-size: 1.5rem;
  }

  .post-title {
    font-size: 1.5rem;
  }

  .post-meta {
    font-size: 0.8125rem;
  }

  .prose {
    font-size: 1rem;
  }

  .archive-item {
    flex-direction: column;
    gap: 0.5rem;
  }

  .archive-item time {
    width: auto;
    font-size: 0.8125rem;
  }

  .archive-info h2 {
    font-size: 1rem;
  }

  .archive-excerpt {
    font-size: 0.875rem;
  }

  .pagination {
    flex-wrap: wrap;
    gap: 1rem;
  }

  .pagination-link {
    font-size: 0.875rem;
    padding: 0.5em 1em;
  }

  .categories-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.75rem;
  }

  .category-card {
    padding: 1.5rem 1rem;
  }

  .category-card h3 {
    font-size: 1rem;
  }

  .tags-cloud {
    gap: 0.5rem;
  }

  .tag-cloud-item {
    font-size: 0.875rem;
    padding: 0.4em 0.875em;
  }

  .post-author {
    gap: 0.5rem;
  }

  .author-avatar {
    width: 32px;
    height: 32px;
  }

  .author-name {
    font-size: 0.875rem;
  }
}

@media (max-width: 480px) {
  body {
    padding: 1rem 0.75rem;
  }

  .page-title {
    font-size: 1.375rem;
  }

  .post-title {
    font-size: 1.375rem;
  }

  .categories-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* Print Styles
   ========================================================================== */
@media print {
  body {
    max-width: none;
    padding: 0;
    font-size: 11pt;
    color: black;
    background: white;
  }

  a {
    color: black;
    text-decoration: underline;
  }

  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #666;
  }

  .post-cover img,
  .prose img {
    max-width: 100%;
    page-break-inside: avoid;
  }

  .pagination,
  .post-tags,
  halo\:comment {
    display: none;
  }

  h1, h2, h3, h4, h5, h6 {
    page-break-after: avoid;
  }

  pre, blockquote, table {
    page-break-inside: avoid;
  }
}

/* Utility Classes
   ========================================================================== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.text-center {
  text-align: center;
}

.text-left {
  text-align: left;
}

.text-right {
  text-align: right;
}

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
