@tailwind base;
@tailwind components;
@tailwind utilities;

/* 全局样式 */
:root {
  --border-radius: 12px;
  --color-text: #333;
  --color-primary: #275c92;
  --color-code-bg: #fff4db;
  --color-code: #8a6534;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial,
    sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --font-mono: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;
  --font-lg: 20px;
  --font-md: 18px;
  --font-sm: 14px;
  --font-sx: 12px;
  --line-height-loose: 1.75;
  --line-height-normal: 1.5;
  --line-height-dense: 1.1;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 10px;
  --space-4: 10px;
  --space-5: 10px;
  --bg-color: #EDEDED;
}

body {
  -moz-osx-font-smoothing: grayscale;
  -webkit-font-smoothing: antialiased;
  color: var(--color-text);
  font-family: var(--font-sans);
  font-weight: normal;
  margin: 0;
  word-wrap: break-word;
  background-color: var(--bg-color);
  font-size: var(--font-sm);
  line-height: var(--line-height-normal);
}

h1 {
  letter-spacing: -.01em;
  line-height: var(--line-height-dense);
  margin: 0 0 3rem;
  padding: 0;  
  display: block;
  font-size: 2em;
  margin-block-start: 0.67em;
  margin-block-end: 0.67em;
  margin-inline-start: 0px;
  margin-inline-end: 0px;
  font-weight: bold;
  unicode-bidi: isolate;
}

a {
  background-color: transparent;
  color: var(--color-primary);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 2px;
}

li {
  display: list-item;
  text-align: -webkit-match-parent;
  unicode-bidi: isolate;
  margin-bottom: calc(var(--space-4) / 2);
}

header h1 {
  color: #089c64;
}

header a {
  color: #089c64;
}

.container {
  max-width: 740px;
  margin: 0 auto;
}


/* Post Feed Container */
.post-feed {
  max-width: 740px;
  margin: var(--space-4) auto;
}

/* Site Main */
.site-main {
  padding: var(--space-4) 0;
}

/* Site Wrapper */
.site-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Make main content area flexible */
.site-main {
  flex: 1;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .container {
    padding: 0 var(--space-3);
  }
}

/* Post Card Styles */
.post-card {
  background: white;
  border-radius: var(--border-radius);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.post-card-header {
  margin-bottom: var(--space-3);
}

.post-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-2);
  font-size: var(--font-sx);
  color: var(--color-text);
}

.post-card-meta a {
  color: #089c64;
  text-decoration: none;
  margin-top: 7px;
}

.post-card-meta a:hover {
  text-decoration: underline;
}

.post-card-content{
  margin: var(--space-2);
}

