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

:root {
  --bg: #fafaf9;
  --surface: #ffffff;
  --text: #1a1a1a;
  --text-secondary: #6b7280;
  --text-tertiary: #9ca3af;
  --accent: #1e3a5f;
  --accent-light: #2d5a8e;
  --accent-subtle: #f0f4f8;
  --border: #e5e7eb;
  --border-light: #f3f4f6;
  --radius: 6px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
  --max-width: 680px;
  --header-height: 64px;
}

html {
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: 'Lora', Georgia, 'Times New Roman', serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.72;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  width: 100%;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(250,250,249,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  height: var(--header-height);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--text);
}

.logo-icon {
  font-size: 1.1rem;
  color: var(--accent);
}

.logo-text {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: -0.01em;
  color: var(--text);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav-links a {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  transition: color 0.2s;
}

.nav-links a:hover {
  color: var(--text);
}

/* Footer */
.site-footer {
  margin-top: auto;
  padding: 3rem 0 2rem;
  border-top: 1px solid var(--border-light);
}

.footer-text {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.78rem;
  color: var(--text-tertiary);
  line-height: 1.6;
}

.footer-copy {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-top: 0.5rem;
}

/* Main */
.site-main {
  flex: 1;
  padding: 3rem 0;
}

/* Post list */
.post-list {
  list-style: none;
}

.post-item {
  padding: 2rem 0;
  border-bottom: 1px solid var(--border-light);
}

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

.post-meta {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.78rem;
  color: var(--text-tertiary);
  margin-bottom: 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  letter-spacing: 0.01em;
}

.post-meta .separator {
  color: var(--border);
}

.post-item h2 {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.post-item h2 a {
  color: var(--text);
  text-decoration: none;
  transition: color 0.2s;
}

.post-item h2 a:hover {
  color: var(--accent);
}

.post-item .subtitle {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 0.8rem;
}

.post-item .excerpt {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.65;
}

.post-item .read-more {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  margin-top: 0.8rem;
  display: inline-block;
  transition: color 0.2s;
}

.post-item .read-more:hover {
  color: var(--accent-light);
}

.tag {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-tertiary);
  background: var(--border-light);
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Single post */
.post-single .post-header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-light);
}

.post-single .post-meta {
  margin-bottom: 1rem;
}

.post-single h1 {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 1.85rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
}

.post-single .subtitle {
  font-size: 1.05rem;
  color: var(--text-secondary);
  line-height: 1.5;
  font-style: italic;
}

/* Post content */
.post-content h2 {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  color: var(--text);
}

.post-content h3 {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-top: 2rem;
  margin-bottom: 0.8rem;
}

.post-content p {
  margin-bottom: 1.3rem;
}

.post-content strong {
  font-weight: 650;
  color: var(--text);
}

.post-content a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: rgba(30,58,95,0.3);
  transition: text-decoration-color 0.2s;
}

.post-content a:hover {
  text-decoration-color: var(--accent);
}

.post-content blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.8rem 1.2rem;
  margin: 1.8rem 0;
  background: var(--accent-subtle);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.post-content blockquote p {
  margin-bottom: 0;
  font-style: italic;
  color: var(--text-secondary);
}

.post-content hr {
  border: none;
  height: 1px;
  background: var(--border-light);
  margin: 2.5rem 0;
}

.post-content ul, .post-content ol {
  margin-bottom: 1.3rem;
  padding-left: 1.5rem;
}

.post-content li {
  margin-bottom: 0.4rem;
}

.post-content code {
  font-family: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
  font-size: 0.88em;
  background: var(--border-light);
  padding: 0.15em 0.4em;
  border-radius: 3px;
  color: var(--accent);
}

.post-content pre {
  background: #1e293b;
  color: #e2e8f0;
  padding: 1.2rem;
  border-radius: var(--radius);
  overflow-x: auto;
  margin-bottom: 1.5rem;
  font-size: 0.85rem;
  line-height: 1.6;
}

.post-content pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
  font-size: 0.92rem;
}

.post-content th {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 600;
  text-align: left;
  padding: 0.6rem 1rem;
  border-bottom: 2px solid var(--border);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}

.post-content td {
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border-light);
}

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

/* Post footer */
.post-footer {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-light);
}

.post-footer .signature {
  font-style: italic;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* About page */
.about-content h2 {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
}

.about-content p {
  margin-bottom: 1.3rem;
}

.about-content ul {
  margin-bottom: 1.3rem;
  padding-left: 1.5rem;
}

.about-content li {
  margin-bottom: 0.4rem;
}

.about-content blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.8rem 1.2rem;
  margin: 1.8rem 0;
  background: var(--accent-subtle);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.about-content blockquote p {
  margin-bottom: 0;
  font-style: italic;
  color: var(--text-secondary);
}

.about-content a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Hero */
.hero {
  text-align: center;
  padding: 2rem 0 3rem;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 1rem;
}

.hero-label {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-tertiary);
  margin-bottom: 0.8rem;
}

