/* ============================================
   BASE STYLES & VARIABLES
   ============================================ */
:root {
  --color-text: #f4f4f4;
  --color-base: #18181B;
  --color-gray: #2b2b2b;
  --color-red: #ee0000;
}

html {
  scroll-behavior: smooth;
  border-bottom: none !important;
}

html, body {
  /* 英文(ラテン文字)は Helvetica Neue、和文は a-otf-gothic-mb101-pr6n などを自動切替。 */
  font-family: "Helvetica Neue", Helvetica, Arial, "a-otf-gothic-mb101-pr6n", "Noto Sans JP", "Yu Gothic", "Hiragino Sans", "Meiryo", sans-serif;
  font-weight: 300;
  font-style: normal;
  letter-spacing: 0.0625rem;
  background-color: var(--color-base);
  color: var(--color-text);
  border-bottom: none !important;
  color-scheme: dark;
}

body {
  background-color: var(--color-base);
  color: var(--color-text);
}

body a {
  color: inherit;
}

body.bg-white {
  background-color: var(--color-base) !important;
}

body.text-\[\#1F1F1D\] {
  color: var(--color-text) !important;
}

/* ============================================
   DARK THEME UTILITY OVERRIDES
   ============================================ */
body .bg-white {
  background-color: rgba(255, 255, 255, 0.08) !important;
}

body .bg-\[\#D0D0D0\] {
  background-color: rgba(255, 255, 255, 0.1) !important;
}

body .text-\[\#1F1F1D\] {
  color: var(--color-text) !important;
}

body .text-\[\#1F1F1D\]\/70 {
  color: rgba(244, 244, 244, 0.7) !important;
}

body .text-\[\#1F1F1D\]\/60 {
  color: rgba(244, 244, 244, 0.6) !important;
}

body .text-\[\#1F1F1D\]\/50 {
  color: rgba(244, 244, 244, 0.5) !important;
}

body .text-\[\#1F1F1D\]\/40 {
  color: rgba(244, 244, 244, 0.4) !important;
}

body .text-\[\#1F1F1D\]\/10 {
  color: rgba(244, 244, 244, 0.1) !important;
}

body .border-\[\#1F1F1D\]\/20 {
  border-color: rgba(244, 244, 244, 0.2) !important;
}

body .border-\[\#1F1F1D\]\/10 {
  border-color: rgba(244, 244, 244, 0.1) !important;
}

body .text-black {
  color: var(--color-text) !important;
}

body .text-black\/90 {
  color: rgba(244, 244, 244, 0.9) !important;
}

body .text-black\/80 {
  color: rgba(244, 244, 244, 0.8) !important;
}

body .text-black\/70 {
  color: rgba(244, 244, 244, 0.7) !important;
}

body .text-black\/60 {
  color: rgba(244, 244, 244, 0.6) !important;
}

body .text-black\/50 {
  color: rgba(244, 244, 244, 0.5) !important;
}

body .text-black\/40 {
  color: rgba(244, 244, 244, 0.4) !important;
}

body .border-black {
  border-color: rgba(244, 244, 244, 0.35) !important;
}

body .border-\[\#1F1F1D\] {
  border-color: rgba(244, 244, 244, 0.35) !important;
}

.base-input-border {
  border-color: rgba(244, 244, 244, 0.25) !important;
  background-color: transparent !important;
}

.base-input-border:focus {
  border-color: rgba(255, 255, 255, 0.9) !important;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35);
}

body .bg-gray-100 {
  background-color: rgba(255, 255, 255, 0.06) !important;
}

/* 英文（ラテン文字）にはヘルベチカ系を強制的に適用 */
:lang(en),
body :lang(en),
body [lang="en"],
.english,
.en,
.en-font {
  font-family: "Helvetica Neue", Helvetica, Arial, system-ui, -apple-system, sans-serif !important;
  font-weight: 300;
  font-style: normal;
}

/* ヘッダーナビゲーションのリンクはboldに */
#header-nav a:lang(en),
body #header-nav a:lang(en),
html body #header-nav a:lang(en) {
  font-weight: 400 !important;
}

/* 英文化したい部分にはenやenglishクラス付与でもOK */

img {
  display: block;
  max-width: 100%;
}

h3 {
  font-size: 2rem !important;
}

h4 {
  font-size: 1.125rem !important;
}

/* ============================================
   LOADING SCREEN
   ============================================ */
body.loading {
  overflow: hidden !important;
}

#loading-screen {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: #111111;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: opacity 0.6s ease;
}

#loading-screen.loading-done {
  opacity: 0;
  pointer-events: none;
}

.loading-logo-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 45rem;
  padding: 0 1.5rem;
  overflow: hidden;
}

