/*
 * A&G Consultant - Modern Agricultural Engineering Website
 * Bilingual Japanese/English Design System
 */

:root {
  /* Colors */
  --primary: #059669;
  --primary-light: #10b981;
  --primary-dark: #047857;
  --secondary: #0369a1;
  --secondary-light: #0ea5e9;
  --accent: #f59e0b;
  --accent-light: #fbbf24;

  /* Neutrals */
  --ink: #0f172a;
  --ink-light: #334155;
  --muted: #64748b;
  --subtle: #94a3b8;
  --border: #e2e8f0;
  --surface: #f8fafc;
  --white: #ffffff;

  /* Gradients */
  --grad-primary: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  --grad-hero: linear-gradient(135deg, #ecfdf5 0%, #f0f9ff 50%, #fffbeb 100%);
  --grad-dark: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
  --shadow-md: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
  --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);
  --shadow-xl: 0 25px 50px -12px rgba(0,0,0,0.25);
  --shadow-glow: 0 0 40px rgba(5, 150, 105, 0.15);

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
  --space-4xl: 6rem;

  /* Typography */
  --font-sans: "Inter", "Noto Sans JP", system-ui, sans-serif;
  --font-display: "Plus Jakarta Sans", "Noto Sans JP", system-ui, sans-serif;

  /* Layout */
  --max-width: 1280px;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--white);
}

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

a {
  color: inherit;
  text-decoration: none;
}

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

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

h1 { font-size: clamp(2.5rem, 5vw, 4rem); letter-spacing: -0.03em; }
h2 { font-size: clamp(2rem, 4vw, 3rem); letter-spacing: -0.02em; }
h3 { font-size: clamp(1.5rem, 3vw, 2rem); letter-spacing: -0.01em; }
h4 { font-size: clamp(1.25rem, 2vw, 1.5rem); }

p {
  color: var(--ink-light);
  margin-bottom: var(--space-md);
}

.lead {
  font-size: 1.25rem;
  line-height: 1.7;
  color: var(--muted);
}

/* ===================
   LANGUAGE TOGGLE
   =================== */

/* Default state: Show English, Hide Japanese */
.lang-en { display: block; }
span.lang-en, a.lang-en { display: inline; }
h1.lang-en, h2.lang-en, h3.lang-en, h4.lang-en, p.lang-en, div.lang-en { display: block; }

.lang-ja { display: none !important; }
span.lang-ja { display: none !important; }
h1.lang-ja, h2.lang-ja, h3.lang-ja, h4.lang-ja, p.lang-ja, div.lang-ja { display: none !important; }

/* Japanese active: Hide English, Show Japanese */
body.ja .lang-en { display: none !important; }
body.ja span.lang-en { display: none !important; }
body.ja h1.lang-en, body.ja h2.lang-en, body.ja h3.lang-en, body.ja h4.lang-en { display: none !important; }
body.ja p.lang-en, body.ja div.lang-en { display: none !important; }

body.ja .lang-ja { display: block !important; }
body.ja span.lang-ja { display: inline !important; }
body.ja h1.lang-ja, body.ja h2.lang-ja, body.ja h3.lang-ja, body.ja h4.lang-ja { display: block !important; }
body.ja p.lang-ja, body.ja div.lang-ja { display: block !important; }

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

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

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

/* Skip Link */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-md);
  background: var(--primary);
  color: var(--white);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius);
  z-index: 9999;
  font-weight: 600;
}

.skip-link:focus {
  top: var(--space-md);
}

/* =====================
   HEADER
   ===================== */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  transition: all 0.3s ease;
}

.site-header.scrolled {
  box-shadow: var(--shadow);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
  gap: var(--space-xl);
}

/* Logo */
.logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--ink);
}

.logo-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  object-fit: contain;
  background: linear-gradient(135deg, #f0fdf4, #ecfeff);
  padding: 4px;
  box-shadow: var(--shadow-sm);
}

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.logo-text small {
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Navigation */
.nav-main {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.nav-main a {
  padding: var(--space-sm) var(--space-md);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink-light);
  border-radius: var(--radius);
  transition: all 0.2s ease;
}

.nav-main a:hover {
  color: var(--primary);
  background: rgba(5, 150, 105, 0.08);
}

/* Header Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

/* Language Switcher */
.lang-switch {
  display: flex;
  align-items: center;
  background: var(--surface);
  border-radius: var(--radius-full);
  padding: 4px;
  gap: 2px;
}

.lang-switch button {
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  border-radius: var(--radius-full);
  transition: all 0.2s ease;
}

.lang-switch button.active {
  background: var(--white);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.lang-switch button:hover:not(.active) {
  color: var(--ink);
}

/* CTA Button */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  transition: all 0.3s ease;
}

.btn-primary {
  background: var(--grad-primary);
  color: var(--white);
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.35);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(5, 150, 105, 0.4);
}

