/* ============================================
   Yuugen Visuals — style.css
   Palette: ink #0c0e10 / surface #14171a /
   paper #ece8e1 / mist #9aa0a6 / shu #c8553d
   Type: Shippori Mincho (display + kanji),
   Oswald (labels/nav), Inter (body)
   ============================================ */

:root {
  --ink: #0c0e10;
  --surface: #14171a;
  --line: #23272b;
  --paper: #ece8e1;
  --mist: #9aa0a6;
  --shu: #c8553d;
  --header-bg: rgba(12, 14, 16, 0.92);
  --font-display: "Shippori Mincho", serif;
  --font-headline: "Space Grotesk", sans-serif;
  --font-label: "Oswald", sans-serif;
  --font-body: "Inter", sans-serif;
}

html.light {
  --ink: #f2efe9;
  --surface: #ffffff;
  --line: #ddd7cd;
  --paper: #1b1d1f;
  --mist: #63676d;
  --header-bg: rgba(242, 239, 233, 0.92);
}

body {
  transition: background 0.4s ease, color 0.4s ease;
}

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

/* Smooth in-page scrolling is handled by GSAP ScrollToPlugin;
   native smooth-behavior would fight it frame-by-frame */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

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

a { color: inherit; text-decoration: none; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
/* Keep page content clear of the floating control rail on the left:
   content's left edge stays >= 146px from the viewport edge until the
   centered 1200px column naturally clears it */
@media (min-width: 861px) {
  .wrap {
    padding-left: clamp(24px, calc(148px - (100vw - 1200px) / 2), 148px);
    padding-right: clamp(24px, calc(148px - (100vw - 1200px) / 2), 148px);
  }
}

.label {
  font-family: var(--font-label);
  font-weight: 500;
  font-size: 0.78rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--mist);
}

.section-head { margin-bottom: 48px; }
.section-head .label { color: var(--shu); }
.section-head h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2rem, 4.5vw, 3.2rem);
  line-height: 1.15;
  margin-top: 10px;
}

