/* ===== CSS Variables - Theme System ===== */
:root {
  --color-bg-primary: #fdfaf6;
  --color-bg-secondary: #f5ede4;
  --color-bg-tertiary: #ede1d5;
  --color-text-primary: #2a2a2c;
  --color-text-secondary: #5f5f61;
  --color-brand-primary: #9d7563;
  --color-brand-accent: #d4a89f;
  --color-brand-dark: #6f5549;
  --color-border: #d4d4d6;
  --color-shadow: rgba(0, 0, 0, 0.08);
  --color-gradient-light: linear-gradient(135deg, #fdfaf6 0%, #f5ede4 100%);
  --color-gradient-accent: linear-gradient(135deg, #9d7563 0%, #d4a89f 100%);

  --font-serif: 'Noto Serif JP', 'Georgia', serif;
  --font-sans: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --color-bg-primary: #1a1a1b;
  --color-bg-secondary: #2d2d2e;
  --color-bg-tertiary: #3a3a3c;
  --color-text-primary: #f5ede4;
  --color-text-secondary: #c9c0b5;
  --color-brand-primary: #c9a990;
  --color-brand-accent: #9d7563;
  --color-brand-dark: #d4a89f;
  --color-border: #3a3a3c;
  --color-shadow: rgba(0, 0, 0, 0.4);
  --color-gradient-light: linear-gradient(135deg, #1a1a1b 0%, #2d2d2e 100%);
  --color-gradient-accent: linear-gradient(135deg, #c9a990 0%, #9d7563 100%);
}

/* ===== Base Styles ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background-color: var(--color-bg-primary);
  color: var(--color-text-primary);
  transition: background-color var(--transition-smooth), color var(--transition-smooth);
  line-height: 1.6;
  letter-spacing: 0.3px;
}

h1, h2, h3, h4, h5, h6, .navbar-brand {
  font-family: var(--font-serif);
  color: var(--color-text-primary);
  font-weight: 400;
  letter-spacing: 0.5px;
}

h1 { font-size: 3.5rem; line-height: 1.2; }
h2 { font-size: 2.5rem; line-height: 1.3; }
h3 { font-size: 1.875rem; line-height: 1.4; }
h4 { font-size: 1.5rem; line-height: 1.4; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1rem; }

p { color: var(--color-text-secondary); margin-bottom: 1rem; }

a {
  color: var(--color-brand-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

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

/* ===== Navbar ===== */
.navbar {
  background-color: rgba(var(--color-bg-primary), 0.95) !important;
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-border);
  box-shadow: 0 2px 8px var(--color-shadow);
  transition: all var(--transition-smooth);
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 1030;
}

.navbar-brand {
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--color-brand-primary) !important;
  letter-spacing: 1px;
}

.nav-link {
  color: var(--color-text-primary) !important;
  margin: 0 0.5rem;
  position: relative;
  font-size: 0.95rem;
  transition: color var(--transition-fast);
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--color-brand-primary);
  transition: width var(--transition-fast);
}

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

.navbar-toggler {
  border-color: var(--color-brand-primary);
}

.navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%239d7563' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* ===== Control Panel (Theme & Language) ===== */
.control-panel {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-left: auto;
}

.control-btn {
  background: var(--color-brand-primary);
  color: var(--color-bg-primary);
  border: none;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: var(--font-sans);
  transition: all var(--transition-fast);
  font-size: 0.85rem;
  font-weight: 500;
}

.control-btn:hover {
  background: var(--color-brand-dark);
  transform: translateY(-1px);
}

.control-btn.active {
  background: var(--color-brand-dark);
}

/* ===== Main Content ===== */
main {
  margin-top: 80px;
}

/* ===== Bento Grid System ===== */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  padding: 2rem;
}

.bento-grid-large {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1.5rem;
  padding: 2rem;
}

.bento-item {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: all var(--transition-smooth);
  position: relative;
  overflow: hidden;
}

.bento-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  transition: left 0.6s ease;
}

.bento-item:hover {
  border-color: var(--color-brand-primary);
  box-shadow: 0 8px 24px var(--color-shadow);
  transform: translateY(-4px);
}

