/* ============================================
   Nomura Gosei — Custom Styles
   Tailwind CDN extensions & component overrides
   ============================================ */

/* --- CSS Variables --- */
:root {
  --primary: #336699;
  --primary-dark: #264d73;
  --primary-light: #4a86bf;
  --secondary: #87ceeb;
  --accent: #ff6b35;
  --accent-dark: #e55a25;
  --contact-red: #c61a1a;
  --text: #2c3e50;
  --text-light: #5a6c7d;
  --bg-light: #f8fafc;
  --bg-warm: #fefcf9;
  --border-light: #e2e8f0;
}

/* --- Base --- */
html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  font-feature-settings: "palt";
  -webkit-font-smoothing: antialiased;
}

/* --- Scroll reveal --- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}
.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }

/* --- Hero Slideshow --- */
.hero-slide {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center 30%;
  opacity: 0;
  transition: opacity 1.2s ease;
}
.hero-slide.active {
  opacity: 1;
}
@media (max-width: 640px) {
  .hero-slide {
    background-position: 65% center;
  }
}

/* --- Rotating Navigation --- */
.rotating-nav-container {
  position: relative;
  height: 140px;
  perspective: 800px;
}
@media (min-width: 640px) {
  .rotating-nav-container {
    height: 260px;
  }
}

.rotating-nav-item {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
  will-change: transform, opacity;
}

.rotating-nav-item[data-position="center"] {
  z-index: 10;
  opacity: 1;
}
.rotating-nav-item[data-position="left"],
.rotating-nav-item[data-position="right"] {
  z-index: 5;
  opacity: 0.5;
}

/* Mobile: side items smaller + muted, still tappable */
@media (max-width: 480px) {
  .rotating-nav-item[data-position="left"],
  .rotating-nav-item[data-position="right"] {
    opacity: 0.35 !important;
    filter: grayscale(0.5);
  }
  /* Swipe hint */
  .rotating-nav-container::after {
    content: '← スワイプで切替 →';
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    color: rgba(36, 59, 83, 0.35);
    letter-spacing: 0.05em;
    white-space: nowrap;
  }
}

/* --- Tech content panel transitions --- */
.tech-panel {
  animation-duration: 0.45s;
  animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
  animation-fill-mode: both;
}
.tech-panel.slide-in-left {
  animation-name: slideInLeft;
}
.tech-panel.slide-in-right {
  animation-name: slideInRight;
}
@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-50px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(50px); }
  to   { opacity: 1; transform: translateX(0); }
}

@media (prefers-reduced-motion: reduce) {
  .tech-panel { animation: none !important; }
}

/* --- Stats Counter --- */
.stat-number {
  font-variant-numeric: tabular-nums;
}

/* --- Business Calendar --- */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
@media (max-width: 1024px) {
  .calendar-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .calendar-grid { grid-template-columns: 1fr; }
}

.month-box {
  transition: transform 0.2s ease;
}
.month-box:hover {
  transform: translateY(-3px);
}

.event-holiday { color: #dc2626; }
.event-maintenance { color: var(--accent); }

/* --- Mobile CTA Bar --- */
.mobile-cta-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}
.mobile-cta-bar.visible {
  transform: translateY(0);
}

/* --- Header scroll state --- */
.site-header {
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}
.site-header.scrolled {
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(12px);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* --- Hamburger --- */
.hamburger-line {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text);
  transition: all 0.3s ease;
  transform-origin: center;
}
.hamburger.active .hamburger-line:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}
.hamburger.active .hamburger-line:nth-child(2) {
  opacity: 0;
}
.hamburger.active .hamburger-line:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* --- Scrollbar hide for horizontal scroll --- */
.scrollbar-hide {
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.scrollbar-hide::-webkit-scrollbar {
  display: none;
}

/* --- Section divider (legacy, kept for compat) --- */
.section-divider {
  width: 48px;
  height: 3px;
  background: var(--accent);
  border-radius: 2px;
}

/* ============================================
   Precision Craft — 共通装飾システム
   ============================================ */

/* --- Section header with accent bar --- */
.pc-section-header {
  position: relative;
  padding-left: 16px;
}
.pc-section-header::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  width: 3px;
  height: 28px;
  background: var(--accent);
  border-radius: 2px;
}

/* Centered variant (no left bar, uses bottom gradient line) */
.pc-section-header-center {
  text-align: center;
}

/* --- Gradient divider line with dot --- */
.pc-divider {
  display: block;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, var(--primary), var(--secondary), transparent);
  position: relative;
  z-index: 2;
}
.pc-divider::after {
  content: '';
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}
/* Centered divider */
.pc-divider-center {
  margin-left: auto;
  margin-right: auto;
}
/* Light variant for dark backgrounds */
.pc-divider-light {
  background: linear-gradient(90deg, var(--secondary), rgba(135,206,235,0.3), transparent);
}
.pc-divider-light::after {
  background: var(--accent);
}

/* --- Noise texture for light sections --- */
.pc-noise {
  position: relative;
}
.pc-noise::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.06;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  z-index: 0;
}
.pc-noise > * {
  position: relative;
  z-index: 1;
}
/* Warmer/stronger noise for product pages */
.pc-noise-warm::before {
  opacity: 0.035;
}

/* --- Emphasis/quote box --- */
.pc-emphasis {
  border-left: 3px solid var(--accent);
  background: rgba(255, 107, 53, 0.04);
  padding: 16px 20px;
  border-radius: 0 8px 8px 0;
}

/* --- Corner marks for precision feel --- */
.pc-corner-mark {
  position: relative;
}
.pc-corner-mark::before,
.pc-corner-mark::after {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  border-color: var(--primary);
  opacity: 0.25;
}
.pc-corner-mark::before {
  top: -4px;
  left: -4px;
  border-top: 2px solid;
  border-left: 2px solid;
}
.pc-corner-mark::after {
  bottom: -4px;
  right: -4px;
  border-bottom: 2px solid;
  border-right: 2px solid;
}

/* --- Section number with extended line --- */
.pc-section-num {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--primary);
}
.pc-section-num::after {
  content: '';
  display: block;
  width: 40px;
  height: 1px;
  flex-shrink: 0;
  background: linear-gradient(90deg, var(--primary), transparent);
}
/* On dark backgrounds */
.pc-section-num-light {
  color: var(--secondary);
}
.pc-section-num-light::after {
  background: linear-gradient(90deg, var(--secondary), transparent);
}

/* --- Section transition: subtle top accent --- */
.pc-section-accent-top {
  position: relative;
}
.pc-section-accent-top::after {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  z-index: 2;
  pointer-events: none;
}

/* --- Hand-drawn underline (for warm/human sections) --- */
.pc-handdrawn {
  position: relative;
  display: inline;
}
.pc-handdrawn::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -4px;
  height: 3px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='4' viewBox='0 0 200 4'%3E%3Cpath d='M0 2 C30 0.5, 50 3.5, 80 2 C110 0.5, 140 3.5, 170 2 C185 1, 195 2.5, 200 2' stroke='%23ff6b35' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") repeat-x;
  background-size: 200px 4px;
  opacity: 0.6;
}

/* --- Grain overlay for hero --- */
.grain-overlay {
  position: absolute;
  inset: 0;
  opacity: 0.03;
  pointer-events: none;
  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)'/%3E%3C/svg%3E");
}

/* --- Accordion --- */
.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
}
.accordion-item.open .accordion-content {
  max-height: 500px;
}
.accordion-icon {
  transition: transform 0.3s ease;
}
.accordion-item.open .accordion-icon {
  transform: rotate(180deg);
}