/* ---------- Header ---------- */
.site-header {
  color: var(--paper);
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  padding: 22px 0;
  transition: background 0.35s ease, padding 0.35s ease;
}
.site-header.scrolled, .site-header.solid {
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
/* Transparent header only ever sits over the dark hero photo,
   so its text stays light regardless of theme */
.site-header:not(.scrolled):not(.solid) {
  --paper: #ece8e1;
  --mist: #9aa0a6;
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.header-left, .header-right {
  display: flex;
  align-items: center;
  gap: 18px;
}

/* ---------- Floating rail: control pill + contact pill ---------- */
.floating-rail {
  position: fixed;
  left: 26px;
  top: 50%;
  translate: 0 -50%;
  z-index: 150;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.floating-rail.rail-right {
  left: auto;
  right: 26px;
}
.floating-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.35);
  /* GSAP owns transform for the magnetic effect — no CSS transforms here */
}
.fc-divider {
  width: 26px;
  height: 1px;
  background: var(--line);
}
.icon-btn {
  background: none;
  border: 0;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  flex: 0 0 auto;
  cursor: pointer;
  color: var(--paper);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.25s, background 0.25s;
}
.icon-btn:hover {
  background: var(--shu);
  color: #ece8e1;
}
.icon-btn:focus-visible {
  outline: 2px solid var(--shu);
  outline-offset: 3px;
}
.icon-btn svg { width: 25px; height: 25px; display: block; }
/* WhatsApp glyph fills its viewBox edge-to-edge; shrink so all three
   contact icons read the same optical size */
.contact-pill a[aria-label="WhatsApp"] svg { width: 21px; height: 21px; }

/* Vertical light/dark switch: sun on top, moon below, knob marks the mode */
.theme-toggle {
  position: relative;
  width: 50px;
  height: 102px;
  border-radius: 999px;
  background: var(--ink);
  border: 1px solid var(--line);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  color: var(--mist);
  transition: border-color 0.25s;
}
.theme-toggle:hover { border-color: var(--shu); }
.theme-toggle:focus-visible {
  outline: 2px solid var(--shu);
  outline-offset: 3px;
}
.theme-toggle svg {
  width: 22px;
  height: 22px;
  position: relative;
  z-index: 1;
  transition: color 0.35s;
}
.tt-knob {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--shu);
  transform: translateY(53px); /* dark: knob over the moon */
  transition: transform 0.35s cubic-bezier(0.55, 0, 0.2, 1.3);
}
html.light .tt-knob { transform: translateY(0); } /* light: knob over the sun */
.theme-toggle .tt-moon { color: #ece8e1; }        /* icon under the knob reads active */
html.light .theme-toggle .tt-moon { color: var(--mist); }
html.light .theme-toggle .tt-sun { color: #ece8e1; }
.icon-btn .icon-alt { display: none; }
html.light .theme-toggle .icon-main { display: none; }
html.light .theme-toggle .icon-alt { display: block; }
html.is-fullscreen .fullscreen-toggle .icon-main { display: none; }
html.is-fullscreen .fullscreen-toggle .icon-alt { display: block; }
.brand {
  display: flex;
  align-items: baseline;
  gap: 12px;
}
.brand .wordmark {
  font-family: var(--font-label);
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: 0.42em;
  text-transform: uppercase;
}
.brand .kanji {
  font-family: var(--font-display);
  color: var(--shu);
  font-size: 1rem;
}
.site-nav { display: flex; gap: 38px; }
.site-nav a {
  font-family: var(--font-label);
  font-weight: 400;
  font-size: 0.8rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--mist);
  transition: color 0.25s;
}
.site-nav a:hover, .site-nav a.active { color: var(--paper); }
.site-nav a.active { border-bottom: 1px solid var(--shu); padding-bottom: 4px; }

.nav-toggle {
  display: none;
  background: none;
  border: 0;
  color: var(--paper);
  font-size: 1.6rem;
  cursor: pointer;
  line-height: 1;
}

/* ---------- Hero ---------- */
.hero {
  /* Hero always sits on the dark photograph — keep its text light in both themes */
  --paper: #ece8e1;
  --mist: #a9aeb4;
  color: var(--paper);
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}
.hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center 40%;
  filter: saturate(0.92);
}
.hero-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(12,14,16,0.55) 0%, rgba(12,14,16,0.15) 40%, rgba(12,14,16,0.92) 88%),
    radial-gradient(120% 60% at 50% 100%, rgba(12,14,16,0.55), transparent 60%);
}
.hero-kanji {
  position: absolute;
  top: 50%;
  right: 4vw;
  transform: translateY(-50%);
  writing-mode: vertical-rl;
  font-family: var(--font-display);
  font-size: clamp(4rem, 9vw, 7.5rem);
  color: rgba(236, 232, 225, 0.14);
  letter-spacing: 0.25em;
  user-select: none;
  pointer-events: none;
}
.hero-inner {
  position: relative;
  width: 100%;
  padding-bottom: 72px;
}
.hero .eyebrow {
  color: var(--shu);
  margin-bottom: 18px;
}
.hero h1 {
  font-family: var(--font-headline);
  font-weight: 700;
  font-size: clamp(2.3rem, 5.6vw, 4.3rem);
  line-height: 1.06;
  letter-spacing: -0.02em;
  max-width: 15em;
}
.hero .sub {
  margin-top: 20px;
  max-width: 34em;
  color: var(--mist);
  font-size: 1.02rem;
}

/* Category switcher */
.cat-switch {
  margin-top: 44px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 26px;
  border-top: 1px solid rgba(236,232,225,0.18);
  padding-top: 22px;
}
.cat-switch .label { margin-right: 8px; align-self: center; color: var(--shu); }
.cat-btn {
  background: none;
  border: 0;
  cursor: pointer;
  font-family: var(--font-label);
  font-weight: 400;
  font-size: 0.92rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--mist);
  padding: 6px 2px;
  position: relative;
  transition: color 0.25s;
}
.cat-btn::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  height: 1px;
  width: 100%;
  background: var(--shu);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
}
.cat-btn:hover { color: var(--paper); }
.cat-btn.active { color: var(--paper); }
.cat-btn.active::after { transform: scaleX(1); }

/* ---------- Portfolio grid ---------- */
.portfolio { padding: 96px 0 64px; }
.grid {
  columns: 3 320px;
  column-gap: 32px;
}
.grid a {
  display: block;
  margin-bottom: 32px;
  break-inside: avoid;
  overflow: hidden;
  background: var(--surface);
  border-radius: 14px;
}
.grid img {
  width: 100%;
  transition: transform 0.6s ease, opacity 0.6s ease;
  opacity: 0.96;
}
.grid a:hover img { transform: scale(1.03); opacity: 1; }
.grid.fading img { opacity: 0; }

