/* ─────────────────────────────────────────
   GAKUYA — index.html 専用スタイル（クリーン版）
   ───────────────────────────────────────── */

html { scroll-behavior: smooth; }

body.top-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ═════════════════════════════════════════
   HERO SECTION
   ═════════════════════════════════════════ */

.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8.5rem 2.5rem 6rem;
  min-height: 60vh;
  position: relative;
  z-index: 1;
}

.hero-logo {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(4rem, 12vw, 8rem);
  font-weight: 400;
  letter-spacing: 0.06em;
  color: var(--ink);
  margin-bottom: 0.1rem;
  text-align: center;
  text-decoration: none;
  display: block;
  opacity: 0;
  animation: fadeUp 0.8s 0.1s ease forwards;
}
.hero-logo span { color: var(--rust); }

.hero-tagline {
  font-family: 'Space Mono', monospace;
  font-size: 0.58rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 3rem;
  opacity: 0;
  animation: fadeUp 0.8s 0.25s ease forwards;
}

/* ─── Search Box ─── */

.search-box {
  width: 100%;
  max-width: 520px;
  display: flex;
  align-items: center;
  position: relative;
  z-index: 1000;
  border: 1px solid var(--border);
  background: var(--cream);
  transition: box-shadow 0.2s, border-color 0.2s;
  opacity: 0;
  animation: fadeUp 0.8s 0.35s ease forwards;
  margin-bottom: 6rem;
}
.search-box:focus-within {
  box-shadow: 0 2px 16px rgba(128,0,0,0.08);
  border-color: var(--rust);
}

.search-input {
  flex: 1;
  padding: 1rem 1.2rem;
  background: none;
  border: none;
  outline: none;
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 1rem;
  font-weight: 500;
  color: var(--ink);
  /* ブラウザのデフォルト補完を無効化 */
  -webkit-autofill: none;
  -webkit-autofill-delay: 999999999s;
  /* OSレベルのキーボード補完を無効化 */
  -webkit-user-select: text;
  -webkit-user-modify: read-write-plaintext-only;
}
.search-input::placeholder {
  color: var(--border);
  font-style: italic;
}
/* ブラウザの自動補完ポップアップを隠す */
.search-input::-webkit-outer-spin-button,
.search-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.search-input::-webkit-calendar-picker-indicator {
  display: none;
}

.search-clear {
  padding: 0 1rem;
  font-size: 0.7rem;
  color: var(--muted);
  cursor: pointer;
  display: none;
  background: none;
  border: none;
  transition: color 0.2s;
}
.search-clear:hover { color: var(--rust); }

.search-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 0.5rem;
  background-color: #fcfaf2 !important;
  background: #fcfaf2 !important;
  border: 1px solid var(--border);
  border-top: none;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08) !important;
  max-height: 400px;
  overflow-y: auto;
  overflow-x: hidden;
  display: none;
  z-index: 10000 !important;
  pointer-events: auto;
}
.search-suggestions.visible {
  display: block;
}

.suggestion-item {
  display: flex;
  flex-direction: column;
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.2s;
  gap: 0.4rem;
  min-height: 3.6rem;
  background-color: #fcfaf2 !important;
}
.suggestion-item:hover,
.suggestion-item.active {
  background: #f0ebe2;
}
.suggestion-item:last-child {
  border-bottom: none;
}

.sug-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 0.95rem;
  font-style: italic;
  color: var(--rust);
  line-height: 1.3;
  margin: 0;
  padding: 0;
  letter-spacing: 0.01em;
}
.sug-reading {
  font-family: 'Noto Serif JP', serif;
  font-size: 0.85rem;
  color: var(--ink);
  line-height: 1.4;
  margin: 0;
  padding: 0;
  font-weight: 500;
}
.sug-cat {
  font-family: 'Space Mono', monospace;
  font-size: 0.65rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  line-height: 1.2;
  margin: 0;
  padding: 0;
}

.no-result {
  padding: 1.5rem 1rem;
  text-align: center;
  font-family: 'Noto Serif JP', serif;
  font-size: 0.9rem;
  color: var(--muted);
  background-color: #fcfaf2;
  line-height: 1.6;
}