.btn-secondary {
  background: var(--white);
  color: var(--ink);
  border: 1px solid var(--border);
}

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

.btn-lg {
  padding: var(--space-md) var(--space-xl);
  font-size: 1rem;
}

/* Mobile Menu Toggle */
.menu-toggle {
  display: none;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  color: var(--ink);
}

.menu-toggle:hover {
  background: var(--surface);
}

/* =====================
   HERO SECTION
   ===================== */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding-top: 72px;
  background: var(--grad-hero);
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 60%;
  height: 100%;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="50" cy="50" r="40" fill="none" stroke="%23059669" stroke-width="0.5" opacity="0.1"/></svg>') repeat;
  background-size: 60px;
  opacity: 0.5;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4xl);
  align-items: center;
  position: relative;
  z-index: 1;
}

.hero-content {
  max-width: 600px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: rgba(5, 150, 105, 0.1);
  border: 1px solid rgba(5, 150, 105, 0.2);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary-dark);
  margin-bottom: var(--space-lg);
}

.hero-badge::before {
  content: "";
  width: 8px;
  height: 8px;
  background: var(--primary);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.2); }
}

.hero h1 {
  margin-bottom: var(--space-lg);
  background: linear-gradient(135deg, var(--ink) 0%, var(--primary-dark) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero .lead {
  margin-bottom: var(--space-xl);
}

.hero-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
}

/* Hero Visual */
.hero-visual {
  position: relative;
}

.hero-image-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: var(--space-md);
  transform: perspective(1000px) rotateY(-5deg) rotateX(2deg);
}

.hero-image {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  aspect-ratio: 4/3;
}

.hero-image:first-child {
  grid-row: span 2;
  aspect-ratio: auto;
}

.hero-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease;
}

.hero-image:hover img {
  transform: scale(1.05);
}

.hero-image::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 50%, rgba(0,0,0,0.3));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.hero-image:hover::after {
  opacity: 1;
}

/* Hero Stats */
.hero-stats {
  display: flex;
  gap: var(--space-2xl);
  margin-top: var(--space-3xl);
  padding-top: var(--space-2xl);
  border-top: 1px solid var(--border);
}

.stat {
  text-align: left;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
}

.stat-label {
  font-size: 0.9rem;
  color: var(--muted);
  margin-top: var(--space-xs);
}

/* =====================
   SERVICES SECTION
   ===================== */
.services {
  background: var(--white);
  position: relative;
}

.services::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
}

.section-header {
  text-align: center;
  max-width: 700px;
  margin: 0 auto var(--space-3xl);
}

.section-header .overline {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--space-sm);
}

.section-header h2 {
  margin-bottom: var(--space-md);
}

.services-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-lg);
}

.service-card {
  position: relative;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  transition: all 0.3s ease;
}

.service-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  transform: translateY(-4px);
}

.service-icon {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #ecfdf5, #f0f9ff);
  border-radius: var(--radius);
  font-size: 1.5rem;
  margin-bottom: var(--space-lg);
}

.service-card h3 {
  font-size: 1.25rem;
  margin-bottom: var(--space-sm);
}

.service-card p {
  font-size: 0.95rem;
  color: var(--muted);
  margin: 0;
}

.service-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  margin-top: var(--space-md);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--primary);
}

.service-link svg {
  transition: transform 0.2s ease;
}

.service-card:hover .service-link svg {
  transform: translateX(4px);
}

/* =====================
   PRODUCTS SECTION
   ===================== */
.products {
  background: var(--surface);
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
}

.product-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
}

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

.product-image {
  position: relative;
  aspect-ratio: 16/10;
  overflow: hidden;
  background: linear-gradient(135deg, #f0fdf4, #ecfeff);
}

.product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease;
}

.product-card:hover .product-image img {
  transform: scale(1.1);
}

.product-content {
  padding: var(--space-xl);
}

.product-category {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--primary);
  margin-bottom: var(--space-sm);
}

.product-card h3 {
  font-size: 1.25rem;
  margin-bottom: var(--space-sm);
}

.product-card p {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0;
}

/* =====================
   ABOUT / FEATURES SECTION
   ===================== */
.about {
  background: var(--white);
}

.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4xl);
  align-items: center;
}

.about-content h2 {
  margin-bottom: var(--space-lg);
}

.about-content .lead {
  margin-bottom: var(--space-xl);
}

