/* ===================================
   共通コンポーネントスタイル
   css/components.css
   
   @description 全ページで再利用可能なUIコンポーネント
   @author Research Portfolio Team
   @version 1.0.0
   =================================== */

/* ===================================
   Base Variables & Utilities
   =================================== */
:root {
  /* Core Design System Colors */
  --primary-blue: #6c584c;
  --warm-orange: #e2c4a6;
  --success-green: #7a9d74;
  --accent-purple: #8f6f5b;
  --warning-yellow: #f0d8b8;
  --error-red: #b2645b;
  
  /* Neutral Colors */
  --dark-navy: #3f2f28;
  --medium-gray: #5f4c42;
  --light-gray: #f7f1e6;
  --white: #ffffff;
  
  /* Text Colors */
  --text-primary: #322620;
  --text-secondary: #5f4c42;
  --text-light: rgba(252, 247, 238, 0.92);
  --text-muted: rgba(98, 81, 71, 0.55);
  
  /* Background Colors */
  --bg-primary: #f7f1e6;
  --bg-secondary: #f0e5d8;
  --bg-dark: #3f2f28;
  --bg-overlay: rgba(63, 47, 40, 0.82);
  
  /* Gradients */
  --gradient-primary: linear-gradient(135deg, var(--primary-blue), var(--warm-orange));
  --gradient-secondary: linear-gradient(135deg, var(--success-green), var(--primary-blue));
  --gradient-accent: linear-gradient(135deg, var(--accent-purple), var(--warm-orange));
  --gradient-subtle: linear-gradient(0deg, rgba(247, 241, 230, 0.95), rgba(247, 241, 230, 0.95));
  
  /* Shadows */
  --shadow-sm: 0 6px 18px rgba(108, 88, 76, 0.08);
  --shadow-md: 0 12px 26px rgba(108, 88, 76, 0.12);
  --shadow-lg: 0 18px 34px rgba(108, 88, 76, 0.16);
  --shadow-xl: 0 28px 46px rgba(108, 88, 76, 0.2);
  --shadow-colored: 0 14px 32px rgba(176, 138, 108, 0.2);
  
  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;
  
  /* Spacing Scale */
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2rem;
  --space-xl: 3rem;
  --space-2xl: 4rem;
  
  /* Typography */
  --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Consolas, 'Liberation Mono', monospace;
  
  /* Animation Timings */
  --timing-fast: 0.2s;
  --timing-normal: 0.3s;
  --timing-slow: 0.5s;
  --timing-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --timing-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
  --timing-elastic: cubic-bezier(0.175, 0.885, 0.32, 1.275);
  
  /* Z-Index Scale */
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-fixed: 300;
  --z-modal-backdrop: 400;
  --z-modal: 500;
  --z-tooltip: 600;
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
  line-height: 1.6;
}

body {
  font-family: var(--font-primary);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ===================================
   Container & Layout Components
   =================================== */
.container {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.container--wide {
  max-width: 1400px;
}

.container--narrow {
  max-width: 800px;
}

.container--fluid {
  max-width: none;
  width: 100%;
}

/* Section Components */
.section {
  padding: var(--space-2xl) 0;
}

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

.section--lg {
  padding: 6rem 0;
}

.section--xl {
  padding: 8rem 0;
}

/* ===================================
   Typography Components
   =================================== */
.section-header {
  text-align: center;
  margin-bottom: var(--space-2xl);
}

.section-title {
  font-size: clamp(2rem, 4vw, 2.5rem);
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
  margin-bottom: var(--space-md);
  letter-spacing: -0.02em;
}

.section-subtitle {
  font-size: 1.125rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.6;
}

.heading-1 {
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.heading-2 {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.heading-3 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 600;
  line-height: 1.3;
}

.text-gradient {
  color: var(--primary-blue);
}

.text-gradient--secondary {
  color: var(--warm-orange);
}

.text-gradient--accent {
  color: var(--accent-purple);
}

/* ===================================
   Button Components
   =================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-full);
  font-size: 0.95rem;
  font-weight: 600;
  font-family: var(--font-primary);
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all var(--timing-normal) var(--timing-smooth);
  position: relative;
  overflow: hidden;
  min-height: 48px; /* Accessibility: minimum touch target */
  
  /* Focus styles for accessibility */
  &:focus-visible {
    outline: 2px solid var(--primary-blue);
    outline-offset: 2px;
  }
}

/* Button Variants */
.btn--primary {
  background-color: var(--primary-blue);
  color: var(--text-inverse);
  box-shadow: var(--shadow-sm);
  border: 1px solid transparent;
  
  &:hover {
    transform: translateY(-2px);
    background-color: var(--warm-orange);
    color: var(--text-primary);
    box-shadow: var(--shadow-md);
  }
  
  &:active {
    transform: translateY(0);
    transition: transform 0.1s ease;
  }
}

.btn--secondary {
  background: transparent;
  color: var(--primary-blue);
  border: 1px solid var(--primary-blue);
  
  &:hover {
    background: rgba(108, 88, 76, 0.08);
    color: var(--primary-blue);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
  }
}

.btn--outline {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--medium-gray);
  
  &:hover {
    background: rgba(108, 88, 76, 0.08);
    color: var(--primary-blue);
    transform: translateY(-2px);
  }
}

.btn--success {
  background: var(--success-green);
  color: var(--text-inverse);
  border: 1px solid transparent;
  
  &:hover {
    background: #6a9163;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
  }
}

.btn--warning {
  background: var(--warning-yellow);
  color: var(--text-primary);
  border: 1px solid transparent;
  
  &:hover {
    background: #c89667;
    transform: translateY(-2px);
  }
}

.btn--error {
  background: var(--error-red);
  color: var(--text-inverse);
  border: 1px solid transparent;
  
  &:hover {
    background: #9a4f47;
    transform: translateY(-2px);
  }
}

/* Button Sizes */
.btn--sm {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  min-height: 40px;
}

.btn--lg {
  padding: 1rem 2rem;
  font-size: 1.125rem;
  min-height: 56px;
}

.btn--xl {
  padding: 1.25rem 2.5rem;
  font-size: 1.25rem;
  min-height: 64px;
}

/* Button States */
.btn:disabled,
.btn--disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.btn--loading {
  color: transparent;
  position: relative;
}

.btn--loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  border: 2px solid transparent;
  border-top: 2px solid currentColor;
  border-radius: 50%;
  animation: button-spin 1s linear infinite;
  color: inherit;
}