/* ---------- Lightbox ---------- */
.lightbox {
  --paper: #ece8e1;
  --mist: #9aa0a6;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(8, 9, 10, 0.96);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 4vh 4vw;
}
.lightbox.open { display: flex; }
.lightbox img {
  max-width: 100%;
  max-height: 92svh;
  object-fit: contain;
  border-radius: 14px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.6);
}
.lightbox .lb-close, .lightbox .lb-prev, .lightbox .lb-next {
  position: absolute;
  background: none;
  border: 0;
  color: var(--mist);
  font-size: 2rem;
  cursor: pointer;
  padding: 12px;
  transition: color 0.2s;
  line-height: 1;
}
.lightbox button:hover { color: var(--paper); }
.lb-close { top: 18px; right: 22px; }
.lb-prev { left: 12px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 12px; top: 50%; transform: translateY(-50%); }

/* ---------- Page hero (inner pages) ---------- */
.page-hero {
  padding: 180px 0 70px;
  border-bottom: 1px solid var(--line);
}
.page-hero .label { color: var(--shu); }
.page-hero h1 {
  font-family: var(--font-headline);
  font-weight: 700;
  font-size: clamp(2.3rem, 5.2vw, 3.8rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin-top: 12px;
}
.page-hero p { color: var(--mist); max-width: 40em; margin-top: 16px; }

/* ---------- Services ---------- */
.services-list { padding: 80px 0 40px; }
.service {
  display: grid;
  grid-template-columns: minmax(180px, 300px) 1fr;
  gap: 28px 48px;
  padding: 44px 0;
  border-bottom: 1px solid var(--line);
}
.service h3 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.7rem;
  line-height: 1.3;
}
.service h3 .jp {
  display: block;
  font-size: 0.95rem;
  color: var(--shu);
  margin-top: 6px;
  letter-spacing: 0.3em;
}
.service p { color: var(--mist); max-width: 46em; }
.service ul {
  margin-top: 14px;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
}
.service li {
  font-family: var(--font-label);
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--paper);
  border: 1px solid var(--line);
  padding: 7px 14px;
}

/* ---------- About ---------- */
.about-section { padding: 90px 0; }
.about-grid {
  display: grid;
  grid-template-columns: 5fr 6fr;
  gap: 64px;
  align-items: start;
}
.about-grid figure {
  position: relative;
}
.about-grid figure img { border-radius: 14px; }

/* Flip card: Carl on the front, Carl on the CBR on the back */
.flip-card { perspective: 1400px; cursor: pointer; }
.flip-inner {
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.9s cubic-bezier(0.5, 0, 0.15, 1);
}
.flip-card:hover .flip-inner,
.flip-card.flipped .flip-inner { transform: rotateY(180deg); }
.flip-front, .flip-back {
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  width: 100%;
  display: block;
}
.flip-back {
  position: absolute;
  inset: 0;
  height: 100%;
  object-fit: cover;
  transform: rotateY(180deg);
}
@media (prefers-reduced-motion: reduce) {
  .flip-inner { transition: none; }
}
.about-grid figure::after {
  content: "幽玄";
  position: absolute;
  right: -18px;
  bottom: -26px;
  writing-mode: vertical-rl;
  font-family: var(--font-display);
  font-size: 2.2rem;
  color: var(--shu);
}
.about-copy h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 2rem;
  margin-bottom: 22px;
}
.about-copy p { color: var(--mist); margin-bottom: 18px; }
.about-copy strong { color: var(--paper); font-weight: 600; }

.definition {
  margin: 34px 0;
  padding: 28px 32px;
  border-left: 2px solid var(--shu);
  background: var(--surface);
}
.definition .term {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--paper);
}
.definition .term span { color: var(--shu); margin-left: 10px; }
.definition p { margin: 10px 0 0; color: var(--mist); font-style: italic; }

/* ---------- Contact ---------- */
.contact { padding: 96px 0; border-top: 1px solid var(--line); }
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 64px;
}
.contact-info p { color: var(--mist); max-width: 30em; margin-bottom: 34px; }
.contact-item { margin-bottom: 26px; }
.contact-item .label { display: block; margin-bottom: 6px; font-size: 0.7rem; }
.contact-item a, .contact-item span {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--paper);
}
.contact-item a:hover { color: var(--shu); }
.socials { display: flex; gap: 22px; margin-top: 10px; }
.socials a {
  font-family: var(--font-label);
  font-size: 0.8rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--mist);
  border-bottom: 1px solid transparent;
  padding-bottom: 3px;
  transition: color 0.25s, border-color 0.25s;
}
.socials a:hover { color: var(--paper); border-color: var(--shu); }