.loading-logo {
  width: min(70vw, 32.5rem);
  height: auto;
  display: block;
  filter: brightness(0) invert(1);
  transform: translateY(110%);
  will-change: transform;
  animation: logo-slide-up 1.2s cubic-bezier(0.21, 0.8, 0.3, 1) forwards;
}

@keyframes logo-slide-up {
  0% {
    transform: translateY(110%);
  }
  70% {
    transform: translateY(-4%);
  }
  100% {
    transform: translateY(0);
  }
}

/* ============================================
   GRADIENT BACKGROUND
   ============================================ */
.gradient-background {
  position: fixed;
  inset: 0;
  pointer-events: none;
  filter: blur(6.875rem);
  opacity: 0.9;
  z-index: 0;
}

.gradient-background-inner {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 20% 20%, rgba(90, 90, 95, 0.35), transparent 55%), 
              radial-gradient(circle at 80% 30%, rgba(70, 70, 75, 0.45), transparent 60%), 
              radial-gradient(circle at 50% 80%, rgba(55, 55, 60, 0.35), transparent 55%),
              #18181B;
}

@keyframes drift {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  25% { transform: translate3d(1.5%, -1%, 0) scale(1.01); }
  50% { transform: translate3d(-1%, 1.5%, 0) scale(1.02); }
  75% { transform: translate3d(1%, 1%, 0) scale(1.01); }
  100% { transform: translate3d(-1.5%, -1%, 0) scale(1); }
}

.gradient-anim {
  animation: drift 12s ease-in-out infinite alternate;
  will-change: transform;
}

/* ============================================
   HEADER
   ============================================ */
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 9999;
  backdrop-filter: blur(1rem);
  -webkit-backdrop-filter: blur(1rem);
  will-change: backdrop-filter;
  transition: all 0.3s;
}

/* PC: Header width limited to 25.875rem and centered */
@media (min-width: 48rem) {
  header {
    left: 50%;
    transform: translateX(-50%);
    width: 25.875rem;
    max-width: 25.875rem;
  }
  
  /* Menu overlay width limited to 25.875rem and centered */
  #menu-overlay {
    left: 50% !important;
    right: auto !important;
    width: 25.875rem;
    max-width: 25.875rem;
  }
  
  /* Combine existing transform with translateX for centering */
  #menu-overlay.is-open {
    transform: translateX(-50%) scale(1.02) !important;
  }
  
  #menu-overlay:not(.is-open) {
    transform: translateX(-50%) scale(1.02) !important;
  }
  
  /* Side Navigation - vertical list in left margin */
  .side-nav-left {
    left: calc((100vw - 25.875rem) / 4) !important;
  }
}

#header-nav a,
#header-nav a:lang(en),
body #header-nav a,
html body #header-nav a {
  font-weight: 400 !important;
  font-family: "Helvetica Neue", Helvetica, Arial, system-ui, -apple-system, sans-serif !important;
}

/* header::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 0.0625rem;
  background: rgba(255, 255, 255, 0.2);
  pointer-events: none;
} */


/* ============================================
   HERO SLIDER ANIMATIONS
   ============================================ */
.hero-fade-out {
  opacity: 0;
  transform: scale(1.02);
  filter: blur(0.125rem);
  transition: opacity 0.4s ease-in-out, transform 0.4s ease-in-out, filter 0.4s ease-in-out;
}

.hero-fade-in {
  opacity: 1;
  transform: scale(1);
  filter: blur(0);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out, filter 0.8s ease-out;
}

/* Text animation styles */
#hero-title,
#hero-description {
  transition: opacity 0.3s ease-out, transform 0.3s ease-out;
}

#hero-badge {
  transition: opacity 0.3s ease-out;
}

/* Hero text gradient overlay for better readability */
#hero-link {
  display: none;
}

.hero-text-container::before {
  content: "";
  position: absolute;
  bottom: -1.5rem;
  left: 0;
  right: 0;
  height: 9rem;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
  pointer-events: none;
  z-index: -1;
}

/* ============================================
   PHILOSOPHY SECTION
   ============================================ */
.philosophy-text {
  filter: blur(6.25rem);
  opacity: 0;
  transform: scale(1.02);
  transition: filter 0.9s ease-out, opacity 0.9s ease-out, transform 0.9s ease-out;
}

.philosophy-text.revealed {
  filter: blur(0);
  opacity: 1;
  transform: scale(1);
}

/* ============================================
   SCROLL REVEAL EFFECTS
   ============================================ */
.reveal-on-scroll {
  opacity: 0;
  transform: translateY(1.5rem);
  transition: opacity 0.8s ease, transform 0.8s ease;
  will-change: opacity, transform;
}

.reveal-on-scroll.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Header adjustments */
#header-logo {
  filter: brightness(0) invert(1);
}

/* Desktop logo variant */
#header-logo-pc {
  filter: brightness(0) invert(1);
}

