/* Living meishi — the card in your hand, alive. /ito/ and /beki/ */
:root {
  --bg: #121B25;
  --bg-2: #1E2A37;
  --fg: #F5EFE6;
  --fg-2: rgba(245, 239, 230, .74);
  --fg-3: rgba(245, 239, 230, .52);
  --line: rgba(245, 239, 230, .14);
  --copper: #E39A68;
  --copper-deep: #B45F2F;
  --shu: #E2623E;
  --panel: rgba(255, 255, 255, .045);
  --f-sans: 'Zen Kaku Gothic New', 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', sans-serif;
  --f-latin: Inter, 'Zen Kaku Gothic New', 'Hiragino Kaku Gothic ProN', sans-serif;
  --f-mono: 'IBM Plex Mono', Menlo, Consolas, 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Zen Kaku Gothic New', monospace;
  --gutter: clamp(20px, 6vw, 64px);
  --ease: cubic-bezier(.2, .7, .2, 1);
  --card-w: min(86vw, 440px);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--fg);
  font-family: var(--f-sans); line-height: 1.6; overflow-x: hidden;
  background-image: radial-gradient(ellipse 90% 60% at 50% 18%, #1E2C3B 0%, rgba(18, 27, 37, 0) 70%);
  background-repeat: no-repeat;
}
html[lang="en"] body { font-family: var(--f-latin); }
a { color: inherit; }
button { font: inherit; color: inherit; }
.mono { font-family: var(--f-mono); letter-spacing: .14em; text-transform: uppercase; font-size: 11px; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 50; background: var(--fg); color: var(--bg); padding: 8px 14px; border-radius: 999px; }
.skip:focus { left: 12px; }
:focus-visible { outline: 2px solid var(--copper); outline-offset: 3px; border-radius: 6px; }

/* ---- top bar ---- */
.top {
  position: fixed; inset: 0 0 auto; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  padding: max(14px, env(safe-area-inset-top)) var(--gutter) 14px;
  background: linear-gradient(var(--bg), rgba(18, 27, 37, 0)); pointer-events: none;
}
.top > * { pointer-events: auto; }
.top-mark { display: block; color: var(--fg); }
.top-mark svg { display: block; height: 20px; width: auto; overflow: visible; }
.lang { display: flex; align-items: center; gap: 2px; font-family: var(--f-mono); font-size: 12px; color: var(--fg-3); }
.lang button { background: none; border: 0; padding: 8px 6px; cursor: pointer; color: var(--fg-3); letter-spacing: .1em; }
.lang button[aria-pressed="true"] { color: var(--fg); }

/* ---- particle canvas: scrolls with the page (never fixed — iOS jitter) ---- */
main { position: relative; }
.particles { position: absolute; left: 0; top: 0; width: 100%; pointer-events: none; z-index: 1; }

/* ---- stage ---- */
.stage {
  position: relative; min-height: 100vh; min-height: 100svh; display: grid;
  grid-template-rows: 1fr auto auto; padding: 72px var(--gutter) max(96px, calc(env(safe-area-inset-bottom) + 96px));
}
.card-zone { position: relative; z-index: 3; display: grid; place-items: center; perspective: 1400px; }
.card3d {
  position: relative; width: var(--card-w); aspect-ratio: 91 / 55; padding: 0; border: 0; background: none; cursor: pointer;
  transform-style: preserve-3d; -webkit-tap-highlight-color: transparent;
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: opacity .7s var(--ease), filter .7s var(--ease);
  opacity: 0;
}
.card3d:focus-visible { outline-offset: 8px; border-radius: 10px; }
.card-inner {
  position: absolute; inset: 0; display: block; -webkit-transform-style: preserve-3d; transform-style: preserve-3d;
  transform: translateY(var(--enter-y, 0)) rotateX(var(--enter-rx, 0deg)) rotateY(var(--flip, 0deg)) scale(var(--card-s, 1));
  transition: transform 1.05s cubic-bezier(.6, .02, .2, 1);
}
.face {
  position: absolute; inset: 0; display: block; overflow: hidden; border-radius: 1.4% / 2.3%;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .06) inset, 0 30px 60px -20px rgba(0, 0, 0, .65), 0 12px 24px -12px rgba(0, 0, 0, .5);
}
.face svg { display: block; width: 100%; height: 100%; }
.face-front { transform: rotateY(0deg) translateZ(.5px); }
.face-back { transform: rotateY(180deg) translateZ(.5px); }
.face-back .meishi-sphere { transition: opacity .25s linear; }
.card3d.lifted .meishi-sphere { opacity: 0; }
.sheen {
  position: absolute; inset: 0; border-radius: 1.4% / 2.3%; pointer-events: none; mix-blend-mode: soft-light;
  background: radial-gradient(circle at var(--gx, 30%) var(--gy, 20%), rgba(255, 236, 214, .75), rgba(255, 236, 214, 0) 45%),
              linear-gradient(115deg, rgba(255, 255, 255, 0) 30%, rgba(227, 154, 104, .22) 48%, rgba(255, 255, 255, 0) 62%);
  background-size: 100% 100%, 260% 100%; background-position: 0 0, var(--bx, 50%) 0;
  transform: translateZ(1px); opacity: .9;
}
.card-hint { position: absolute; left: 0; right: 0; bottom: calc(50% - var(--card-w) * 55 / 91 / 2 - 44px); margin: 0; text-align: center; color: var(--fg-3); opacity: 0; transition: opacity .6s; }
body.is-front .card-hint { opacity: 1; }
.sheen { transition: opacity .35s; }
body.is-flipping .sheen { opacity: 0; }