.features-list {
  display: grid;
  gap: var(--space-lg);
}

.feature-item {
  display: flex;
  gap: var(--space-md);
}

.feature-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--grad-primary);
  border-radius: var(--radius);
  color: var(--white);
  font-size: 1.25rem;
  flex-shrink: 0;
}

.feature-text h4 {
  font-size: 1.1rem;
  margin-bottom: var(--space-xs);
}

.feature-text p {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0;
}

.about-images {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
}

.about-images img {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.about-images img:first-child {
  grid-row: span 2;
}

/* =====================
   CTA SECTION
   ===================== */
.cta-section {
  background: var(--grad-dark);
  color: var(--white);
  position: relative;
  overflow: hidden;
}

.cta-section::before {
  content: "";
  position: absolute;
  top: -50%;
  right: -20%;
  width: 80%;
  height: 200%;
  background: radial-gradient(circle, rgba(5, 150, 105, 0.15) 0%, transparent 50%);
}

.cta-inner {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 700px;
  margin: 0 auto;
}

.cta-inner h2 {
  color: var(--white);
  margin-bottom: var(--space-md);
}

.cta-inner p {
  color: rgba(255,255,255,0.7);
  font-size: 1.1rem;
  margin-bottom: var(--space-xl);
}

.cta-buttons {
  display: flex;
  justify-content: center;
  gap: var(--space-md);
}

/* =====================
   FOOTER
   ===================== */
.footer {
  background: var(--ink);
  color: rgba(255,255,255,0.8);
  padding: var(--space-4xl) 0 var(--space-xl);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr repeat(3, 1fr);
  gap: var(--space-3xl);
  margin-bottom: var(--space-3xl);
}

.footer-brand .logo {
  color: var(--white);
  margin-bottom: var(--space-md);
}

.footer-brand .logo-icon {
  background: var(--white);
}

.footer-brand p {
  color: rgba(255,255,255,0.6);
  font-size: 0.95rem;
  max-width: 300px;
}

.footer-nav h4 {
  color: var(--white);
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-lg);
}

.footer-nav a {
  display: block;
  padding: var(--space-xs) 0;
  font-size: 0.9rem;
  color: rgba(255,255,255,0.6);
  transition: color 0.2s ease;
}

.footer-nav a:hover {
  color: var(--primary-light);
}

.footer-bottom {
  padding-top: var(--space-xl);
  border-top: 1px solid rgba(255,255,255,0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: rgba(255,255,255,0.5);
}

/* =====================
   UTILITIES
   ===================== */
.text-center { text-align: center; }
.text-primary { color: var(--primary); }

.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* =====================
   RESPONSIVE
   ===================== */
@media (max-width: 1024px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: var(--space-3xl);
  }

  .hero-visual {
    max-width: 500px;
    margin: 0 auto;
  }

  .hero-image-grid {
    transform: none;
  }

  .services-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .products-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .about-grid {
    grid-template-columns: 1fr;
    gap: var(--space-3xl);
  }

  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  :root {
    --space-4xl: 4rem;
    --space-3xl: 3rem;
  }

  .header-inner {
    height: 64px;
  }

  .nav-main {
    display: none;
  }

  .menu-toggle {
    display: flex;
  }

  .hero {
    min-height: auto;
    padding: calc(64px + var(--space-3xl)) 0 var(--space-3xl);
  }

  .hero-stats {
    flex-direction: column;
    gap: var(--space-lg);
  }

  .services-grid,
  .products-grid {
    grid-template-columns: 1fr;
  }

  .about-images {
    grid-template-columns: 1fr;
  }

  .about-images img:first-child {
    grid-row: auto;
  }

  .cta-buttons {
    flex-direction: column;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: var(--space-xl);
  }

  .footer-bottom {
    flex-direction: column;
    gap: var(--space-md);
    text-align: center;
  }
}

/* Page Specific Styles */
.page-header {
  padding: calc(72px + var(--space-3xl)) 0 var(--space-3xl);
  background: var(--grad-hero);
}

.page-header .container {
  max-width: 800px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: var(--space-lg);
}

.breadcrumb a {
  color: var(--primary);
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.page-header h1 {
  margin-bottom: var(--space-md);
}

/* Card Grid for internal pages */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-xl);
}

.info-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
}

.info-card h3 {
  margin-bottom: var(--space-sm);
}

/* Contact form styles */
.form-group {
  margin-bottom: var(--space-lg);
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: var(--space-sm);
  font-size: 0.9rem;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: var(--space-md);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
}

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

.animate-in {
  animation: fadeInUp 0.6s ease forwards;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }
}
