/* Opus: top — きちんとした名刺1枚。すべて [data-scene="top"] 以下に限定。See CORE-CONTRACT.md. */

/* 薄い紙地。机ではない。光はまっすぐ。 */
[data-scene="top"] {
  --scene-background:
    radial-gradient(120% 80% at 50% 38%, #f4f5f8 0%, #eef0f3 60%, #e7eaef 100%),
    #eef0f3;
  --top-ink: #20252d;
  --top-sub: #3a4252;
  --top-blue: #2148a6;
  --top-curl: 4.6rem;
  display: grid;
  align-content: center;
  overflow: clip;
}
[data-scene="top"]::before {
  /* 紙の繊維。ごく薄い斜めの筋。 */
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: repeating-linear-gradient(115deg, #0000 0 6px, #ffffff59 6px 7px);
}

/* ---- 名刺（本文そのものを名刺として組む）。余白を広く。 ---- */
[data-scene="top"] [data-scene-content] {
  --top-leave: 0;
  --top-drag: 0;
  display: flex;
  flex-direction: column;
  width: min(100%, 21rem);
  max-width: none;
  margin-inline: auto;
  padding: 2.45rem 2.4rem calc(var(--top-curl) + .9rem);
  background: #fff;
  border: 1px solid #d9dee7;
  border-radius: 2px;
  box-shadow: 0 1px 0 #c9d0db, 0 22px 34px -22px #20252d59;
  color: var(--top-ink);
  translate: calc(var(--top-leave) * -3%) calc(var(--top-leave) * -5%);
  rotate: calc(var(--top-leave) * -2deg + var(--top-drag) * -.7deg);
}
@media (min-height: 640px) {
  [data-scene="top"] [data-scene-content] { min-height: 29rem; }
}
@media (min-width: 900px) {
  [data-scene="top"] { --top-curl: 5.2rem; }
  [data-scene="top"] [data-scene-content] { width: 24rem; min-height: 32rem; padding: 3.4rem 3rem calc(var(--top-curl) + 1.4rem); }
}

/* はじめまして → 青い線 → 肩書き → 氏名 → 連絡先 */
[data-scene="top"] :where([data-scene-content]) > * { margin: 0; }
[data-scene="top"] .scene-note {
  order: 0;
  font-family: "Yu Mincho", "YuMincho", "Hiragino Mincho ProN", "Noto Serif JP", "Noto Serif CJK JP", serif;
  font-size: .9rem;
  letter-spacing: .22em;
  line-height: 1.7;
  color: var(--top-sub);
}
[data-scene="top"] .scene-note::after {
  content: "";
  display: block;
  width: 1.5rem;
  height: 2px;
  margin-block: 1.15rem .9rem;
  background: var(--top-blue);
}
[data-scene="top"] .top-titles {
  order: 1;
  padding: 0;
  list-style: none;
  font-size: .8rem;
  letter-spacing: .065em;
  line-height: 1.65;
  color: var(--top-sub);
}
[data-scene="top"] .top-titles span {
  display: inline-block;
  white-space: nowrap;
}
[data-scene="top"] [data-copy="top.profession"] {
  color: var(--top-ink);
  font-size: 1.0625rem;
  font-weight: 650;
  letter-spacing: .08em;
}
[data-scene="top"] h1 {
  order: 2;
  margin-block: .95rem 1.55rem;
  font-family: "Yu Mincho", "YuMincho", "Hiragino Mincho ProN", "Noto Serif JP", "Noto Serif CJK JP", serif;
  font-size: clamp(2.4rem, 12vw, 3.1rem);
  font-weight: 700;
  letter-spacing: .12em;
  line-height: 1.25;
  white-space: nowrap;
}
@media (min-width: 900px) {
  [data-scene="top"] h1 { font-size: 3.5rem; }
}

/* 連絡先：最初から見えて押せる。細く小さく、同じ幅で左にそろえる。 */
[data-scene="top"] .contact-links {
  order: 4;
  display: grid;
  gap: .6rem;
  width: max-content;
  max-width: 100%;
  margin: auto 0 0;
}
[data-scene="top"] .contact-links a {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.6rem;
  min-height: 2.35rem;
  padding: 0 .9rem 0 1rem;
  border: 1px solid #b6c2d5;
  border-radius: 2px;
  background: #fff;
  color: var(--top-ink);
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .08em;
  line-height: 1.3;
  text-decoration: none;
  transition: background-color .18s ease, border-color .18s ease;
}
/* 見た目は細く、押せる高さは44px以上を保つ */
[data-scene="top"] .contact-links a::before {
  content: "";
  position: absolute;
  inset: max(-.25rem, calc((2.75rem - 100%) / -2)) 0;
}
[data-scene="top"] .contact-links a::after {
  content: "→";
  content: "→" / "";
  font-weight: 400;
  font-size: .9em;
  transition: translate .2s ease;
}
[data-scene="top"] .contact-links a:first-child {
  border-color: var(--top-blue);
  background: var(--top-blue);
  color: #fff;
}
@media (hover: hover) {
  [data-scene="top"] .contact-links a:hover { border-color: var(--top-blue); background: #f3f6fb; }
  [data-scene="top"] .contact-links a:first-child:hover { background: #1b3d8f; }
  [data-scene="top"] .contact-links a:hover::after { translate: .2rem 0; }
}
[data-scene="top"] .contact-links a:focus-visible { outline-offset: 3px; }

/* 角のリンク。ラベルは角の左に並べる。 */
[data-scene="top"] p:has(> [data-intro-link]) { order: 5; position: static; }
[data-scene="top"] [data-intro-link] {
  --top-hover: 0;
  position: absolute;
  right: -1px;
  bottom: -1px;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  width: var(--top-curl);
  height: var(--top-curl);
  padding: calc(var(--top-curl) * .2) calc(var(--top-curl) * .8 + .15rem) 0 0;
  border-radius: 2px;
  color: #56637d;
  font-family: "Yu Mincho", "YuMincho", "Hiragino Mincho ProN", "Noto Serif JP", "Noto Serif CJK JP", serif;
  font-size: .7rem;
  letter-spacing: .14em;
  line-height: 1.2;
  white-space: nowrap;
  text-decoration: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
[data-scene="top"] [data-intro-link] [data-intro-arrow] {
  display: inline-block;
  margin-inline-start: .25em;
  color: var(--top-blue);
  font-family: "Yu Gothic", "Meiryo", sans-serif;
  translate: 0 .08em;
}
.scene-top--waiting [data-intro-link] > [aria-hidden] { opacity: 0; }
.scene-top--hint [data-intro-link] > [aria-hidden] { animation: top-hint-in .24s both; }
.scene-top--hint [data-intro-arrow] { animation: top-arrow-nudge 1.1s .4s ease-in-out 2 both; }
@keyframes top-hint-in { from { opacity: 0; } }
@keyframes top-arrow-nudge {
  0%, 100% { transform: none; }
  45%      { transform: translate(.18em, .18em); }
}
[data-scene="top"].scene-top--peeled [data-intro-arrow] { animation: none; }
/* 紙は拡大し、下の机と盤は見える範囲だけを変える。 */
@property --top-intro { syntax: "<number>"; inherits: true; initial-value: 1; }
@property --top-pull  { syntax: "<number>"; inherits: true; initial-value: 1; }
@property --top-hover { syntax: "<number>"; inherits: true; initial-value: 0; }
[data-scene="top"] [data-intro-link] {
  --top-f: calc(var(--top-intro) * var(--top-pull) * (1 + var(--top-leave) * .55 + var(--top-hover) + var(--top-drag)));
  transition: --top-hover .28s cubic-bezier(.2, .8, .3, 1.2);
}
.scene-top--waiting [data-intro-link] { animation: top-curl-peel 1.7s 2s cubic-bezier(.45, 0, .25, 1) both; }
[data-scene="top"] [data-intro-link]::before,
[data-scene="top"] [data-intro-link]::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  pointer-events: auto;
}
[data-scene="top"] [data-intro-link]::after {
  z-index: 0;
  width: calc(var(--top-curl) * 4.4);
  height: calc(var(--top-curl) * 4.4);
  --top-k: calc(var(--top-curl) * var(--top-f) * .892);
  clip-path: polygon(100% calc(100% - var(--top-k)), 100% 100%, calc(100% - var(--top-k)) 100%);
  background: no-repeat 100% 100% / 100% 100% url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 330 330'%3E%3Crect width='330' height='330' fill='%235a4535'/%3E%3Cpath d='M330 236C318 262 316 300 300 330M330 280C324 296 322 318 316 330M330 192C300 240 286 300 264 330' fill='none' stroke='%234a372a' stroke-width='1.1'/%3E%3Cg transform='rotate(-2.5 318 321)'%3E%3Crect x='-20' y='-20' width='341' height='344' fill='%232a1d14' opacity='.3'/%3E%3Crect x='-20' y='-20' width='338' height='341' fill='%23e9dfc6'/%3E%3Crect x='-20' y='-20' width='335.5' height='338.5' fill='%236c8975'/%3E%3Crect x='-20' y='-20' width='330' height='333' fill='%237d9a86'/%3E%3Cellipse cx='150' cy='196' rx='27' ry='16' fill='%23a9c0b8' stroke='%232c3b31' stroke-width='.8'/%3E%3Crect x='281' y='113' width='14' height='14' rx='2' fill='%23e7d7b1' stroke='%232c3b31' stroke-width='.8' transform='rotate(-8 288 120)'/%3E%3Crect x='277' y='135' width='14' height='14' rx='2' fill='%23e7d7b1' stroke='%232c3b31' stroke-width='.8' transform='rotate(-8 284 142)'/%3E%3Crect x='271' y='156' width='14' height='14' rx='2' fill='%23e7d7b1' stroke='%232c3b31' stroke-width='.8' transform='rotate(-8 278 163)'/%3E%3Crect x='261' y='175' width='14' height='14' rx='2' fill='%23e7d7b1' stroke='%232c3b31' stroke-width='.8' transform='rotate(-8 268 182)'/%3E%3Crect x='247' y='191' width='14' height='14' rx='2' fill='%23e7d7b1' stroke='%232c3b31' stroke-width='.8' transform='rotate(-8 254 198)'/%3E%3Crect x='231' y='204' width='14' height='14' rx='2' fill='%23e7d7b1' stroke='%232c3b31' stroke-width='.8' transform='rotate(-8 238 211)'/%3E%3Crect x='214' y='216' width='14' height='14' rx='2' fill='%23e7d7b1' stroke='%232c3b31' stroke-width='.8' transform='rotate(-8 221 223)'/%3E%3Crect x='200' y='231' width='14' height='14' rx='2' fill='%23e7d7b1' stroke='%232c3b31' stroke-width='.8' transform='rotate(-8 207 238)'/%3E%3Crect x='192' y='250' width='14' height='14' rx='2' fill='%23e7d7b1' stroke='%232c3b31' stroke-width='.8' transform='rotate(-8 199 257)'/%3E%3Crect x='194' y='270' width='14' height='14' rx='2' fill='%23e7d7b1' stroke='%232c3b31' stroke-width='.8' transform='rotate(-8 201 277)'/%3E%3Crect x='206' y='285' width='14' height='14' rx='2' fill='%23e7d7b1' stroke='%232c3b31' stroke-width='.8' transform='rotate(-8 213 292)'/%3E%3Cg fill='none' stroke='%232c3b31' stroke-width='.9'%3E%3Ccircle cx='283' cy='272' r='7'/%3E%3Cpath d='M283 279v7'/%3E%3Ccircle cx='243' cy='296' r='5.5'/%3E%3Cpath d='M243 301.5v6'/%3E%3Cpath d='M262 246l2-5 2 5M269 250l1.6-4 1.6 4M172 262l2-5 2 5M290 214l1.6-4 1.6 4'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
[data-scene="top"] [data-intro-link]::before {
  z-index: 1;
  width: var(--top-curl);
  height: var(--top-curl);
  background: no-repeat 100% 100% / 100% 100% url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 74 74'%3E%3Cpath d='M10.5 77L76.5 11Q47 18 21 21Q18 47 10.5 77z' fill='%2320252d' opacity='.2'/%3E%3Cpath d='M8 74L74 8Q44 14 18 18Q14 44 8 74z' fill='%23e4e9f0' stroke='%23c3cad6' stroke-width='.8' stroke-linejoin='round'/%3E%3Cpath d='M18 18Q38 15 58 12Q36 24 22 40Q19 28 18 18z' fill='%23f5f7fa'/%3E%3Cpath d='M8 74L74 8L65 13.5Q38 34 13.5 65z' fill='%23c8d0dc' opacity='.75'/%3E%3Cpath d='M8.5 73.5L73.5 8.5' stroke='%23fff' stroke-width='.9' opacity='.7'/%3E%3C/svg%3E");
  transform-origin: 100% 100%;
  scale: max(.05, var(--top-f));
}
@media (hover: hover) {
  [data-scene="top"] [data-intro-link]:hover { --top-hover: .1; }
}
[data-scene="top"] [data-intro-link]:focus-visible { outline-offset: 2px; --top-hover: .06; }
[data-scene="top"].scene-top--moving [data-scene-content],
[data-scene="top"].scene-top--dragging [data-scene-content] { will-change: translate, rotate; }
[data-scene="top"].scene-top--dragging [data-intro-link] { cursor: grabbing; transition: none; }
/* 2秒後：少し浮く → 一度ためる → 一気にめくれる → 余韻 */
@keyframes top-curl-peel {
  0%   { --top-intro: .1; }
  30%  { --top-intro: .27; animation-timing-function: cubic-bezier(.4, 0, .6, 1); }
  44%  { --top-intro: .2;  animation-timing-function: cubic-bezier(.2, .9, .25, 1); }
  72%  { --top-intro: 1.07; animation-timing-function: ease-in-out; }
  86%  { --top-intro: .97; }
  100% { --top-intro: 1; }
}
/* ---- 名刺が左上へ抜ける（JSで付与、動きを減らす設定では付けない） ---- */
[data-scene="top"].scene-top--leaving [data-scene-content] {
  animation: top-card-leave .52s cubic-bezier(.5, 0, .8, .4) forwards;
}
[data-scene="top"].scene-top--leaving [data-intro-link] {
  animation: top-curl-pull .3s cubic-bezier(.3, 0, .2, 1) forwards;
}
/* ドラッグから抜けるときは、めくれの大きさをJSがそのまま引き継ぐ */
[data-scene="top"].scene-top--leaving.scene-top--from-drag [data-intro-link] { animation: none; }
@keyframes top-card-leave {
  0%   { transform: none; opacity: 1; }
  22%  { transform: translate(.6%, .8%) rotate(.5deg) scale(.988); opacity: 1; }
  60%  { opacity: 1; box-shadow: 0 1px 0 #c9d0db, 0 40px 50px -24px #20252d55; }
  100% { transform: translate(-46%, -58%) rotate(-11deg) scale(1.03); opacity: 0; box-shadow: 0 1px 0 #c9d0db, 0 46px 56px -26px #20252d33; }
}
[data-scene="top"].scene-top--from-drag [data-scene-content] { animation-name: top-card-leave-drag; }
@keyframes top-card-leave-drag {
  0%   { transform: none; opacity: 1; }
  60%  { opacity: 1; }
  100% { transform: translate(-46%, -58%) rotate(-10deg) scale(1.03); opacity: 0; }
}
@keyframes top-curl-pull {
  from { --top-pull: 1; }
  to   { --top-pull: 2.3; }
}

/* 動きを減らす設定：角は最初からめくれた静止表示。スクロール連動・ドラッグなし。 */
html[data-reduced-motion="true"] [data-scene="top"] [data-scene-content] { translate: none; rotate: none; }
html[data-reduced-motion="true"] [data-scene="top"] [data-intro-link] { --top-f: 1; }
@media (prefers-reduced-motion: reduce) {
  [data-scene="top"] [data-scene-content] { translate: none; rotate: none; }
  [data-scene="top"] [data-intro-link] { --top-f: 1; }
}

/* 狭い画面 */
@media (max-width: 360px) {
  [data-scene="top"] { --top-curl: 4.2rem; }
  [data-scene="top"] [data-scene-content] { padding-inline: 1.9rem; }
}
@media (max-height: 639px) {
  [data-scene="top"] { padding-block: 1rem calc(var(--nav-height) + 1rem); }
  html[data-pager="horizontal"] [data-scene="top"] { padding-block-end: 1rem; }
  [data-scene="top"] [data-scene-content] { min-height: 0; padding-block: 1.6rem calc(var(--top-curl) + .65rem); }
  [data-scene="top"] .scene-note::after { margin-block: .8rem .65rem; }
  [data-scene="top"] h1 { margin-block: .7rem 1.1rem; }
}