body.is-entering .card3d { opacity: 1; }
body.is-entering .card-inner { --enter-y: 0; }
/* WebKit does not pass opacity from a preserve-3d parent to its faces: fade the faces */
.face { transition: opacity .7s var(--ease), filter .7s var(--ease); }
body.is-lifted .card3d { pointer-events: none; }
body.is-lifted .face, body.is-lifted .sheen { opacity: 0; filter: blur(2px); }
.card3d.gone { visibility: hidden; }
body.is-lifted .card-inner { --card-s: .94; }

.identity { position: relative; z-index: 3; text-align: center; opacity: 0; transform: translateY(14px); transition: opacity .9s var(--ease) .15s, transform .9s var(--ease) .15s; }
body.is-lifted .identity { opacity: 1; transform: none; }
.kicker { text-transform: none; display: inline-flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px 12px; margin: 0 0 14px; color: var(--copper); }
.kicker .sep { width: 4px; height: 4px; border-radius: 50%; background: currentColor; opacity: .7; }
.name { margin: 0; font-size: clamp(38px, 11vw, 76px); line-height: 1.08; font-weight: 700; letter-spacing: .06em; }
.name.latin { font-family: var(--f-latin); font-weight: 600; letter-spacing: -.01em; }
.reading { margin: 8px 0 0; color: var(--fg-3); font-size: 14px; letter-spacing: .16em; }
.scroll-cue { position: relative; z-index: 3; display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 26px 0 0; color: var(--fg-3); opacity: 0; transition: opacity .8s .9s; }
.scroll-cue i { width: 1px; height: 28px; background: linear-gradient(var(--fg-3), transparent); animation: cue 2.2s var(--ease) infinite; transform-origin: top; }
@keyframes cue { 0% { transform: scaleY(0); } 50% { transform: scaleY(1); } 100% { transform: scaleY(1); opacity: 0; } }
body.is-lifted .scroll-cue { opacity: 1; }

