/* Via Foramen motion: page transitions, scroll reveals, sigil draw, breathing glow */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .6s; animation-timing-function: ease; }

html.vf-js body { opacity: 0; transition: opacity .7s ease; }
html.vf-js.vf-ready body { opacity: 1; }
html.vf-js body > *:not(#vf-music):not(#vf-yt):not(#vf-view) { transition: opacity .38s ease; }
html.vf-js.vf-leaving body > *:not(#vf-music):not(#vf-yt):not(#vf-view) { opacity: 0; transition-duration: .24s; }

/* scroll reveal */
html.vf-js .vf-r { opacity: 0; transform: translateY(18px); transition: opacity .9s ease, transform .9s cubic-bezier(.2,.7,.2,1); transition-delay: var(--vf-d, 0s); }
html.vf-js .vf-r.vf-in { opacity: 1; transform: none; }

/* sigil draws itself: white lines from the top, red details last, then the image settles in */
.sigil-wrap img.sigil { -webkit-mask-image: radial-gradient(ellipse 58% 58% at 50% 50%, #000 93%, transparent 100%); mask-image: radial-gradient(ellipse 58% 58% at 50% 50%, #000 93%, transparent 100%); }
html.vf-js .sigil-wrap img.sigil { opacity: 0; animation: vf-in 1s ease 5.3s forwards; }
/* once built, the sigil turns slowly; its labels stay upright and follow their shapes */
html.vf-js .sigil-wrap { animation: vf-turn 240s linear 6.4s infinite; }
html.vf-js .sigil-wrap::after { content: ""; position: absolute; inset: 12%; border-radius: 50%; z-index: -1; pointer-events: none; background: radial-gradient(circle, rgba(214,120,90,.16), transparent 70%); opacity: 0; animation: vf-pulse 9s ease-in-out 6.4s infinite; }
@keyframes vf-turn { to { rotate: 360deg; } }
@keyframes vf-unturn { to { rotate: -360deg; } }
@keyframes vf-pulse { 50% { opacity: 1; } }
.sigil-wrap .vf-sig { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; animation: vf-out 1s ease 5.4s forwards; }
.vf-sig .w { stroke: #e4ddc8; stroke-width: 8.5; }
.vf-sig .thin { stroke-width: 2; }
.vf-sig .r { stroke: #b24539; stroke-width: 3.6; }
.vf-sig .ring { stroke: #6a2f2a; stroke-width: 1.6; }
.vf-sig .vf-d { stroke-dasharray: 1; stroke-dashoffset: 1; animation-name: vf-stroke; animation-timing-function: cubic-bezier(.6,.05,.3,1); animation-fill-mode: forwards; }
.vf-sig .vf-f { opacity: 0; animation: vf-in .8s ease forwards; }
@keyframes vf-stroke { to { stroke-dashoffset: 0; } }
@keyframes vf-in { to { opacity: 1; } }
@keyframes vf-out { to { opacity: 0; } }

html.vf-js .sigil-wrap .spot { opacity: 0; transform-origin: 0 0; animation: vf-in 1.2s ease 5.6s forwards, vf-unturn 240s linear 6.4s infinite; }

/* breathing glow on the maps and art */
section.map a.img img, li.work a.frame img {
  animation: vf-breathe 10s ease-in-out infinite;
  transition: transform .6s ease, box-shadow .6s ease;
}
@keyframes vf-breathe {
  0%, 100% { box-shadow: 0 0 0 rgba(214,120,90,0); }
  50% { box-shadow: 0 0 34px rgba(214,120,90,.22); }
}
section.map a.img:hover img, li.work a.frame:hover img { transform: scale(1.015); }

/* hover life on links and lists */
main a { transition: color .3s ease, opacity .3s ease, text-shadow .3s ease; }
main a:hover { text-shadow: 0 0 14px rgba(214,120,90,.35); }
li.entry, li.work, a.half, li.scrap, li.leaf, details.poem { transition: transform .4s ease; }
li.entry:hover, a.half:hover, details.poem:hover { transform: translateX(4px); }
details.poem[open] .body { animation: vf-unfold .7s ease; }
@keyframes vf-unfold { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }


/* the sigil in the background of each page turns slowly */
body::before { transform-origin: 50% 50%; animation: vf-spin 120s linear infinite; }
@keyframes vf-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  body::before { animation: none; }
  html.vf-js body, html.vf-js .vf-r { opacity: 1 !important; transform: none !important; transition: none !important; }
  html.vf-js .sigil-wrap img.sigil { opacity: 1; animation: none; }
  .sigil-wrap .vf-sig { display: none; }
  html.vf-js .sigil-wrap .spot { opacity: 1; animation: none; }
  html.vf-js .sigil-wrap, html.vf-js .sigil-wrap::after { animation: none; }
  section.map a.img img, li.work a.frame img, details.poem[open] .body { animation: none; }
}

/* keep the top menu on one line as it grows */
@media (min-width:900px) and (max-width:1900px) {
  #bt3-topbar { gap: 20px !important; padding: 0 12px !important; }
  #bt3-topbar a { font-size: 12.5px !important; letter-spacing: .12em !important; }
}
@media (min-width:900px) and (max-width:1600px) {
  #bt3-topbar { gap: clamp(10px, 1.2vw, 18px) !important; }
  #bt3-topbar a { font-size: 11.5px !important; letter-spacing: .09em !important; }
}
@media (min-width:900px) and (max-width:1200px) {
  #bt3-topbar { gap: 9px !important; padding: 0 8px !important; }
  #bt3-topbar a { font-size: 10.5px !important; letter-spacing: .05em !important; }
}
@media (min-width:900px) and (max-width:1000px) {
  #bt3-topbar { gap: 6px !important; padding: 0 6px !important; }
  #bt3-topbar a { font-size: 9.5px !important; letter-spacing: .03em !important; }
}

/* the enter screen holds the opening sigil until the visitor steps in */
html.vf-gate .sigil-wrap, html.vf-gate .sigil-wrap * { animation-play-state: paused !important; }
#vf-gate { position: fixed; inset: 0; z-index: 3000; background: #110503; color: #ebe5d3; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 26px; text-align: center; padding: 24px; transition: opacity 1.1s ease; }
#vf-gate.out { opacity: 0; pointer-events: none; }
#vf-gate .vf-sig { position: static; width: min(46vw, 34vh, 300px); height: auto; animation: none; }
#vf-gate h1 { margin: 0; font-family: Italiana, Didot, "Bodoni 72", Georgia, serif; font-weight: 400; font-size: clamp(28px, 5vw, 46px); letter-spacing: .05em; -webkit-text-stroke: .02em currentColor; opacity: 0; animation: vf-in 1.4s ease 2.2s forwards; }
#vf-gate .go { opacity: 0; animation: vf-in 1.2s ease 3.2s forwards; display: flex; flex-direction: column; align-items: center; gap: 14px; }
#vf-enter { font-family: "Cormorant Garamond", "EB Garamond", Georgia, serif; font-weight: 600; font-size: 15px; letter-spacing: .34em; text-transform: uppercase; color: #ebe5d3; background: transparent; border: 1px solid rgba(235,229,211,.55); border-radius: 999px; padding: 14px 34px 14px 40px; cursor: pointer; transition: background .35s, border-color .35s, color .35s; }
#vf-enter:hover, #vf-enter:focus-visible { background: #7a2418; border-color: #b14536; outline: none; }
#vf-quiet { font-family: "EB Garamond", Georgia, serif; font-style: italic; font-size: 14px; color: #8f7f78; background: none; border: 0; cursor: pointer; }
#vf-quiet:hover { color: #ebe5d3; }
#vf-gate .note { font-family: "EB Garamond", Georgia, serif; font-size: 13px; letter-spacing: .2em; text-transform: uppercase; color: #8f7f78; margin: 0; }

/* picture viewer */
#vf-view { position: fixed; inset: 0; z-index: 2500; background: rgba(17,5,3,.94); display: flex; align-items: center; justify-content: center; padding: 4vh 4vw; opacity: 0; transition: opacity .4s ease; cursor: zoom-out; }
#vf-view.on { opacity: 1; }
#vf-view img { max-width: 100%; max-height: 100%; object-fit: contain; box-shadow: 0 10px 40px rgba(0,0,0,.5); cursor: default; }
#vf-view button { position: absolute; top: 16px; right: 18px; width: 42px; height: 42px; border-radius: 50%; border: 1px solid rgba(235,229,211,.4); background: rgba(17,5,3,.6); color: #ebe5d3; font: 24px/1 Georgia, serif; cursor: pointer; }

/* gentler, quicker reveals on phones */
@media (max-width: 700px) {
  html.vf-js .vf-r { transform: translateY(8px); transition-duration: .6s, .6s; }
}