body.projects-mode #menu-toggle {
  color: var(--color-text) !important;
  border-color: rgba(244, 244, 244, 0.35) !important;
  background-color: transparent !important;
}

body.projects-mode #menu-toggle:hover {
  opacity: 0.7 !important;
}

/* Default style for menu toggle (PHILOSOPHY, CONTACT sections) */
#menu-toggle {
  background-color: transparent !important;
  transition: border-color 0.3s ease, color 0.3s ease, opacity 0.2s ease;
}

/* Grid overlay for dark sections */
#grid-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 200;
  background-image: 
    linear-gradient(rgba(255,255,255,0.05) 0.0625rem, transparent 0.0625rem),
    linear-gradient(90deg, rgba(255,255,255,0.05) 0.0625rem, transparent 0.0625rem);
  background-size: 1.75rem 1.75rem;
  opacity: 0;
  transition: opacity 0.5s ease;
  display: none; /* グリッドを非表示 */
}

.object-center-60 {
  object-position: center 60%;
}

.grid-reveal {
  opacity: 1 !important;
}

/* ============================================
   PROJECT DETAIL PAGES
   ============================================ */
.project-detail .main-content-wrapper {
  width: 100%;
}

.project-detail .project-hero img {
  width: 100%;
  display: block;
}
.project-detail .project-hero {
  min-height: 24rem;
}
.project-hero-tall {
  position: relative;
  width: 100%;
  height: min(37.5rem, 70vh);
  min-height: 26rem;
  overflow: hidden;
}
.project-hero-tall .project-hero-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}
.project-detail .project-hero + main {
  padding-top: 1rem;
}

.project-detail .project-detail-grid {
  grid-template-columns: 1fr !important;
}

.project-detail .project-detail-grid aside {
  margin-bottom: 3rem;
}

@media (min-width: 48rem) {
  .project-detail .main-content-wrapper {
    max-width: 25.875rem;
    padding-left: 0;
    padding-right: 0;
  }

  .project-detail .project-hero img {
    height: 37.5rem;
  }
  .project-hero-tall {
    height: min(40rem, 70vh);
    min-height: 32rem;
  }
}

.project-detail h1 {
  font-size: 1.75rem !important;
}

.project-detail p.project-summary {
  font-size: 0.875rem !important;
}

.project-detail h1 + p.project-summary {
  margin-top: 0.5rem !important;
}

.side-nav-left {
  font-size: 1.75rem;
}

.side-nav-link {
  font-family: "Helvetica Neue", Helvetica, Arial, system-ui, -apple-system, sans-serif !important;
  font-weight: 400 !important;
  letter-spacing: 0.0625rem;
}

.subtle-link {
  font-family: "Helvetica Neue", Helvetica, Arial, system-ui, -apple-system, sans-serif !important;
  font-weight: 300 !important;
  letter-spacing: 0.0625rem;
}

.badge-tight {
  letter-spacing: 0.0625rem;
}

.section-label {
  letter-spacing: 0.0625rem;
}

.modal-panel {
  top: 1rem;
  transform: scale(1.02);
  transition: opacity 0.5s ease-out, transform 0.5s ease-out;
  backdrop-filter: blur(1.875rem);
  -webkit-backdrop-filter: blur(1.875rem);
}

@media (min-width: 48rem) {
  .about-profile {
    gap: 0 !important;
  }

  .about-profile .name-block {
    margin-bottom: 0 !important;
  }
}

/* ============================================
   MENU OVERLAY
   ============================================ */
#menu-overlay.is-open {
  pointer-events: auto;
}

/* Menu overlay styles for dark section (projects-mode) */
body.projects-mode #menu-overlay {
  background-color: rgba(20, 20, 20, 0.92) !important;
  border-color: rgba(250, 250, 250, 0.1) !important;
  color: var(--color-text) !important;
}

body.projects-mode #menu-overlay a {
  color: var(--color-text) !important;
}

body.projects-mode #menu-overlay a:hover {
  opacity: 0.7 !important;
}

body.projects-mode #menu-overlay span {
  color: rgba(255, 255, 255, 0.6) !important;
}

body.projects-mode #menu-overlay .text-white\/40 {
  color: rgba(255, 255, 255, 0.4) !important;
}

body.projects-mode #menu-overlay .text-white\/50 {
  color: rgba(255, 255, 255, 0.5) !important;
}

body.projects-mode #menu-overlay .text-white\/60 {
  color: rgba(255, 255, 255, 0.6) !important;
}

body.projects-mode #menu-overlay .text-white\/70 {
  color: rgba(255, 255, 255, 0.7) !important;
}

body.projects-mode #menu-overlay .border-white\/10 {
  border-color: rgba(255, 255, 255, 0.1) !important;
}

