/* 
  Modern Design System for tadano-ko-ko-sei.com
  Theme: Tech-Studio Dark (Sophisticated Slate & Electric Cyan)
*/

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

:root {
  /* Colors */
  --bg-dark: #0f172a;
  --bg-card: rgba(30, 41, 59, 0.7);
  --primary: #38bdf8;
  --primary-glow: rgba(56, 189, 248, 0.3);
  --accent: #818cf8;
  --text-main: #f8fafc;
  --text-muted: #f8fafc;
  --border: rgba(255, 255, 255, 0.1);
  --glass-bg: rgba(15, 23, 42, 0.8);
  
  /* Typography */
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Noto Sans JP', sans-serif;
  
  /* Spacing & Effects */
  --header-height: 80px;
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  --radius-lg: 16px;
  --radius-md: 8px;
  
  /* Spacing Tokens */
  --spacing-section: clamp(100px, 15vh, 200px);
  --spacing-block: clamp(60px, 10vh, 120px);
  --spacing-title: clamp(40px, 6vh, 80px);
}

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

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-body);
  line-height: 1.6;
  overflow-x: hidden;
}

/* Typography Helpers */
h1, h2, h3, h4 {
  font-family: var(--font-heading);
  letter-spacing: -0.02em;
}

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

ul {
  list-style: none;
}

/* Glassmorphism Components */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
}

/* Global Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header & Navigation */
header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--header-height);
  z-index: 1000;
  display: flex;
  align-items: center;
  transition: var(--transition-slow);
}

header.scrolled {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  height: 70px;
}

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

.logo {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: -1px;
}

.logo span {
  color: var(--primary);
}

.nav-links {
  display: flex;
  gap: 32px;
}

.nav-links a {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-muted);
}

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

/* Hero Section */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: var(--header-height);
  overflow: hidden;
}

#plexus-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

.hero-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: transparent; /* Removed radial-gradient to keep the star background pristine */
  z-index: -1;
}

@keyframes hero-zoom {
  from { transform: scale(1.05); }
  to { transform: scale(1.15); }
}

.hero-content {
  text-align: center;
  max-width: 800px;
}

.hero-content h1 {
  font-size: clamp(2.5rem, 8vw, 5rem);
  line-height: 1.1;
  margin-bottom: 24px;
}

.hero-content p {
  font-size: 1.25rem;
  color: var(--text-muted);
  margin-bottom: 40px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  padding: 12px 32px;
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
  border: none;
}

.btn-primary {
  background: var(--primary);
  color: #000;
  box-shadow: 0 0 20px var(--primary-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 30px var(--primary-glow);
  background: #fff;
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text-main);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--primary);
}

/* Base structure for normal native scrolling */
html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-body);
  line-height: 1.6;
  overflow-x: hidden;
}

main {
  width: 100%;
}

.portfolio-home section {
  min-height: 100vh;
  width: 100%;
  display: flex;
  align-items: center;
  position: relative;
  padding: var(--spacing-section) 0;
  box-sizing: border-box;
  background: transparent;
}

/* Apply frosted glass effect to all sections EXCEPT the Hero section */
.portfolio-home section:not(.hero) {
  background: rgba(15, 23, 42, 0.25); /* Very light opacity */
  backdrop-filter: blur(4px); /* Very subtle blur */
  -webkit-backdrop-filter: blur(2px);
}

/* Subpage Utilities */
.subpage-header {
  padding-top: clamp(100px, 10vh, 140px);
  padding-bottom: 60px;
  text-align: center;
}