.bento-item:hover::before {
  left: 100%;
}

/* Bento Grid Responsive Layout */
.bento-grid-large .bento-item-1x1 { grid-column: span 6; }
.bento-grid-large .bento-item-2x1 { grid-column: span 12; }
.bento-grid-large .bento-item-1x2 { grid-column: span 6; grid-row: span 2; }
.bento-grid-large .bento-item-2x2 { grid-column: span 12; grid-row: span 2; }

@media (min-width: 768px) {
  .bento-grid-large .bento-item-1x1 { grid-column: span 4; }
  .bento-grid-large .bento-item-2x1 { grid-column: span 8; }
  .bento-grid-large .bento-item-1x2 { grid-column: span 4; grid-row: span 2; }
  .bento-grid-large .bento-item-2x2 { grid-column: span 8; grid-row: span 2; }
}

@media (min-width: 1024px) {
  .bento-grid-large .bento-item-1x1 { grid-column: span 3; }
  .bento-grid-large .bento-item-2x1 { grid-column: span 6; }
  .bento-grid-large .bento-item-1x2 { grid-column: span 3; grid-row: span 2; }
  .bento-grid-large .bento-item-2x2 { grid-column: span 6; grid-row: span 2; }
}

/* ===== Container ===== */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ===== Hero Section ===== */
.hero {
  position: relative;
  min-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
  background: var(--color-gradient-light);
  border-bottom: 1px solid var(--color-border);
}

.hero-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.6;
  z-index: 1;
}

.hero-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(42, 42, 44, 0.4);
  z-index: 2;
}

[data-theme="dark"] .hero-overlay {
  background: rgba(0, 0, 0, 0.6);
}

.hero-content {
  position: relative;
  z-index: 3;
  color: var(--color-bg-primary);
  animation: fadeInUp 0.8s ease-out;
}

