/* ===================================
   cocoeki — style.css
   株式会社ヒューマニティドットジャパン
   =================================== */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@300;400;500;700&family=DM+Mono:wght@400;500&family=Syne:wght@700;800&display=swap');

/* ---- CSS Variables ---- */
:root {
  --accent: #4f8ef7;
  --accent-2: #f7a34f;
  --accent-glow: rgba(79,142,247,0.18);
  --radius: 12px;
  --radius-sm: 7px;
  --transition: 0.22s cubic-bezier(.4,0,.2,1);
  --font-main: 'Noto Sans JP', sans-serif;
  --font-mono: 'DM Mono', monospace;
  --font-display: 'Syne', sans-serif;
}

/* ---- DARK THEME (default) ---- */
[data-theme="dark"], :root {
  --bg: #0d0f14;
  --bg-2: #13161e;
  --bg-3: #1a1e29;
  --bg-card: #181c27;
  --bg-hover: #202535;
  --border: rgba(255,255,255,0.07);
  --border-accent: rgba(79,142,247,0.3);
  --text: #e8ecf4;
  --text-2: #8b93aa;
  --text-3: #555d75;
  --logo-color: #4f8ef7;
  --shadow: 0 4px 24px rgba(0,0,0,0.5);
  --shadow-card: 0 2px 12px rgba(0,0,0,0.35);
  --tag-bg: rgba(79,142,247,0.12);
  --tag-color: #7aadff;
  --hero-gradient: linear-gradient(135deg, #0d0f14 0%, #131825 50%, #0d1520 100%);
  --nav-bg: rgba(13,15,20,0.88);
}

/* ---- LIGHT THEME ---- */
[data-theme="light"] {
  --bg: #f4f6fb;
  --bg-2: #ffffff;
  --bg-3: #eef1f8;
  --bg-card: #ffffff;
  --bg-hover: #e8edf8;
  --border: rgba(0,0,0,0.07);
  --border-accent: rgba(79,142,247,0.35);
  --text: #1a1e2e;
  --text-2: #5a6280;
  --text-3: #9aa0b8;
  --logo-color: #2a6ef0;
  --shadow: 0 4px 24px rgba(100,120,180,0.12);
  --shadow-card: 0 2px 12px rgba(100,120,180,0.1);
  --tag-bg: rgba(42,110,240,0.09);
  --tag-color: #2a6ef0;
  --hero-gradient: linear-gradient(135deg, #e8edf8 0%, #f4f6fb 50%, #dde5f5 100%);
  --nav-bg: rgba(244,246,251,0.9);
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-main);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
  transition: background var(--transition), color var(--transition);
}
a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-2); }
ul { list-style: none; }
img { max-width: 100%; }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-2); }
::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 3px; }

/* ============================
   NAVIGATION
   ============================ */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--nav-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 0;
  transition: background var(--transition);
}
.nav-inner {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-logo {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--logo-color) !important;
  letter-spacing: -0.03em;
  margin-right: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.nav-logo .logo-icon {
  width: 28px;
  height: 28px;
  background: var(--accent);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
}
.nav-links a {
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text-2);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  white-space: nowrap;
}
.nav-links a:hover, .nav-links a.active {
  color: var(--text);
  background: var(--bg-hover);
}
.nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}
.theme-toggle {
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text-2);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 0.78rem;
  font-family: var(--font-main);
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.theme-toggle:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.nav-search-btn {
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text-2);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font-main);
  display: flex;
  align-items: center;
  gap: 6px;
}
.nav-search-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
}

/* ============================
   HERO
   ============================ */
.hero {
  background: var(--hero-gradient);
  border-bottom: 1px solid var(--border);
  padding: 64px 24px 56px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 20% 50%, var(--accent-glow), transparent),
    radial-gradient(ellipse 40% 60% at 80% 30%, rgba(247,163,79,0.07), transparent);
  pointer-events: none;
}
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--tag-bg);
  color: var(--tag-color);
  font-size: 0.75rem;
  font-weight: 500;
  font-family: var(--font-mono);
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid var(--border-accent);
  margin-bottom: 20px;
  letter-spacing: 0.05em;
}
.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.04em;
  line-height: 1.15;
  margin-bottom: 14px;
}
.hero h1 span { color: var(--accent); }
.hero p {
  font-size: 1rem;
  color: var(--text-2);
  max-width: 520px;
  margin: 0 auto 32px;
}
.hero-stats {
  display: flex;
  gap: 32px;
  justify-content: center;
  flex-wrap: wrap;
}
.hero-stat {
  text-align: center;
}
.hero-stat .num {
  font-family: var(--font-mono);
  font-size: 1.6rem;
  font-weight: 500;
  color: var(--accent);
  display: block;
}
.hero-stat .label {
  font-size: 0.75rem;
  color: var(--text-3);
  letter-spacing: 0.05em;
}