/* Breadcrumbs */
.breadcrumbs {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 40px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.breadcrumbs a {
  transition: color 0.2s;
}

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

.breadcrumbs span::before {
  content: '/';
  margin-right: 12px;
  opacity: 0.5;
}

/* Ensure content has some background if needed for readability during stacking */
.portfolio-home section .container {
  position: relative;
  z-index: 5;
}

/* Winding Path Base */
.node-container {
  position: relative;
  width: 100%;
}

/* Spotlight overlay for the final CTA section */
.cta-spotlight {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  /* Static bright spotlight centered for balanced glow */
  background:
    radial-gradient(ellipse 60% 50% at 50% 50%, rgba(99, 179, 237, 0.35) 0%, rgba(99, 102, 241, 0.15) 50%, transparent 80%);
}

#final-cta {
  position: relative;
  overflow: hidden;
}

.scroll-node {
  width: 16px;
  height: 16px;
  background: var(--primary);
  border-radius: 50%;
  position: absolute;
  left: 50%;
  top: 100px; /* Midpoint of the 200px top padding */
  transform: translate(-50%, -50%);
  box-shadow: 0 0 15px var(--primary);
  z-index: 3; /* Lower than titles */
  opacity: 0;
  transition: opacity 0.5s ease;
}

.scroll-node::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 40px;
  height: 40px;
  border: 1px solid var(--primary);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  opacity: 0.3;
  animation: node-pulse 2s infinite;
}

@keyframes node-pulse {
  0% { transform: translate(-50%, -50%) scale(0.8); opacity: 0.5; }
  100% { transform: translate(-50%, -50%) scale(2); opacity: 0; }
}

.scroll-path {
  display: none;
}

/* Top Connector Line: Section TopBoundary(0) -> ContentStart(200px) */
.node-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  width: 2px;
  height: 200px;
  background: var(--primary);
  transform: translateX(-50%) scaleY(0);
  transform-origin: top;
  opacity: 0.3;
  z-index: 0; /* Lower than container */
  pointer-events: none;
}

/* Bottom Connector Line: ContentEnd(100%-200px) -> SectionBottomBoundary(100%) */
.node-container::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 2px;
  height: 200px;
  background: var(--primary);
  transform: translateX(-50%) scaleY(0);
  transform-origin: top;
  opacity: 0.3;
  z-index: 0; /* Lower than container */
  pointer-events: none;
}

/* Remove the downward line for the very last section */
.final-cta.node-container::after,
.final-cta.node-container.active::after,
.final-cta.node-container.scroll-down.active::after {
  display: none !important;
}


/* Drawing Animations triggered by .active and direction classes */

/* 1. Scroll Down (Default) */
.node-container.scroll-down.active::before,
.node-container.active:not(.scroll-up)::before {
  transform: translateX(-50%) scaleY(1);
  transform-origin: top;
  transition: transform 1.5s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.node-container.scroll-down.active .scroll-node,
.node-container.active:not(.scroll-up) .scroll-node {
  opacity: 1;
  transition-delay: 0.8s;
}

.node-container.scroll-down.active::after,
.node-container.active:not(.scroll-up)::after {
  transform: translateX(-50%) scaleY(1);
  transform-origin: top;
  transition: transform 1.5s cubic-bezier(0.165, 0.84, 0.44, 1) 1.2s;
}

/* 2. Scroll Up (Reverse Drawing) */
.node-container.scroll-up.active::after {
  transform: translateX(-50%) scaleY(1);
  transform-origin: bottom;
  transition: transform 1.5s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.node-container.scroll-up.active .scroll-node {
  opacity: 1;
  transition-delay: 0.8s;
}

.node-container.scroll-up.active::before {
  transform: translateX(-50%) scaleY(1);
  transform-origin: bottom;
  transition: transform 1.5s cubic-bezier(0.165, 0.84, 0.44, 1) 1.2s;
}

.section-title {
  font-size: clamp(2rem, 5vw, 2.5rem);
  margin-bottom: var(--spacing-title);
  text-align: center;
  position: relative;
  z-index: 10; /* Ensure title is on top */
}

/* Section Indicator (Side Dots) */
.section-nav {
  position: fixed;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.nav-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.3);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  cursor: pointer;
  position: relative;
}

.nav-dot.active {
  background: var(--primary);
  border-color: var(--primary);
  transform: scale(1.5);
  box-shadow: 0 0 10px var(--primary-glow);
}

/* Winding Path Utilities - Animation Override */
.node-container::before,
.scroll-node::before,
.node-container::after {
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 1.2s cubic-bezier(0.65, 0, 0.35, 1);
}

.node-container.active::before,
.node-container.active .scroll-node::before,
.node-container.active::after {
  transform: scaleY(1);
}

.node-container.active .scroll-node {
  animation: node-entry 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes node-entry {
  0% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.scroll-node {
  opacity: 0; /* Start hidden for animation */
}
.zig-zag .container {
  display: flex;
  align-items: center;
  gap: 80px;
}

.zig-zag:nth-of-type(even) .container {
  flex-direction: row-reverse;
}

.zig-zag .container > div {
  flex: 1;
}

.zig-zag h2 {
  text-align: left;
}

@media (max-width: 992px) {
  .zig-zag .container {
    flex-direction: column !important;
    text-align: center;
  }
  .zig-zag h2 {
    text-align: center;
  }
  .scroll-path {
    display: none;
  }
}

/* News Section Styles */
.news-list {
  display: flex;
  flex-direction: column;
  gap: 20px; /* Increased from 12px */
  max-width: 800px;
  margin: 0 auto;
}

.news-item {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 16px 24px;
  border-radius: var(--radius-md);
  transition: var(--transition-fast);
  border: 1px solid transparent;
}

.news-item:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--border);
  transform: translateX(8px);
}

.news-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 160px;
}

