/* ===================================
   global.css - Design System
   =================================== */

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

/* ===================================
   CSS Custom Properties
   =================================== */
:root {
  /* Base */
  --color-bg: #f8f8f6;
  --color-surface: #ffffff;
  --color-border: #e8e8e4;

  /* Text */
  --color-text-primary: #1a1a1a;
  --color-text-secondary: #6b6b6b;
  --color-text-muted: #a8a8a8;

  /* Accent */
  --color-accent: #2d6cdf;
  --color-accent-light: #e8f0fd;
  --color-accent-dark: #1a4ba8;

  /* Game */
  --color-success: #16a34a;
  --color-error: #dc2626;
  --color-warning: #d97706;

  /* Game Dark Mode */
  --color-game-bg: #0f172a;
  --color-game-surface: #1e293b;
  --color-game-text: #f1f5f9;

  /* Typography */
  --font-display: 'Outfit', sans-serif;
  --font-body: 'Noto Sans JP', sans-serif;

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --text-hero: clamp(2.5rem, 6vw, 4.5rem);

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-24: 6rem;

  /* Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Shadow */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);

  /* Layout */
  --container: 1120px;
  --container-narrow: 720px;
}

/* ===================================
   Reset & Base
   =================================== */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text-primary);
  background-color: var(--color-bg);
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--color-accent-dark);
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

ul, ol {
  list-style: none;
}

/* ===================================
   Typography
   =================================== */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.3;
  color: var(--color-text-primary);
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }

/* ===================================
   Layout Utilities
   =================================== */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.container-narrow {
  width: 100%;
  max-width: var(--container-narrow);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

/* ===================================
   Header
   =================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(248, 248, 246, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
  transition: background 0.3s;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.site-logo {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.site-logo:hover {
  color: var(--color-text-primary);
}

.site-logo .logo-icon {
  font-size: var(--text-2xl);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-8);
}

.nav-links a {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-secondary);
  transition: color 0.2s;
  position: relative;
}

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

.nav-links a.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--color-accent);
  border-radius: var(--radius-full);
}

.nav-soon {
  color: var(--color-text-muted) !important;
  cursor: default;
  pointer-events: none;
}

.nav-soon::after {
  content: 'Soon';
  font-size: var(--text-xs);
  background: var(--color-border);
  color: var(--color-text-muted);
  padding: 1px 6px;
  border-radius: var(--radius-full);
  margin-left: var(--space-1);
  vertical-align: middle;
}

/* Language Switcher */
.lang-switcher {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  font-family: var(--font-display);
}

.lang-switcher a,
.lang-switcher span {
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  transition: all 0.2s;
}

.lang-switcher a:hover {
  color: var(--color-accent);
  background: var(--color-accent-light);
}

.lang-switcher .active {
  color: var(--color-accent);
  background: var(--color-accent-light);
  font-weight: 600;
}

/* Hamburger Menu (Mobile) */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: var(--space-2);
  cursor: pointer;
}

.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-text-primary);
  border-radius: 1px;
  transition: all 0.3s;
}

.hamburger.open span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.open span:nth-child(2) {
  opacity: 0;
}

.hamburger.open span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* Mobile Nav */
.mobile-nav {
  display: none;
  position: fixed;
  top: 64px;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(248, 248, 246, 0.98);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 99;
  padding: var(--space-8) var(--space-6);
}

.mobile-nav.open {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.mobile-nav a {
  font-size: var(--text-2xl);
  font-weight: 500;
  color: var(--color-text-primary);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-border);
}

.mobile-nav .lang-switcher {
  margin-top: var(--space-4);
  font-size: var(--text-sm);
  gap: var(--space-2);
}

/* ===================================
   Footer
   =================================== */
.site-footer {
  border-top: 1px solid var(--color-border);
  padding: var(--space-8) 0;
  margin-top: var(--space-24);
  text-align: center;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.footer-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: var(--space-6);
  margin-top: var(--space-4);
}

.footer-links a {
  color: var(--color-text-muted);
  font-size: var(--text-xs);
}

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

