/* ========================================
   KAMINOGI WORKS - Design System
   Single-page, white-base, refined studio
   ======================================== */

/* --- CSS Custom Properties --- */
:root {
  /* Colors - Light Refined Theme */
  --color-bg-primary: #fafafa;
  --color-bg-secondary: #f2f2f2;
  --color-bg-card: #ffffff;
  --color-bg-glass: rgba(255, 255, 255, 0.92);
  --color-bg-dark: #111111;

  --color-text-primary: #1a1a1a;
  --color-text-secondary: #555555;
  --color-text-muted: #999999;

  --color-accent: #c80023;
  --color-accent-light: #d4243f;

  --color-border: #e0e0e0;
  --color-border-hover: #bbbbbb;

  /* Typography — Sans-serif */
  --font-heading: 'Inter', 'Yu Gothic', 'YuGothic', sans-serif;
  --font-body: 'Inter', 'Yu Gothic', 'YuGothic', sans-serif;
  --font-ja: 'Yu Gothic', 'YuGothic', 'Hiragino Kaku Gothic Pro', sans-serif;

  --text-xs: 0.7rem;
  --text-sm: 0.825rem;
  --text-base: 0.95rem;
  --text-lg: 1.05rem;
  --text-xl: 1.2rem;
  --text-2xl: 1.5rem;
  --text-3xl: 2rem;
  --text-4xl: 2.8rem;
  --text-5xl: 3.8rem;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 5rem;
  --space-4xl: 8rem;
  --space-5xl: 10rem;

  /* Layout */
  --container-max: 1100px;
  --container-padding: 2rem;

  /* Border Radius */
  --radius-sm: 2px;
  --radius-md: 3px;

  /* Shadows */
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-card-hover: 0 8px 24px rgba(0, 0, 0, 0.08);

  /* Transitions */
  --transition-fast: 0.2s ease;
  --transition-base: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  background-color: var(--color-bg-primary);
  color: var(--color-text-primary);
  line-height: 1.8;
  min-height: 100vh;
  overflow-x: hidden;
  font-weight: 400;
}

a {
  color: var(--color-text-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-accent);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

ul,
ol {
  list-style: none;
}

.text-ja {
  font-family: var(--font-ja);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.9;
}

/* --- Utility --- */
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--container-padding);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.section {
  padding: var(--space-5xl) 0;
}

.section-label {
  font-size: var(--text-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--color-text-muted);
  margin-bottom: var(--space-sm);
}

.section-title {
  font-family: var(--font-heading);
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--color-text-primary);
  margin-bottom: var(--space-lg);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.section-divider {
  width: 32px;
  height: 1px;
  background: var(--color-accent);
  margin-bottom: var(--space-3xl);
}

/* --- Header / Navigation --- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: var(--space-md) 0;
  background: transparent;
  transition: background var(--transition-base), box-shadow var(--transition-base);
}

.site-header.scrolled {
  background: var(--color-bg-glass);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 1px 0 var(--color-border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Logo as image */
.site-logo {
  display: flex;
  align-items: center;
  height: 32px;
}

.site-logo img {
  height: 28px;
  width: auto;
  transition: filter var(--transition-fast), opacity var(--transition-fast);
}

/* White logo on hero (dark bg) */
.site-header:not(.scrolled) .site-logo img {
  filter: brightness(0) invert(1);
}

.site-logo:hover img {
  opacity: 0.7;
}

.nav-list {
  display: flex;
  gap: var(--space-xl);
}

.nav-list a {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  font-weight: 500;
  position: relative;
  padding-bottom: 4px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transition: color var(--transition-fast);
}

.site-header:not(.scrolled) .nav-list a {
  color: rgba(255, 255, 255, 0.7);
}

.site-header:not(.scrolled) .nav-list a:hover,
.site-header:not(.scrolled) .nav-list a.active {
  color: #ffffff;
}

.nav-list a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 1px;
  background: currentColor;
  transition: width var(--transition-base);
}

.nav-list a:hover,
.nav-list a.active {
  color: var(--color-text-primary);
}

.nav-list a:hover::after,
.nav-list a.active::after {
  width: 100%;
}

/* Hamburger */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-sm);
  z-index: 1001;
}

.menu-toggle span {
  display: block;
  width: 22px;
  height: 1px;
  background: var(--color-text-primary);
  margin: 6px 0;
  transition: var(--transition-base);
}

.site-header:not(.scrolled) .menu-toggle span {
  background: #ffffff;
}

.menu-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 4px);
}

.menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -4px);
}

/* --- Hero Section --- */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: flex-end;
  position: relative;
  overflow: hidden;
  background: #111;
}

.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.hero-bg-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg,
      rgba(0, 0, 0, 0.15) 0%,
      rgba(0, 0, 0, 0.05) 40%,
      rgba(0, 0, 0, 0.35) 70%,
      rgba(0, 0, 0, 0.65) 100%);
}

.hero-content {
  position: relative;
  z-index: 2;
  padding-bottom: var(--space-4xl);
}