.news-date {
  font-family: var(--font-heading);
  font-size: 0.9rem;
  color: var(--text-muted);
  opacity: 0.7;
}

.news-label {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--border);
}

.news-label.update {
  background: rgba(56, 189, 248, 0.1);
  color: var(--primary);
  border: 1px solid rgba(56, 189, 248, 0.2);
}

.news-label.info {
  background: rgba(129, 140, 248, 0.1);
  color: var(--accent);
  border: 1px solid rgba(129, 140, 248, 0.2);
}

.news-title {
  flex: 1;
  font-size: 1rem;
}

@media (max-width: 640px) {
  .news-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 16px;
  }
  .news-item:hover {
    transform: none;
  }
}

/* Tech Stack */
.tech-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 20px; /* Increased from 12px */
  justify-content: center;
  max-width: 900px;
  margin: 0 auto;
}

.tech-badge {
  padding: 8px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 30px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--transition-fast);
}

.tech-badge:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(56, 189, 248, 0.2);
}

/* Photography Gallery */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 40px; /* Increased from 24px */
}

.gallery-item {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  aspect-ratio: 4 / 3;
  cursor: pointer;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.8s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.gallery-item:hover img {
  transform: scale(1.1);
}

.gallery-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(15, 23, 42, 0.9), transparent);
  opacity: 0;
  transition: opacity 0.4s ease;
  display: flex;
  align-items: flex-end;
  padding: 24px;
}

.gallery-item:hover .gallery-overlay {
  opacity: 1;
}

.gallery-info h4 {
  font-size: 1.1rem;
  margin-bottom: 4px;
  transform: translateY(10px);
  transition: transform 0.4s ease;
}

.gallery-item:hover .gallery-info h4 {
  transform: translateY(0);
}

.gallery-info p {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.7);
}

/* Workflow */
.workflow-steps {
  max-width: 800px;
  margin: 0 auto;
  position: relative;
}

.workflow-step {
  display: flex;
  gap: 40px;
  padding-bottom: 60px;
}

.workflow-step:last-child {
  padding-bottom: 0;
}

.step-number {
  width: 48px;
  height: 48px;
  background: var(--bg-dark);
  border: 2px solid var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--primary);
  font-size: 1.2rem;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
  box-shadow: 0 0 20px var(--primary-glow);
}