/* ===================================
   Buttons
   =================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--text-base);
  padding: var(--space-3) var(--space-8);
  border-radius: var(--radius-md);
  transition: all 0.2s;
  cursor: pointer;
  border: none;
  text-decoration: none;
}

.btn-primary {
  background: var(--color-accent);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: var(--color-accent-dark);
  color: #ffffff;
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

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

.btn-secondary:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.btn-lg {
  font-size: var(--text-lg);
  padding: var(--space-4) var(--space-12);
  border-radius: var(--radius-lg);
}

.btn-sm {
  font-size: var(--text-sm);
  padding: var(--space-2) var(--space-4);
}

/* ===================================
   Cards
   =================================== */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all 0.3s;
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card-body {
  padding: var(--space-6);
}

.card-disabled {
  opacity: 0.5;
  pointer-events: none;
}

.card-disabled:hover {
  box-shadow: none;
  transform: none;
}

/* ===================================
   Badge
   =================================== */
.badge {
  display: inline-block;
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 500;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  background: var(--color-accent-light);
  color: var(--color-accent);
}

.badge-muted {
  background: var(--color-border);
  color: var(--color-text-muted);
}

/* ===================================
   Section Utilities
   =================================== */
.section {
  padding: var(--space-24) 0;
}

.section-title {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: 700;
  margin-bottom: var(--space-4);
  text-align: center;
}

.section-subtitle {
  font-size: var(--text-lg);
  color: var(--color-text-secondary);
  text-align: center;
  margin-bottom: var(--space-12);
}

/* ===================================
   Search
   =================================== */

/* Trigger button */
.search-trigger {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  background: none;
  border: 1px solid var(--color-border);
  flex-shrink: 0;
}

.search-trigger:hover {
  color: var(--color-accent);
  border-color: var(--color-accent);
  background: var(--color-accent-light);
}

/* Overlay */
.search-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  justify-content: center;
  padding: var(--space-16) var(--space-6) var(--space-6);
}

.search-overlay.open {
  display: flex;
}

/* Modal */
.search-modal {
  width: 100%;
  max-width: 560px;
  max-height: 70vh;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: searchFadeIn 0.15s ease-out;
}

@keyframes searchFadeIn {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.search-modal-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--color-border);
}

.search-input-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.search-input-icon {
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  border: none;
  outline: none;
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text-primary);
  background: transparent;
}

.search-input::placeholder {
  color: var(--color-text-muted);
}

.search-close-btn {
  font-size: var(--text-2xl);
  color: var(--color-text-muted);
  line-height: 1;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

.search-close-btn:hover {
  color: var(--color-text-primary);
  background: var(--color-bg);
}

/* Results */
.search-results {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4) var(--space-4);
}

.search-hint,
.search-no-result {
  text-align: center;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  padding: var(--space-8) 0;
}

.search-result-item {
  display: block;
  padding: var(--space-4);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: inherit;
  transition: background 0.15s;
}

.search-result-item:hover {
  background: var(--color-bg);
  color: inherit;
}

.search-result-type {
  display: inline-block;
  margin-bottom: var(--space-2);
}

.search-result-title {
  display: block;
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: var(--space-1);
}

.search-result-desc {
  display: block;
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (max-width: 768px) {
  .search-overlay {
    padding: var(--space-8) var(--space-4) var(--space-4);
  }

  .search-modal {
    max-height: 80vh;
  }
}

/* ===================================
   Responsive
   =================================== */
@media (max-width: 768px) {
  .nav-links {
    display: none;
  }

  .hamburger {
    display: flex;
  }

  h1 { font-size: var(--text-3xl); }
  h2 { font-size: var(--text-2xl); }
  h3 { font-size: var(--text-xl); }

  .section {
    padding: var(--space-16) 0;
  }

  .container,
  .container-narrow {
    padding: 0 var(--space-4);
  }

  .btn-lg {
    width: 100%;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .header-inner {
    height: 56px;
  }

  .site-logo {
    font-size: var(--text-lg);
  }
}
