/* ============================================================
   LANDING — ink / paper / vermilion
   Horizontal expanding-panel accordion
   ============================================================ */

body.landing {
  --page-bg: var(--ink);
  --page-fg: var(--paper);
  --veil: var(--ink);
  --chrome-fg: var(--paper);
  height: 100dvh;
  overflow: hidden;
}

/* The chrome scrim exists for scrolling pages; here the background is
   already ink and the centered title shares the chrome's zone — the
   scrim would dim the flags and headline. */
body.landing .chrome::before { display: none; }

.landing main {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 0 clamp(0.9rem, 2.5vw, 1.6rem) clamp(0.9rem, 2.5vw, 1.6rem);
  gap: clamp(0.3rem, 0.8vh, 0.6rem);
}

/* ---------- Heading ----------
   The band is content-sized with symmetric padding, so the title sits
   centered between the viewport top and the panels while the stage
   keeps every remaining pixel. The fixed chrome floats above it. */
.landing-head {
  text-align: center;
  flex: none;
  padding-block: clamp(1rem, 2.4vh, 1.9rem);
}
/* Below ~1180px the centered title would brush the chrome corners
   (logo / language toggle) — start it under the chrome instead. */
@media (max-width: 1180px) {
  .landing main { padding-top: 3.2rem; }
}
.landing-head .head-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(1rem, 3.5vw, 2.4rem);
}
.landing-head .flag {
  width: clamp(36px, 4.5vw, 58px);
  height: auto;
  flex: none;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.45));
  opacity: 0;
  animation:
    headRise 1.1s var(--ease-out) forwards,
    flagFloat 5.5s ease-in-out 1.8s infinite alternate;
}
.landing-head .flag-sl { animation-delay: 0.5s, 1.8s; }
.landing-head .flag-jp { animation-delay: 0.62s, 4.2s; }
@keyframes flagFloat {
  from { transform: translateY(0); }
  to { transform: translateY(-6px); }
}
.landing-head h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.7rem, 4.2vw, 3.3rem);
  letter-spacing: -0.02em;
  line-height: 1.1;
  opacity: 0;
  transform: translateY(26px);
  animation: headRise 1.1s var(--ease-out) 0.15s forwards;
}
.landing-head h1 .full-stop { color: var(--vermilion); }
.landing-head .sub {
  margin-top: 0.5rem;
  font-size: clamp(0.78rem, 1.4vw, 0.95rem);
  letter-spacing: 0.08em;
  opacity: 0;
  animation: headRise 1.1s var(--ease-out) 0.35s forwards;
  color: color-mix(in srgb, var(--paper) 62%, transparent);
}
@keyframes headRise {
  from { opacity: 0; transform: translateY(26px); }
  to { opacity: 1; transform: none; }
}

/* ---------- Accordion stage ---------- */
.stage {
  flex: 1;
  min-height: 0;
  display: flex;
  gap: clamp(0.5rem, 1vw, 0.8rem);
}

.panel {
  position: relative;
  flex: 1;
  min-width: 0;
  border-radius: clamp(14px, 1.6vw, 22px);
  overflow: hidden;
  cursor: pointer;
  background: #1a1a1a;
  isolation: isolate;
  opacity: 0;
  transform: translateY(34px);
  animation: panelRise 1s var(--ease-out) forwards;
  transition: flex 0.85s var(--ease-snap);
  outline: none;
}
.panel:nth-child(1) { animation-delay: 0.45s; }
.panel:nth-child(2) { animation-delay: 0.58s; }
.panel:nth-child(3) { animation-delay: 0.71s; }
.panel:nth-child(4) { animation-delay: 0.84s; }
@keyframes panelRise {
  from { opacity: 0; transform: translateY(34px); }
  to { opacity: 1; transform: none; }
}