.step-content h3 {
  margin-bottom: 12px;
  font-size: 1.4rem;
}

.step-content p {
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.7;
}

/* Final CTA */
.final-cta {
  text-align: center;
  background: radial-gradient(circle at center, rgba(56, 189, 248, 0.08), transparent 70%);
}

/* Footer */
footer {
  padding: 80px 0 40px;
  background: #0a1120;
  border-top: 1px solid var(--border);
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 48px;
  margin-bottom: 48px;
}

.footer-bottom {
  text-align: center;
  padding-top: 32px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* Animations */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.8s ease-out;
}

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

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

  /* Typography Fixes */
  .hero-title {
    font-size: 1.6rem !important; /* Final verified size for 1-screen fit */
    line-height: 1.3 !important;
    margin-bottom: 24px;
    text-align: center;
  }

  .hero-subtitle {
    font-size: 1.0rem !important;
    margin-bottom: 30px;
    text-align: center;
  }

  .section-title {
    font-size: 1.4rem !important;
    margin-bottom: 32px !important; /* Increased from 20px */
  }

  /* Button Wraps & Layout */
  .cta-buttons {
    display: flex !important;
    flex-direction: column !important;
    gap: 16px !important;
    width: 100% !important;
    align-items: center !important;
  }

  .btn {
    white-space: nowrap !important;
    padding: 12px 28px !important;
    font-size: 0.95rem !important;
    width: fit-content !important; /* Force width to fit text exactly */
    max-width: 100% !important;
    flex: none !important; /* Clear any flex stretch */
    align-self: center !important; /* Prevent stretching in column layouts */
    text-align: center;
    justify-content: center;
  }

  .app-dev-actions .btn {
    width: fit-content !important;
    flex: none !important; 
    align-self: center !important;
  }

  /* Full width only for main CTA sections */
  /* Hero buttons should stretch to fill current container width */
  .cta-buttons .btn {
    width: 100% !important;
    max-width: 320px !important;
    align-self: center !important;
  }

  /* App Development Section Mobile Adjustments */
  #apps .reveal {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  
  #apps .section-title {
    text-align: center !important;
  }

  #apps > .container > div > .reveal > div:last-child {
    justify-content: center; /* Center the button container */
  }


  /* Hide Mouse Scroll Indicator on Mobile */
  .scroll-indicator {
    display: none !important;
  }

  section {
    padding: 100px 24px; /* Increased from 80px 20px 30px 20px */
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 100vh !important;
  }

  /* Make images smaller for mobile instead of hiding them */
  img {
    max-width: 100%;
    height: auto;
  }

  .product-image img,
  .featured-product img {
    max-height: 150px;
    object-fit: contain;
  }

  .gallery-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px; /* Increased from 8px */
  }

  .gallery-item {
    height: 120px;
  }

  .workflow-step img {
    max-height: 80px;
    object-fit: contain;
  }

  /* Update line coordinates for mobile layout */
  .node-container::before {
    height: 30px;
  }

  .node-container::after {
    height: 30px;
  }

  .scroll-node {
    top: 15px;
  }

  section > .container {
    width: 100%;
    padding: 0 32px; /* Increased from 20px for better breathing room */
  }

  /* Adjust Workflow Steps for mobile (text only) */
  .workflow-step {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
    text-align: left;
    padding-bottom: 48px; /* Increased from 32px */
    border-left: 2px solid var(--primary);
    padding-left: 24px;
    margin-left: 0;
  }

  .step-number {
    font-size: 0.75rem;
    margin-bottom: 0;
  }

  .workflow-step h3 {
    font-size: 1.0rem;
  }

  .workflow-step p {
    font-size: 0.8rem;
    line-height: 1.4;
  }

  .section-nav {
    display: none;
  }

  #photography {
    min-height: 100vh !important;
    padding: 100px 20px; /* Align with other sections */
  }
}
