/* ===========================
   cocotrain — CSS
   humanity-japan.jp
   =========================== */

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

/* ── CSS Variables ── */
:root {
  --bg:           #f7f7f5;
  --bg-card:      #ffffff;
  --bg-nav:       #ffffff;
  --text-primary: #1a1a1a;
  --text-secondary: #666666;
  --text-muted:   #999999;
  --border:       #e8e8e4;
  --border-light: #f0f0ec;
  --accent:       #1a4fff;
  --accent-light: #e8eeff;
  --delay:        #e53935;
  --delay-light:  #fdecea;
  --warning:      #fb8c00;
  --warning-light:#fff3e0;
  --ok:           #2e7d32;
  --ok-light:     #e8f5e9;
  --shadow-sm:    0 1px 4px rgba(0,0,0,0.06);
  --shadow-md:    0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg:    0 8px 32px rgba(0,0,0,0.10);
  --radius:       12px;
  --radius-sm:    8px;
  --transition:   0.2s ease;
}

[data-theme="dark"] {
  --bg:           #111113;
  --bg-card:      #1c1c1f;
  --bg-nav:       #161618;
  --text-primary: #f0f0ee;
  --text-secondary: #a0a0a0;
  --text-muted:   #606060;
  --border:       #2a2a2e;
  --border-light: #222226;
  --accent:       #5b84ff;
  --accent-light: #1a2040;
  --delay:        #ef5350;
  --delay-light:  #2a1212;
  --warning:      #ffa726;
  --warning-light:#2a1f0a;
  --ok:           #66bb6a;
  --ok-light:     #0a1f0c;
  --shadow-sm:    0 1px 4px rgba(0,0,0,0.3);
  --shadow-md:    0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg:    0 8px 32px rgba(0,0,0,0.5);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: 'Noto Sans JP', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  transition: background var(--transition), color var(--transition);
  min-height: 100vh;
}

/* ── Nav ── */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-nav);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: background var(--transition), border-color var(--transition);
}
.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}
.nav-logo-mark {
  width: 32px;
  height: 32px;
  background: var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}
.nav-logo-text {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}
.nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
}
.nav-links {
  display: flex;
  gap: 4px;
  list-style: none;
}
.nav-links a {
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition);
}
.nav-links a:hover,
.nav-links a.active {
  background: var(--accent-light);
  color: var(--accent);
}
.theme-toggle {
  background: var(--border);
  border: none;
  border-radius: 20px;
  width: 52px;
  height: 28px;
  position: relative;
  cursor: pointer;
  transition: background var(--transition);
}
.theme-toggle::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  transition: transform var(--transition);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
[data-theme="dark"] .theme-toggle {
  background: var(--accent);
}
[data-theme="dark"] .theme-toggle::after {
  transform: translateX(24px);
}
.theme-toggle-icon {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  pointer-events: none;
}
.theme-toggle-icon.sun { left: 6px; }
.theme-toggle-icon.moon { right: 5px; }

/* ── Hero ── */
.hero {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 48px 24px 40px;
}
.hero-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.hero-text h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 8px;
}
.hero-text h1 span {
  color: var(--accent);
}
.hero-text p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}
.hero-stats {
  display: flex;
  gap: 24px;
}
.stat-item {
  text-align: center;
}
.stat-num {
  font-family: 'DM Mono', monospace;
  font-size: 1.8rem;
  font-weight: 500;
  color: var(--accent);
  line-height: 1;
}
.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── Main Layout ── */
.main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

/* ── Status Banner ── */
.status-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-radius: var(--radius);
  margin-bottom: 28px;
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid;
  animation: fadeInDown 0.4s ease;
}
.status-banner.all-ok {
  background: var(--ok-light);
  border-color: var(--ok);
  color: var(--ok);
}
.status-banner.has-delay {
  background: var(--delay-light);
  border-color: var(--delay);
  color: var(--delay);
}
.status-banner.loading {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
}
.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.status-dot.pulse {
  animation: pulse 1.5s infinite;
}
.last-updated {
  margin-left: auto;
  font-family: 'DM Mono', monospace;
  font-size: 0.78rem;
  opacity: 0.8;
}

