/* ===== 名言の泉 - Main Stylesheet ===== */
:root {
  --navy: #1a2744;
  --navy-light: #243560;
  --gold: #c9a84c;
  --gold-light: #e8c96b;
  --white: #ffffff;
  --bg: #f5f6fa;
  --bg-card: #ffffff;
  --text: #222233;
  --text-muted: #666680;
  --border: #e2e6f0;
  --shadow: 0 2px 12px rgba(26,39,68,0.10);
  --shadow-hover: 0 6px 24px rgba(26,39,68,0.18);
  --radius: 12px;
  --transition: 0.22s ease;
}

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

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

body {
  font-family: 'Noto Sans JP', 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', Meiryo, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
}

a { color: var(--navy); text-decoration: none; }
a:hover { color: var(--gold); }

/* ===== HEADER ===== */
.site-header {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
  color: var(--white);
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,0.18);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.logo-icon {
  font-size: 2rem;
  line-height: 1;
}

.logo-text {
  display: flex;
  flex-direction: column;
}

.logo-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--white);
  letter-spacing: 0.05em;
  line-height: 1.2;
}

.logo-subtitle {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.65);
  letter-spacing: 0.12em;
}

.header-search {
  flex: 1;
  min-width: 200px;
  max-width: 440px;
  margin-left: auto;
  position: relative;
}

.header-search input {
  width: 100%;
  padding: 10px 42px 10px 16px;
  border: 2px solid rgba(255,255,255,0.25);
  border-radius: 50px;
  background: rgba(255,255,255,0.12);
  color: var(--white);
  font-size: 0.95rem;
  outline: none;
  transition: var(--transition);
}

.header-search input::placeholder { color: rgba(255,255,255,0.5); }

.header-search input:focus {
  background: rgba(255,255,255,0.22);
  border-color: var(--gold);
}

.search-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 4px;
}

.search-btn:hover { color: var(--gold); }

/* ===== HERO ===== */
.hero {
  background: linear-gradient(160deg, var(--navy) 0%, #2d4a8a 60%, var(--navy-light) 100%);
  color: var(--white);
  padding: 64px 24px 56px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '「」';
  position: absolute;
  font-size: 18rem;
  color: rgba(255,255,255,0.03);
  top: -40px;
  left: -20px;
  font-family: serif;
  line-height: 1;
}

.hero-inner { max-width: 800px; margin: 0 auto; position: relative; }

.hero h1 {
  font-size: clamp(1.6rem, 4vw, 2.6rem);
  font-weight: 700;
  margin-bottom: 12px;
  letter-spacing: 0.03em;
}

.hero h1 span { color: var(--gold-light); }

.hero-desc {
  font-size: 1rem;
  color: rgba(255,255,255,0.75);
  margin-bottom: 40px;
  line-height: 1.8;
}

/* Featured Quote */
.featured-quote-box {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.18);
  border-left: 4px solid var(--gold);
  border-radius: var(--radius);
  padding: 28px 32px;
  text-align: left;
  backdrop-filter: blur(4px);
}

.featured-label {
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  color: var(--gold-light);
  text-transform: uppercase;
  margin-bottom: 12px;
  font-weight: 600;
}

.featured-text {
  font-size: clamp(1.05rem, 2.5vw, 1.35rem);
  line-height: 1.8;
  color: var(--white);
  font-style: italic;
  font-family: 'Noto Serif JP', 'Georgia', serif;
  margin-bottom: 14px;
}

.featured-author {
  font-size: 0.9rem;
  color: rgba(255,255,255,0.7);
  display: flex;
  align-items: center;
  gap: 8px;
}

.featured-author::before {
  content: '—';
  color: var(--gold);
}

/* Stats bar */
.stats-bar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
}

.stats-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  gap: 32px;
  align-items: center;
  flex-wrap: wrap;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.stat-num {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--navy);
}

/* ===== CATEGORY NAV ===== */
.category-nav {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 64px;
  z-index: 90;
}

.category-nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 24px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  align-items: center;
}

.category-nav-inner::-webkit-scrollbar { display: none; }