/* Menu overlay divider line - projects-mode (white) */
body.projects-mode #menu-overlay .border-t {
  border-color: rgba(255, 255, 255, 0.1) !important;
}

/* Menu overlay divider line - default (black) */
#menu-overlay .border-t {
  border-color: rgba(250, 250, 250, 0.08) !important;
  transition: border-color 0.3s ease;
}

body.projects-mode #menu-overlay .border-t {
  border-color: rgba(255, 255, 255, 0.1) !important;
}

/* Menu overlay styles for light section (default) */
#menu-overlay {
  background-color: rgba(20, 20, 20, 0.92) !important;
  border-color: rgba(250, 250, 250, 0.1) !important;
  color: var(--color-text) !important;
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.font-ten-mincho {
  font-family: "Helvetica Neue", Helvetica, Arial, "a-otf-gothic-mb101-pr6n", "Noto Sans JP", "Yu Gothic", "Hiragino Sans", "Meiryo", sans-serif;
  font-weight: 300;
  font-style: normal;
}

.font-moulin {
  font-family: "Moulin", cursive;
}

/* ============================================
   ACCESSIBILITY & PERFORMANCE
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  #page-dark-overlay,
  header,
  #header-nav,
  #header-menu,
  #header-logo {
    transition: none !important;
  }
  
  .grid-reveal {
    animation: none;
    -webkit-mask-size: 100% 100%;
    mask-size: 100% 100%;
    opacity: 0.28;
  }
  
  .gradient-anim {
    animation: none;
  }

  .reveal-on-scroll {
    opacity: 1;
    transform: none;
    transition: none !important;
  }

  .reveal-on-scroll.is-visible {
    opacity: 1;
    transform: none;
  }
}

/* ============================================
   MODAL ANIMATIONS
   ============================================ */
/* Prevent body scroll when modal is open */
body.overflow-hidden {
  overflow: hidden !important;
}

/* Hide header completely when contact modal is open */
body.overflow-hidden:has(#contact-confirm-modal.modal-open) header,
body.overflow-hidden:has(#contact-success-modal.modal-open) header {
  transform: translateY(-100%);
  transition: transform 0.3s ease;
}

/* Keep header visible when menu is open */
body.overflow-hidden:has(.menu-overlay.is-open) header {
  transform: translateY(0);
}

.modal-open {
  opacity: 1 !important;
  transform: scale(1) !important;
  pointer-events: auto !important;
}

/* ============================================
   CHECKMARK ANIMATION
   ============================================ */
.checkmark-circle {
  position: relative;
  width: 5rem;
  height: 5rem;
}

.checkmark-circle-check {
  stroke-dasharray: 240;
  stroke-dashoffset: 240;
  animation: stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
  animation-delay: 0.2s;
}

.checkmark-check {
  stroke-dasharray: 50;
  stroke-dashoffset: 50;
  animation: stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) forwards;
  animation-delay: 0.6s;
}

@keyframes stroke {
  100% {
    stroke-dashoffset: 0;
  }
}

/* Checkmark scale animation */
.checkmark-circle {
  animation: scaleIn 0.5s cubic-bezier(0.65, 0, 0.45, 1);
}

@keyframes scaleIn {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* ============================================
   CUSTOM SCROLLBAR (for modals)
   ============================================ */
.overflow-y-auto::-webkit-scrollbar {
  width: 0.375rem;
}

.overflow-y-auto::-webkit-scrollbar-track {
  background: rgba(31, 31, 29, 0.05);
  border-radius: 0.1875rem;
}

.overflow-y-auto::-webkit-scrollbar-thumb {
  background: rgba(31, 31, 29, 0.2);
  border-radius: 0.1875rem;
}

.overflow-y-auto::-webkit-scrollbar-thumb:hover {
  background: rgba(31, 31, 29, 0.3);
}

/* Remove bottom border from footer */
footer {
  border-bottom: none !important;
}

/* Remove any bottom border from body on projects page */
body:has(#projects) footer {
  border-bottom: none !important;
}

/* ============================================
   CONTENT SHADOW (Floating Effect) - PC Only
   ============================================ */
/* Main content wrapper with shadow - PC only */
@media (min-width: 48rem) {
  html {
    background-color: #222222 !important;
  }

  body {
    background-color: #222222 !important;
  }

  /* PC background color - left/right margins */
  /* Main content wrapper - scrollable content area with white background */
  .main-content-wrapper {
    box-shadow: 0 0.75rem 2rem rgba(0, 0, 0, 0.45), 0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.38);
    background-color: rgba(255, 255, 255, 0.08);
    border-radius: 0;
  }

  .privacy-policy-left {
    left: calc((100vw - 25.875rem) / 4) !important;
  }

  .copyright-right {
    right: calc((100vw - 25.875rem) / 4) !important;
  }
}