/* ── Filter Bar ── */
.filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.filter-btn {
  padding: 7px 16px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-family: 'Noto Sans JP', sans-serif;
  cursor: pointer;
  transition: all var(--transition);
  font-weight: 500;
}
.filter-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ── Section Title ── */
.section-title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
  padding-left: 2px;
}

/* ── Delay Alert Cards ── */
.delay-section {
  margin-bottom: 32px;
}
.delay-cards {
  display: grid;
  gap: 10px;
}
.delay-card {
  background: var(--delay-light);
  border: 1px solid var(--delay);
  border-left: 4px solid var(--delay);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  animation: slideIn 0.3s ease;
  transition: box-shadow var(--transition);
}
.delay-card:hover {
  box-shadow: var(--shadow-md);
}
.delay-card-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
}
.delay-card-body {
  flex: 1;
}
.delay-card-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--delay);
}
.delay-card-company {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 2px;
}
.delay-card-time {
  font-family: 'DM Mono', monospace;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.delay-badge {
  background: var(--delay);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── All-OK message ── */
.all-ok-msg {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-secondary);
}
.all-ok-msg .ok-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}
.all-ok-msg p {
  font-size: 0.9rem;
}

/* ── Lines Grid ── */
.lines-section {
  margin-bottom: 32px;
}
.lines-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}
.line-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}
.line-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.line-card.delayed {
  border-color: var(--delay);
  border-left-width: 4px;
  background: var(--delay-light);
}
.line-color-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}
.line-card-info {
  flex: 1;
  min-width: 0;
}
.line-card-name {
  font-weight: 600;
  font-size: 0.875rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.line-card-company {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.line-status-tag {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
  flex-shrink: 0;
}
.tag-ok {
  background: var(--ok-light);
  color: var(--ok);
}
.tag-delay {
  background: var(--delay-light);
  color: var(--delay);
}

/* ── Company Links ── */
.links-section {
  margin-bottom: 32px;
}
.links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}
.link-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  text-decoration: none;
  color: inherit;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}
.link-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.link-card-icon {
  font-size: 1.5rem;
  width: 40px;
  height: 40px;
  background: var(--accent-light);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.link-card-body h3 {
  font-size: 0.875rem;
  font-weight: 600;
}
.link-card-body p {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 2px;
}
.link-card-arrow {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 1rem;
  flex-shrink: 0;
}

/* ── Refresh Button ── */
.refresh-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 auto 32px;
  padding: 10px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 24px;
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}
.refresh-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.refresh-btn.spinning .refresh-icon {
  animation: spin 0.8s linear infinite;
}

/* ── Footer ── */
.footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 40px 24px;
}
.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  align-items: start;
}
.footer-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.footer-brand-mark {
  width: 28px;
  height: 28px;
  background: var(--accent);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}
.footer-brand-name {
  font-weight: 700;
  font-size: 1rem;
}
.footer-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.7;
}
.footer-company {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 8px;
}
.footer-links {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
}
.footer-links a {
  font-size: 0.82rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition);
}
.footer-links a:hover {
  color: var(--accent);
}
.footer-bottom {
  max-width: 1100px;
  margin: 24px auto 0;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.footer-bottom a {
  color: var(--text-muted);
  text-decoration: none;
}
.footer-bottom a:hover {
  color: var(--accent);
}

/* ── Skeleton ── */
.skeleton {
  background: linear-gradient(90deg, var(--border) 25%, var(--border-light) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
}
.skeleton-card {
  height: 70px;
  border-radius: var(--radius);
  margin-bottom: 10px;
}

/* ── Animations ── */
@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes slideIn {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Hamburger ── */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}
.hamburger span {
  width: 22px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: all var(--transition);
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .hamburger { display: flex; }
  .hero-text h1 { font-size: 1.5rem; }
  .hero-stats { gap: 16px; }
  .stat-num { font-size: 1.4rem; }
  .lines-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .links-grid { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr; }
  .footer-links { align-items: flex-start; }
  .footer-bottom { flex-direction: column; }
  .filter-bar { gap: 6px; }
  .filter-btn { padding: 6px 12px; font-size: 0.78rem; }
}