/* ─── Browse Link ─── */

.browse-link {
  margin-top: 2rem;
  font-family: 'Space Mono', monospace;
  font-size: 0.58rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  padding-bottom: 2px;
  transition: color 0.2s, border-color 0.2s;
  cursor: pointer;
  opacity: 0;
  animation: fadeUp 0.8s 0.5s ease forwards;
  position: relative;
  z-index: 1;
  display: inline-block;
}
.browse-link:hover { color: var(--rust); border-color: var(--rust); }

/* ═════════════════════════════════════════
   ALL TERMS MODAL
   ═════════════════════════════════════════ */

.all-terms-modal {
  position: fixed;
  inset: 0;
  background: var(--paper);
  z-index: 500;
  overflow-y: auto;
  padding: 6rem 2rem 3rem;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s, visibility 0.3s;
}
.all-terms-modal.visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.all-terms-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 960px;
  margin: 0 auto 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.all-terms-title {
  font-family: 'Space Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

.all-terms-close {
  font-family: 'Space Mono', monospace;
  font-size: 0.6rem;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  letter-spacing: 0.1em;
  transition: color 0.2s;
  padding: 0.5rem 1rem;
}
.all-terms-close:hover { color: var(--rust); }

/* ─── Alphabet Tabs ─── */

.alpha-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin: 2rem auto 3rem;
  padding: 1rem;
  background: transparent;
  max-width: 960px;
  opacity: 0;
  animation: fadeUp 0.7s 0.2s ease forwards;
}

.alpha-tab {
  font-family: 'Space Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  padding: 0.5rem 1rem;
  border: 1.5px solid var(--border);
  color: var(--ink);
  background: var(--cream);
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
  text-transform: uppercase;
  font-weight: 600;
  border-radius: 20px;
  white-space: nowrap;
}
.alpha-tab:hover {
  border-color: var(--rust);
  color: var(--rust);
  background: var(--paper);
  font-weight: 700;
}
.alpha-tab.disabled {
  opacity: 0.3;
  color: #ccc;
  border-color: #ddd;
  background: #f5f5f5;
  cursor: not-allowed;
  pointer-events: none;
  font-weight: 400;
}

/* ─── Category Index Search ─── */

.cat-search-wrap {
  max-width: 960px;
  margin: 0 auto 1.5rem;
  padding: 0 1rem;
}

.cat-search-input {
  width: 100%;
  padding: 0.75rem 1.1rem;
  border: 1px solid var(--border);
  background: var(--cream);
  font-family: 'Noto Serif JP', serif;
  font-size: 0.9rem;
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}
.cat-search-input:focus {
  border-color: var(--rust);
  box-shadow: 0 2px 8px rgba(128,0,0,0.07);
}
.cat-search-input::placeholder {
  color: var(--muted);
  font-style: italic;
}

.cat-no-result {
  font-family: 'Noto Serif JP', serif;
  font-size: 0.9rem;
  color: var(--muted);
  text-align: center;
  padding: 3rem 0;
}

/* ─── Terms List ─── */

.terms-list {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1rem;
}

.az-section { margin-bottom: 2.5rem; }

.az-letter {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--rust);
  margin-bottom: 0.8rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--rust);
}

.term-list { display: flex; flex-direction: column; }

.term-row {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--ink);
  transition: background 0.15s;
  position: relative;
}
.term-row::before {
  content: '';
  position: absolute;
  left: -1rem;
  top: 0;
  bottom: 0;
  width: 2px;
  background: transparent;
  transition: background 0.2s;
}
.term-row:hover { background: var(--cream); }
.term-row:hover::before { background: var(--rust); }

.row-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.3rem;
  font-weight: 400;
  min-width: 140px;
}
.row-reading {
  font-family: 'Space Mono', monospace;
  font-size: 0.55rem;
  color: var(--muted);
  min-width: 100px;
}
.row-desc {
  font-family: 'Noto Serif JP', serif;
  font-size: 0.8rem;
  color: var(--muted);
  flex: 1;
}

.row-cat {
  font-family: 'Space Mono', monospace;
  font-size: 0.55rem;
  color: var(--muted);
  text-transform: uppercase;
}

