/* 개발 섹션 목록 토글: 이야기(/dev/) ↔ 개발(/dev/tech/). 이 두 페이지만 읽어서 둘 사이에서만 전환 효과가 난다
   개발로: 화면이 어두워지고 호박색 빛줄기가 새 화면을 위에서 아래로 찍어 낸다
   이야기로: 누른 자리에서 잉크가 번지며 탁자가 스며 나온다 (글 안 토글과 같은 "해독과 잉크") */
@view-transition { navigation: auto; }
@property --ms { syntax: '<length>'; inherits: false; initial-value: 0px; }
html[data-list] { --ox: 50vw; --oy: 92vh; }

#gh { view-transition-name: dev-header; }
::view-transition-group(dev-header) { animation-duration: .6s; }

.sw { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 22px); z-index: 30; transform: translateX(-50%);
  display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 999px; view-transition-name: dev-sw;
  transition: opacity .3s, visibility .3s; }
.sw a { position: relative; z-index: 1; display: grid; place-items: center; min-width: 92px; height: 44px; padding: 0 20px;
  border-radius: 999px; font: 700 15px/1 "Pretendard Variable", Pretendard, sans-serif; text-decoration: none; transition: color .2s; }
.sw .knob { position: absolute; top: 4px; bottom: 4px; width: calc(50% - 4px); border-radius: 999px; }
.sw a:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }

html[data-list="story"] .sw { background: rgba(255, 253, 248, .85); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  box-shadow: inset 0 0 0 1px rgba(42, 33, 25, .16), 0 10px 24px -14px rgba(50, 28, 8, .6); }
html[data-list="story"] .sw a { color: #5f5143; }
html[data-list="story"] .sw a[aria-current] { color: #fffdf8; }
html[data-list="story"] .sw a:not([aria-current]):hover { color: #2a2119; }
html[data-list="story"] .sw .knob { left: 4px; background: #2a2119; }

html[data-list="dev"] .sw { background: rgba(10, 12, 22, .75); box-shadow: inset 0 0 0 1px rgba(255, 181, 71, .25), 0 12px 30px -12px rgba(0, 0, 0, .8); }
html[data-list="dev"] .sw a { color: #a8a093; font-family: "IBM Plex Sans KR", sans-serif; }
html[data-list="dev"] .sw a[aria-current] { color: #0a0c16; }
html[data-list="dev"] .sw a:not([aria-current]):hover { color: #efe6d6; }
html[data-list="dev"] .sw .knob { left: 50%; background: #ffb547; }

/* ───── 전환 ───── */
::view-transition-old(root), ::view-transition-new(root) { mix-blend-mode: normal; }
::view-transition-group(dev-sw) { animation-duration: .45s; animation-timing-function: cubic-bezier(.16, 1, .3, 1); }
::view-transition-old(dev-sw) { animation: sw-out .18s ease both; }
::view-transition-new(dev-sw) { animation: sw-in .3s ease both; }
html.t-dev .sw .knob { animation: sw-knob-r .6s cubic-bezier(.16, 1, .3, 1) both; }
html.t-story .sw .knob { animation: sw-knob-l .6s cubic-bezier(.16, 1, .3, 1) both; }
@keyframes sw-knob-r { from { transform: translateX(-100%); } }
@keyframes sw-knob-l { from { transform: translateX(100%); } }
@keyframes sw-out { to { opacity: 0; } }
@keyframes sw-in { from { opacity: 0; } }

html.t-dev::view-transition-old(root) { animation: sw-dim .95s ease both; }
html.t-dev::view-transition-new(root) { animation: sw-print .95s cubic-bezier(.65, 0, .35, 1) both; }
@keyframes sw-dim { to { filter: brightness(.28) saturate(.6) blur(2px); transform: scale(.985); } }
@keyframes sw-print { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }
.sw-scan { display: none; }
html.t-dev .sw-scan { display: block; position: fixed; left: 0; right: 0; top: 0; z-index: 40; height: 140px; pointer-events: none;
  background: linear-gradient(to bottom, transparent, rgba(255, 181, 71, .1) 70%, rgba(255, 196, 120, .55) 98%, #ffe2b0);
  animation: sw-scan .95s cubic-bezier(.65, 0, .35, 1) both; }
@keyframes sw-scan { from { transform: translateY(-100%); } 96% { opacity: 1; } to { transform: translateY(calc(100vh - 100%)); opacity: 0; } }

html.t-story::view-transition-old(root) { animation: sw-fade 1.15s ease both; }
html.t-story::view-transition-new(root) { animation: sw-ink 1.15s cubic-bezier(.55, 0, .2, 1) both;
  -webkit-mask: url("/dev-post/ink.svg") no-repeat; mask: url("/dev-post/ink.svg") no-repeat;
  -webkit-mask-size: var(--ms) var(--ms); mask-size: var(--ms) var(--ms);
  -webkit-mask-position: calc(var(--ox) - var(--ms) / 2) calc(var(--oy) - var(--ms) / 2);
  mask-position: calc(var(--ox) - var(--ms) / 2) calc(var(--oy) - var(--ms) / 2); }
@keyframes sw-ink { from { --ms: 0px; } to { --ms: 360vmax; } }
@keyframes sw-fade { 30% { filter: none; } to { filter: blur(4px) brightness(.6); transform: scale(.98); } }

@media (prefers-reduced-motion: reduce) {
  html::view-transition-old(root) { animation: sw-out .22s ease both !important; -webkit-mask: none !important; mask: none !important; }
  html::view-transition-new(root) { animation: sw-in .22s ease both !important; -webkit-mask: none !important; mask: none !important; }
  html::view-transition-group(*) { animation-duration: .22s !important; }
  html .sw .knob, html .sw-scan { animation: none !important; }
}