.author-info {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.author-logo {
  width: 16px;
  height: 16px;
  border-radius: var(--border-radius);
}

.date-info {
  color: var(--color-text);
  margin-right: var(--space-2);
}

/* News Title Styles */
.news-title-cn {
  font-size: var(--font-md);
  margin-bottom: var(--space-2);
  color: var(--color-text);
}

.news-title-en {
  font-size: var(--font-sm);
  margin-bottom: var(--space-3);
  color: var(--color-text);
}

.news-title-en a {
  color: inherit;
  text-decoration: none;
}

.news-title-en a:hover {
  color: var(--color-primary);
}

/* Post Content */
.post-card-excerpt {
  font-size: var(--font-sm);
  line-height: var(--line-height-normal);
  color: var(--color-text);
  margin-bottom: var(--space-3);
}

/* Tags */
.post-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.post-card-tag {
  font-size: var(--font-sx);
  padding: 2px 10px;
  border-radius: 3px;
  text-decoration: none;
  color: var(--color-text);
}

/* Tag Colors */
.post-card-tag.bg1 { background-color: #fc7779; }
.post-card-tag.bg2 { background-color: #f58e56; }
.post-card-tag.bg3 { background-color: #f8961e; }
.post-card-tag.bg4 { background-color: #f9c74f; }
.post-card-tag.bg5 { background-color: #90be6d; }
.post-card-tag.bg6 { background-color: #87e3c7; }
.post-card-tag.bg7 { background-color: #7f98d8; }

/* Language Switch */
.language-switch {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 1000;
  display: flex;
  gap: var(--space-2);
  background: white;
  padding: 4px;
  border-radius: 12px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.language-button {
  padding: 4px 8px;
  border: none;
  border-radius: 12px;
  color: white;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  min-width: 32px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.language-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.language-button:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.language-button.zh {
  background-color: #007bff;
}

.language-button.en {
  background-color: #28a745;
}

/* Visibility */
.visible {
  display: block;
}

.hidden {
  display: none;
}

.news-titles a {
  text-decoration: none; /* Remove default styles */
}

.news-titles h2 {
  font-weight: 700;
  margin-block-start: .2em;
  margin-inline-end: 0;
  margin-inline-start: 0;
  unicode-bidi: isolate;
  margin-block-end: .1em;
  font-size: 1em;
}

/* 布局容器 */
.layout-container {
  margin: 0 auto;
  max-width: var(--size-content);
  padding: 0 var(--size-gutter);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
  padding: 1rem 0;
}

/* 文章容器样式 */
.posts_topContainer {
  width: 100%;
}

@media (min-width: 768px) {
  .posts_topContainer {
    width: 70%;
  }
}

.tagContainer {
  width: 100%;
  margin-top: 2rem;
  text-align: center;
}

.tagContainer .tag-title {
  text-align: center;
  margin-bottom: 1rem;
}

.tagContainer .post-card-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 0 auto;
  max-width: 800px;
}

/* Card specific tag styles */
.card .post-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-start;
}

.card p{
  margin: 0;
}

/* Tag styles */
.tag {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 16px;
  font-size: 0.9em;
  text-decoration: none;
  transition: all 0.2s ease;
}

.tag:hover {
  transform: translateY(-2px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.toppostContainer {
  list-style-type: none;
  border: 1px solid #fff;
  line-height: 1.3;
  padding: 10px;
  margin: 10px 0;
  background-color: white;
  border-radius: 10px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.postContainer {
  width: 100%;
}

@media (min-width: 768px) {
  .postContainer {
    width: calc(33.333% - 1rem);
  }
}

/* 文章内容样式 */
.newsTitle {
  margin-block-start: 0.2em;
  margin-block-end: 0.1em;
  font-size: 1em;
  font-weight: normal;
}

.newsTitle a {
  color: #007acc;
  text-decoration: none;
}

.newsTitle a:hover {
  text-decoration: underline;
}

.moreinfo {
  margin: 0;
  color: #666;
  font-size: 0.9em;
}

.dateinfo {
  color: #d0d0d0;
  font-size: 0.875rem;
  margin-right: 10px;
}

/* 网站图标样式 */
.icon-container {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  margin-right: 5px;
}

[class^="top_"] {
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border-radius: 4px;
}

.top_default {
  background-color: #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #9ca3af;
  border-radius: 20%;
}

.top_tomshardware { background-image: url(/favicon_tomshardware.png); }
.top_thelec { background-image: url(/favicon_thelec.png); }
.top_digitimes { background-image: url(/favicon_digitimes.png); }
.top_theregister { background-image: url(/favicon_theregister.png); }
.top_anandtech { 
  background-image: url(/favicon_anandtech.png);
  border-radius: 20%;
}
.top_anysilicon { background-image: url(/favicon_anysilicon.png); }
.top_semiwiki { 
  background-image: url(/favicon_semiwiki.png);
  border-radius: 20%;
}
.top_electronicdesign { background-image: url(/favicon_electronicdesign.png); }
.top_youtube { background-image: url(/favicon_youtube.png); }
.top_fierceelectronics { background-image: url(/favicon_fierceelectronics.png); }
.top_electronicsweekly { background-image: url(/favicon_electronicsweekly.png); }
.top_tweaktown { background-image: url(/favicon_tweaktown.png); }
.top_weixin { background-image: url(/favicon_weixin.png); }

/* 标签样式 */
.tag {
  display: inline-block;
  padding: 2px 8px;
  margin: 2px;
  background-color: #f3f4f6;
  color: #666;
  border-radius: 12px;
  font-size: 0.875rem;
  text-decoration: none;
}

.tag:hover {
  background-color: #e5e7eb;
}

/* 响应式调整 */
@media (max-width: 640px) {
  .layout-container {
    padding: 0 0.5rem;
  }
  
  .toppostContainer {
    padding: 8px;
  }
  
  .newsTitle {
    font-size: 0.95em;
  }
}

.load-more-button {
  display: block;
  margin: 2rem auto;
  padding: 0.75rem 2rem;
  background-color: #f3f4f6;
  color: #374151;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
}

.load-more-button:hover {
  background-color: #e5e7eb;
  border-color: #9ca3af;
}

.load-more-button:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.5);
}

/* Post Detail Page Styles */
.post-full {
  max-width: 740px;
  margin: 0 auto;
  padding: 2rem 0;
  background-color: white;
  border-radius: var(--border-radius);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.post-full-header {
  margin-bottom: 2rem;
  text-align: center;
  padding: 0 2rem;
}

.post-full-meta {
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--color-text-light);
  font-size: 0.9rem;
  gap: 1rem;
}

.post-full-meta-date {
  margin-right: 1rem;
  color: #666;
}

.post-full-meta-author {
  color: #666;
}

.post-full-content {
  font-size: 1.1rem;
  line-height: 1.8;
  padding: 0 2rem;
}

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

.post-content p {
  margin-bottom: 1.5rem;
  color: #333;
}

.post-full-footer {
  padding: 1rem;
  border-top: 1px solid #e5e7eb;
}

.post-full-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.post-full-tag {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background-color: #f3f4f6;
  color: #666;
  border-radius: 12px;
  font-size: 0.875rem;
  text-decoration: none;
  transition: all 0.2s ease;
}

.post-full-tag:hover {
  background-color: #e5e7eb;
  transform: translateY(-2px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Related Articles (话题追踪) */
.related-link {
  color: var(--color-primary);
  text-decoration: none;
}

.related-link:hover {
  text-decoration: underline;
}

.related-date {
  margin-left: var(--space-2);
  color: #666;
  font-size: 0.9rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .post-full {
    padding: 1rem;
  }
  
  .post-full-header,
  .post-full-content {
    padding: 0 1rem;
  }
  
  .post-full-title {
    font-size: 2rem;
  }
  
  .related-articles {
    width: 90%;
    padding: 1rem;
  }
}

/* Tag Page Styles */
.tag-page {
  max-width: 740px;
  margin: 0 auto;
  padding: 2rem 0;
}

.tag-title {
  margin: 0 0 2rem;
  font-size: 2.5rem;
  line-height: 1.2;
  text-align: center;
}

.tag-description {
  margin-bottom: 2rem;
  padding: 1rem;
  background-color: var(--color-bg-light);
  border-radius: 4px;
  font-size: 1.1rem;
  line-height: 1.6;
}

.tag-description p {
  margin: 0;
}

.more-info {
  margin-top: 1rem;
  text-align: center;
}

.more-info a {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 500;
}

.more-info a:hover {
  text-decoration: underline;
}

/* author */

.group {
  display: block;
  border-radius: 10px;
  border: 1px solid white;
  margin: 5px 0;
  padding: 10px;
  background-color: white;
  list-style-type: none;
}
.group ul {
  list-style-type: none;
  margin: 0;
  padding: 0;
}

.group ul li:not(:last-child) {
  border-bottom: 1px solid #ededed;
  margin-bottom: 5px;
  padding-bottom: 5px;
}

.group p {
  margin: 0;
}

.group a {
  text-decoration: none;
  margin: 0;
  padding: 0;
}

.pagination {
  align-items: center;
  display: flex;
  justify-content: center;
  margin: 20px;
}

/* Site Main */
.site-main {
  padding: var(--space-4) 0;
}

/* Site Wrapper */
.site-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Card Styles */
.card {
  background: white;
  border-radius: var(--border-radius);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease-in-out;
  margin-bottom: var(--space-4);
  overflow: hidden;
}

/* Post Container */
.postContainer {
  width: 100%;
}

@media (min-width: 768px) {
  .postContainer {
    width: 70%;
  }
}

/* Top Post Container */
.toppostContainer {
  width: 100%;
  display: flex;
  flex-direction: column;
}

@media (min-width: 768px) {
  .toppostContainer {
    width: 63%;
  }
}

/* Tag Container */
.tagContainer {
  width: 100%;
}

@media (min-width: 768px) {
  .tagContainer {
    width: 70%;
  }
}

/* Author Logo */
.authorLogo {
  width: 16px;
  height: 16px;
  margin: var(--space-2) 0 0 var(--space-2);
}

.authorLogo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* News Title */
.newsTitle {
  font-size: var(--font-md);
  font-weight: bold;
  margin-bottom: var(--space-2);
  line-height: var(--line-height-dense);
}

/* Date Info */
.dateinfo {
  color: #666;
  font-size: var(--font-sx);
}

/* Tag Styles */
.tag {
  display: inline-block;
  padding: 2px 8px;
  margin: 0 4px 4px 0;
  border-radius: 12px;
  font-size: var(--font-sx);
  color: white;
}

.bg1 { background-color: #089c64; }
.bg2 { background-color: #275c92; }
.bg3 { background-color: #8a6534; }
.bg4 { background-color: #f9c74f; }
.bg5 { background-color: #e95800; }
.bg6 { background-color: #159bf3; }
.bg7 { background-color: #8eb814; }
.bg0 { background-color: #ccc; }

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: var(--space-4) 0;
  gap: var(--space-2);
}

.pagination a {
  padding: var(--space-2) var(--space-3);
  background-color: #f3f4f6;
  border-radius: var(--border-radius);
  color: var(--color-text);
  text-decoration: none;
  transition: background-color 0.2s ease;
}

.pagination a:hover {
  background-color: #e5e7eb;
}

/* Responsive Styles */
@media (max-width: 640px) {
  .postContainer {
    width: 100%;
  }
  
  .toppostContainer {
    padding: var(--space-2);
  }
  
  .newsTitle {
    font-size: var(--font-sm);
  }
}

/* Tag Page Styles */
.tag-page {
  max-width: 740px;
  margin: 0 auto;
  padding: var(--space-4) 0;
}

.tag-title {
  margin: 0 0 var(--space-4);
  font-size: var(--font-lg);
  line-height: var(--line-height-dense);
  text-align: center;
}

/* Author Page Styles */
.author-page {
  max-width: 740px;
  margin: 0 auto;
  padding: var(--space-4) 0;
}

.author-title {
  margin: 0 0 var(--space-4);
  font-size: var(--font-lg);
  line-height: var(--line-height-dense);
  color: var(--color-primary);
  text-align: center;
}

/* Footer Styles */
.site-footer {
  margin-top: auto;
  padding: var(--space-4) 0;
  background-color: white;
  border-top: 1px solid #e5e7eb;
}

.site-footer-content {
  max-width: 740px;
  margin: 0 auto;
  padding: 0 var(--space-4);
  text-align: center;
  color: #666;
}

.date-links {
  display: flex;
  gap: 8px;
  align-items: center;
}

.source-link {
  color: #666;
  text-decoration: none;
  font-size: 0.9em;
}

.source-link:hover {
  color: #007bff;
  text-decoration: underline;
}

.post-link {
  color: #999;
  text-decoration: none;
  font-size: 0.8em;
}

.post-link:hover {
  color: #28a745;
  text-decoration: underline;
}

.title-links {
  position: relative;
  margin-bottom: 8px;
}

.title-links .newsTitle-en {
  color: #666;
  font-size: 0.9em;
  margin-bottom: 4px;
}

.title-links .source-link {
  position: relative;
  display: block;
  z-index: 1;
}

.title-links .post-link {
  position: relative;
  z-index: 2;
  display: block;
  margin-top: 4px;
}

.title-links .newsTitle {
  margin: 0;
  font-size: 1.2em;
  line-height: 1.4;
}

.title-links .source-link .newsTitle {
  color: #333;
}

.title-links .post-link .newsTitle {
  color: #666;
  font-size: 1.1em;
}