.contact-form label {
  display: block;
  margin-bottom: 20px;
}
.contact-form .label { display: block; margin-bottom: 8px; font-size: 0.7rem; }
.contact-form input, .contact-form textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--paper);
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 13px 15px;
  transition: border-color 0.25s;
}
.contact-form input:focus, .contact-form textarea:focus {
  outline: none;
  border-color: var(--shu);
}
.contact-form textarea { min-height: 140px; resize: vertical; }
.btn {
  display: inline-block;
  background: none;
  border: 1px solid var(--shu);
  color: var(--paper);
  font-family: var(--font-label);
  font-size: 0.8rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  padding: 15px 38px;
  cursor: pointer;
  transition: background 0.3s, color 0.3s;
}
.btn:hover { background: var(--shu); color: var(--ink); }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 36px 0;
}
.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
}
.site-footer p {
  font-family: var(--font-label);
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--mist);
}
.site-footer .kanji { color: var(--shu); font-family: var(--font-display); }

/* ---------- Reveal on scroll ---------- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}
.reveal.visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .grid img { transition: none; }
}

/* ---------- Film grain ---------- */
.grain {
  position: fixed;
  inset: -100px;
  z-index: 300;
  pointer-events: none;
  opacity: 0.055;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.72' numOctaves='2'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain-shift 0.9s steps(4) infinite;
}
@keyframes grain-shift {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-36px, 22px); }
  50% { transform: translate(24px, -30px); }
  75% { transform: translate(-18px, -12px); }
  100% { transform: translate(30px, 18px); }
}
html.light .grain { opacity: 0.04; }

/* ---------- Custom cursor ---------- */
@media (pointer: fine) {
  html.has-cursor, html.has-cursor a, html.has-cursor button,
  html.has-cursor input, html.has-cursor textarea, html.has-cursor label {
    cursor: none;
  }
}
.cursor-dot, .cursor-ring {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 400;
  pointer-events: none;
  border-radius: 50%;
}
.cursor-dot {
  width: 7px;
  height: 7px;
  background: var(--shu);
}
.cursor-ring {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(200, 85, 61, 0.55);
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .site-nav {
    position: fixed;
    top: 0;
    right: 0;
    height: 100svh;
    width: min(78vw, 320px);
    background: var(--surface);
    flex-direction: column;
    gap: 28px;
    padding: 110px 40px;
    transform: translateX(100%);
    transition: transform 0.35s ease;
    border-left: 1px solid var(--line);
  }
  .site-nav.open { transform: none; }
  .nav-toggle { display: block; position: relative; z-index: 110; }
  /* Dock the rail bottom-right on mobile, pills side by side
     (bottom-left would sit on top of the hero's category buttons) */
  .floating-rail { left: auto; right: 14px; top: auto; bottom: 18px; translate: none; flex-direction: row; align-items: flex-end; gap: 8px; }
  /* Contact pill sits just left of the controls pill in the corner */
  .floating-rail.rail-right { right: 80px; }
  .floating-controls { gap: 6px; padding: 6px; }
  .icon-btn { width: 44px; height: 44px; }
  .icon-btn svg { width: 22px; height: 22px; }
  .contact-pill a[aria-label="WhatsApp"] svg { width: 18px; height: 18px; }
  .theme-toggle { width: 44px; height: 90px; padding: 11px 0; }
  .theme-toggle svg { width: 20px; height: 20px; }
  .tt-knob { top: 4px; left: 4px; width: 34px; height: 34px; transform: translateY(48px); }
  html.light .tt-knob { transform: translateY(0); }
  /* Keep the hero's top clear of the fixed header when content overflows,
     and the category row clear of the docked controls */
  .hero-inner { padding-top: 110px; }
  .cat-switch { padding-right: 150px; }
  .icon-btn { width: 58px; height: 58px; }
  .icon-btn svg { width: 27px; height: 27px; }
  .about-grid, .contact-grid { grid-template-columns: 1fr; gap: 44px; }
  .service { grid-template-columns: 1fr; gap: 14px; padding: 34px 0; }
  .hero-kanji { right: 2vw; }
}