/* ═════════════════════════════════════════
   FOOTER
   ═════════════════════════════════════════ */

footer {
  border-top: 1px solid var(--border);
  padding: 2rem 2.5rem;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  margin-top: auto;
  opacity: 0;
  animation: fadeIn 0.5s 0.7s ease forwards;
}

.footer-text {
  font-family: 'Space Mono', monospace;
  font-size: 0.55rem;
  letter-spacing: 0.1em;
  color: var(--muted);
  text-transform: uppercase;
}

/* ═════════════════════════════════════════
   ANIMATIONS
   ═════════════════════════════════════════ */

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ═════════════════════════════════════════
   RESPONSIVE
   ═════════════════════════════════════════ */

@media (max-width: 768px) {
  .hero { padding: 7rem 1.5rem 4rem; min-height: 50vh; }
  .hero-logo { font-size: clamp(2.5rem, 10vw, 4rem); }
  .hero-tagline { margin-bottom: 2rem; font-size: 0.5rem; }

  .search-input { font-size: 0.95rem; padding: 0.9rem 1rem; }

  .alpha-tabs { margin: 1.5rem auto 2rem; padding: 0.5rem; }
  .alpha-tab { font-size: 0.6rem; padding: 0.4rem 0.8rem; }

  .az-section { margin-bottom: 1.8rem; }
  .az-letter { font-size: 1.4rem; margin-bottom: 0.6rem; }

  .row-name { min-width: 120px; font-size: 1.15rem; }
  .row-reading { min-width: 80px; }

  .all-terms-modal { padding: 5rem 1.5rem 2rem; }
  .all-terms-header { margin: 0 auto 1.5rem; }

  footer { grid-template-columns: 1fr; gap: 0.5rem; text-align: center; }
  .footer-text:first-child, .footer-text:last-child { text-align: center; }
  .footer-mark { width: 18px; height: 18px; max-width: 18px; max-height: 18px; justify-self: center; }
}

@media (max-width: 640px) {
  .hero { padding: 6.5rem 1.2rem 2rem; min-height: 45vh; }
  .hero-logo { font-size: clamp(2rem, 8vw, 3rem); }
  .hero-tagline { font-size: 0.5rem; margin-bottom: 1.5rem; }

  .search-box { max-width: 100%; }
  .search-input { font-size: 0.9rem; padding: 0.8rem; }

  .browse-link {
    font-size: 0.5rem;
    margin-top: 1.5rem;
    padding: 0.75rem 0.75rem 0.5rem;
    touch-action: manipulation;
  }

  .search-input { font-size: 16px; }

  .all-terms-modal { padding: 5rem 1rem 2rem; }
  .all-terms-header { margin: 0 auto 1.5rem; }

  .alpha-tabs { margin: 1.5rem auto 2rem; padding: 0.5rem; }
  .alpha-tab { font-size: 0.55rem; padding: 0.35rem 0.6rem; }

  .az-section { margin-bottom: 1.8rem; }
  .az-letter { font-size: 1.4rem; margin-bottom: 0.6rem; }

  .row-reading { display: none; }
  .row-name { min-width: 100px; font-size: 1.1rem; }

  .terms-list { padding: 0 0.5rem; }
}

@media (max-width: 480px) {
  .hero { padding: 5.5rem 1rem 1.5rem; min-height: 40vh; }
  .hero-logo { font-size: clamp(1.5rem, 8vw, 2.5rem); }
  .search-input { font-size: 16px; }
  .browse-link { padding: 0.75rem 0.75rem 0.5rem; touch-action: manipulation; }

  .all-terms-modal { padding: 4.5rem 0.8rem 1.5rem; }

  .alpha-tabs { margin: 1rem auto 1.5rem; gap: 0.2rem; }
  .alpha-tab { font-size: 0.5rem; padding: 0.3rem 0.5rem; }

  .az-letter { font-size: 1.15rem; margin-bottom: 0.5rem; }
  .row-name { font-size: 1.05rem; min-width: 90px; }

  footer { padding: 1rem; font-size: 0.5rem; }
  .footer-mark { width: 16px; height: 16px; max-width: 16px; max-height: 16px; justify-self: center; }
}