/* ---- who ---- */
.who { position: relative; z-index: 3; min-height: 100vh; min-height: 100svh; display: grid; grid-template-rows: auto auto; align-content: center; padding: 40px var(--gutter) 80px; }
.seal-space { width: min(70vw, 340px); aspect-ratio: 1; margin: 0 auto 30px; }
.who-copy { max-width: 560px; margin: 0 auto; text-align: center; }
.eyebrow { margin: 0 0 14px; color: var(--copper); }
.ph { display: inline-block; }
.who-intro { word-break: auto-phrase; margin: 0; font-size: clamp(24px, 6.4vw, 38px); line-height: 1.45; font-weight: 700; letter-spacing: .02em; text-wrap: balance; }
html[lang="en"] .who-intro { letter-spacing: -.01em; font-weight: 600; }
.topics-label { margin: 36px 0 12px; color: var(--fg-3); }
.topics { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.topics li { padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; font-size: 14px; color: var(--fg-2); background: var(--panel); }

/* ---- contact ---- */
.contact { position: relative; z-index: 3; max-width: 720px; margin: 0 auto; padding: 40px var(--gutter) 64px; }
.section-title { margin: 0 0 22px; font-size: clamp(26px, 7vw, 40px); line-height: 1.2; letter-spacing: .04em; }
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.action {
  display: flex; align-items: center; gap: 14px; min-height: 76px; padding: 16px 18px; text-align: left; text-decoration: none; cursor: pointer;
  border: 1px solid var(--line); border-radius: 18px; background: var(--panel);
  transition: border-color .25s, background .25s, transform .25s var(--ease);
}
.action:hover { border-color: rgba(227, 154, 104, .5); background: rgba(227, 154, 104, .07); }
.action:active { transform: scale(.985); }
.action svg, .dock svg, .send svg { width: 24px; height: 24px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.action span { display: grid; gap: 2px; min-width: 0; }
.action strong { font-size: 15px; font-weight: 700; }
.action small { color: var(--fg-3); font-size: 12px; overflow-wrap: anywhere; }
.action-primary { grid-column: 1 / -1; background: var(--copper); border-color: var(--copper); color: #1A1410; }
.action-primary small { color: rgba(26, 20, 16, .7); }
.action-primary:hover { background: #EBA97C; border-color: #EBA97C; }
@media (max-width: 520px) { .contact-grid { grid-template-columns: 1fr; } }

.message-form { margin-top: 18px; padding: 22px; border: 1px solid var(--line); border-radius: 22px; background: var(--panel); }
.purposes { border: 0; margin: 0 0 18px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.purposes legend { margin-bottom: 10px; color: var(--fg-3); padding: 0; }
.purposes label { position: relative; }
.purposes input { position: absolute; opacity: 0; inset: 0; }
.purposes span { display: block; padding: 9px 14px; border: 1px solid var(--line); border-radius: 999px; font-size: 14px; cursor: pointer; transition: all .2s; }
.purposes input:checked + span { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.purposes input:focus-visible + span { outline: 2px solid var(--copper); outline-offset: 2px; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: grid; gap: 6px; font-size: 13px; color: var(--fg-2); }
.field small { color: var(--fg-3); }
.field-wide, .fields .field:nth-child(3) { grid-column: 1 / -1; }
@media (min-width: 560px) { .fields .field:nth-child(3) { grid-column: auto; } .fields .field:nth-child(1) { grid-column: 1 / -1; } }
.field input, .field textarea {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: rgba(0, 0, 0, .18);
  color: var(--fg); font: inherit; font-size: 16px; resize: vertical;
}
.field input:focus, .field textarea:focus { outline: none; border-color: var(--copper); }
.field [aria-invalid="true"] { border-color: var(--shu); }
@media (max-width: 520px) { .fields { grid-template-columns: 1fr; } }
.hp { position: absolute; left: -9999px; }
.consent { display: flex; gap: 10px; align-items: flex-start; margin: 16px 0 0; font-size: 13px; color: var(--fg-2); }
.consent input { margin-top: 4px; accent-color: var(--copper); width: 16px; height: 16px; flex: none; }
.form-end { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; }
.form-status { margin: 0; font-size: 13px; color: var(--shu); }
.send { white-space: nowrap; flex: none; display: inline-flex; align-items: center; gap: 10px; padding: 13px 22px; border: 0; border-radius: 999px; background: var(--fg); color: var(--bg); font-weight: 700; cursor: pointer; }
.send[disabled] { opacity: .6; cursor: progress; }
.sent { margin-top: 18px; padding: 26px 22px; border: 1px solid rgba(227, 154, 104, .45); border-radius: 22px; background: rgba(227, 154, 104, .08); }
.sent p { margin: 0; color: var(--fg-2); }
.sent .sent-title { font-size: 20px; font-weight: 700; color: var(--fg); margin-bottom: 6px; }

/* ---- company ---- */
.company { position: relative; z-index: 3; max-width: 720px; margin: 0 auto; padding: 40px var(--gutter) 40px; border-top: 1px solid var(--line); }
.company-title { word-break: auto-phrase; margin: 0 0 12px; font-size: clamp(22px, 5.6vw, 30px); line-height: 1.35; }
.company-text { margin: 0 0 20px; color: var(--fg-2); }
.company-link { display: inline-flex; align-items: center; gap: 8px; color: var(--copper); text-decoration: none; font-weight: 700; }
.company-link::after { content: '→'; transition: transform .25s var(--ease); }
.company-link:hover::after { transform: translateX(4px); }
.foot { text-transform: none; display: flex; justify-content: space-between; gap: 12px; max-width: 720px; margin: 0 auto; padding: 24px var(--gutter) calc(110px + env(safe-area-inset-bottom)); color: var(--fg-3); font-size: 10px; }

/* ---- dock ---- */
.dock {
  position: fixed; z-index: 30; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); display: flex; gap: 6px; padding: 6px;
  border: 1px solid var(--line); border-radius: 999px; background: rgba(18, 27, 37, .78);
  -webkit-backdrop-filter: blur(16px) saturate(1.4); backdrop-filter: blur(16px) saturate(1.4);
  box-shadow: 0 18px 40px -16px rgba(0, 0, 0, .7);
  transform: translate(-50%, 140%); transition: transform .8s var(--ease) .5s;
}
body.is-lifted .dock { transform: translate(-50%, 0); }
body.is-lifted.dock-away .dock { transform: translate(-50%, 140%); transition-delay: 0s; }
.dock a { display: inline-flex; align-items: center; justify-content: center; gap: 10px; height: 48px; border-radius: 999px; text-decoration: none; }
.dock-save { padding: 0 20px 0 16px; background: var(--copper); color: #1A1410; font-weight: 700; font-size: 15px; white-space: nowrap; }
.dock-icon { width: 48px; color: var(--fg); background: rgba(255, 255, 255, .06); }
.dock svg { width: 22px; height: 22px; }

/* ---- no-JS / reduced motion fallbacks ---- */
body.is-static .card3d { opacity: 1; }
body.is-static .card-inner { transition: none; }
body.is-static .identity, body.is-static .scroll-cue { opacity: 1; transform: none; transition: none; }
body.is-static .dock { transform: translate(-50%, 0); transition: none; }
@media (min-width: 900px) {
  .stage { grid-template-rows: 1fr auto auto; }
  :root { --card-w: min(44vw, 520px); }
}