.hero-content h1 {
  color: var(--color-bg-primary);
  font-size: clamp(2rem, 8vw, 4rem);
  margin-bottom: 1.5rem;
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.hero-content p {
  color: rgba(255, 255, 255, 0.95);
  font-size: 1.125rem;
  margin-bottom: 2rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

/* ===== Buttons ===== */
.btn {
  border: none;
  border-radius: var(--radius-md);
  padding: 0.75rem 1.5rem;
  font-family: var(--font-sans);
  font-weight: 500;
  transition: all var(--transition-fast);
  cursor: pointer;
  display: inline-block;
  text-align: center;
  text-decoration: none;
}

.btn-primary {
  background: var(--color-brand-primary);
  color: var(--color-bg-primary);
}

.btn-primary:hover {
  background: var(--color-brand-dark);
  transform: translateY(-2px);
  box-shadow: 0 8px 16px var(--color-shadow);
}

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

.btn-outline-primary:hover {
  background: var(--color-brand-primary);
  color: var(--color-bg-primary);
}

.btn-lg { padding: 1rem 2rem; font-size: 1rem; }
.btn-sm { padding: 0.5rem 1rem; font-size: 0.875rem; }

/* ===== Cards ===== */
.card {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition-smooth);
  box-shadow: 0 2px 8px var(--color-shadow);
}

.card:hover {
  border-color: var(--color-brand-primary);
  box-shadow: 0 8px 24px var(--color-shadow);
  transform: translateY(-4px);
}

.card-img-top {
  width: 100%;
  height: 300px;
  object-fit: cover;
}

.card-body {
  padding: 1.5rem;
}

.card-title {
  color: var(--color-text-primary);
  margin-bottom: 0.5rem;
}

/* ===== Footer ===== */
footer {
  background: var(--color-bg-tertiary);
  color: var(--color-text-secondary);
  border-top: 1px solid var(--color-border);
  margin-top: 4rem;
}

footer h5, footer h6 {
  color: var(--color-text-primary);
  margin-bottom: 1rem;
}

footer a {
  color: var(--color-brand-primary);
}

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

.footer-section {
  margin-bottom: 2rem;
}

/* ===== Forms ===== */
.form-control, .form-select {
  border: 1px solid var(--color-border);
  background-color: var(--color-bg-secondary);
  color: var(--color-text-primary);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus, .form-select:focus {
  border-color: var(--color-brand-primary);
  box-shadow: 0 0 0 3px rgba(157, 117, 99, 0.1);
  background-color: var(--color-bg-secondary);
  color: var(--color-text-primary);
}

.form-label {
  color: var(--color-text-primary);
  font-weight: 500;
  margin-bottom: 0.5rem;
}

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

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.animate-fade-in {
  animation: fadeIn 0.6s ease-out;
}

.animate-fade-in-up {
  animation: fadeInUp 0.6s ease-out;
}

.animate-slide-left {
  animation: slideInLeft 0.6s ease-out;
}

.animate-slide-right {
  animation: slideInRight 0.6s ease-out;
}

/* Stagger animations */
.stagger-children > * {
  animation: fadeInUp 0.6s ease-out;
}

.stagger-children > *:nth-child(1) { animation-delay: 0s; }
.stagger-children > *:nth-child(2) { animation-delay: 0.1s; }
.stagger-children > *:nth-child(3) { animation-delay: 0.2s; }
.stagger-children > *:nth-child(4) { animation-delay: 0.3s; }
.stagger-children > *:nth-child(5) { animation-delay: 0.4s; }

/* ===== Glassmorphism ===== */
.glass {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-lg);
}

[data-theme="dark"] .glass {
  background: rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ===== Images ===== */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

.img-rounded {
  border-radius: var(--radius-lg);
}

/* ===== Sections ===== */
section {
  padding: 3rem 0;
}

section.section-alt {
  background: var(--color-bg-secondary);
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

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

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mt-5 { margin-top: 3rem; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.mb-5 { margin-bottom: 3rem; }

.mx-auto { margin-left: auto; margin-right: auto; }
.my-auto { margin-top: auto; margin-bottom: auto; }

.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }
.p-5 { padding: 3rem; }

.row { display: flex; flex-wrap: wrap; margin: -0.75rem; }
.col { flex: 1; padding: 0.75rem; }
.col-1 { flex: 0 0 8.333%; }
.col-2 { flex: 0 0 16.666%; }
.col-3 { flex: 0 0 25%; }
.col-4 { flex: 0 0 33.333%; }
.col-5 { flex: 0 0 41.666%; }
.col-6 { flex: 0 0 50%; }
.col-7 { flex: 0 0 58.333%; }
.col-8 { flex: 0 0 66.666%; }
.col-9 { flex: 0 0 75%; }
.col-10 { flex: 0 0 83.333%; }
.col-11 { flex: 0 0 91.666%; }
.col-12 { flex: 0 0 100%; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  h1 { font-size: 2rem; }
  h2 { font-size: 1.75rem; }
  h3 { font-size: 1.5rem; }

  .bento-grid {
    grid-template-columns: 1fr;
  }

  .col-md-6 { flex: 0 0 50%; }
  .col-md-12 { flex: 0 0 100%; }

  section {
    padding: 2rem 0;
  }
}

@media (max-width: 480px) {
  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.35rem; }
  h3 { font-size: 1.15rem; }

  .navbar {
    padding: 0.5rem 0;
  }

  .control-panel {
    flex-wrap: wrap;
    gap: 0.5rem;
    width: 100%;
  }

  section {
    padding: 1.5rem 0;
  }
}

/* ===== Accessibility ===== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus visible for keyboard navigation */
*:focus-visible {
  outline: 2px solid var(--color-brand-primary);
  outline-offset: 2px;
}

/* ===== Cookie Banner ===== */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--color-bg-tertiary);
  border-top: 1px solid var(--color-border);
  padding: 1.5rem;
  z-index: 1020;
  box-shadow: 0 -2px 8px var(--color-shadow);
}

.cookie-banner p {
  margin: 0;
  color: var(--color-text-secondary);
}

/* ===== Skip to Main Content Link ===== */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--color-brand-primary);
  color: var(--color-bg-primary);
  padding: 8px;
  text-decoration: none;
  z-index: 100;
}

.skip-link:focus {
  top: 0;
}