.hero-title {
  font-family: var(--font-heading);
  font-size: var(--text-5xl);
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: var(--space-lg);
  color: #ffffff;
  letter-spacing: -0.03em;
  max-width: 700px;
}

.hero-label {
  font-size: var(--text-xs);
  color: rgba(255, 255, 255, 0.55);
  font-weight: 500;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  margin-bottom: var(--space-2xl);
}

.hero-links {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.75rem 1.8rem;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: all var(--transition-base);
  border: none;
  cursor: pointer;
}

.btn-primary {
  background: var(--color-accent);
  color: #ffffff;
}

.btn-primary:hover {
  background: #a3001c;
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(200, 0, 35, 0.25);
}

.btn-outline {
  background: transparent;
  color: var(--color-text-primary);
  border: 1px solid var(--color-border);
}

.btn-outline:hover {
  border-color: var(--color-text-primary);
  transform: translateY(-1px);
}

.hero .btn-outline {
  color: rgba(255, 255, 255, 0.85);
  border-color: rgba(255, 255, 255, 0.3);
}

.hero .btn-outline:hover {
  border-color: #ffffff;
  color: #ffffff;
}

.social-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-md);
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: all var(--transition-base);
}

.social-link:hover {
  border-color: var(--color-text-primary);
  color: var(--color-text-primary);
  transform: translateY(-1px);
}

.social-link svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* --- Projects Tile Grid --- */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-auto-flow: dense;
  gap: 4px;
}

/* Size variants */
.project-tile--large {
  grid-column: span 2;
  grid-row: span 2;
}

.project-tile--small {
  grid-column: span 1;
  grid-row: span 1;
}

/* Larger text for large tiles */
.project-tile--large .project-tile-title {
  font-size: var(--text-base);
}

.project-tile--large .project-tile-desc {
  font-size: var(--text-sm);
}

.project-tile--large .project-tile-badge-tag,
.project-tile--large .project-tile-badge-year {
  font-size: 0.7rem;
}

.project-tile--large .project-tile-badge {
  padding: 10px 14px;
}

.project-tile {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: var(--color-bg-secondary);
  cursor: pointer;
  display: block;
  color: inherit;
  text-decoration: none;
}

/* リンクなし（div）タイルはデフォルトカーソルのまま */
div.project-tile {
  cursor: default;
}

.project-tile-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.project-tile:hover .project-tile-image {
  transform: scale(1.06);
}

/* Top-left badge — always visible */
.project-tile-badge {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.project-tile-badge-tag {
  font-size: 0.6rem;
  font-weight: 600;
  color: #ffffff;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.project-tile-badge-year {
  font-size: 0.6rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.55);
  letter-spacing: 0.05em;
}

/* Hover overlay — details */
.project-tile-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: var(--space-lg);
  background: linear-gradient(180deg,
      rgba(0, 0, 0, 0) 30%,
      rgba(0, 0, 0, 0.75) 100%);
  opacity: 0;
  transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.project-tile:hover .project-tile-overlay {
  opacity: 1;
}

.project-tile-title {
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: 600;
  color: #ffffff;
  line-height: 1.5;
  margin-bottom: 4px;
}

.project-tile-title .text-ja {
  color: rgba(255, 255, 255, 0.6);
  font-size: var(--text-xs);
}

.project-tile-desc {
  font-family: var(--font-ja);
  font-size: var(--text-xs);
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.7;
}

.project-tile-action {
  display: inline-block;
  align-self: flex-start;
  margin-top: var(--space-sm);
  padding: 0.3rem 0.75rem;
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--color-accent);
  background: rgba(255, 255, 255, 0.92);
  border-radius: 2px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transition: background var(--transition-fast), color var(--transition-fast);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.project-tile:hover .project-tile-action {
  background: var(--color-accent);
  color: #ffffff;
}

/* Coming soon tile */
.project-tile--coming-soon {
  border: 1px dashed var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: default;
}

.project-tile--coming-soon .project-tile-coming-inner {
  padding: var(--space-lg);
}

.project-tile--coming-soon .project-tile-title {
  color: var(--color-text-muted);
  font-size: var(--text-lg);
}

.project-tile--coming-soon .project-tile-desc {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

/* --- Service Section --- */
.service-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-xl);
}

.service-card {
  padding: var(--space-2xl);
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
}

.service-card:hover {
  border-color: var(--color-border-hover);
  box-shadow: var(--shadow-card-hover);
}

.service-card h3 {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: 600;
  margin-bottom: var(--space-md);
}

.service-card p,
.service-card li {
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  line-height: 1.9;
}

.service-card ul {
  list-style: none;
  padding-left: 0;
  margin-top: var(--space-md);
}

.service-card ul li {
  margin-bottom: var(--space-xs);
  padding-left: 1rem;
  position: relative;
}

.service-card ul li::before {
  content: '—';
  position: absolute;
  left: 0;
  color: var(--color-text-muted);
  font-size: var(--text-xs);
}