.cat-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 16px;
  border-radius: 50px;
  border: 1.5px solid var(--border);
  background: var(--white);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
  font-family: inherit;
}

.cat-btn:hover {
  border-color: var(--navy);
  color: var(--navy);
  background: #f0f3fc;
}

.cat-btn.active {
  background: var(--navy);
  color: var(--white);
  border-color: var(--navy);
}

.cat-count {
  font-size: 0.72rem;
  opacity: 0.7;
}

/* ===== MAIN CONTENT ===== */
.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border);
}

.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--navy);
  display: flex;
  align-items: center;
  gap: 8px;
}

.result-count {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ===== QUOTE GRID ===== */
.quotes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

/* Quote Card */
.quote-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: var(--transition);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.quote-card::before {
  content: '\201C';
  position: absolute;
  top: -8px;
  left: 12px;
  font-size: 5rem;
  color: var(--navy);
  opacity: 0.06;
  font-family: Georgia, serif;
  line-height: 1;
}

.quote-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
  border-color: rgba(26,39,68,0.18);
}

.quote-card-tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 50px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  align-self: flex-start;
}

.quote-card-text {
  font-size: 1rem;
  line-height: 1.85;
  color: var(--text);
  font-family: 'Noto Serif JP', 'Georgia', serif;
  flex: 1;
}

.quote-card-text.long { font-size: 0.9rem; }

.quote-card-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-top: auto;
}

.quote-card-author {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--navy);
}

.quote-card-bio {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.quote-no {
  font-size: 0.7rem;
  color: var(--text-muted);
  opacity: 0.6;
}

/* Share button */
.share-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.95rem;
  padding: 4px 6px;
  border-radius: 6px;
  transition: var(--transition);
  flex-shrink: 0;
}