@keyframes button-spin {
  0% { transform: translate(-50%, -50%) rotate(0deg); }
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Button Icons */
.btn__icon {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

.btn--sm .btn__icon {
  width: 16px;
  height: 16px;
}

.btn--lg .btn__icon {
  width: 20px;
  height: 20px;
}

/* ===================================
   Navigation Components
   =================================== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-fixed);
  background: rgba(255, 255, 240, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(31, 61, 84, 0.14);
  padding: var(--space-md) 0;
  transition: all var(--timing-normal) var(--timing-smooth);
}

.navbar--scrolled {
  background: rgba(255, 255, 240, 0.96);
  box-shadow: var(--shadow-md);
  padding: var(--space-sm) 0;
}

.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-weight: 700;
  font-size: 1.5rem;
  font-family: var(--font-mono);
  background: var(--gradient-primary);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-decoration: none;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: var(--space-lg);
  margin: 0;
  padding: 0;
}

.nav-link {
  text-decoration: none;
  color: var(--text-secondary);
  font-weight: 500;
  position: relative;
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-full);
  transition: all var(--timing-normal) var(--timing-smooth);
}

.nav-link:hover,
.nav-link--active {
  color: var(--primary-blue);
  background: rgba(31, 61, 84, 0.08);
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--gradient-primary);
  transform: translateX(-50%);
  transition: width var(--timing-normal) var(--timing-smooth);
}

.nav-link:hover::after,
.nav-link--active::after {
  width: 80%;
}

/* Mobile Menu */
.mobile-menu-btn {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-xs);
  border-radius: var(--radius-sm);
  transition: all var(--timing-normal) var(--timing-smooth);
}

.mobile-menu-btn span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: all var(--timing-normal) var(--timing-smooth);
}

.mobile-menu-btn:hover {
  background: rgba(31, 61, 84, 0.08);
}

.mobile-menu-btn--active span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.mobile-menu-btn--active span:nth-child(2) {
  opacity: 0;
}

.mobile-menu-btn--active span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* ===================================
   Card Components
   =================================== */
.card {
  background: var(--bg-primary);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  transition: all var(--timing-normal) var(--timing-smooth);
  overflow: hidden;
  border: 1px solid rgba(31, 61, 84, 0.14);
}

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

.card--bordered {
  border: 2px solid rgba(31, 61, 84, 0.18);
}

.card--shadow-sm {
  box-shadow: var(--shadow-sm);
}

.card--shadow-lg {
  box-shadow: var(--shadow-lg);
}

.card__header {
  padding: var(--space-lg);
  border-bottom: 1px solid rgba(31, 61, 84, 0.14);
}

.card__content {
  padding: var(--space-lg);
}

.card__footer {
  padding: var(--space-lg);
  border-top: 1px solid rgba(31, 61, 84, 0.14);
  background: var(--bg-secondary);
}

/* ===================================
   Badge & Tag Components
   =================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge--primary {
  background: var(--primary-blue);
  color: var(--white);
}

.badge--secondary {
  background: var(--warm-orange);
  color: var(--white);
}

.badge--success {
  background: var(--success-green);
  color: var(--white);
}

.badge--warning {
  background: var(--warning-yellow);
  color: var(--white);
}

.badge--error {
  background: var(--error-red);
  color: var(--white);
}

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

.badge--subtle {
  background: rgba(31, 61, 84, 0.08);
  color: var(--primary-blue);
}

/* ===================================
   Loading & Animation Components
   =================================== */
