/* ═══════════════════════════════════════════
   Tomomi in Japan — Blog CSS
   Clean, fast, English-optimized blog design
   ═══════════════════════════════════════════ */

:root {
  --brand: #2563EB;
  --brand-light: #DBEAFE;
  --brand-dark: #1D4ED8;
  --text: #1E293B;
  --text-light: #64748B;
  --bg: #F8FAFC;
  --white: #FFFFFF;
  --border: #E2E8F0;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.08);
  --max-width: 1200px;
  --content-width: 720px;
}

/* ─── Reset ─────────────────────────────── */

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--brand-dark); }

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

/* ─── Header ────────────────────────────── */

.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}
.site-logo:hover { color: var(--brand); }

.site-nav { display: flex; gap: 1.5rem; }
.site-nav a {
  color: var(--text-light);
  font-size: 0.9rem;
  font-weight: 500;
}
.site-nav a:hover { color: var(--brand); }

/* ─── Hero ──────────────────────────────── */

.hero {
  text-align: center;
  padding: 3rem 1.5rem 2rem;
  max-width: var(--content-width);
  margin: 0 auto;
}

.hero h1 {
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 0.75rem;
  color: var(--text);
}

.hero p {
  font-size: 1.1rem;
  color: var(--text-light);
  max-width: 540px;
  margin: 0 auto;
}

/* ─── Filter Bar ────────────────────────── */

.filter-bar {
  max-width: var(--max-width);
  margin: 0 auto 1.5rem;
  padding: 0 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.filter-btn {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 2rem;
  padding: 0.4rem 1rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-light);
  cursor: pointer;
  transition: all 0.2s;
  text-transform: capitalize;
}
.filter-btn:hover { border-color: var(--brand); color: var(--brand); }
.filter-btn.active {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--white);
}

/* ─── Card Grid ─────────────────────────── */

.card-grid {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.5rem;
}

.card {
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.card-thumb {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.card-body { padding: 1.25rem; }

.card-category {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--brand);
  margin-bottom: 0.5rem;
}

.card h2 {
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 0.5rem;
}
.card h2 a { color: var(--text); }
.card h2 a:hover { color: var(--brand); }

.card-excerpt {
  font-size: 0.9rem;
  color: var(--text-light);
  line-height: 1.5;
  margin-bottom: 0.75rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  font-size: 0.8rem;
  color: var(--text-light);
}

.empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem;
  color: var(--text-light);
}

/* ─── Article Page ──────────────────────── */

.article-page {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.article-content h1 {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
}

.article-category a {
  background: var(--brand-light);
  color: var(--brand);
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.article-author {
  font-size: 0.9rem;
  color: var(--text-light);
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

/* Disclosure */
.disclosure {
  background: #FEF3C7;
  border: 1px solid #FDE68A;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 1.5rem;
  font-size: 0.85rem;
  color: #92400E;
}

/* TOC */
.toc {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 2rem;
}
.toc h2 {
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-light);
  margin-bottom: 0.75rem;
  border: none;
  padding: 0;
}
.toc ol {
  list-style: decimal;
  padding-left: 1.25rem;
}
.toc li {
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
}

/* Article Body */
.article-body h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 2.5rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 3px solid var(--brand);
}

.article-body h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 2rem 0 0.75rem;
}

.article-body p {
  margin-bottom: 1.25rem;
}

.article-body strong {
  background: linear-gradient(transparent 60%, var(--brand-light) 60%);
  padding: 0 2px;
}

.article-body blockquote {
  border-left: 4px solid var(--brand);
  background: var(--brand-light);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  border-radius: 0 8px 8px 0;
  font-style: normal;
}
.article-body blockquote p { margin-bottom: 0.5rem; }
.article-body blockquote p:last-child { margin-bottom: 0; }

.article-body ul, .article-body ol {
  padding-left: 1.5rem;
  margin-bottom: 1.25rem;
}
.article-body li { margin-bottom: 0.4rem; }

.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.9rem;
}
.article-body th, .article-body td {
  padding: 0.6rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.article-body th {
  background: var(--bg);
  font-weight: 600;
}

.article-body code {
  background: var(--bg);
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  font-size: 0.88em;
}
.article-body pre {
  background: #1E293B;
  color: #E2E8F0;
  padding: 1.25rem;
  border-radius: 8px;
  overflow-x: auto;
  margin: 1.5rem 0;
}
.article-body pre code {
  background: none;
  padding: 0;
  color: inherit;
}

/* Article Images */
.article-image {
  margin: 2rem -1rem;
}
.article-image img {
  width: 100%;
  border-radius: 8px;
}
.article-image figcaption {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-light);
  margin-top: 0.5rem;
}

/* Ad Slots */
.ad-slot {
  min-height: 1px;
  margin: 2rem 0;
  text-align: center;
}

/* Email Signup */
.email-signup {
  background: var(--brand);
  color: var(--white);
  border-radius: var(--radius);
  padding: 2rem;
  margin: 2.5rem 0;
  text-align: center;
}
.email-signup h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}
.email-signup p {
  font-size: 0.95rem;
  opacity: 0.9;
  margin-bottom: 1rem;
}

.email-form-placeholder {
  display: flex;
  gap: 0.5rem;
  max-width: 420px;
  margin: 0 auto;
}
.email-form-placeholder input {
  flex: 1;
  padding: 0.6rem 1rem;
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 8px;
  background: rgba(255,255,255,0.15);
  color: var(--white);
  font-size: 0.9rem;
}
.email-form-placeholder input::placeholder { color: rgba(255,255,255,0.6); }
.email-form-placeholder button {
  background: var(--white);
  color: var(--brand);
  border: none;
  border-radius: 8px;
  padding: 0.6rem 1.25rem;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  white-space: nowrap;
}
.form-note {
  font-size: 0.75rem;
  opacity: 0.7;
  margin-top: 0.5rem;
}

/* Tags */
.article-tags {
  margin: 2rem 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.tag {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 2rem;
  padding: 0.3rem 0.75rem;
  font-size: 0.8rem;
  color: var(--text-light);
}
.tag:hover { border-color: var(--brand); color: var(--brand); }

/* Article Nav */
.article-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}
.article-nav a {
  font-size: 0.9rem;
  font-weight: 500;
  max-width: 45%;
}
.nav-prev { text-align: left; }
.nav-next { text-align: right; }

/* ─── Footer ────────────────────────────── */

.site-footer {
  background: var(--white);
  border-top: 1px solid var(--border);
  padding: 1.5rem;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-light);
}

.footer-nav { display: flex; gap: 1.5rem; }
.footer-nav a { color: var(--text-light); }
.footer-nav a:hover { color: var(--brand); }

/* ─── Mobile ────────────────────────────── */

@media (max-width: 640px) {
  .hero h1 { font-size: 1.75rem; }
  .hero p { font-size: 1rem; }

  .card-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .article-content h1 { font-size: 1.5rem; }
  .article-body h2 { font-size: 1.25rem; }

  .article-image { margin: 1.5rem 0; }

  .email-form-placeholder {
    flex-direction: column;
  }

  .article-nav {
    flex-direction: column;
    gap: 0.75rem;
  }
  .article-nav a { max-width: 100%; }

  .footer-inner {
    flex-direction: column;
    gap: 0.75rem;
    text-align: center;
  }
}
