/* ============================================
   xLab株式会社 - Shared Stylesheet
   ============================================ */

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

:root {
  --bg-deep: #0a0e1a;
  --bg-card: #0f172a;
  --bg-surface: #1e293b;
  --cyan: #00d4ff;
  --cyan-dim: rgba(0, 212, 255, 0.15);
  --purple: #7c3aed;
  --purple-dim: rgba(124, 58, 237, 0.15);
  --amber: #f59e0b;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #475569;
  --border: rgba(255,255,255,0.07);
  --glow-cyan: 0 0 20px rgba(0, 212, 255, 0.3);
  --glow-purple: 0 0 20px rgba(124, 58, 237, 0.3);
  --font-jp: 'Noto Sans JP', sans-serif;
  --font-mono: 'Space Mono', monospace;
  --font-display: 'Syne', sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-jp);
  background-color: var(--bg-deep);
  color: var(--text-primary);
  line-height: 1.7;
  font-size: 16px;
  overflow-x: hidden;
}

/* Noise texture overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9999;
  opacity: 0.5;
}

/* ============ NAVIGATION ============ */
nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 5%;
  height: 70px;
  background: rgba(10, 14, 26, 0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

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

.nav-logo img { height: 36px; }

.nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
}

.nav-links a {
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-family: var(--font-jp);
  font-weight: 500;
  letter-spacing: 0.05em;
  transition: color 0.3s;
  position: relative;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--cyan);
  transition: width 0.3s;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--cyan);
}

.nav-links a:hover::after,
.nav-links a.active::after {
  width: 100%;
}

.nav-cta {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1.2rem;
  border: 1px solid var(--cyan);
  color: var(--cyan) !important;
  border-radius: 4px;
  font-size: 0.85rem !important;
  transition: all 0.3s !important;
}

.nav-cta::after { display: none !important; }

.nav-cta:hover {
  background: var(--cyan-dim) !important;
  box-shadow: var(--glow-cyan) !important;
  color: var(--cyan) !important;
}

/* ============ LAYOUT ============ */
main { padding-top: 70px; }

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 5%;
}

section {
  padding: 6rem 0;
}

/* ============ TYPOGRAPHY ============ */
.label {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 1rem;
  opacity: 0.8;
}

h1, h2, h3 {
  font-family: var(--font-display);
}

h1 {
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

h2 {
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  font-weight: 700;
  line-height: 1.2;
}

h3 {
  font-size: 1.3rem;
  font-weight: 600;
}

p { color: var(--text-secondary); }

/* ============ GRADIENT TEXT ============ */
.gradient-text {
  background: linear-gradient(135deg, var(--cyan), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ============ CARDS ============ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--cyan-dim), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}

.card:hover {
  border-color: rgba(0, 212, 255, 0.3);
  box-shadow: var(--glow-cyan);
  transform: translateY(-4px);
}

.card:hover::before { opacity: 1; }

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.9rem 2rem;
  border-radius: 6px;
  font-family: var(--font-jp);
  font-weight: 500;
  font-size: 0.95rem;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: all 0.3s;
}

.btn-primary {
  background: linear-gradient(135deg, var(--cyan), var(--purple));
  color: white;
  box-shadow: 0 4px 20px rgba(0, 212, 255, 0.2);
}

.btn-primary:hover {
  box-shadow: 0 6px 30px rgba(0, 212, 255, 0.4);
  transform: translateY(-2px);
}

.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-outline:hover {
  border-color: var(--cyan);
  color: var(--cyan);
  background: var(--cyan-dim);
}

/* ============ SECTION HEADER ============ */
.section-header {
  margin-bottom: 4rem;
}

.section-header p {
  max-width: 600px;
  margin-top: 1rem;
  font-size: 1.05rem;
}

/* ============ DIVIDER ============ */
.divider {
  width: 60px;
  height: 2px;
  background: linear-gradient(90deg, var(--cyan), var(--purple));
  margin: 1.5rem 0;
  border-radius: 2px;
}

/* ============ TAG ============ */
.tag {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 100px;
  font-size: 0.78rem;
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
}

.tag-cyan {
  background: var(--cyan-dim);
  color: var(--cyan);
  border: 1px solid rgba(0, 212, 255, 0.2);
}

.tag-purple {
  background: var(--purple-dim);
  color: #a78bfa;
  border: 1px solid rgba(124, 58, 237, 0.2);
}

/* ============ FOOTER ============ */
footer {
  border-top: 1px solid var(--border);
  padding: 3rem 5%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.footer-links {
  display: flex;
  gap: 2rem;
  list-style: none;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  transition: color 0.3s;
}

.footer-links a:hover { color: var(--cyan); }

.footer-copy {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ============ ANIMATIONS ============ */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 10px rgba(0, 212, 255, 0.2); }
  50% { box-shadow: 0 0 30px rgba(0, 212, 255, 0.5); }
}

