/* --- Variables --- */
:root {
  --bg: #f8f6f3;
  --bg-soft: #f0ede8;
  --text: #2c2a28;
  --text-muted: #6b6560;
  --border: #e0dcd6;
  --serif: 'Cormorant Garamond', 'Times New Roman', serif;
  --sans: 'Noto Sans JP', sans-serif;
  --space: clamp(1.5rem, 4vw, 3rem);
  --space-lg: clamp(3rem, 8vw, 6rem);
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

/* --- Splash (dog drawing on load) --- */
.splash {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  opacity: 1;
  transition: opacity 0.6s ease;
  pointer-events: none;
}
.splash.hidden {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.8s ease, visibility 0s linear 0.8s;
}
.splash-inner {
  max-width: 85vw;
  max-height: 85vh;
  animation: splashFadeIn 0.8s ease;
}
.splash-image {
  max-width: 100%;
  max-height: 85vh;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}
@keyframes splashFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

body {
  margin: 0;
  font-family: var(--sans);
  font-weight: 400;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
  vertical-align: middle;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease, opacity 0.2s ease;
}
a:hover { color: var(--text-muted); }

/* --- Header --- */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem var(--space);
  background: rgba(248, 246, 243, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s ease;
}
.header.scrolled { border-color: var(--border); }

.logo {
  font-family: var(--serif);
  font-size: 1.1rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.nav {
  display: flex;
  gap: 2rem;
}
.nav a {
  font-size: 0.9rem;
  font-weight: 400;
  letter-spacing: 0.04em;
}

/* Language switch */
.lang-switch {
  display: flex;
  gap: 0;
  margin-left: 0.5rem;
}
.lang-btn {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-family: var(--sans);
  font-weight: 500;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: none;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}
.lang-btn:first-child { border-right: none; border-radius: 2px 0 0 2px; }
.lang-btn:not(:first-child):not(:last-child) { border-right: none; }
.lang-btn:last-child { border-radius: 0 2px 2px 0; }
.lang-btn:hover { color: var(--text); }
.lang-btn.active {
  color: var(--text);
  background: var(--bg-soft);
  border-color: var(--text-muted);
}

/* Language visibility */
body.lang-ja .lang-en,
body.lang-ja .lang-fr { display: none !important; }
body.lang-en .lang-ja,
body.lang-en .lang-fr { display: none !important; }
body.lang-fr .lang-ja,
body.lang-fr .lang-en { display: none !important; }

.menu-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 6px;
  width: 44px;
  height: 44px;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.menu-btn span {
  width: 22px;
  height: 1px;
  background: var(--text);
  display: block;
}

.nav-backdrop { display: none; }
.nav-close { display: none; }

@media (max-width: 768px) {
  .nav {
    position: fixed;
    top: 0;
    right: 0;
    width: 60%;
    min-width: 240px;
    height: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 4rem var(--space) var(--space);
    background-color: #fff;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.08);
    z-index: 101;
    transform: translateX(100%);
    transition: transform 0.25s ease;
    isolation: isolate;
    overflow: auto;
  }
  .nav::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #fff;
    z-index: -1;
  }
  .nav.open { transform: translateX(0); }
  .nav-close {
    display: block;
    position: absolute;
    top: 1rem;
    right: var(--space);
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    font-size: 1.75rem;
    line-height: 1;
    color: var(--text);
    background: none;
    border: none;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s ease;
    z-index: 2;
  }
  .nav-close:hover { opacity: 1; }
  .nav a {
    position: relative;
    z-index: 1;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
  }
  .nav a:last-child { border-bottom: none; }
  .nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(44, 42, 40, 0.2);
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }
  .nav-backdrop.open {
    opacity: 1;
    pointer-events: auto;
  }
  .lang-switch { margin-left: auto; }
  .menu-btn { display: flex; position: relative; z-index: 102; }
  .menu-btn span { background: var(--text); }
}

/* --- Hero --- */
.hero {
  padding-top: 0;
  margin-bottom: var(--space-lg);
}
.hero-image {
  width: 100%;
  max-height: 85vh;
  overflow: hidden;
  background: var(--bg-soft);
}
.hero-image img {
  width: 100%;
  height: auto;
  max-height: 85vh;
  object-fit: cover;
  object-position: center;
}
.hero-caption {
  margin: 1rem var(--space) 0;
  font-family: var(--serif);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  text-align: center;
}

/* --- Sections --- */
.section {
  padding: var(--space-lg) var(--space);
  max-width: 1200px;
  margin: 0 auto;
}
.section-title {
  font-family: var(--serif);
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 500;
  letter-spacing: 0.06em;
  margin-bottom: var(--space);
  color: var(--text);
}