/* ============================
   SEARCH BAR
   ============================ */
.search-wrap {
  max-width: 600px;
  margin: 0 auto 0;
  padding: 28px 24px 0;
}
.search-box {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: 48px;
  padding: 6px 6px 6px 20px;
  gap: 8px;
  transition: border-color var(--transition), box-shadow var(--transition);
  box-shadow: var(--shadow-card);
}
.search-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.search-box input {
  flex: 1;
  border: none;
  background: transparent;
  font-family: var(--font-main);
  font-size: 0.95rem;
  color: var(--text);
  outline: none;
}
.search-box input::placeholder { color: var(--text-3); }
.search-box button {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 40px;
  padding: 9px 22px;
  font-family: var(--font-main);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.search-box button:hover { background: #3a7de8; transform: scale(1.03); }

/* GPS button */
.btn-gps {
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text-2);
  border-radius: 40px;
  padding: 9px 16px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font-main);
  white-space: nowrap;
}
.btn-gps:hover { background: var(--bg-hover); color: var(--text); }

/* ============================
   MAIN LAYOUT
   ============================ */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}
.section {
  padding: 48px 0 0;
}
.section-title {
  font-size: 0.72rem;
  font-weight: 500;
  font-family: var(--font-mono);
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 14px;
  background: var(--accent);
  border-radius: 2px;
}

/* ============================
   AREA TABS
   ============================ */
.area-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 28px;
}
.area-tab {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-2);
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font-main);
}
.area-tab:hover, .area-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ============================
   LINE CARDS / GRID
   ============================ */
.lines-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  margin-bottom: 32px;
}
.line-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}
.line-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
  opacity: 0;
  transition: opacity var(--transition);
}
.line-card:hover {
  border-color: var(--border-accent);
  background: var(--bg-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.line-card:hover::before { opacity: 1; }
.line-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--tag-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.line-info { flex: 1; min-width: 0; }
.line-name {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.line-meta {
  font-size: 0.75rem;
  color: var(--text-3);
  font-family: var(--font-mono);
  margin-top: 2px;
}
.line-arrow {
  color: var(--text-3);
  font-size: 0.9rem;
  flex-shrink: 0;
  transition: transform var(--transition), color var(--transition);
}
.line-card:hover .line-arrow {
  color: var(--accent);
  transform: translateX(3px);
}

/* ============================
   STATION LIST
   ============================ */
.station-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 32px;
  box-shadow: var(--shadow-card);
}
.station-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--transition);
  position: relative;
}
.station-item:last-child { border-bottom: none; }
.station-item:hover { background: var(--bg-hover); }
.station-num {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-3);
  width: 28px;
  flex-shrink: 0;
  text-align: right;
}
.station-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
  flex-shrink: 0;
}
.station-name-wrap { flex: 1; min-width: 0; }
.station-name {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text);
}
.station-pref {
  font-size: 0.72rem;
  color: var(--text-3);
  font-family: var(--font-mono);
}
.station-badges {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.badge {
  background: var(--tag-bg);
  color: var(--tag-color);
  font-size: 0.68rem;
  font-family: var(--font-mono);
  padding: 2px 8px;
  border-radius: 20px;
  border: 1px solid var(--border-accent);
  white-space: nowrap;
}

/* ============================
   STATION DETAIL PAGE
   ============================ */
.detail-header {
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  padding: 40px 24px 32px;
}
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--text-3);
  margin-bottom: 16px;
  font-family: var(--font-mono);
}
.breadcrumb a { color: var(--text-2); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb span { color: var(--text-3); }
.detail-title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text);
  margin-bottom: 8px;
}
.detail-title span { color: var(--accent); }
.detail-subtitle {
  font-size: 0.88rem;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 24px;
  padding: 32px 0 48px;
}
@media (max-width: 800px) {
  .detail-grid { grid-template-columns: 1fr; }
}
.info-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-card);
  margin-bottom: 16px;
}
.info-card h3 {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}
.info-row:last-child { border-bottom: none; }
.info-label { color: var(--text-2); }
.info-value {
  font-family: var(--font-mono);
  color: var(--text);
  font-size: 0.84rem;
}
.neighbor-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 4px;
}
.neighbor-btn {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  cursor: pointer;
  font-family: var(--font-main);
  font-size: 0.82rem;
  color: var(--text-2);
  transition: all var(--transition);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.neighbor-btn .dir { font-size: 0.68rem; color: var(--text-3); font-family: var(--font-mono); }
.neighbor-btn .nname { font-weight: 500; color: var(--text); }
.neighbor-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.neighbor-btn:hover .dir,
.neighbor-btn:hover .nname { color: #fff; }
.neighbor-btn.disabled {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}

/* MAP */
#station-map {
  width: 100%;
  height: 320px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-3);
  overflow: hidden;
}