.panel.open { flex: 6.5; cursor: pointer; }
.stage.zooming .panel.open { flex: 200; }
.stage.zooming .panel:not(.open) { flex: 0.0001; opacity: 0; }
.stage.zooming .panel { transition: flex 0.8s var(--ease-snap), opacity 0.5s ease 0.15s; }

/* Scene art fills the panel */
.scene {
  position: absolute;
  inset: 0;
  z-index: -1;
  transition: filter 0.85s var(--ease-luxe), transform 1.6s var(--ease-luxe);
  filter: brightness(0.55) saturate(0.65);
  transform: scale(1.06);
  /* Keep the scene on its own GPU layer so the browser doesn't re-rasterise
     (and re-round to a whole pixel) when the scale transition settles —
     that pixel snap is what made the image "slip" sideways at the end. */
  will-change: transform;
  backface-visibility: hidden;
}
.scene img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.scene svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.panel.open .scene { filter: brightness(1) saturate(1); transform: scale(1.0); }
.stage.zooming .panel.open .scene { transform: scale(1.04); }

/* Gradient shade so text stays readable */
.panel::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.72) 0%, rgba(0,0,0,0.16) 48%, rgba(0,0,0,0.28) 100%);
  opacity: 0;
  transition: opacity 0.7s var(--ease-luxe);
  pointer-events: none;
}
.panel.open::after { opacity: 1; }

/* ---------- Collapsed spine ---------- */
.spine {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.45s var(--ease-luxe);
  pointer-events: none;
}
.panel.open .spine { opacity: 0; }
.spine .v-label {
  writing-mode: vertical-rl;
  font-family: var(--font-jp);
  font-weight: 600;
  font-size: clamp(1rem, 1.8vw, 1.45rem);
  letter-spacing: 0.42em;
  color: rgba(250, 247, 242, 0.92);
  text-shadow: 0 2px 18px rgba(0,0,0,0.6);
}