/* --- Works Grid --- */
.works-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}
.work-item {
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--bg-soft);
}
.work-link {
  display: block;
  width: 100%;
  height: 100%;
}
.work-link img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.work-link:hover img {
  transform: scale(1.02);
}
.work-caption {
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

@media (max-width: 900px) {
  .works-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .works-grid { gap: 0.75rem; }
}

/* --- Works list --- */
.works-list-wrap {
  margin-top: var(--space-lg);
  padding-top: var(--space);
  border-top: 1px solid var(--border);
}
.subsection-title {
  font-family: var(--serif);
  font-size: 1.1rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  margin-bottom: 1rem;
  color: var(--text-muted);
}
.works-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem 3rem;
}
.works-list-col h4 {
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}
.work-entries {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.85rem;
  line-height: 1.75;
  color: var(--text);
}
.work-entries li { margin-bottom: 0.35em; }
.work-entries .work-list-link {
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease, color 0.2s ease;
  padding-right: 0.5em;
}
.work-entries .work-list-link::after {
  content: ' →';
  font-size: 0.9em;
  opacity: 0.6;
  transition: opacity 0.2s ease;
}
.work-entries .work-list-link:hover { border-color: var(--text-muted); }
.work-entries .work-list-link:hover::after { opacity: 1; }

@media (max-width: 900px) {
  .works-list { grid-template-columns: 1fr; }
}

/* --- About --- */
.about-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-lg);
  align-items: start;
}
.about-image {
  background: var(--bg-soft);
  overflow: hidden;
}
.about-image img {
  width: 100%;
  height: auto;
  object-fit: cover;
}
.about-name {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  margin-bottom: 1rem;
  line-height: 1.5;
}
.about-text p {
  margin: 0 0 0.75em;
  color: var(--text);
}
.about-text p:last-child { margin-bottom: 0; }
.about-hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1rem 0;
}
.about-statement {
  font-size: 0.95rem;
  line-height: 1.8;
  margin-bottom: 1rem;
}

@media (max-width: 768px) {
  .about-inner { grid-template-columns: 1fr; }
}

/* --- CV --- */
.cv-block {
  margin-bottom: var(--space);
}
.cv-heading {
  font-family: var(--serif);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--text);
  margin-bottom: 0.5rem;
}
.cv-bilingual {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  font-size: 0.9rem;
  line-height: 1.75;
}
.cv-ja p,
.cv-en p,
.cv-fr p {
  margin: 0 0 0.25em;
  color: var(--text);
}
.cv-en,
.cv-fr { color: var(--text-muted); }
body.lang-ja .cv-bilingual,
body.lang-en .cv-bilingual,
body.lang-fr .cv-bilingual { grid-template-columns: 1fr; }
body.lang-ja .cv-en,
body.lang-ja .cv-fr,
body.lang-en .cv-ja,
body.lang-en .cv-fr,
body.lang-fr .cv-ja,
body.lang-fr .cv-en { display: none !important; }
.cv-note {
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--text-muted);
  max-width: 40em;
}
.cv-note p { margin: 0; }

@media (max-width: 768px) {
  .cv-bilingual { grid-template-columns: 1fr; }
}

/* --- Contact --- */
.contact-text { margin-bottom: 0.5rem; }
.contact-email,
.contact-instagram { margin-bottom: 0.5rem; }
.contact-email:last-child,
.contact-instagram:last-child { margin-bottom: 0; }
.contact-email a,
.contact-instagram a {
  border-bottom: 1px solid var(--border);
}
.contact-email a:hover,
.contact-instagram a:hover { border-color: var(--text-muted); }

/* --- Lightbox --- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(44, 42, 40, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.lightbox.open {
  opacity: 1;
  visibility: visible;
}
.lightbox-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  width: 44px;
  height: 44px;
  font-size: 2rem;
  line-height: 1;
  color: #fff;
  background: none;
  border: none;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.2s ease;
}
.lightbox-close:hover { opacity: 1; }
.lightbox-prev,
.lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  font-size: 2.5rem;
  line-height: 1;
  color: #fff;
  background: none;
  border: none;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}
.lightbox-prev { left: 1rem; }
.lightbox-next { right: 1rem; }
.lightbox-prev:hover,
.lightbox-next:hover { opacity: 1; }
.lightbox-content {
  max-width: 90vw;
  max-height: 85vh;
  text-align: center;
}
.lightbox-content img {
  max-width: 100%;
  max-height: 75vh;
  width: auto;
  height: auto;
  margin: 0 auto;
  object-fit: contain;
}
.lightbox-caption {
  margin-top: 1rem;
  font-size: 0.9rem;
  color: rgba(255,255,255,0.8);
}

/* --- Legal --- */
.legal {
  padding-top: var(--space);
  padding-bottom: var(--space-lg);
  border-top: 1px solid var(--border);
}
.legal .section-title { margin-bottom: 1.25rem; }
.legal-block {
  margin-bottom: var(--space);
  max-width: 40em;
}
.legal-block:last-child { margin-bottom: 0; }
.legal-heading {
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  color: var(--text);
  margin-bottom: 0.5rem;
}
.legal-block p {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
  line-height: 1.8;
  color: var(--text);
}
.legal-block p:last-child { margin-bottom: 0; }

/* --- Footer --- */
.footer {
  padding: var(--space) var(--space);
  border-top: 1px solid var(--border);
  text-align: center;
}
.footer p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}
.footer p + p { margin-top: 0.5rem; }
.footer-legal {
  font-size: 0.85rem;
}
.footer-legal a {
  color: var(--text);
  border-bottom: 1px solid var(--border);
  transition: border-color 0.2s ease, color 0.2s ease;
}
.footer-legal a:hover { border-color: var(--text-muted); color: var(--text-muted); }