.hero-title {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 0.6rem;
}

.hero-desc {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 520px;
  margin: 0 auto;
}

/* Translation toast */
.translate-toast {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  transform: translateY(-100%);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.translate-toast.visible {
  transform: translateY(0);
}

.translate-toast-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.translate-toast-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.translate-toast-text .globe {
  font-size: 1rem;
}

.translate-toast-text strong {
  color: var(--text);
  font-weight: 600;
}

.translate-toast-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.toast-btn {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0.4rem 0.9rem;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.toast-btn-primary {
  background: var(--accent);
  color: #fff;
}

.toast-btn-primary:hover {
  background: var(--accent-light);
}

.toast-btn-ghost {
  background: transparent;
  color: var(--text-tertiary);
  padding: 0.4rem 0.6rem;
}

.toast-btn-ghost:hover {
  color: var(--text-secondary);
}

/* Refresh notice (inline) */
.translate-notice {
  display: none;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1rem;
  margin-bottom: 1.5rem;
  background: #fef9c3;
  border: 1px solid #fde68a;
  border-radius: var(--radius);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.82rem;
  color: #92400e;
  animation: notice-fade-in 0.4s ease;
}

.translate-notice.visible {
  display: flex;
}

@keyframes notice-fade-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.translate-notice .notice-icon {
  font-size: 0.95rem;
  flex-shrink: 0;
}

.translate-notice strong {
  font-weight: 600;
}

/* Language selector (header) */
.lang-selector {
  position: relative;
}

.lang-trigger {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.3rem 0.55rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.15s ease;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.lang-trigger:hover {
  border-color: var(--text-tertiary);
  color: var(--text);
}

.lang-trigger .globe-icon {
  font-size: 0.9rem;
  line-height: 1;
}

.trigger-flag {
  font-size: 0.85rem;
  line-height: 1;
}

.lang-trigger .arrow {
  font-size: 0.55rem;
  transition: transform 0.2s;
  margin-left: 0.1rem;
}

.lang-selector.open .lang-trigger .arrow {
  transform: rotate(180deg);
}

.lang-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 260px;
  max-height: 380px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.lang-selector.open .lang-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.lang-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.9rem;
  cursor: pointer;
  transition: background 0.1s;
  border-bottom: 1px solid var(--border-light);
}

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

.lang-dropdown-item:hover {
  background: var(--accent-subtle);
}

.lang-dropdown-item.active {
  background: var(--accent-subtle);
}

.lang-dropdown-item .lang-flag {
  font-size: 1rem;
  line-height: 1;
  flex-shrink: 0;
}

.lang-dropdown-item .lang-native {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text);
  flex: 1;
}

.lang-dropdown-item .lang-english {
  font-size: 0.72rem;
  color: var(--text-tertiary);
}

.lang-dropdown-item .lang-check {
  font-size: 0.75rem;
  color: var(--accent);
  opacity: 0;
}

.lang-dropdown-item.active .lang-check {
  opacity: 1;
}

/* Translation active state */
.translation-active {
  position: relative;
}

.translation-active::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-light) 50%, var(--accent) 100%);
  background-size: 200% 100%;
  animation: translation-pulse 2s ease-in-out infinite;
  z-index: 9999;
}

@keyframes translation-pulse {
  0%, 100% { background-position: 0% 0%; }
  50% { background-position: 100% 0%; }
}

/* Hide Google Translate elements we don't want */
.skiptranslate,
.goog-te-spinner-pos,
#google_translate_element {
  position: absolute !important;
  left: -9999px !important;
  height: 0 !important;
  width: 0 !important;
  overflow: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

body.translated-ltr {
  margin-top: 0 !important;
}

body.translated-rtl {
  margin-top: 0 !important;
}

.goog-te-banner-frame {
  display: none !important;
}

.goog-te-ftab {
  display: none !important;
}

/* Responsive */
@media (max-width: 640px) {
  html { font-size: 16px; }

  .post-single h1 {
    font-size: 1.5rem;
  }

  .hero-title {
    font-size: 1.6rem;
  }

  .translate-toast-inner {
    flex-direction: column;
    gap: 0.6rem;
    padding: 0.75rem 1rem;
  }

  .translate-toast-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .lang-dropdown {
    right: -0.5rem;
    width: 240px;
  }
}