.fade-in {
  animation: fadeInUp 0.8s ease forwards;
}

.fade-in-1 { animation-delay: 0.1s; }
.fade-in-2 { animation-delay: 0.2s; }
.fade-in-3 { animation-delay: 0.3s; }
.fade-in-4 { animation-delay: 0.4s; }

/* ============ HERO ============ */
.hero {
  min-height: calc(100vh - 70px);
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 4rem;
  padding: 5rem 5%;
}

.hero-content { position: relative; z-index: 1; }

.hero-tagline {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  color: var(--cyan);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.hero-tagline::before {
  content: '';
  width: 30px;
  height: 1px;
  background: var(--cyan);
}

.hero-title {
  margin-bottom: 1.5rem;
}

.hero-desc {
  font-size: 1.05rem;
  line-height: 1.8;
  max-width: 480px;
  margin-bottom: 2.5rem;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.hero-image {
  position: relative;
  animation: float 6s ease-in-out infinite;
}

.hero-image img {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
}

/* ============ GRID LAYOUTS ============ */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: center;
}

/* ============ STAT ROW ============ */
.stats-row {
  display: flex;
  gap: 3rem;
  flex-wrap: wrap;
  padding: 2.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin: 4rem 0;
}

.stat-item { flex: 1; min-width: 150px; }

.stat-number {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--cyan), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  margin-bottom: 0.5rem;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-family: var(--font-jp);
}

/* ============ TIMELINE ============ */
.timeline {
  position: relative;
  padding-left: 2rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 1px;
  background: linear-gradient(to bottom, var(--cyan), var(--purple), transparent);
}

.timeline-item {
  position: relative;
  padding-bottom: 2rem;
  padding-left: 1.5rem;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -2.4rem;
  top: 6px;
  width: 8px;
  height: 8px;
  background: var(--cyan);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--cyan);
}

.timeline-date {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--cyan);
  margin-bottom: 0.3rem;
  letter-spacing: 0.05em;
}

.timeline-title {
  font-family: var(--font-jp);
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
  margin-bottom: 0.3rem;
}

.timeline-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
}

/* ============ PAGE HERO ============ */
.page-hero {
  padding: 5rem 5% 4rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(0, 212, 255, 0.03) 0%, transparent 100%);
}

.page-hero .label { display: block; margin-bottom: 1rem; }

/* ============ CONTACT FORM ============ */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-family: var(--font-jp);
}

.form-group input,
.form-group textarea,
.form-group select {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.85rem 1rem;
  color: var(--text-primary);
  font-family: var(--font-jp);
  font-size: 0.95rem;
  transition: border-color 0.3s, box-shadow 0.3s;
  width: 100%;
  outline: none;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
}

.form-group textarea {
  min-height: 150px;
  resize: vertical;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* ============ ICON BOX ============ */
.icon-box {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 1.25rem;
  flex-shrink: 0;
}

.icon-cyan { background: var(--cyan-dim); border: 1px solid rgba(0,212,255,0.2); }
.icon-purple { background: var(--purple-dim); border: 1px solid rgba(124,58,237,0.2); }

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
  .hero { grid-template-columns: 1fr; }
  .hero-image { display: none; }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .nav-links { display: none; }
  .stats-row { gap: 1.5rem; }
}

/* ============ PRINT STYLES ============ */
@media print {
  nav, footer, .btn, .hero-image { display: none !important; }
  body { background: white; color: #000; }
  a { color: #000; }
  .gradient-text { -webkit-text-fill-color: #000 !important; }
}

/* ============ SCROLL ANIMATIONS ============ */
.card, .timeline-item, .expertise-item,
.usecase-item, .grant-item, .paper-item,
.research-area-card, .service-hero-card,
.pricing-card, .contact-method, .faq-item {
  transition: opacity 0.6s ease, transform 0.6s ease, box-shadow 0.3s, border-color 0.3s, background 0.3s;
}

/* ============ SKIP LINK (accessibility) ============ */
.skip-link {
  position: absolute;
  top: -100px;
  left: 1rem;
  background: var(--cyan);
  color: #000;
  padding: 0.5rem 1rem;
  border-radius: 0 0 6px 6px;
  font-family: var(--font-jp);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  z-index: 9999;
  transition: top 0.3s;
}
.skip-link:focus { top: 0; }

/* ============ SELECTION COLOR ============ */
::selection {
  background: rgba(0, 212, 255, 0.25);
  color: var(--text-primary);
}

/* ============ SCROLLBAR ============ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb {
  background: linear-gradient(to bottom, var(--cyan), var(--purple));
  border-radius: 3px;
}

/* ============ FOCUS RING ============ */
:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ============ BACK TO TOP ============ */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 44px;
  height: 44px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 1.2rem;
  cursor: pointer;
  text-decoration: none;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.3s, transform 0.3s, border-color 0.3s, color 0.3s;
  z-index: 500;
}
.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
}
.back-to-top:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}