/* Google Fonts - Modern Bilingual (English + Japanese) */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Noto+Sans+JP:wght@400;500;600&display=swap');

:root {
  --bg: #0d1117;
  --bg-secondary: #161b22;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --accent: #58a6ff;
  --accent-hover: #79b8ff;
  --border: #30363d;
}

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

html {
  font-size: 18px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', 'Noto Sans JP', -apple-system, BlinkMacSystemFont, 
               'Segoe UI', 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 
               'Yu Gothic', 'Meiryo', sans-serif;
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header nav {
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

header nav > a {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 1.2rem;
}

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

.nav-categories a {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.nav-categories a:hover {
  color: var(--accent);
  background: rgba(88, 166, 255, 0.1);
}

@media (max-width: 768px) {
  header nav {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  
  .nav-categories {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 0.75rem;
  }
  
  .nav-categories a {
    font-size: 0.9rem;
    padding: 0.4rem 0.8rem;
  }
}

main {
  flex: 1;
  max-width: 720px;
  margin: 0 auto;
  padding: 3rem 2rem;
  width: 100%;
}

article header {
  margin-bottom: 2.5rem;
}

article header h1 {
  font-size: 2.2rem;
  line-height: 1.3;
  margin-bottom: 0.5rem;
}

article header time {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

/* Categories */
.post-categories {
  margin: 0.5rem 0;
}

.category {
  background: var(--accent);
  color: var(--bg);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 500;
  margin-right: 0.5rem;
}

/* CEFR Level badges */
.cefr-level {
  margin: 0.5rem 0;
}

.level-badge {
  padding: 0.3rem 0.8rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.level-A1, .level-A2 {
  background: #22c55e;
  color: white;
}

.level-B1, .level-B2 {
  background: #f59e0b;
  color: white;
}

.level-C1, .level-C2 {
  background: #dc2626;
  color: white;
}

/* Level navigation */
.level-navigation {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  margin: 2rem 0;
}

.level-navigation h3 {
  margin: 0 0 1rem 0;
  color: var(--accent);
  font-size: 1.1rem;
}

.level-links {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.level-link {
  padding: 0.5rem 1rem;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  transition: transform 0.2s ease;
}

.level-link:hover {
  transform: translateY(-1px);
  text-decoration: none;
}

.level-link.level-A1,
.level-link.level-A2 {
  background: #22c55e;
  color: white;
}

.level-link.level-B1,
.level-link.level-B2 {
  background: #f59e0b;
  color: white;
}

.level-link.level-C1,
.level-link.level-C2 {
  background: #dc2626;
  color: white;
}

h1, h2, h3, h4 {
  color: var(--text);
  margin-top: 2rem;
  margin-bottom: 1rem;
}

h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }

p {
  margin-bottom: 1.25rem;
}

a {
  color: var(--accent);
  text-decoration: none;
}

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

ul, ol {
  margin-bottom: 1.25rem;
  padding-left: 1.5rem;
}

li {
  margin-bottom: 0.5rem;
}

code {
  background: var(--bg-secondary);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-size: 0.9rem;
}

pre {
  background: var(--bg-secondary);
  padding: 1rem;
  border-radius: 6px;
  overflow-x: auto;
  margin-bottom: 1.25rem;
}

pre code {
  background: none;
  padding: 0;
}

blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 1rem;
  margin: 1.5rem 0;
  color: var(--text-muted);
  font-style: italic;
}

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

img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}

/* Featured images */
.featured-image {
  margin: 2rem 0 2.5rem 0;
}

.featured-image img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

footer {
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
}

/* Index page */
.post-list {
  list-style: none;
  padding: 0;
}

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

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

.post-item.with-image {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}

.post-thumbnail {
  flex-shrink: 0;
  width: 160px;
  height: 120px;
}

.post-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.post-content {
  flex: 1;
  min-width: 0;
}

.post-content a {
  font-size: 1.2rem;
  font-weight: 500;
  text-decoration: none;
}

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

.post-content time {
  display: block;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 0.25rem;
}

.post-content p {
  margin-top: 0.5rem;
  margin-bottom: 0;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Fallback for posts without images */
.post-item:not(.with-image) .post-content a {
  font-size: 1.2rem;
  font-weight: 500;
}

.post-item:not(.with-image) .post-content time {
  display: block;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 0.25rem;
}

.post-item:not(.with-image) .post-content p {
  margin-top: 0.5rem;
  margin-bottom: 0;
  color: var(--text-muted);
}

@media (max-width: 600px) {
  html { font-size: 16px; }
  main { padding: 2rem 1rem; }
  article header h1 { font-size: 1.8rem; }
  
  /* Mobile layout for post thumbnails */
  .post-item.with-image {
    flex-direction: column;
    gap: 1rem;
  }
  
  .post-thumbnail {
    width: 100%;
    height: 180px;
    align-self: center;
  }
  
  /* Mobile level navigation */
  .level-navigation {
    padding: 1rem;
  }
  
  .level-links {
    flex-direction: column;
  }
  
  .level-link {
    text-align: center;
    padding: 0.75rem;
  }
  
  /* Mobile categories */
  .post-categories {
    margin-bottom: 1rem;
  }
}

/* Grammar pill styling */
.grammar-pill {
  display: inline-block;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.5rem;
  font-weight: 500;
  margin-bottom: 0;
  letter-spacing: 0.02em;
  box-shadow: 0 1px 2px rgba(102, 126, 234, 0.3);
  vertical-align: sub;
  line-height: 1;
}

/* Reduce gap between grammar pill and following dialogue */
p:has(.grammar-pill) {
  margin-bottom: 0.05rem;
}

p:has(.grammar-pill) + p {
  margin-top: 0;
}