/* ---------- Icon badge (slides bottom-center → top-left) ---------- */
.badge {
  position: absolute;
  z-index: 3;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(20, 20, 20, 0.45);
  border: 1px solid rgba(250, 247, 242, 0.5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: var(--paper);
  left: 50%;
  top: calc(100% - 74px);
  transform: translateX(-50%);
  transition:
    left 0.8s var(--ease-snap),
    top 0.8s var(--ease-snap),
    transform 0.8s var(--ease-snap),
    border-color 0.8s;
  pointer-events: none;
}
.badge svg { width: 22px; height: 22px; }
.panel.open .badge {
  left: clamp(1.2rem, 2vw, 2rem);
  top: clamp(1.2rem, 2vw, 2rem);
  transform: translateX(0);
  border-color: var(--badge-accent, var(--vermilion));
}

/* ---------- Expanded content ---------- */
.panel-content {
  position: absolute;
  z-index: 2;
  inset: auto 0 0 0;
  padding: clamp(1.4rem, 3vw, 2.6rem);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.65rem;
  pointer-events: none;
}
.panel.open .panel-content { pointer-events: auto; }

.panel-content .kicker {
  font-size: 0.7rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--badge-accent, var(--vermilion));
  font-weight: 600;
}
.panel-content h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.7rem, 3.6vw, 3rem);
  line-height: 1.05;
  letter-spacing: -0.015em;
  color: var(--paper);
}
.panel-content .teaser {
  font-size: clamp(0.86rem, 1.3vw, 1rem);
  max-width: 34ch;
  color: rgba(250, 247, 242, 0.82);
}
.panel-content .enter-btn {
  margin-top: 0.7rem;
  pointer-events: auto;
  background: rgba(250, 247, 242, 0.1);
  border: 1px solid rgba(250, 247, 242, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: var(--paper);
}
.panel-content .enter-btn:hover {
  background: var(--badge-accent, var(--vermilion));
  border-color: var(--badge-accent, var(--vermilion));
  color: var(--ink);
  box-shadow: 0 14px 30px -12px var(--badge-accent, var(--vermilion));
}

.panel-content > * {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.55s var(--ease-out), transform 0.55s var(--ease-out);
}
.panel.open .panel-content > * { opacity: 1; transform: none; }
.panel.open .panel-content > :nth-child(1) { transition-delay: 0.28s; }
.panel.open .panel-content > :nth-child(2) { transition-delay: 0.36s; }
.panel.open .panel-content > :nth-child(3) { transition-delay: 0.44s; }
.panel.open .panel-content > :nth-child(4) { transition-delay: 0.52s; }

/* Big kanji watermark */
.kanji-mark {
  position: absolute;
  z-index: 1;
  right: clamp(0.8rem, 2vw, 2rem);
  top: clamp(0.6rem, 1.5vw, 1.4rem);
  font-family: var(--font-jp);
  font-weight: 900;
  font-size: clamp(4rem, 9vw, 8rem);
  line-height: 1;
  color: rgba(250, 247, 242, 0.07);
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.9s var(--ease-luxe) 0.25s, transform 0.9s var(--ease-luxe) 0.25s;
  pointer-events: none;
}
.panel.open .kanji-mark { opacity: 1; transform: none; }

/* Focus ring for keyboard users */
.panel:focus-visible { box-shadow: 0 0 0 3px var(--vermilion); }

/* ---------- Bottom dock (panel switcher) ---------- */
.dock {
  flex: none;
  display: flex;
  justify-content: center;
  gap: clamp(2.2rem, 9vw, 7rem);
  padding-top: clamp(0.7rem, 1.8vh, 1.2rem);
}
.dock-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.18rem;
  padding: 0.25rem 0.5rem 0.6rem;
  color: var(--paper);
  opacity: 0.5;
  transition: opacity 0.35s var(--ease-out);
}
.dock-item:hover { opacity: 0.85; }
.dock-item:focus-visible {
  outline: 2px solid var(--vermilion);
  outline-offset: 3px;
  border-radius: 6px;
}
.dock-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(0.85rem, 1.4vw, 1rem);
  letter-spacing: 0.03em;
  transition: color 0.35s;
}
.dock-sub {
  font-size: 0.66rem;
  letter-spacing: 0.2em;
  opacity: 0.75;
}
.dock-item::after {
  content: "";
  position: absolute;
  left: 12%;
  right: 12%;
  bottom: 0;
  height: 2px;
  border-radius: 2px;
  background: var(--dock-accent, var(--vermilion));
  transform: scaleX(0);
  transition: transform 0.5s var(--ease-snap);
}
.dock-item.active { opacity: 1; }
.dock-item.active .dock-name { color: var(--dock-accent, var(--vermilion)); }
.dock-item.active::after { transform: scaleX(1); }

/* ---------- Dock entrance ----------
   The rail fades in as a unit just after the panels settle, while its items
   stagger in. Opacity is animated on the *container* (not the items) so each
   item keeps its rest dimming (inactive 0.5 / active 1) and hover behaviour.
   Items animate transform only — translateY for the bottom dock, overridden
   to translateX (slide from the left edge) for the desktop rail below. */
.dock {
  opacity: 0;
  animation: dockFade 1s var(--ease-out) 0.5s forwards;
}
@keyframes dockFade { from { opacity: 0; } to { opacity: 1; } }
.dock-item { animation: dockRiseY 0.9s var(--ease-out) backwards; }
@keyframes dockRiseY { from { transform: translateY(16px); } to { transform: none; } }
@keyframes dockRiseX { from { transform: translateX(-18px); } to { transform: none; } }
.dock-item:nth-child(1) { animation-delay: 0.52s; }
.dock-item:nth-child(2) { animation-delay: 0.62s; }
.dock-item:nth-child(3) { animation-delay: 0.72s; }
.dock-item:nth-child(4) { animation-delay: 0.82s; }