/* ============================
   MAP PAGE
   ============================ */
.map-page-wrap {
  display: grid;
  grid-template-columns: 300px 1fr;
  height: calc(100vh - 60px);
  overflow: hidden;
}
@media (max-width: 700px) {
  .map-page-wrap {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    height: auto;
  }
}
.map-sidebar {
  border-right: 1px solid var(--border);
  background: var(--bg-2);
  overflow-y: auto;
  padding: 20px 16px;
}
.map-sidebar h2 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 14px;
}
#main-map {
  width: 100%;
  height: 100%;
  background: var(--bg-3);
  min-height: 400px;
}

/* ============================
   SEARCH PAGE
   ============================ */
.search-page-hero {
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  padding: 48px 24px 36px;
  text-align: center;
}
.search-page-hero h1 {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  margin-bottom: 20px;
}
.search-results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.result-count {
  font-size: 0.78rem;
  font-family: var(--font-mono);
  color: var(--text-3);
}

/* ============================
   LOADING / EMPTY STATES
   ============================ */
.loading-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  gap: 16px;
}
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text {
  font-size: 0.82rem;
  color: var(--text-3);
  font-family: var(--font-mono);
}
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-3);
  font-size: 0.88rem;
}
.empty-icon { font-size: 2.5rem; margin-bottom: 10px; }

/* ============================
   FOOTER
   ============================ */
.footer {
  border-top: 1px solid var(--border);
  padding: 36px 24px;
  margin-top: 64px;
  background: var(--bg-2);
}
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 32px;
  flex-wrap: wrap;
}
.footer-brand .logo {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--logo-color);
  letter-spacing: -0.03em;
  margin-bottom: 6px;
}
.footer-brand p {
  font-size: 0.78rem;
  color: var(--text-3);
  max-width: 260px;
  line-height: 1.6;
}
.footer-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.footer-links a {
  font-size: 0.82rem;
  color: var(--text-2);
  transition: color var(--transition);
}
.footer-links a:hover { color: var(--accent); }
.footer-bottom {
  max-width: 1200px;
  margin: 24px auto 0;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.74rem;
  color: var(--text-3);
  font-family: var(--font-mono);
}
.footer-bottom a { color: var(--text-3); }
.footer-bottom a:hover { color: var(--accent); }

/* ============================
   RESPONSIVE
   ============================ */
@media (max-width: 640px) {
  .nav-links { display: none; }
  .hero { padding: 40px 16px 36px; }
  .lines-grid { grid-template-columns: 1fr; }
  .hero-stats { gap: 20px; }
  .footer-inner { flex-direction: column; }
}

/* ============================
   ANIMATIONS
   ============================ */
.fade-in {
  animation: fadeIn 0.35s ease both;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.stagger > * {
  animation: fadeIn 0.3s ease both;
}
.stagger > *:nth-child(1) { animation-delay: 0.03s; }
.stagger > *:nth-child(2) { animation-delay: 0.06s; }
.stagger > *:nth-child(3) { animation-delay: 0.09s; }
.stagger > *:nth-child(4) { animation-delay: 0.12s; }
.stagger > *:nth-child(5) { animation-delay: 0.15s; }
.stagger > *:nth-child(6) { animation-delay: 0.18s; }
.stagger > *:nth-child(n+7) { animation-delay: 0.20s; }

/* ============================
   BACK TO TOP
   ============================ */
.back-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 40px;
  height: 40px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 1rem;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: all var(--transition);
  box-shadow: 0 4px 12px rgba(79,142,247,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
}
.back-top.visible {
  opacity: 1;
  pointer-events: all;
}
.back-top:hover { transform: translateY(-3px); }

/* ============================
   INLINE MAP (Leaflet override)
   ============================ */
.leaflet-container {
  background: var(--bg-3) !important;
  font-family: var(--font-main) !important;
}
[data-theme="dark"] .leaflet-tile {
  filter: brightness(0.75) saturate(0.7) hue-rotate(180deg) invert(1);
}