.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(31, 61, 84, 0.16);
  border-top: 3px solid var(--primary-blue);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.loading-spinner--sm {
  width: 24px;
  height: 24px;
  border-width: 2px;
}

.loading-spinner--lg {
  width: 56px;
  height: 56px;
  border-width: 4px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Pulse Animation */
.pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* Fade In Animation */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.6s var(--timing-smooth);
}

.fade-in.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ===================================
   Utility Classes
   =================================== */

/* Spacing Utilities */
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: var(--space-xs); }
.mt-2 { margin-top: var(--space-sm); }
.mt-3 { margin-top: var(--space-md); }
.mt-4 { margin-top: var(--space-lg); }
.mt-5 { margin-top: var(--space-xl); }
.mt-6 { margin-top: var(--space-2xl); }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: var(--space-xs); }
.mb-2 { margin-bottom: var(--space-sm); }
.mb-3 { margin-bottom: var(--space-md); }
.mb-4 { margin-bottom: var(--space-lg); }
.mb-5 { margin-bottom: var(--space-xl); }
.mb-6 { margin-bottom: var(--space-2xl); }

.p-0 { padding: 0; }
.p-1 { padding: var(--space-xs); }
.p-2 { padding: var(--space-sm); }
.p-3 { padding: var(--space-md); }
.p-4 { padding: var(--space-lg); }
.p-5 { padding: var(--space-xl); }
.p-6 { padding: var(--space-2xl); }

/* Text Utilities */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-white { color: var(--white); }

.font-mono { font-family: var(--font-mono); }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }
.font-normal { font-weight: 400; }
.font-light { font-weight: 300; }

/* Display Utilities */
.hidden { display: none; }
.block { display: block; }
.inline { display: inline; }
.inline-block { display: inline-block; }
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }

/* Flexbox Utilities */
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-start { justify-content: flex-start; }
.justify-end { justify-content: flex-end; }

/* Background Utilities */
.bg-primary { background-color: var(--bg-primary); }
.bg-secondary { background-color: var(--bg-secondary); }
.bg-dark { background-color: var(--bg-dark); }
.bg-gradient { background: var(--gradient-primary); }

/* Border Utilities */
.rounded { border-radius: var(--radius-md); }
.rounded-sm { border-radius: var(--radius-sm); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-full { border-radius: var(--radius-full); }

/* Shadow Utilities */
.shadow { box-shadow: var(--shadow-md); }
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.shadow-xl { box-shadow: var(--shadow-xl); }
.shadow-none { box-shadow: none; }

/* Position Utilities */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }

/* Z-Index Utilities */
.z-dropdown { z-index: var(--z-dropdown); }
.z-sticky { z-index: var(--z-sticky); }
.z-fixed { z-index: var(--z-fixed); }
.z-modal { z-index: var(--z-modal); }

/* ===================================
   Responsive Design
   =================================== */
@media (max-width: 1024px) {
  .container {
    padding: 0 var(--space-md);
  }
  
  .section {
    padding: var(--space-xl) 0;
  }
}

@media (max-width: 768px) {
  /* Mobile Navigation */
  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-primary);
    box-shadow: var(--shadow-lg);
    flex-direction: column;
    padding: var(--space-md);
    gap: var(--space-sm);
  }
  
  .nav-links--open {
    display: flex;
  }
  
  .mobile-menu-btn {
    display: flex;
  }
  
  /* Mobile Typography */
  .section-title {
    font-size: clamp(1.75rem, 5vw, 2.25rem);
  }
  
  .section-subtitle {
    font-size: 1rem;
  }
  
  /* Mobile Container */
  .container {
    padding: 0 var(--space-sm);
  }
  
  /* Mobile Buttons */
  .btn {
    width: 100%;
    justify-content: center;
  }
  
  .btn--sm {
    width: auto;
  }
}

@media (max-width: 480px) {
  .section {
    padding: var(--space-lg) 0;
  }
  
  .section--lg {
    padding: var(--space-2xl) 0;
  }
}

/* ===================================
   Footer Icon Size Fix
   css/components.css または css/projects.css に追加
   =================================== */

/* Footer Social Links Fix */
.footer-social-link {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  text-decoration: none;
  transition: all 0.3s ease;
  flex-shrink: 0; /* 重要：サイズ固定 */
}

.footer-social-link svg {
  width: 18px !important;  /* !important で強制適用 */
  height: 18px !important;
  stroke-width: 2;
  fill: none;
  stroke: currentColor;
}

.footer-social-link:hover {
  background: var(--brand-primary);
  transform: translateY(-2px);
}

/* 全体的なSVGサイズ制御 */
.footer svg {
  max-width: 18px;
  max-height: 18px;
  width: 18px;
  height: 18px;
}

/* レスポンシブでの追加調整 */
@media (max-width: 768px) {
  .footer-social-link {
    width: 36px;
    height: 36px;
  }
  
  .footer-social-link svg {
    width: 16px !important;
    height: 16px !important;
  }
}