/* ---------- Desktop (≥1024px): dock becomes a left rail ----------
   Moving the switcher off the bottom hands that whole strip back to the
   panels, so the photos show more and the bottom-anchored text sits over
   the darker lower third of each image. Mobile/tablet keep the bottom dock. */
@media (min-width: 1024px) {
  .landing main {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto 1fr;
    grid-template-areas:
      "head head"
      "dock stage";
    column-gap: clamp(1rem, 2vw, 1.9rem);
  }
  .landing-head { grid-area: head; }
  .stage { grid-area: stage; min-width: 0; }

  .dock {
    grid-area: dock;
    flex-direction: column;
    justify-content: center;       /* centre the three items against the panels */
    align-items: flex-start;
    gap: clamp(1.6rem, 3.6vh, 3rem);
    padding: 0 0.2rem;
  }
  .dock-item {
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    gap: 0.22rem;
    padding: 0.2rem 0 0.2rem 1rem;  /* room for the left accent bar */
    animation-name: dockRiseX;       /* slide in from the left edge */
  }
  /* accent indicator: bottom underline → left bar */
  .dock-item::after {
    left: 0;
    right: auto;
    top: 6%;
    bottom: 6%;
    width: 2px;
    height: auto;
    transform: scaleY(0);
    transform-origin: center;
  }
  .dock-item.active::after { transform: scaleY(1); }
}

/* ---------- Grain ---------- */
.grain {
  position: fixed;
  inset: 0;
  z-index: 85;
  pointer-events: none;
  opacity: 0.055;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Scene animations ---------- */
.float-slow { animation: floatY 7s ease-in-out infinite alternate; }
.float-slower { animation: floatY 11s ease-in-out infinite alternate; }
@keyframes floatY { from { transform: translateY(0); } to { transform: translateY(-14px); } }

/* transform-box: fill-box makes rotation spin each petal around its own
   center — without it, SVG rotates around the viewBox center and the
   petals orbit right out of the panel. */
.petal {
  animation: petalFall linear infinite;
  transform-box: fill-box;
  transform-origin: center;
}
@keyframes petalFall {
  0% { transform: translate(0, -40px) rotate(0deg); opacity: 0; }
  10% { opacity: 0.9; }
  100% { transform: translate(-90px, 660px) rotate(300deg); opacity: 0; }
}

.bokeh {
  animation: bokehPulse ease-in-out infinite alternate;
  transform-box: fill-box;
  transform-origin: center;
}
@keyframes bokehPulse {
  from { opacity: 0.2; transform: translateY(0) scale(1); }
  to { opacity: 0.8; transform: translateY(-20px) scale(1.2); }
}

.speedline { stroke-dasharray: 220 700; animation: dashMove 2.6s linear infinite; }
@keyframes dashMove { to { stroke-dashoffset: -920; } }

/* Jobs panel — motes rising toward the dawn (opportunity ascending) */
.rise-mote {
  animation: riseMote linear infinite;
  transform-box: fill-box;
  transform-origin: center;
}
@keyframes riseMote {
  0% { transform: translateY(0) scale(1); opacity: 0; }
  15% { opacity: 0.85; }
  100% { transform: translateY(-300px) scale(0.4); opacity: 0; }
}

/* ---------- Mobile: vertical stack ---------- */
@media (max-width: 760px) {
  .landing main { padding-top: 2.8rem; }
  .stage { flex-direction: column; }
  .panel { flex: 1; }
  .panel.open { flex: 7; }
  .spine {
    flex-direction: row;
    gap: 0.8rem;
  }
  .spine .v-label {
    writing-mode: horizontal-tb;
    letter-spacing: 0.3em;
    font-size: 0.95rem;
  }
  .badge {
    left: auto;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
  }
  .panel.open .badge {
    left: 1rem;
    right: auto;
    top: 1rem;
    transform: translateY(0);
  }
  .kanji-mark { font-size: 4.4rem; }
  .panel-content { padding: 1.2rem; }
  .panel-content h2 { font-size: 1.6rem; }
}