/* --- About --- */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-xl);
  align-items: start;
}

/* 右列ラッパー: flex columnで上下に並べる */
.about-col-right {
  display: flex;
  flex-direction: column;
}

/* Principal: 左列を占有 */
.about-card--tall {
  grid-column: 1;
}

.about-card {
  padding: var(--space-2xl) 0;
  border-bottom: 1px solid var(--color-border);
}

.about-card h3 {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: 600;
  margin-bottom: var(--space-md);
}

.about-card p {
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  line-height: 1.9;
}

/* 日本語と英語の間に1行分の余白 */
.about-card p+p {
  margin-top: var(--space-lg);
}

/* 末尾ボーダーを非表示 */
.about-card--tall,
.about-col-right .about-card:last-child,
.about-card--links {
  border-bottom: none;
}

/* --- About Parallax Banner --- */
.about-parallax {
  width: 100vw;
  height: 300px;
  overflow: hidden;
  position: relative;
  /* transformを使わないfull-bleed（fixedパララックスが壊れないため） */
  margin-left: calc(-50vw + 50%);
  margin-top: var(--space-3xl);
  margin-bottom: var(--space-3xl);
}

.about-parallax-img {
  width: 100%;
  height: 160%;
  /* 大きめにして視差のストロークを確保 */
  background-image: url('../images/mizuki_bg.jpg');
  background-size: cover;
  background-position: center 30%;
  background-attachment: fixed;
  /* ネイティブパララックス */
  will-change: background-position;
}

/* --- Contact --- */
.contact-section {
  text-align: center;
  padding: var(--space-5xl) 0;
  border-top: 1px solid var(--color-border);
}

.contact-section .section-title {
  margin-bottom: var(--space-md);
}

.contact-desc {
  color: var(--color-text-secondary);
  font-size: var(--text-base);
  margin-bottom: var(--space-sm);
}

/* --- Footer --- */
.site-footer {
  background: var(--color-bg-dark);
  padding: var(--space-3xl) 0;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-lg);
}

.footer-links {
  display: flex;
  gap: var(--space-lg);
}

.footer-links a {
  font-size: var(--text-xs);
  color: rgba(255, 255, 255, 0.5);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.footer-links a:hover {
  color: rgba(255, 255, 255, 0.9);
}

.footer-copy {
  font-size: var(--text-xs);
  color: rgba(255, 255, 255, 0.3);
  letter-spacing: 0.08em;
}

/* --- Scroll Animations --- */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger children */
.projects-scroll .fade-in:nth-child(1) {
  transition-delay: 0s;
}

.projects-scroll .fade-in:nth-child(2) {
  transition-delay: 0.06s;
}

.projects-scroll .fade-in:nth-child(3) {
  transition-delay: 0.12s;
}

.projects-scroll .fade-in:nth-child(4) {
  transition-delay: 0.18s;
}

.projects-scroll .fade-in:nth-child(5) {
  transition-delay: 0.24s;
}

.projects-scroll .fade-in:nth-child(6) {
  transition-delay: 0.30s;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  :root {
    --text-5xl: 2.4rem;
    --text-3xl: 1.5rem;
    --container-padding: 1.25rem;
  }

  .nav-list {
    position: fixed;
    top: 0;
    right: -100%;
    width: 280px;
    height: 100vh;
    background: var(--color-bg-primary);
    flex-direction: column;
    padding: 80px var(--space-xl) var(--space-xl);
    transition: right var(--transition-base);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.08);
  }

  .nav-list.open {
    right: 0;
  }

  .nav-list.open a {
    color: var(--color-text-secondary) !important;
  }

  .nav-list.open a:hover,
  .nav-list.open a.active {
    color: var(--color-text-primary) !important;
  }

  .menu-toggle {
    display: block;
  }

  .projects-grid {
    grid-template-columns: repeat(6, 1fr);
  }

  .hero {
    min-height: 85vh;
  }

  .hero-links {
    flex-direction: column;
    align-items: flex-start;
  }

  .about-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }

  /* モバイルではrow-spanをリセット */
  .about-card--tall {
    grid-column: auto;
    grid-row: auto;
  }

  /* iOSはbackground-attachment:fixedが効かないためscrollに */
  .about-parallax-img {
    background-attachment: scroll;
    background-position: center center;
    height: 100%;
  }

  .service-grid {
    grid-template-columns: 1fr;
  }

  .footer-inner {
    flex-direction: column;
    text-align: center;
  }

  .footer-links {
    justify-content: center;
    flex-wrap: wrap;
  }
}

@media (max-width: 480px) {
  :root {
    --text-5xl: 2rem;
    --container-padding: 1rem;
  }

  .projects-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  /* On touch devices, show overlay always */
  .project-tile-overlay {
    opacity: 1;
    background: linear-gradient(180deg,
        rgba(0, 0, 0, 0) 50%,
        rgba(0, 0, 0, 0.7) 100%);
  }
}