.share-btn:hover { color: var(--gold); background: #faf7ed; }

/* Category color coding */
.tag-philosophy { background: #eef2ff; color: #4a5eff; }
.tag-literature { background: #fff3e0; color: #c06000; }
.tag-japan { background: #fce4ec; color: #c62828; }
.tag-proverb { background: #e8f5e9; color: #2e7d32; }
.tag-business { background: #e3f2fd; color: #1565c0; }
.tag-anime { background: #fce4ec; color: #880e4f; }
.tag-science { background: #e0f7fa; color: #006064; }
.tag-education { background: #fff8e1; color: #f57f17; }
.tag-politics { background: #ede7f6; color: #4a148c; }
.tag-religion { background: #fbe9e7; color: #bf360c; }
.tag-sports { background: #e8f5e9; color: #1b5e20; }
.tag-society { background: #f3e5f5; color: #6a1b9a; }
.tag-love { background: #fce4ec; color: #c2185b; }
.tag-music { background: #fff3e0; color: #e65100; }
.tag-tech { background: #e1f5fe; color: #01579b; }
.tag-life { background: #f9fbe7; color: #558b2f; }
.tag-other { background: #f5f5f5; color: #616161; }

/* ===== LOAD MORE ===== */
.load-more-wrapper {
  text-align: center;
  margin-top: 40px;
}

.load-more-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 36px;
  background: var(--navy);
  color: var(--white);
  border: none;
  border-radius: 50px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.load-more-btn:hover {
  background: var(--navy-light);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(26,39,68,0.25);
}

/* ===== NO RESULTS ===== */
.no-results {
  text-align: center;
  padding: 64px 24px;
  color: var(--text-muted);
}

.no-results-icon { font-size: 3rem; margin-bottom: 16px; }
.no-results h3 { font-size: 1.1rem; margin-bottom: 8px; color: var(--navy); }

/* ===== POPULAR SECTION ===== */
.popular-section {
  margin-top: 48px;
  padding-top: 40px;
  border-top: 2px solid var(--border);
}

/* ===== FOOTER ===== */
.site-footer {
  background: var(--navy);
  color: rgba(255,255,255,0.75);
  padding: 48px 24px 32px;
  margin-top: 64px;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
}

.footer-top {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 36px;
}

.footer-brand .logo-title { color: var(--white); font-size: 1.3rem; }
.footer-brand p { margin-top: 12px; font-size: 0.85rem; line-height: 1.8; }

.footer-nav h4 {
  color: var(--white);
  font-size: 0.85rem;
  margin-bottom: 14px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.footer-nav ul { list-style: none; }
.footer-nav li { margin-bottom: 8px; }
.footer-nav a { font-size: 0.85rem; color: rgba(255,255,255,0.65); transition: var(--transition); }
.footer-nav a:hover { color: var(--gold); }

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.12);
  padding-top: 20px;
  text-align: center;
  font-size: 0.78rem;
  color: rgba(255,255,255,0.4);
}

/* ===== SEARCH HIGHLIGHT ===== */
.highlight {
  background: #fff9c4;
  color: #333;
  border-radius: 2px;
  padding: 0 2px;
}

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--navy);
  color: var(--white);
  padding: 12px 24px;
  border-radius: 50px;
  font-size: 0.88rem;
  z-index: 9999;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===== BACK TO TOP ===== */
.back-to-top {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 44px;
  height: 44px;
  background: var(--navy);
  color: var(--white);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  opacity: 0;
  transform: translateY(20px);
  transition: var(--transition);
  z-index: 200;
}

.back-to-top.visible { opacity: 1; transform: translateY(0); }
.back-to-top:hover { background: var(--navy-light); }

/* ===== COUNTER ===== */
.counter-widget {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
  color: var(--white);
  border-radius: 50px;
  padding: 8px 20px 8px 14px;
  font-size: 0.85rem;
  box-shadow: 0 2px 10px rgba(26,39,68,0.18);
  white-space: nowrap;
}

.counter-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.counter-label {
  color: rgba(255,255,255,0.65);
  font-size: 0.75rem;
  line-height: 1.2;
}

.counter-digits {
  display: flex;
  gap: 3px;
  align-items: center;
}

.counter-digit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 28px;
  background: rgba(255,255,255,0.12);
  border-radius: 5px;
  font-size: 1rem;
  font-weight: 700;
  font-family: 'Courier New', monospace;
  color: var(--gold-light);
  border: 1px solid rgba(255,255,255,0.15);
  transition: all 0.35s ease;
}

.counter-digit.flip {
  animation: digitFlip 0.35s ease;
}

@keyframes digitFlip {
  0%   { transform: rotateX(0deg);   opacity: 1; }
  50%  { transform: rotateX(90deg);  opacity: 0.3; }
  100% { transform: rotateX(0deg);   opacity: 1; }
}

.counter-sep {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.35);
  margin: 0 1px;
}

/* Stats bar にカウンターを溶け込ませる */
.stat-item.counter-stat { margin-left: auto; }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .footer-top { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
  .header-inner {
    padding: 10px 16px;
    gap: 8px;
    flex-wrap: wrap;
  }
  .site-logo { flex-shrink: 0; }
  .header-search {
    order: 3;
    flex: 0 0 100%;
    max-width: 100%;
    min-width: unset;
    margin-left: 0;
  }
  .logo-title { font-size: 1.15rem; }
  .hero { padding: 32px 16px 28px; }
  .hero-desc br { display: none; }
  .featured-quote-box { padding: 20px 18px; }
  .main-content { padding: 20px 16px; }
  .quotes-grid { grid-template-columns: 1fr; gap: 14px; }
  .footer-top { grid-template-columns: 1fr; gap: 24px; }
  .stats-inner {
    gap: 12px;
    flex-wrap: wrap;
  }
  .stat-item.counter-stat {
    margin-left: 0;
    flex: 0 0 100%;
  }
  .counter-widget { width: 100%; justify-content: center; }
  .category-nav { top: 0; position: static; }
  .category-nav-inner { padding: 8px 16px; }
  /* タッチターゲットを大きめに */
  .cat-btn { padding: 8px 14px; font-size: 0.85rem; min-height: 40px; }
  .share-btn { padding: 8px; min-height: 36px; min-width: 36px; }
}

@media (max-width: 400px) {
  .header-inner { padding: 10px 12px; }
  .logo-subtitle { display: none; }
  .counter-digit { width: 18px; height: 24px; font-size: 0.88rem; }
}
